toolchain: musl: update to current HEAD
[openwrt/openwrt.git] / toolchain / musl / patches / 900-iconv_size_hack.patch
1 --- a/src/locale/iconv.c
2 +++ b/src/locale/iconv.c
3 @@ -42,6 +42,7 @@ static const unsigned char charmaps[] =
4 "ucs4\0ucs4be\0utf32\0utf32be\0\0\300"
5 "ucs4le\0utf32le\0\0\303"
6 "ascii\0usascii\0iso646\0iso646us\0\0\307"
7 +#ifdef FULL_ICONV
8 "eucjp\0\0\320"
9 "shiftjis\0sjis\0\0\321"
10 "iso2022jp\0\0\322"
11 @@ -50,6 +51,7 @@ static const unsigned char charmaps[] =
12 "gb2312\0\0\332"
13 "big5\0bigfive\0cp950\0big5hkscs\0\0\340"
14 "euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
15 +#endif
16 #include "codepages.h"
17 ;
18
19 @@ -60,6 +62,7 @@ static const unsigned short legacy_chars
20 #include "legacychars.h"
21 };
22
23 +#ifdef FULL_ICONV
24 static const unsigned short jis0208[84][94] = {
25 #include "jis0208.h"
26 };
27 @@ -79,6 +82,7 @@ static const unsigned short hkscs[] = {
28 static const unsigned short ksc[93][94] = {
29 #include "ksc.h"
30 };
31 +#endif
32
33 static const unsigned short rev_jis[] = {
34 #include "revjis.h"
35 @@ -196,6 +200,7 @@ static unsigned legacy_map(const unsigne
36 return x < 256 ? x : legacy_chars[x-256];
37 }
38
39 +#ifdef FULL_ICONV
40 static unsigned uni_to_jis(unsigned c)
41 {
42 unsigned nel = sizeof rev_jis / sizeof *rev_jis;
43 @@ -214,6 +219,7 @@ static unsigned uni_to_jis(unsigned c)
44 }
45 }
46 }
47 +#endif
48
49 size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
50 {
51 @@ -285,6 +291,7 @@ size_t iconv(iconv_t cd, char **restrict
52 c = ((c-0xd7c0)<<10) + (d-0xdc00);
53 }
54 break;
55 +#ifdef FULL_ICONV
56 case SHIFT_JIS:
57 if (c < 128) break;
58 if (c-0xa1 <= 0xdf-0xa1) {
59 @@ -476,6 +483,7 @@ size_t iconv(iconv_t cd, char **restrict
60 c = ksc[c][d];
61 if (!c) goto ilseq;
62 break;
63 +#endif
64 default:
65 if (!c) break;
66 c = legacy_map(map, c);
67 @@ -516,6 +524,7 @@ size_t iconv(iconv_t cd, char **restrict
68 }
69 }
70 goto subst;
71 +#ifdef FULL_ICONV
72 case SHIFT_JIS:
73 if (c < 128) goto revout;
74 if (c == 0xa5) {
75 @@ -589,6 +598,7 @@ size_t iconv(iconv_t cd, char **restrict
76 *(*out)++ = 'B';
77 *outb -= 8;
78 break;
79 +#endif
80 case UCS2BE:
81 case UCS2LE:
82 case UTF_16BE:
83 --- a/src/locale/codepages.h
84 +++ b/src/locale/codepages.h
85 @@ -129,6 +129,7 @@
86 "\340\204\43\316\100\344\34\144\316\71\350\244\243\316\72\354\264\343\316\73"
87 "\21\361\44\317\74\364\30\145\17\124\146\345\243\317\76\374\134\304\327\77"
88
89 +#ifdef FULL_ICONV
90 "cp1250\0"
91 "windows1250\0"
92 "\0\40"
93 @@ -239,6 +240,7 @@
94 "\20\105\163\330\64\324\324\145\315\65\330\144\243\315\66\334\334\145\330\67"
95 "\340\204\43\316\100\344\224\143\316\71\350\244\243\316\72\205\265\343\316\73"
96 "\21\305\203\330\74\364\330\145\317\75\370\344\243\317\76\374\340\65\362\77"
97 +#endif
98
99 "koi8r\0"
100 "\0\40"