--- wcstoull.c.orig Tue May 20 15:21:45 2003 +++ wcstoull.c Fri Feb 18 14:58:24 2005 @@ -40,6 +40,8 @@ #endif __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.1 2002/09/22 08:06:45 tjr Exp $"); +#include "xlocale_private.h" + #include <errno.h> #include <limits.h> #include <stdlib.h> @@ -50,8 +52,8 @@ * Convert a wide character string to an unsigned long long integer. */ unsigned long long -wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, - int base) +wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base, locale_t loc) { const wchar_t *s; unsigned long long acc; @@ -59,13 +61,14 @@ unsigned long long cutoff; int neg, any, cutlim; + NORMALIZE_LOCALE(loc); /* * See strtoull 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++; @@ -90,8 +93,8 @@ cutlim = ULLONG_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') @@ -123,4 +126,11 @@ if (endptr != NULL) *endptr = (wchar_t *)(any ? s - 1 : nptr); return (acc); +} + +unsigned long long +wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, + int base) +{ + return wcstoull_l(nptr, endptr, base, __current_locale()); }