musl: add a hack to rip out excessive iconv bloat
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40875 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
a114d8a80a
commit
798d7b55fc
|
@ -0,0 +1,68 @@
|
|||
--- a/src/locale/iconv.c
|
||||
+++ b/src/locale/iconv.c
|
||||
@@ -44,6 +44,7 @@ static const unsigned char charmaps[] =
|
||||
"ucs4\0ucs4be\0utf32\0utf32be\0\0\300"
|
||||
"ucs4le\0utf32le\0\0\303"
|
||||
"ascii\0usascii\0iso646\0iso646us\0\0\307"
|
||||
+#ifdef FULL_ICONV
|
||||
"eucjp\0\0\320"
|
||||
"shiftjis\0sjis\0\0\321"
|
||||
"gb18030\0\0\330"
|
||||
@@ -51,6 +52,7 @@ static const unsigned char charmaps[] =
|
||||
"gb2312\0\0\332"
|
||||
"big5\0bigfive\0cp950\0big5hkscs\0\0\340"
|
||||
"euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
|
||||
+#endif
|
||||
#include "codepages.h"
|
||||
;
|
||||
|
||||
@@ -58,6 +60,7 @@ static const unsigned short legacy_chars
|
||||
#include "legacychars.h"
|
||||
};
|
||||
|
||||
+#ifdef FULL_ICONV
|
||||
static const unsigned short jis0208[84][94] = {
|
||||
#include "jis0208.h"
|
||||
};
|
||||
@@ -77,6 +80,7 @@ static const unsigned short hkscs[] = {
|
||||
static const unsigned short ksc[93][94] = {
|
||||
#include "ksc.h"
|
||||
};
|
||||
+#endif
|
||||
|
||||
static int fuzzycmp(const unsigned char *a, const unsigned char *b)
|
||||
{
|
||||
@@ -217,6 +221,7 @@ size_t iconv(iconv_t cd0, char **restric
|
||||
c = ((c-0xd7c0)<<10) + (d-0xdc00);
|
||||
}
|
||||
break;
|
||||
+#ifdef FULL_ICONV
|
||||
case SHIFT_JIS:
|
||||
if (c-0xa1 <= 0xdf-0xa1) {
|
||||
c += 0xff61-0xa1;
|
||||
@@ -363,6 +368,7 @@ size_t iconv(iconv_t cd0, char **restric
|
||||
c = ksc[c][d];
|
||||
if (!c) goto ilseq;
|
||||
break;
|
||||
+#endif
|
||||
default:
|
||||
if (c < 128+type) break;
|
||||
c -= 128+type;
|
||||
--- a/src/locale/codepages.h
|
||||
+++ b/src/locale/codepages.h
|
||||
@@ -118,6 +118,7 @@
|
||||
"\0\0\0\100\15\0\344\0\0\0\0\0\0\0\0\0\0\0\0\0\103\270\1\0\0\0\340\1\200\40"
|
||||
"\230\0\0\0\0\0\44\341\12\0"
|
||||
|
||||
+#ifdef FULL_ICONV
|
||||
"cp1250\0"
|
||||
"windows1250\0"
|
||||
"\0\0"
|
||||
@@ -214,6 +215,7 @@
|
||||
"\0\0\0\0\0\0\0\0\0\15\0\0\0\0\0\0\0\0\0\0\266\0\0\0\0\102\0\220\13\0"
|
||||
"\0\234\2\0\0\0\0\0\0\0\0\244\202\13\0\0\0\0\100\15\0\0\0\0\0\0\0\0\0\0"
|
||||
"\267\0\0\0\0\103\0\240\13\0\0\240\2\0\0\0\0\0\0\0\0\250\62\45\0"
|
||||
+#endif
|
||||
|
||||
"koi8r\0"
|
||||
"\0\0"
|
Loading…
Reference in New Issue