]> git.saurik.com Git - apple/libc.git/blobdiff - locale/FreeBSD/wcstoull.c
Libc-1158.1.2.tar.gz
[apple/libc.git] / locale / FreeBSD / wcstoull.c
index fd9558beb286de2d42075c636e3375dbeeab6165..474480e455ce88ebf5ff17c55c04026685fd5dc9 100644 (file)
  * 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.
  * 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.
  * 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.
@@ -38,7 +34,9 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
 #endif
 #endif /* LIBC_SCCS and not lint */
 __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
 #endif
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.1 2002/09/22 08:06:45 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
+
+#include "xlocale_private.h"
 
 #include <errno.h>
 #include <limits.h>
 
 #include <errno.h>
 #include <limits.h>
@@ -50,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.1 2002/09/22 08:06:45 tjr
  * Convert a wide character string to an unsigned long long integer.
  */
 unsigned long long
  * 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;
 {
        const wchar_t *s;
        unsigned long long acc;
@@ -59,13 +57,14 @@ wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        unsigned long long cutoff;
        int neg, any, cutlim;
 
        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++;
        /*
         * 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++;
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -90,8 +89,8 @@ wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        cutlim = ULLONG_MAX % base;
        for ( ; ; c = *s++) {
 #ifdef notyet
        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')
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -124,3 +123,10 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
                *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());
+}