1 --- gb18030.c.bsdnew 2009-11-09 15:05:25.000000000 -0800
2 +++ gb18030.c 2009-11-09 15:50:31.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $");
7 +#include "xlocale_private.h"
12 @@ -39,35 +41,34 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
16 -extern int __mb_sb_limit;
17 +#define GB18030_MB_CUR_MAX 4
19 static size_t _GB18030_mbrtowc(wchar_t * __restrict, const char * __restrict,
20 - size_t, mbstate_t * __restrict);
21 -static int _GB18030_mbsinit(const mbstate_t *);
22 + size_t, mbstate_t * __restrict, locale_t);
23 +static int _GB18030_mbsinit(const mbstate_t *, locale_t);
24 static size_t _GB18030_wcrtomb(char * __restrict, wchar_t,
25 - mbstate_t * __restrict);
26 + mbstate_t * __restrict, locale_t);
34 -_GB18030_init(_RuneLocale *rl)
35 +__private_extern__ int
36 +_GB18030_init(struct __xlocale_st_runelocale *xrl)
39 - __mbrtowc = _GB18030_mbrtowc;
40 - __wcrtomb = _GB18030_wcrtomb;
41 - __mbsinit = _GB18030_mbsinit;
42 - _CurrentRuneLocale = rl;
44 - __mb_sb_limit = 128;
45 + xrl->__mbrtowc = _GB18030_mbrtowc;
46 + xrl->__wcrtomb = _GB18030_wcrtomb;
47 + xrl->__mbsinit = _GB18030_mbsinit;
48 + xrl->__mb_cur_max = GB18030_MB_CUR_MAX;
49 + xrl->__mb_sb_limit = 128;
55 -_GB18030_mbsinit(const mbstate_t *ps)
56 +_GB18030_mbsinit(const mbstate_t *ps, locale_t loc __unused)
59 return (ps == NULL || ((const _GB18030State *)ps)->count == 0);
60 @@ -75,7 +76,7 @@ _GB18030_mbsinit(const mbstate_t *ps)
63 _GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
64 - size_t n, mbstate_t * __restrict ps)
65 + size_t n, mbstate_t * __restrict ps, locale_t loc __unused)
69 @@ -95,7 +96,7 @@ _GB18030_mbrtowc(wchar_t * __restrict pw
73 - ncopy = MIN(MIN(n, MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
74 + ncopy = MIN(MIN(n, GB18030_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
75 memcpy(gs->bytes + gs->count, s, ncopy);
78 @@ -158,7 +159,7 @@ ilseq:
82 -_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
83 +_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)