Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/time Use the correct upper bounds for the types arr...



details:   https://anonhg.NetBSD.org/src/rev/98a6078b0c09
branches:  trunk
changeset: 814399:98a6078b0c09
user:      ginsbach <ginsbach%NetBSD.org@localhost>
date:      Fri Mar 18 12:41:25 2016 +0000

description:
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.

diffstat:

 lib/libc/time/localtime.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 928b44d37288 -r 98a6078b0c09 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Fri Mar 18 10:14:39 2016 +0000
+++ b/lib/libc/time/localtime.c Fri Mar 18 12:41:25 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $ */
+/*     $NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach 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.102 2016/03/15 15:16:01 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -282,7 +282,7 @@
 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 = &sp->ttis[sp->types[i]];
 
                if (ttisp->tt_isdst == isdst)
@@ -297,7 +297,7 @@
 {
        int i;
        long l = -1;
-       for (i = 0; i < sp->timecnt; ++i) {
+       for (i = 0; i < sp->typecnt; ++i) {
                const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
 
                if (ttisp->tt_isdst == isdst) {



Home | Main Index | Thread Index | Old Index