X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdlib%2Fwcstoumax.c;h=cee5ff7f5c42410d911165bdd1e9fbb529efb952;hb=570edb19d12dd3920b576db06b657b639fdbac00;hp=e30b063847ce5b6efe3d8564d22a07400685dbe3;hpb=ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42;p=musl diff --git a/src/stdlib/wcstoumax.c b/src/stdlib/wcstoumax.c index e30b0638..cee5ff7f 100644 --- a/src/stdlib/wcstoumax.c +++ b/src/stdlib/wcstoumax.c @@ -7,8 +7,8 @@ uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base) { + const wchar_t *s1 = s; struct intparse ip = {0}; - unsigned char tmp; if (p) *p = (wchar_t *)s; @@ -20,14 +20,14 @@ 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; + *p = (wchar_t *)s1 + ip.cnt; if (ip.err) { errno = ip.err; - if (ip.err = EINVAL) return 0; + if (ip.err == EINVAL) return 0; return UINTMAX_MAX; }