Module Name: src Committed By: christos Date: Tue Sep 20 13:09:08 UTC 2016
Modified Files: src/lib/libc/time: zic.c Log Message: put back part of the code that determines the smallest of INT_MAX and SIZE_MAX to avoid llvm truncation warning. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 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/zic.c diff -u src/lib/libc/time/zic.c:1.60 src/lib/libc/time/zic.c:1.61 --- src/lib/libc/time/zic.c:1.60 Mon Sep 19 14:43:23 2016 +++ src/lib/libc/time/zic.c Tue Sep 20 09:09:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: zic.c,v 1.60 2016/09/19 18:43:23 christos Exp $ */ +/* $NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos 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.60 2016/09/19 18:43:23 christos Exp $"); +__RCSID("$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $"); #endif /* !defined lint */ #include "private.h" @@ -437,8 +437,9 @@ growalloc(void *ptr, size_t itemsize, in if (nitems < *nitems_alloc) return ptr; else { - size_t nitems_max = INT_MAX - WORK_AROUND_QTBUG_53071; - int amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX; + static const int imax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX; + 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(_("int overflow")); *nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;