]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/wcstoull.c.patch
5ec05f89e6f0a4751bef54a6bb773e868c2d4596
[apple/libc.git] / locale / FreeBSD / wcstoull.c.patch
1 --- wcstoull.c.orig 2009-11-09 15:05:25.000000000 -0800
2 +++ wcstoull.c 2009-11-09 15:05:26.000000000 -0800
3 @@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/s
4 #endif
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <errno.h>
10 #include <limits.h>
11 #include <stdlib.h>
12 @@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
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 @@ -55,13 +57,14 @@ wcstoull(const wchar_t * __restrict nptr
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 @@ -86,8 +89,8 @@ wcstoull(const wchar_t * __restrict nptr
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 @@ -120,3 +123,10 @@ noconv:
51 *endptr = (wchar_t *)(any ? s - 1 : nptr);
52 return (acc);
53 }
54 +
55 +unsigned long long
56 +wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
57 + int base)
58 +{
59 + return wcstoull_l(nptr, endptr, base, __current_locale());
60 +}