CVS commit: [netbsd-7] src/lib/libc/time

2016-12-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 13 06:39:13 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: private.h zic.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1323):
lib/libc/time/private.h: patch
lib/libc/time/zic.c: patch
Make zic properly parse newer tzdata files.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/lib/libc/time/private.h
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 src/lib/libc/time/zic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/private.h
diff -u src/lib/libc/time/private.h:1.33.2.1 src/lib/libc/time/private.h:1.33.2.2
--- src/lib/libc/time/private.h:1.33.2.1	Sun Jan 25 09:11:03 2015
+++ src/lib/libc/time/private.h	Tue Dec 13 06:39:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: private.h,v 1.33.2.1 2015/01/25 09:11:03 martin Exp $	*/
+/*	$NetBSD: private.h,v 1.33.2.2 2016/12/13 06:39:13 snj Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -477,6 +477,17 @@ const char *	scheck(const char * string,
 #define TYPE_SIGNED(type) (/*CONSTCOND*/((type) -1) < 0)
 #endif /* !defined TYPE_SIGNED */
 
+#define TWOS_COMPLEMENT(t) (/*CONSTCOND*/(t) ~ (t) 0 < 0)
+
+/* Max and min values of the integer type T, of which only the bottom
+   B bits are used, and where the highest-order used bit is considered
+   to be a sign bit if T is signed.  */
+#define MAXVAL(t, b) /*LINTED*/	\
+  ((t) (((t) 1 << ((b) - 1 - TYPE_SIGNED(t)))			\
+	- 1 + ((t) 1 << ((b) - 1 - TYPE_SIGNED(t)
+#define MINVAL(t, b)		\
+  ((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
+
 #ifdef LOCALTIME_IMPLEMENTATION
 /* The minimum and maximum finite time values.  */
 static time_t const time_t_min =

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.46.2.1 src/lib/libc/time/zic.c:1.46.2.2
--- src/lib/libc/time/zic.c:1.46.2.1	Sun Jan 25 09:11:03 2015
+++ src/lib/libc/time/zic.c	Tue Dec 13 06:39:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.46.2.1 2015/01/25 09:11:03 martin Exp $	*/
+/*	$NetBSD: zic.c,v 1.46.2.2 2016/12/13 06:39:13 snj Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.46.2.1 2015/01/25 09:11:03 martin Exp $");
+__RCSID("$NetBSD: zic.c,v 1.46.2.2 2016/12/13 06:39:13 snj Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -88,6 +88,7 @@ struct zone {
 	zic_t		z_gmtoff;
 	const char *	z_rule;
 	const char *	z_format;
+	char		z_format_specifier;
 
 	zic_t		z_stdoff;
 
@@ -145,6 +146,16 @@ static bool	yearistype(int year, const c
 static int	atcomp(const void *avp, const void *bvp);
 static void	updateminmax(zic_t x);
 
+/* Bound on length of what %z can expand to.  */
+enum { PERCENT_Z_LEN_BOUND = sizeof "+995959" - 1 };
+
+/* If true, work around a bug in Qt 5.6.1 and earlier, which mishandles
+   tz binary files whose POSIX-TZ-style strings contain '<'; see
+   QTBUG-53071 .  This
+   workaround will no longer be needed when Qt 5.6.1 and earlier are
+   obsolete, say in the year 2021.  */
+enum { WORK_AROUND_QTBUG_53071 = 1 };
+
 static int		charcnt;
 static bool		errors;
 static bool		warnings;
@@ -154,7 +165,7 @@ static bool		leapseen;
 static zic_t		leapminyear;
 static zic_t		leapmaxyear;
 static int		linenum;
-static size_t		max_abbrvar_len;
+static size_t		max_abbrvar_len = PERCENT_Z_LEN_BOUND;
 static size_t		max_format_len;
 static zic_t		max_year;
 static zic_t		min_year;
@@ -350,6 +361,7 @@ static const int	len_years[2] = {
 
 static struct attype {
 	zic_t		at;
+	bool		dontmerge;
 	unsigned char	type;
 } *			attypes;
 static zic_t		gmtoffs[TZ_MAX_TYPES];
@@ -588,7 +600,7 @@ _("%s: More than one -L option specified
 noise = true;
 break;
 			case 's':
-warning(_("-s ignored\n"));
+warning(_("-s ignored"));
 break;
 		}
 	if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
@@ -641,31 +653,44 @@ _("%s: More than one -L option specified
 	return errors ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-static void
+static bool
 componentcheck(char const *name, char const *component,
 	   char const *component_end)
 {
 	enum { component_len_max = 14 };
-	size_t component_len = component_end - component;
+	ptrdiff_t component_len = component_end - component;
+	if (component_len == 0) {
+	  if (!*name)
+	error (_("empty file name"));
+	  else
+	error (_(component == name
+		 ? "file name '%s' begins with '/'"
+		 : *component_end
+		 ? "file name '%s' contains '//'"
+		 : "file name '%s' ends with '/'"),
+		   name);
+	  return false;
+	}
 	if (0 < component_len && component_len <= 2
 	&& component[0] == '.' && component_end[-1] == '.') {
-		fprintf(stderr, _("%s: file name '%s' contains"
-  " '%.*s' component"),
-			progname, name, 

CVS commit: [netbsd-7] src/lib/libc/time

2016-12-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 13 06:39:13 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: private.h zic.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1323):
lib/libc/time/private.h: patch
lib/libc/time/zic.c: patch
Make zic properly parse newer tzdata files.


To generate a diff of this commit:
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/lib/libc/time/private.h
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 src/lib/libc/time/zic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-7] src/lib/libc/time

2016-04-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Apr 29 18:53:11 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: localtime.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1146):
lib/libc/time/localtime.c: revision 1.103 via patch
Use the correct upper bounds for the types array.  The correct upper
bound is typecnt not timecnt.  Now perpetual 'standard' time zones
will work correctly as they have a typecnt of 1 but a timecnt of 0.


To generate a diff of this commit:
cvs rdiff -u -r1.82.2.2 -r1.82.2.3 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.82.2.2 src/lib/libc/time/localtime.c:1.82.2.3
--- src/lib/libc/time/localtime.c:1.82.2.2	Sun Mar  6 18:01:48 2016
+++ src/lib/libc/time/localtime.c	Fri Apr 29 18:53:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.82.2.2 2016/03/06 18:01:48 martin Exp $	*/
+/*	$NetBSD: localtime.c,v 1.82.2.3 2016/04/29 18:53:11 snj Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.82.2.2 2016/03/06 18:01:48 martin Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.82.2.3 2016/04/29 18:53:11 snj Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -255,7 +255,7 @@ const char *
 tzgetname(const timezone_t sp, int isdst)
 {
 	int i;
-	for (i = 0; i < sp->timecnt; ++i) {
+	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
 
 		if (ttisp->tt_isdst == isdst)



CVS commit: [netbsd-7] src/lib/libc/time

2016-04-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Apr 29 18:53:11 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: localtime.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1146):
lib/libc/time/localtime.c: revision 1.103 via patch
Use the correct upper bounds for the types array.  The correct upper
bound is typecnt not timecnt.  Now perpetual 'standard' time zones
will work correctly as they have a typecnt of 1 but a timecnt of 0.


To generate a diff of this commit:
cvs rdiff -u -r1.82.2.2 -r1.82.2.3 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-7] src/lib/libc/time

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 18:01:48 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: localtime.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1121):
lib/libc/time/localtime.c: revision 1.101
PR/50133: Martin Husemann: Can't cache $TZ.
XXX: Pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-7] src/lib/libc/time

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 18:01:48 UTC 2016

Modified Files:
src/lib/libc/time [netbsd-7]: localtime.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1121):
lib/libc/time/localtime.c: revision 1.101
PR/50133: Martin Husemann: Can't cache $TZ.
XXX: Pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/lib/libc/time/localtime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.82.2.1 src/lib/libc/time/localtime.c:1.82.2.2
--- src/lib/libc/time/localtime.c:1.82.2.1	Sun Jan 25 09:11:03 2015
+++ src/lib/libc/time/localtime.c	Sun Mar  6 18:01:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.82.2.1 2015/01/25 09:11:03 martin Exp $	*/
+/*	$NetBSD: localtime.c,v 1.82.2.2 2016/03/06 18:01:48 martin Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.82.2.1 2015/01/25 09:11:03 martin Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.82.2.2 2016/03/06 18:01:48 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1476,7 +1476,7 @@ localtime(const time_t *const timep)
 struct tm *
 localtime_r(const time_t * __restrict timep, struct tm *tmp)
 {
-	return localtime_tzset(timep, tmp, false);
+	return localtime_tzset(timep, tmp, true);
 }
 
 /*