mirror of
https://github.com/curl/curl.git
synced 2024-12-03 06:20:31 +08:00
timeval.c: Use long long constant type for timeval assignment
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 long constant types in order to prevent undesired overflow failures. Bug: https://curl.haxx.se/mail/lib-2017-07/0003.html Closes #1636 Signed-off-by: Martin Kepplinger <martink@posteo.de>
This commit is contained in:
parent
b3786f61dc
commit
f50124f566
@ -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 >= (0x7fffffffffffffffLL/1000000))
|
||||
return 0x7fffffffffffffffLL;
|
||||
#endif
|
||||
return (newer.tv_sec-older.tv_sec)*1000000+
|
||||
(time_t)(newer.tv_usec-older.tv_usec);
|
||||
|
Loading…
Reference in New Issue
Block a user