blob: e7259920b5468c21547eb1654a7d9ec0e0d4b35a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#include "cns11643_4a.h"
#include "cns11643_4b.h"
static int
cns11643_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
{
unsigned char c1 = s[0];
if ((c1 >= 0x21 && c1 <= 0x6e)) {
if (n >= 2) {
unsigned char c2 = s[1];
if (c2 >= 0x21 && c2 < 0x7f) {
unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21);
ucs4_t wc = 0xfffd;
unsigned short swc;
{
if (i < 2914)
swc = cns11643_4a_2uni_page21[i],
wc = cns11643_4a_2uni_upages[swc>>8] | (swc & 0xff);
else if (i < 7298)
swc = cns11643_4b_2uni_page40[i-2914],
wc = cns11643_4b_2uni_upages[swc>>8] | (swc & 0xff);
}
if (wc != 0xfffd) {
*pwc = wc;
return 2;
}
}
return RET_ILSEQ;
}
return RET_TOOFEW(0);
}
return RET_ILSEQ;
}
|