]>
Commit | Line | Data |
---|---|---|
1 | --- wcstoumax.c.orig 2003-05-20 15:21:45.000000000 -0700 | |
2 | +++ wcstoumax.c 2005-02-23 16:08:34.000000000 -0800 | |
3 | @@ -40,6 +40,8 @@ | |
4 | #endif | |
5 | __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.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 <inttypes.h> | |
11 | #include <stdlib.h> | |
12 | @@ -50,8 +52,8 @@ | |
13 | * Convert a wide character string to a uintmax_t integer. | |
14 | */ | |
15 | uintmax_t | |
16 | -wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, | |
17 | - int base) | |
18 | +wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, | |
19 | + int base, locale_t loc) | |
20 | { | |
21 | const wchar_t *s; | |
22 | uintmax_t acc; | |
23 | @@ -59,13 +61,14 @@ | |
24 | uintmax_t cutoff; | |
25 | int neg, any, cutlim; | |
26 | ||
27 | + NORMALIZE_LOCALE(loc); | |
28 | /* | |
29 | * See strtoimax 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 = UINTMAX_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 | @@ -124,3 +127,10 @@ | |
51 | *endptr = (wchar_t *)(any ? s - 1 : nptr); | |
52 | return (acc); | |
53 | } | |
54 | + | |
55 | +uintmax_t | |
56 | +wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, | |
57 | + int base) | |
58 | +{ | |
59 | + return wcstoumax_l(nptr, endptr, base, __current_locale()); | |
60 | +} |