X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/locale/FreeBSD/wcstoul.c diff --git a/locale/FreeBSD/wcstoul.c b/locale/FreeBSD/wcstoul.c index f3b8b49..1cad0f6 100644 --- a/locale/FreeBSD/wcstoul.c +++ b/locale/FreeBSD/wcstoul.c @@ -10,10 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -32,7 +28,9 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.1 2002/09/08 13:27:26 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); + +#include "xlocale_private.h" #include #include @@ -44,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.1 2002/09/08 13:27:26 tjr * Convert a wide character string to an unsigned long integer. */ unsigned long -wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) +wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base, locale_t loc) { const wchar_t *s; unsigned long acc; @@ -52,13 +51,14 @@ wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) unsigned long cutoff; int neg, any, cutlim; + NORMALIZE_LOCALE(loc); /* * See strtol 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++; @@ -83,8 +83,8 @@ wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) cutlim = ULONG_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') @@ -117,3 +117,9 @@ noconv: *endptr = (wchar_t *)(any ? s - 1 : nptr); return (acc); } + +unsigned long +wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base) +{ + return wcstoul_l(nptr, endptr, base, __current_locale()); +}