curl-library
[PATCH] timeval.c: Use long constant type for 64 bit timeval
From: Martin Kepplinger <martink_at_posteo.de>
Date: Mon, 3 Jul 2017 11:50:29 +0200
Date: Mon, 3 Jul 2017 11:50:29 +0200
On a 64 bit host, sparse says:
timeval.c:148:15: warning: constant 0x7fffffffffffffff is so big it is long
timeval.c:149:12: warning: constant 0x7fffffffffffffff is so big it is long
so let's use long constant types in order to prevent undesired overflow
failures.
Signed-off-by: Martin Kepplinger <martink_at_posteo.de>
--- lib/timeval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/timeval.c b/lib/timeval.c index 1012b4e39..87654f398 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -145,8 +145,8 @@ time_t Curl_tvdiff_us(struct timeval newer, struct timeval older) return 0x7fffffff; #else /* for 64bit time_t systems */ - if(diff >= (0x7fffffffffffffff/1000000)) - return 0x7fffffffffffffff; + if(diff >= (0x7fffffffffffffffUL/1000000)) + return 0x7fffffffffffffffUL; #endif return (newer.tv_sec-older.tv_sec)*1000000+ (time_t)(newer.tv_usec-older.tv_usec); -- 2.11.0 ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2017-07-03