diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-07-14 01:12:05 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-07-14 01:12:05 -0400 |
commit | d3fd192523db544e6005051f224a2d7bafabedd9 (patch) | |
tree | ca5f8c14f29b229658a6d217cc667edd61655505 /src/stdlib/wcstoumax.c | |
parent | ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42 (diff) | |
download | musl-d3fd192523db544e6005051f224a2d7bafabedd9.tar.gz musl-d3fd192523db544e6005051f224a2d7bafabedd9.tar.xz musl-d3fd192523db544e6005051f224a2d7bafabedd9.zip |
fix wcsto[iu]max with high characters
stopping without letting the parser see a stop character prevented getting a result. so treat all high chars as the null character and pass them into the parser. also eliminated ugly tmp var using compound literals.
Diffstat (limited to 'src/stdlib/wcstoumax.c')
-rw-r--r-- | src/stdlib/wcstoumax.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/stdlib/wcstoumax.c b/src/stdlib/wcstoumax.c index e30b0638..af7ba3dc 100644 --- a/src/stdlib/wcstoumax.c +++ b/src/stdlib/wcstoumax.c @@ -8,7 +8,6 @@ uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base) { struct intparse ip = {0}; - unsigned char tmp; if (p) *p = (wchar_t *)s; @@ -20,7 +19,7 @@ uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base) for (; iswspace(*s); s++); ip.base = base; - for (; *s<256 && (tmp=*s, __intparse(&ip, &tmp, 1)); s++); + for (; __intparse(&ip, (char[]){(*s&-(*s<128U))}, 1); s++); if (p && ip.err != EINVAL) *p = (wchar_t *)s; |