diff options
author | J William Piggott | 2017-05-16 21:05:55 +0200 |
---|---|---|
committer | J William Piggott | 2017-06-15 21:02:41 +0200 |
commit | 07668cd1fa04d6e185cd71d11c010faea4486897 (patch) | |
tree | bed51853fa2da7c26f8ad5ac6e7049315f60802c /lib/parse-date.y | |
parent | parse-date: use int where appropriate (diff) | |
download | kernel-qcow2-util-linux-07668cd1fa04d6e185cd71d11c010faea4486897.tar.gz kernel-qcow2-util-linux-07668cd1fa04d6e185cd71d11c010faea4486897.tar.xz kernel-qcow2-util-linux-07668cd1fa04d6e185cd71d11c010faea4486897.zip |
parse-date: use uintmax_t where appropriate
Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Influenced-by: gnulib 30784c4 Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'lib/parse-date.y')
-rw-r--r-- | lib/parse-date.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/parse-date.y b/lib/parse-date.y index b79b333e3..a8f710cd8 100644 --- a/lib/parse-date.y +++ b/lib/parse-date.y @@ -1061,7 +1061,7 @@ static int yylex (union YYSTYPE *lvalp, parser_control *pc) if (c_isdigit (c) || c == '-' || c == '+') { char const *p; int sign; - unsigned long int value; + uintmax_t value; if (c == '-' || c == '+') { sign = c == '-' ? -1 : 1; while (c = *++pc->input, c_isspace (c)) @@ -1073,21 +1073,21 @@ static int yylex (union YYSTYPE *lvalp, parser_control *pc) sign = 0; p = pc->input; for (value = 0; ; value *= 10) { - unsigned long int value1 = value + (c - '0'); + uintmax_t value1 = value + (c - '0'); if (value1 < value) return '?'; value = value1; c = *++p; if (! c_isdigit (c)) break; - if (ULONG_MAX / 10 < value) + if (UINTMAX_MAX / 10 < value) return '?'; } if ((c == '.' || c == ',') && c_isdigit (p[1])) { time_t s; int ns; int digits; - unsigned long int value1; + uintmax_t value1; /* Check for overflow when converting value to * time_t. |