Module Name:    src
Committed By:   martin
Date:           Thu Oct 25 15:04:06 UTC 2012

Modified Files:
        src/lib/libc/time: zic.c

Log Message:
Revert previous - casting to long is a bad idea, as the value will overflow.
Pointed out by apb.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/lib/libc/time/zic.c:1.34
--- src/lib/libc/time/zic.c:1.33	Thu Oct 25 13:14:32 2012
+++ src/lib/libc/time/zic.c	Thu Oct 25 15:04:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.33 2012/10/25 13:14:32 martin Exp $	*/
+/*	$NetBSD: zic.c,v 1.34 2012/10/25 15:04:05 martin 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.33 2012/10/25 13:14:32 martin Exp $");
+__RCSID("$NetBSD: zic.c,v 1.34 2012/10/25 15:04:05 martin Exp $");
 #endif /* !defined lint */
 
 #include "version.h"
@@ -1128,11 +1128,11 @@ inleap(char **const fields, const int nf
 		error(_("time before zero"));
 		return;
 	}
-	if (dayoff < (long)(min_time / SECSPERDAY)) {
+	if (dayoff < min_time / SECSPERDAY) {
 		error(_("time too small"));
 		return;
 	}
-	if (dayoff > (long)(max_time / SECSPERDAY)) {
+	if (dayoff > max_time / SECSPERDAY) {
 		error(_("time too large"));
 		return;
 	}
@@ -2522,9 +2522,9 @@ rpytime(const struct rule *const rp, con
 will not work with pre-2004 versions of zic"));
 		}
 	}
-	if (dayoff < (long)(min_time / SECSPERDAY))
+	if (dayoff < min_time / SECSPERDAY)
 		return min_time;
-	if (dayoff > (long)(max_time / SECSPERDAY))
+	if (dayoff > max_time / SECSPERDAY)
 		return max_time;
 	t = (zic_t) dayoff * SECSPERDAY;
 	return tadd(t, rp->r_tod);

Reply via email to