X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/wcstoumax.c diff --git a/locale/FreeBSD/wcstoumax.c b/locale/FreeBSD/wcstoumax.c index 765bbfb..1b447b8 100644 --- a/locale/FreeBSD/wcstoumax.c +++ b/locale/FreeBSD/wcstoumax.c @@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr #endif __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 im * Convert a wide character string to a uintmax_t integer. */ uintmax_t -wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, - int base) +wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base, locale_t loc) { const wchar_t *s; uintmax_t acc; @@ -55,13 +57,14 @@ wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, uintmax_t cutoff; int neg, any, cutlim; + NORMALIZE_LOCALE(loc); /* * See strtoimax for comments as to the logic used. */ s = nptr; do { c = *s++; - } while (iswspace(c)); + } while (iswspace_l(c, loc)); if (c == L'-') { neg = 1; c = *s++; @@ -86,8 +89,8 @@ wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, cutlim = UINTMAX_MAX % base; for ( ; ; c = *s++) { #ifdef notyet - if (iswdigit(c)) - c = digittoint(c); + if (iswdigit_l(c, loc)) + c = digittoint_l(c, loc); else #endif if (c >= L'0' && c <= L'9') @@ -120,3 +123,10 @@ noconv: *endptr = (wchar_t *)(any ? s - 1 : nptr); return (acc); } + +uintmax_t +wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base) +{ + return wcstoumax_l(nptr, endptr, base, __current_locale()); +}