]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/big5.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / locale / FreeBSD / big5.c.patch
1 --- big5.c.orig Thu Nov 25 11:38:16 2004
2 +++ big5.c Fri Feb 18 15:48:14 2005
3 @@ -41,6 +41,8 @@
4 #include <sys/param.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.16 2004/05/17 11:16:14 tjr Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <errno.h>
10 #include <runetype.h>
11 #include <stdlib.h>
12 @@ -48,30 +50,29 @@
13 #include <wchar.h>
14 #include "mblocal.h"
15
16 -int _BIG5_init(_RuneLocale *);
17 -size_t _BIG5_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
18 - mbstate_t * __restrict);
19 -int _BIG5_mbsinit(const mbstate_t *);
20 -size_t _BIG5_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
21 +__private_extern__ int _BIG5_init(struct __xlocale_st_runelocale *);
22 +static size_t _BIG5_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
23 + mbstate_t * __restrict, locale_t);
24 +static int _BIG5_mbsinit(const mbstate_t *, locale_t);
25 +static size_t _BIG5_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
26
27 typedef struct {
28 wchar_t ch;
29 } _BIG5State;
30
31 -int
32 -_BIG5_init(_RuneLocale *rl)
33 +__private_extern__ int
34 +_BIG5_init(struct __xlocale_st_runelocale *xrl)
35 {
36
37 - __mbrtowc = _BIG5_mbrtowc;
38 - __wcrtomb = _BIG5_wcrtomb;
39 - __mbsinit = _BIG5_mbsinit;
40 - _CurrentRuneLocale = rl;
41 - __mb_cur_max = 2;
42 + xrl->__mbrtowc = _BIG5_mbrtowc;
43 + xrl->__wcrtomb = _BIG5_wcrtomb;
44 + xrl->__mbsinit = _BIG5_mbsinit;
45 + xrl->__mb_cur_max = 2;
46 return (0);
47 }
48
49 -int
50 -_BIG5_mbsinit(const mbstate_t *ps)
51 +static int
52 +_BIG5_mbsinit(const mbstate_t *ps, locale_t loc)
53 {
54
55 return (ps == NULL || ((const _BIG5State *)ps)->ch == 0);
56 @@ -85,9 +86,9 @@
57 return ((c >= 0xa1 && c <= 0xfe) ? 2 : 1);
58 }
59
60 -size_t
61 +static size_t
62 _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
63 - mbstate_t * __restrict ps)
64 + mbstate_t * __restrict ps, locale_t loc)
65 {
66 _BIG5State *bs;
67 wchar_t wc;
68 @@ -146,8 +147,8 @@
69 }
70 }
71
72 -size_t
73 -_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
74 +static size_t
75 +_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
76 {
77 _BIG5State *bs;
78