@matheusbsbs / matheus-bagliano / commits / d66ee046fc
Fork 0

test-date: fix sscanf type conversion

Reading into a time_t isn't portable, since we don't know the exact type. Instead, use an unsigned long, which is what show_date wants, anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 6, 2010 at 03:54 UTC d66ee046fc8597af62daeb890b15d5799c786b0d
1 file changed +2 -2
test-date.c
+2 -2
@@ -20,12 +20,12 @@ static void parse_dates(char **argv, struct timeval *now)
20 {
21 for (; *argv; argv++) {
22 char result[100];
23 - time_t t;
23 + unsigned long t;
24 int tz;
25
26 result[0] = 0;
27 parse_date(*argv, result, sizeof(result));
28 - if (sscanf(result, "%ld %d", &t, &tz) == 2)
28 + if (sscanf(result, "%lu %d", &t, &tz) == 2)
29 printf("%s -> %s\n",
30 *argv, show_date(t, tz, DATE_ISO8601));
31 else