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:
Rene Gollent
2015-07-24 21:57:11 -04:00
parent f5d564a1d3
commit 410b38b5c5
+2 -4
View File
@@ -35,15 +35,13 @@ imaxdiv(intmax_t numer, intmax_t denom)
intmax_t intmax_t
strtoimax(const char *string, char **_end, int base) strtoimax(const char *string, char **_end, int base)
{ {
// ToDo: implement me properly! return (intmax_t)strtoll(string, _end, base);
return (intmax_t)strtol(string, _end, base);
} }
uintmax_t uintmax_t
strtoumax(const char *string, char **_end, int base) strtoumax(const char *string, char **_end, int base)
{ {
// ToDo: implement me properly! return (intmax_t)strtoull(string, _end, base);
return (intmax_t)strtoul(string, _end, base);
} }