]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/mbstowcs.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / mbstowcs.c.patch
1 --- mbstowcs.c.orig Thu Nov 25 11:38:18 2004
2 +++ mbstowcs.c Fri Feb 18 17:02:15 2005
3 @@ -27,17 +27,27 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.11 2004/07/21 10:54:57 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <limits.h>
10 #include <stdlib.h>
11 #include <wchar.h>
12 #include "mblocal.h"
13
14 size_t
15 -mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
16 +mbstowcs_l(wchar_t * __restrict pwcs, const char * __restrict s, size_t n,
17 + locale_t loc)
18 {
19 static const mbstate_t initial;
20 mbstate_t mbs;
21
22 + NORMALIZE_LOCALE(loc);
23 mbs = initial;
24 - return (__mbsnrtowcs(pwcs, &s, SIZE_T_MAX, n, &mbs));
25 + return (loc->__lc_ctype->__mbsnrtowcs(pwcs, &s, SIZE_T_MAX, n, &mbs, loc));
26 +}
27 +
28 +size_t
29 +mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
30 +{
31 + return mbstowcs_l(pwcs, s, n, __current_locale());
32 }