From 8c0252300ece746f91a2454a967c1e4b0c9b7d9b Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 13 May 2015 18:26:24 +0200 Subject: [PATCH] Fix strtol isspace calls. --- libc/inttypes/strtoimax.cpp | 1 + libc/inttypes/strtoumax.cpp | 1 + libc/inttypes/wcstoimax.cpp | 1 + libc/inttypes/wcstoumax.cpp | 1 + libc/stdlib/strtol.cpp | 5 +++-- libc/stdlib/strtoll.cpp | 1 + libc/stdlib/strtoul.cpp | 1 + libc/stdlib/strtoull.cpp | 1 + libc/wchar/wcstol.cpp | 1 + libc/wchar/wcstoll.cpp | 1 + libc/wchar/wcstoul.cpp | 1 + libc/wchar/wcstoull.cpp | 1 + 12 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libc/inttypes/strtoimax.cpp b/libc/inttypes/strtoimax.cpp index f6975ce9..46976c8f 100644 --- a/libc/inttypes/strtoimax.cpp +++ b/libc/inttypes/strtoimax.cpp @@ -24,6 +24,7 @@ #define STRTOL strtoimax #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT intmax_t diff --git a/libc/inttypes/strtoumax.cpp b/libc/inttypes/strtoumax.cpp index e718f6ab..5d34fad7 100644 --- a/libc/inttypes/strtoumax.cpp +++ b/libc/inttypes/strtoumax.cpp @@ -24,6 +24,7 @@ #define STRTOL strtoumax #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT uintmax_t diff --git a/libc/inttypes/wcstoimax.cpp b/libc/inttypes/wcstoimax.cpp index 12c1237b..7e3e6f34 100644 --- a/libc/inttypes/wcstoimax.cpp +++ b/libc/inttypes/wcstoimax.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstoimax #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT intmax_t diff --git a/libc/inttypes/wcstoumax.cpp b/libc/inttypes/wcstoumax.cpp index df3fc47b..01cbbe33 100644 --- a/libc/inttypes/wcstoumax.cpp +++ b/libc/inttypes/wcstoumax.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstoumax #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT uintmax_t diff --git a/libc/stdlib/strtol.cpp b/libc/stdlib/strtol.cpp index 9a9c8008..b4547a37 100644 --- a/libc/stdlib/strtol.cpp +++ b/libc/stdlib/strtol.cpp @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2011, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2011, 2013, 2014, 2015. This file is part of the Sortix C Library. @@ -25,6 +25,7 @@ #ifndef STRTOL #define STRTOL strtol #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT long @@ -138,7 +139,7 @@ STRTOL_INT STRTOL(const STRTOL_CHAR* restrict str, const STRTOL_CHAR* original_str = str; // Skip any leading white space. - while ( STRTOL_ISSPACE(*str) ) + while ( STRTOL_ISSPACE((STRTOL_UCHAR) *str) ) str++; bool negative = false; diff --git a/libc/stdlib/strtoll.cpp b/libc/stdlib/strtoll.cpp index 590bebe9..d1de6ef6 100644 --- a/libc/stdlib/strtoll.cpp +++ b/libc/stdlib/strtoll.cpp @@ -24,6 +24,7 @@ #define STRTOL strtoll #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT long long diff --git a/libc/stdlib/strtoul.cpp b/libc/stdlib/strtoul.cpp index 47403fc1..533d235c 100644 --- a/libc/stdlib/strtoul.cpp +++ b/libc/stdlib/strtoul.cpp @@ -24,6 +24,7 @@ #define STRTOL strtoul #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT unsigned long diff --git a/libc/stdlib/strtoull.cpp b/libc/stdlib/strtoull.cpp index 94a2c4c0..3a40bbac 100644 --- a/libc/stdlib/strtoull.cpp +++ b/libc/stdlib/strtoull.cpp @@ -24,6 +24,7 @@ #define STRTOL strtoull #define STRTOL_CHAR char +#define STRTOL_UCHAR unsigned char #define STRTOL_L(x) x #define STRTOL_ISSPACE isspace #define STRTOL_INT unsigned long long diff --git a/libc/wchar/wcstol.cpp b/libc/wchar/wcstol.cpp index 42bd4084..c12ee79a 100644 --- a/libc/wchar/wcstol.cpp +++ b/libc/wchar/wcstol.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstol #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT long diff --git a/libc/wchar/wcstoll.cpp b/libc/wchar/wcstoll.cpp index 009a3ad7..64ed1cf2 100644 --- a/libc/wchar/wcstoll.cpp +++ b/libc/wchar/wcstoll.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstoll #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT long long diff --git a/libc/wchar/wcstoul.cpp b/libc/wchar/wcstoul.cpp index 68e6b2e4..60038c70 100644 --- a/libc/wchar/wcstoul.cpp +++ b/libc/wchar/wcstoul.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstoul #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT unsigned long diff --git a/libc/wchar/wcstoull.cpp b/libc/wchar/wcstoull.cpp index e356d4ad..114ff856 100644 --- a/libc/wchar/wcstoull.cpp +++ b/libc/wchar/wcstoull.cpp @@ -24,6 +24,7 @@ #define STRTOL wcstoull #define STRTOL_CHAR wchar_t +#define STRTOL_UCHAR wint_t #define STRTOL_L(x) L##x #define STRTOL_ISSPACE iswspace #define STRTOL_INT unsigned long long