get rid of undefined behavior regarding -INT_MAX
This commit is contained in:
parent
90529e9952
commit
cee447066f
@ -38,7 +38,7 @@ size_t scan_int(const char* src,int* dest) {
|
||||
ok=1;
|
||||
}
|
||||
if (!ok) return 0;
|
||||
*dest=(neg?-l:l);
|
||||
*dest=(neg?-(unsigned int)l:l);
|
||||
return (size_t)(tmp-src);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,6 @@ size_t scan_longn(const char *src,size_t len,long *dest) {
|
||||
ok=1;
|
||||
}
|
||||
if (!ok) return 0;
|
||||
*dest=(neg?-l:l);
|
||||
*dest=(neg?-(unsigned long int)l:l);
|
||||
return (size_t)(tmp-src);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user