]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/btowc.c.patch
3dc8fccdd962c1cd4ec616555e4d8ea59eafc280
[apple/libc.git] / locale / FreeBSD / btowc.c.patch
1 --- btowc.c.orig Thu Nov 25 11:38:16 2004
2 +++ btowc.c Fri Feb 18 15:58:50 2005
3 @@ -27,18 +27,21 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <stdio.h>
10 #include <wchar.h>
11 #include "mblocal.h"
12
13 wint_t
14 -btowc(int c)
15 +btowc_l(int c, locale_t loc)
16 {
17 static const mbstate_t initial;
18 mbstate_t mbs = initial;
19 char cc;
20 wchar_t wc;
21
22 + NORMALIZE_LOCALE(loc);
23 if (c == EOF)
24 return (WEOF);
25 /*
26 @@ -47,7 +50,13 @@
27 * counts.
28 */
29 cc = (char)c;
30 - if (__mbrtowc(&wc, &cc, 1, &mbs) > 1)
31 + if (loc->__lc_ctype->__mbrtowc(&wc, &cc, 1, &mbs, loc) > 1)
32 return (WEOF);
33 return (wc);
34 +}
35 +
36 +wint_t
37 +btowc(int c)
38 +{
39 + return btowc_l(c, __current_locale());
40 }