Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Revert a couple of lines of code from tzcode20...



details:   https://anonhg.NetBSD.org/src/rev/1c27fde2c2ae
branches:  trunk
changeset: 818898:1c27fde2c2ae
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Nov 05 22:21:48 2016 +0000

description:
Revert a couple of lines of code from tzcode2016i to their state in 2016h

SIZE_MAX is the max value of a size_t (and is unsigned) so when converted
to a ptrdiff_t  (int) becomes -1.   That's not what the code was attempting
to achieve.

This will be reported upstream to the tzcode maintainers, and we'll see
what variation appears in tzcode2016j ...

Until then, the older code always worked for us, so it will do for now.

This should fix the broken i386 build.

diffstat:

 lib/libc/time/zic.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r e93e08c31e35 -r 1c27fde2c2ae lib/libc/time/zic.c
--- a/lib/libc/time/zic.c       Sat Nov 05 21:49:28 2016 +0000
+++ b/lib/libc/time/zic.c       Sat Nov 05 22:21:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $        */
+/*     $NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $     */
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -453,9 +453,13 @@
                return ptr;
        else {
 #define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
+#if 0
                ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
                ptrdiff_t amax = nitems_max < (ptrdiff_t)SIZE_MAX ?
                    nitems_max : (ptrdiff_t)SIZE_MAX;
+#endif
+               int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
+               int amax = nitems_max < IMAX ? nitems_max : IMAX;
                if ((amax - 1) / 3 * 2 < *nitems_alloc)
                        memory_exhausted(_("integer overflow"));
                *nitems_alloc += (*nitems_alloc >> 1) + 1;



Home | Main Index | Thread Index | Old Index