X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdlib%2Fwcstoumax.c;h=cee5ff7f5c42410d911165bdd1e9fbb529efb952;hb=3e082df3cc4c287f659e9067b2b23c7db0855695;hp=af7ba3dc9fe1b8deabc5e3009663d44e8f787217;hpb=d3fd192523db544e6005051f224a2d7bafabedd9;p=musl diff --git a/src/stdlib/wcstoumax.c b/src/stdlib/wcstoumax.c index af7ba3dc..cee5ff7f 100644 --- a/src/stdlib/wcstoumax.c +++ b/src/stdlib/wcstoumax.c @@ -7,6 +7,7 @@ uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base) { + const wchar_t *s1 = s; struct intparse ip = {0}; if (p) *p = (wchar_t *)s; @@ -22,11 +23,11 @@ uintmax_t wcstoumax(const wchar_t *s, wchar_t **p, int base) 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; }