libroot: Fix strto{i,u}max.
- According to POSIX, these functions should map to whatever's appropriate for the platform's intmax_t size, which in our case is a 64-bit integer. Our (2004) implementation, however, was calling the 32-bit variations of strto*(), leading to truncation for larger values.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
@@ -35,15 +35,13 @@ imaxdiv(intmax_t numer, intmax_t denom)
|
||||
intmax_t
|
||||
strtoimax(const char *string, char **_end, int base)
|
||||
{
|
||||
// ToDo: implement me properly!
|
||||
return (intmax_t)strtol(string, _end, base);
|
||||
return (intmax_t)strtoll(string, _end, base);
|
||||
}
|
||||
|
||||
|
||||
uintmax_t
|
||||
strtoumax(const char *string, char **_end, int base)
|
||||
{
|
||||
// ToDo: implement me properly!
|
||||
return (intmax_t)strtoul(string, _end, base);
|
||||
return (intmax_t)strtoull(string, _end, base);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user