]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/wcstoull.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / locale / FreeBSD / wcstoull.c.patch
1 --- wcstoull.c.orig Tue May 20 15:21:45 2003
2 +++ wcstoull.c Fri Feb 18 14:58:24 2005
3 @@ -40,6 +40,8 @@
4 #endif
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.1 2002/09/22 08:06:45 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <errno.h>
10 #include <limits.h>
11 #include <stdlib.h>
12 @@ -50,8 +52,8 @@
13 * Convert a wide character string to an unsigned long long integer.
14 */
15 unsigned long long
16 -wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
17 - int base)
18 +wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
19 + int base, locale_t loc)
20 {
21 const wchar_t *s;
22 unsigned long long acc;
23 @@ -59,13 +61,14 @@
24 unsigned long long cutoff;
25 int neg, any, cutlim;
26
27 + NORMALIZE_LOCALE(loc);
28 /*
29 * See strtoull for comments as to the logic used.
30 */
31 s = nptr;
32 do {
33 c = *s++;
34 - } while (iswspace(c));
35 + } while (iswspace_l(c, loc));
36 if (c == L'-') {
37 neg = 1;
38 c = *s++;
39 @@ -90,8 +93,8 @@
40 cutlim = ULLONG_MAX % base;
41 for ( ; ; c = *s++) {
42 #ifdef notyet
43 - if (iswdigit(c))
44 - c = digittoint(c);
45 + if (iswdigit_l(c, loc))
46 + c = digittoint_l(c, loc);
47 else
48 #endif
49 if (c >= L'0' && c <= L'9')
50 @@ -123,4 +126,11 @@
51 if (endptr != NULL)
52 *endptr = (wchar_t *)(any ? s - 1 : nptr);
53 return (acc);
54 +}
55 +
56 +unsigned long long
57 +wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
58 + int base)
59 +{
60 + return wcstoull_l(nptr, endptr, base, __current_locale());
61 }