- do not use strtol for parsing critical values that can get large.
This function will truncate everything that is larger than LONG_MAX or smaller than LONG_MIN to fit into a long variable, but longs are 32 bit on Windows and 64 bit elsewhere, so to ensure consistency and the ability to parse larger values better use strtoll which does not truncate 32 bit values.
This commit is contained in:
parent
1fd37ff2ff
commit
6d28aa3541
20 changed files with 47 additions and 35 deletions
|
|
@ -1104,12 +1104,12 @@ digits = [0-9];
|
|||
|
||||
long FString::ToLong (int base) const
|
||||
{
|
||||
return strtol (Chars, NULL, base);
|
||||
return (long)strtoll (Chars, NULL, base);
|
||||
}
|
||||
|
||||
unsigned long FString::ToULong (int base) const
|
||||
{
|
||||
return strtoul (Chars, NULL, base);
|
||||
return (unsigned long)strtoull (Chars, NULL, base);
|
||||
}
|
||||
|
||||
double FString::ToDouble () const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue