X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdlib%2Fwcstoull.c;h=48c557db59d77889e8095098c7478cd7a0d37fd0;hb=28af39fe427ffec8b836f4f30450ffc30b03e5c4;hp=e324dfb22edd7a5ac3c0c40305211952808b6c01;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/stdlib/wcstoull.c b/src/stdlib/wcstoull.c index e324dfb2..48c557db 100644 --- a/src/stdlib/wcstoull.c +++ b/src/stdlib/wcstoull.c @@ -6,8 +6,11 @@ unsigned long long wcstoull(const wchar_t *s, wchar_t **p, int base) { - uintmax_t x = wcstoumax(s, p, base); - if (x > ULLONG_MAX) { + intmax_t x; + if (sizeof(intmax_t) == sizeof(long long)) + return wcstoumax(s, p, base); + x = wcstoimax(s, p, base); + if (-x > ULLONG_MAX || x > ULLONG_MAX) { errno = ERANGE; return ULLONG_MAX; }