From 410b38b5c533f55ed4cda35ef10971b6d073d781 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 24 Jul 2015 21:57:11 -0400 Subject: [PATCH] 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. --- src/system/libroot/posix/inttypes.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/system/libroot/posix/inttypes.c b/src/system/libroot/posix/inttypes.c index 711c02f7a6..2bcc0186b1 100644 --- a/src/system/libroot/posix/inttypes.c +++ b/src/system/libroot/posix/inttypes.c @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. 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); }