openwrtv4/toolchain/musl/patches/900-iconv_size_hack.patch
Christian Lamparter 6b175b7cd6 toolchain: musl: update to current HEAD
Changes:

72656157 fix fgetwc when decoding a character that crosses buffer boundary
a223dbd2 add reverse iconv mappings for JIS-based encodings
105eff9d generalize iconv framework for 8-bit codepages
a71b46cf fix malloc state corruption when ldso rejects loading a second libc
d060edf6 reformat cjk iconv tables to be diff-friendly, match tool output
c21051e9 prevent fork's errno from being clobbered by atfork handlers
a39f20bf add iso-2022-jp support (decoding only) to iconv
5b546faa add iconv framework for decoding stateful encodings
0df5b39a simplify/optimize iconv utf-8 case
9eb6dd51 handle ascii range individually in each iconv case
bff59d13 move iconv_close to its own translation unit
79f49eff refactor iconv conversion descriptor encoding/decoding
30fdda6c fix getaddrinfo error code for non-numeric service with AI_NUMERICSERV
67b29947 fix mismatched type of __pthread_tsd_run_dtors weak definition
13935337 s390x: use generic ioctl.h
4dc44ce8 microblaze: add statx syscall from linux v4.13
ffd048a0 aarch64: add extra_context struct from linux v4.13
6651ef1f add new tcp.h socket options from linux v4.13
14ced228 add new fcntl.h macros from linux v4.13
754f66af ioctl TIOCGPTPEER from linux v4.13
c35a8bf4 add SO_ getsockopt options from linux v4.13
5daaed6a s390x: add syscall number for s390_guarded_storage from linux v4.12
2dc6760f i386: add arch_prctl syscall number from linux v4.12
840d45be aarch64: add new HWCAP_* flags from linux v4.12
4c811227 add ARPHDR_VSOCKMON from linux v4.12
54f04d99 add new SO_ socket options from linux v4.12
9864f60e add statx syscall numbers from linux v4.11
c519658c add TCP_NLA_* enums from linux v4.11
ee3ae782 add TCP_FASTOPEN_CONNECT tcp socket option from linux v4.11
3eb82f73 add ETH_P_IBOE from linux v4.11
bd1560f6 update aarch64 hwcap.h for linux v4.11
cee73f0c add kexec_file_load syscall number on powerpc from linux v4.10
8f569557 add microblaze syscall numbers from linux v4.10
d8004030 add TFD_TIMER_CANCEL_ON_SET that timerfd.h was missing
f5638c22 add ETH_MIN_MTU and ETH_MAX_MTU from linux v4.10
01369691 add IP_RECVFRAGSIZE and IPV6_RECVFRAGSIZE from linux v4.10
5c596ed8 add SCM_TIMESTAMPING_OPT_STATS and related TCP_ enums from linux v4.10
6fc6ca1a adjust posix_spawn dup2 action behavior to match future requirements

Cc: Syrone Wong <wong.syrone@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2017-12-08 19:54:21 +01:00

100 lines
2.6 KiB
Diff

--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -42,6 +42,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"
"iso2022jp\0\0\322"
@@ -50,6 +51,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"
;
@@ -60,6 +62,7 @@ static const unsigned short legacy_chars
#include "legacychars.h"
};
+#ifdef FULL_ICONV
static const unsigned short jis0208[84][94] = {
#include "jis0208.h"
};
@@ -79,6 +82,7 @@ static const unsigned short hkscs[] = {
static const unsigned short ksc[93][94] = {
#include "ksc.h"
};
+#endif
static const unsigned short rev_jis[] = {
#include "revjis.h"
@@ -196,6 +200,7 @@ static unsigned legacy_map(const unsigne
return x < 256 ? x : legacy_chars[x-256];
}
+#ifdef FULL_ICONV
static unsigned uni_to_jis(unsigned c)
{
unsigned nel = sizeof rev_jis / sizeof *rev_jis;
@@ -214,6 +219,7 @@ static unsigned uni_to_jis(unsigned c)
}
}
}
+#endif
size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
{
@@ -285,6 +291,7 @@ size_t iconv(iconv_t cd, char **restrict
c = ((c-0xd7c0)<<10) + (d-0xdc00);
}
break;
+#ifdef FULL_ICONV
case SHIFT_JIS:
if (c < 128) break;
if (c-0xa1 <= 0xdf-0xa1) {
@@ -476,6 +483,7 @@ size_t iconv(iconv_t cd, char **restrict
c = ksc[c][d];
if (!c) goto ilseq;
break;
+#endif
default:
if (!c) break;
c = legacy_map(map, c);
@@ -516,6 +524,7 @@ size_t iconv(iconv_t cd, char **restrict
}
}
goto subst;
+#ifdef FULL_ICONV
case SHIFT_JIS:
if (c < 128) goto revout;
if (c == 0xa5) {
@@ -589,6 +598,7 @@ size_t iconv(iconv_t cd, char **restrict
*(*out)++ = 'B';
*outb -= 8;
break;
+#endif
case UCS2BE:
case UCS2LE:
case UTF_16BE:
--- a/src/locale/codepages.h
+++ b/src/locale/codepages.h
@@ -129,6 +129,7 @@
"\340\204\43\316\100\344\34\144\316\71\350\244\243\316\72\354\264\343\316\73"
"\21\361\44\317\74\364\30\145\17\124\146\345\243\317\76\374\134\304\327\77"
+#ifdef FULL_ICONV
"cp1250\0"
"windows1250\0"
"\0\40"
@@ -239,6 +240,7 @@
"\20\105\163\330\64\324\324\145\315\65\330\144\243\315\66\334\334\145\330\67"
"\340\204\43\316\100\344\224\143\316\71\350\244\243\316\72\205\265\343\316\73"
"\21\305\203\330\74\364\330\145\317\75\370\344\243\317\76\374\340\65\362\77"
+#endif
"koi8r\0"
"\0\40"