projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
strtoumax: fix typo in previous commit.
[gnulib.git]
/
lib
/
parse-datetime.y
diff --git
a/lib/parse-datetime.y
b/lib/parse-datetime.y
index
67669f6
..
4dce7fa
100644
(file)
--- a/
lib/parse-datetime.y
+++ b/
lib/parse-datetime.y
@@
-1,7
+1,7
@@
%{
/* Parse a string into an internal time stamp.
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-201
2
Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-201
3
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-113,6
+113,11
@@
typedef long int long_time_t;
typedef time_t long_time_t;
#endif
typedef time_t long_time_t;
#endif
+/* Convert a possibly-signed character to an unsigned character. This is
+ a bit safer than casting to unsigned char, since it catches some type
+ errors that the cast doesn't. */
+static unsigned char to_uchar (char ch) { return ch; }
+
/* Lots of this code assumes time_t and time_t-like values fit into
long_time_t. */
verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
/* Lots of this code assumes time_t and time_t-like values fit into
long_time_t. */
verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
@@
-1171,7
+1176,8
@@
yylex (YYSTYPE *lvalp, parser_control *pc)
}
if (c != '(')
}
if (c != '(')
- return *pc->input++;
+ return to_uchar (*pc->input++);
+
count = 0;
do
{
count = 0;
do
{
@@
-1466,7
+1472,7
@@
parse_datetime (struct timespec *result, char const *p,
+ sizeof pc.time_zone * CHAR_BIT / 3];
if (!tz_was_altered)
tz0 = get_tz (tz0buf);
+ sizeof pc.time_zone * CHAR_BIT / 3];
if (!tz_was_altered)
tz0 = get_tz (tz0buf);
- sprintf (tz1buf, "XXX%s%ld:%02d",
"-" + (time_zone < 0)
,
+ sprintf (tz1buf, "XXX%s%ld:%02d",
&"-"[time_zone < 0]
,
abs_time_zone_hour, abs_time_zone_min);
if (setenv ("TZ", tz1buf, 1) != 0)
goto fail;
abs_time_zone_hour, abs_time_zone_min);
if (setenv ("TZ", tz1buf, 1) != 0)
goto fail;