diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-10-26 10:44:50 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-10-26 13:05:48 +0200 |
commit | b9deb8ce2a72de8f74361ea10dd4c4b116458518 (patch) | |
tree | 8c953fc6bf1bde2a361d93f8b61be4243cdb6d33 | |
parent | 68fc2ccc1aebc15b92e596b2bdc5605da1e25f3c (diff) | |
download | glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.zip glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.tar.gz glibc-b9deb8ce2a72de8f74361ea10dd4c4b116458518.tar.bz2 |
iconv: Avoid writable data and relocations in IBM charsets
The IBM930, IBM933, IBM935 and IBM939 converters defined lookup
tables which were not constant. They also contained an
unnecessary pointer indirection.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | iconvdata/ibm930.c | 9 | ||||
-rw-r--r-- | iconvdata/ibm930.h | 78 | ||||
-rw-r--r-- | iconvdata/ibm933.c | 9 | ||||
-rw-r--r-- | iconvdata/ibm933.h | 64 | ||||
-rw-r--r-- | iconvdata/ibm935.c | 9 | ||||
-rw-r--r-- | iconvdata/ibm935.h | 56 | ||||
-rw-r--r-- | iconvdata/ibm939.c | 9 | ||||
-rw-r--r-- | iconvdata/ibm939.h | 78 |
9 files changed, 171 insertions, 154 deletions
@@ -1,3 +1,16 @@ +2016-10-26 Florian Weimer <fweimer@redhat.com> + + * iconvdata/ibm930.h (__ucs4_to_ibm930sb): Remove indirection and + make const. + * iconvdata/ibm933.h (__ucs4_to_ibm933sb): Likewise. + * iconvdata/ibm935.h (__ucs4_to_ibm935sb): Likewise. + * iconvdata/ibm939.h (__ucs4_to_ibm939sb): Likewise. + * iconvdata/ibm930.c [TO_LOOP] (BODY): Store converted single-byte + character in sbconv. + * iconvdata/ibm933.c [TO_LOOP] (BODY): Likewise. + * iconvdata/ibm935.c [TO_LOOP] (BODY): Likewise. + * iconvdata/ibm939.c [TO_LOOP] (BODY): Likewise. + 2016-10-26 Siddhesh Poyarekar <siddhesh@sourceware.org> * malloc/malloc.c (M_ARENA_TEST, M_ARENA_MAX): Remove. diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c index 9d35734..f632997 100644 --- a/iconvdata/ibm930.c +++ b/iconvdata/ibm930.c @@ -191,7 +191,6 @@ enum uint32_t ch = get32 (inptr); \ const struct gap *rp1 = __ucs4_to_ibm930sb_idx; \ const struct gap *rp2 = __ucs4_to_ibm930db_idx; \ - const char *cp; \ \ if (__glibc_unlikely (ch >= 0xffff)) \ { \ @@ -204,14 +203,16 @@ enum ++rp1; \ \ /* Use the UCS4 table for single byte. */ \ + unsigned char sbconv; \ if (__builtin_expect (ch < rp1->start, 0) \ - || (cp = __ucs4_to_ibm930sb[ch + rp1->idx], \ - __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0')) \ + || (sbconv = __ucs4_to_ibm930sb[ch + rp1->idx], \ + __builtin_expect (sbconv, L'\1') == L'\0' && ch != '\0')) \ { \ /* Use the UCS4 table for double byte. */ \ while (ch > rp2->end) \ ++rp2; \ \ + const char *cp; \ if (__builtin_expect (ch < rp2->start, 0) \ || (cp = __ucs4_to_ibm930db[ch + rp2->idx], \ __builtin_expect (cp[0], L'\1')== L'\0' && ch != '\0')) \ @@ -264,7 +265,7 @@ enum else if (ch == 0x5c) \ *outptr++ = 0x5b; \ else \ - *outptr++ = cp[0]; \ + *outptr++ = sbconv; \ } \ \ /* Now that we wrote the output increment the input pointer. */ \ diff --git a/iconvdata/ibm930.h b/iconvdata/ibm930.h index 1afda56..749623e 100644 --- a/iconvdata/ibm930.h +++ b/iconvdata/ibm930.h @@ -1499,46 +1499,46 @@ static const struct gap __ucs4_to_ibm930sb_idx[] = { .start = 0xffff, .end = 0xffff, .idx = 0 } }; -static const char * __ucs4_to_ibm930sb[] = +static const unsigned char __ucs4_to_ibm930sb[] = { - "\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16", - "\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11", - "\x12", "\x13", "\x3c", "\x3d", "\x32", "\x26", "\x18", "\x19", "\x3f", - "\x27", "\x1c", "\x1d", "\x1e", "\x1f", "\x40", "\x5a", "\x7f", "\x7b", - "\xe0", "\x6c", "\x50", "\x7d", "\x4d", "\x5d", "\x5c", "\x4e", "\x6b", - "\x60", "\x4b", "\x61", "\xf0", "\xf1", "\xf2", "\xf3", "\xf4", "\xf5", - "\xf6", "\xf7", "\xf8", "\xf9", "\x7a", "\x5e", "\x4c", "\x7e", "\x6e", - "\x6f", "\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7", - "\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6", "\xd7", - "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6", "\xe7", "\xe8", - "\xe9", "\x70", "\xb2", "\x80", "\xb0", "\x6d", "\x79", "\x62", "\x63", - "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x71", "\x72", "\x73", - "\x74", "\x75", "\x76", "\x77", "\x78", "\x8b", "\x9b", "\xab", "\xb3", - "\xb4", "\xb5", "\xb6", "\xb7", "\xb8", "\xb9", "\xc0", "\x4f", "\xd0", - "\xa0", "\x07", "\x20", "\x21", "\x22", "\x23", "\x24", "\x15", "\x06", - "\x17", "\x28", "\x29", "\x2a", "\x2b", "\x2c", "\x09", "\x0a", "\x1b", - "\x30", "\x31", "\x1a", "\x33", "\x34", "\x35", "\x36", "\x08", "\x38", - "\x39", "\x3a", "\x3b", "\x04", "\x14", "\x3e", "\xff", "\x3f", "\x3f", - "\xb1", "\x4a", "\x3f", "\x5b", "\x3f", "\x3f", "\x3f", "\x5f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\xa1", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x41", "\x42", "\x43", "\x44", "\x45", - "\x46", "\x47", "\x48", "\x49", "\x51", "\x52", "\x53", "\x54", "\x55", - "\x56", "\x58", "\x81", "\x82", "\x83", "\x84", "\x85", "\x86", "\x87", - "\x88", "\x89", "\x8a", "\x8c", "\x8d", "\x8e", "\x8f", "\x90", "\x91", - "\x92", "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\x9a", - "\x9d", "\x9e", "\x9f", "\xa2", "\xa3", "\xa4", "\xa5", "\xa6", "\xa7", - "\xa8", "\xa9", "\xaa", "\xac", "\xad", "\xae", "\xaf", "\xba", "\xbb", - "\xbc", "\xbd", "\xbe", "\xbf", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f" + '\x00', '\x01', '\x02', '\x03', '\x37', '\x2d', '\x2e', '\x2f', '\x16', + '\x05', '\x25', '\x0b', '\x0c', '\x0d', '\x3f', '\x3f', '\x10', '\x11', + '\x12', '\x13', '\x3c', '\x3d', '\x32', '\x26', '\x18', '\x19', '\x3f', + '\x27', '\x1c', '\x1d', '\x1e', '\x1f', '\x40', '\x5a', '\x7f', '\x7b', + '\xe0', '\x6c', '\x50', '\x7d', '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', + '\x60', '\x4b', '\x61', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', + '\xf6', '\xf7', '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', + '\x6f', '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', + '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', + '\xe9', '\x70', '\xb2', '\x80', '\xb0', '\x6d', '\x79', '\x62', '\x63', + '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x71', '\x72', '\x73', + '\x74', '\x75', '\x76', '\x77', '\x78', '\x8b', '\x9b', '\xab', '\xb3', + '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xc0', '\x4f', '\xd0', + '\xa0', '\x07', '\x20', '\x21', '\x22', '\x23', '\x24', '\x15', '\x06', + '\x17', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x09', '\x0a', '\x1b', + '\x30', '\x31', '\x1a', '\x33', '\x34', '\x35', '\x36', '\x08', '\x38', + '\x39', '\x3a', '\x3b', '\x04', '\x14', '\x3e', '\xff', '\x3f', '\x3f', + '\xb1', '\x4a', '\x3f', '\x5b', '\x3f', '\x3f', '\x3f', '\x5f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\xa1', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x41', '\x42', '\x43', '\x44', '\x45', + '\x46', '\x47', '\x48', '\x49', '\x51', '\x52', '\x53', '\x54', '\x55', + '\x56', '\x58', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', + '\x88', '\x89', '\x8a', '\x8c', '\x8d', '\x8e', '\x8f', '\x90', '\x91', + '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\x9a', + '\x9d', '\x9e', '\x9f', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', + '\xa8', '\xa9', '\xaa', '\xac', '\xad', '\xae', '\xaf', '\xba', '\xbb', + '\xbc', '\xbd', '\xbe', '\xbf', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f' }; static const struct gap __ucs4_to_ibm930db_idx[] = diff --git a/iconvdata/ibm933.c b/iconvdata/ibm933.c index 669e357..8abc05a 100644 --- a/iconvdata/ibm933.c +++ b/iconvdata/ibm933.c @@ -189,7 +189,6 @@ enum uint32_t ch = get32 (inptr); \ const struct gap *rp1 = __ucs4_to_ibm933sb_idx; \ const struct gap *rp2 = __ucs4_to_ibm933db_idx; \ - const char *cp; \ \ if (__glibc_unlikely (ch >= 0xffff)) \ { \ @@ -202,14 +201,16 @@ enum ++rp1; \ \ /* Use the UCS4 table for single byte. */ \ + unsigned char sbconv; \ if (__builtin_expect (ch < rp1->start, 0) \ - || (cp = __ucs4_to_ibm933sb[ch + rp1->idx], \ - __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0')) \ + || (sbconv = __ucs4_to_ibm933sb[ch + rp1->idx], \ + __builtin_expect (sbconv, L'\1') == L'\0' && ch != '\0')) \ { \ /* Use the UCS4 table for double byte. */ \ while (ch > rp2->end) \ ++rp2; \ \ + const char *cp; \ if (__builtin_expect (ch < rp2->start, 0) \ || (cp = __ucs4_to_ibm933db[ch + rp2->idx], \ __builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \ @@ -257,7 +258,7 @@ enum result = __GCONV_FULL_OUTPUT; \ break; \ } \ - *outptr++ = cp[0]; \ + *outptr++ = sbconv; \ } \ \ /* Now that we wrote the output increment the input pointer. */ \ diff --git a/iconvdata/ibm933.h b/iconvdata/ibm933.h index cb00137..1b69dd7 100644 --- a/iconvdata/ibm933.h +++ b/iconvdata/ibm933.h @@ -3371,39 +3371,39 @@ static const struct gap __ucs4_to_ibm933sb_idx[] = { .start = 0xffff, .end = 0xffff, .idx = 0 } }; -static const char *__ucs4_to_ibm933sb[] = +static const unsigned char __ucs4_to_ibm933sb[] = { - "\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16", - "\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11", - "\x12", "\x13", "\x3c", "\x3d", "\x32", "\x26", "\x18", "\x19", "\x3f", - "\x27", "\x1c", "\x1d", "\x1e", "\x1f", "\x40", "\x5a", "\x7f", "\x7b", - "\x5b", "\x6c", "\x50", "\x7d", "\x4d", "\x5d", "\x5c", "\x4e", "\x6b", - "\x60", "\x4b", "\x61", "\xf0", "\xf1", "\xf2", "\xf3", "\xf4", "\xf5", - "\xf6", "\xf7", "\xf8", "\xf9", "\x7a", "\x5e", "\x4c", "\x7e", "\x6e", - "\x6f", "\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7", - "\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6", "\xd7", - "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6", "\xe7", "\xe8", - "\xe9", "\x70", "\xb2", "\x80", "\xb0", "\x6d", "\x79", "\x81", "\x82", - "\x83", "\x84", "\x85", "\x86", "\x87", "\x88", "\x89", "\x91", "\x92", - "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\xa2", "\xa3", - "\xa4", "\xa5", "\xa6", "\xa7", "\xa8", "\xa9", "\xc0", "\x4f", "\xd0", - "\xa1", "\x07", "\x20", "\x21", "\x22", "\x23", "\x24", "\x15", "\x06", - "\x17", "\x28", "\x29", "\x2a", "\x2b", "\x2c", "\x09", "\x0a", "\x1b", - "\x30", "\x31", "\x1a", "\x33", "\x34", "\x35", "\x36", "\x08", "\x38", - "\x39", "\x3a", "\x3b", "\x04", "\x14", "\x3e", "\xff", "\x3f", "\x4a", - "\x3f", "\x3f", "\x6a", "\x3f", "\x3f", "\x5f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\xa0", "\xe0", "\x42", "\x43", "\x44", "\x45", "\x46", "\x47", "\x48", - "\x49", "\x52", "\x53", "\x54", "\x55", "\x56", "\x57", "\x58", "\x59", - "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x72", - "\x73", "\x74", "\x75", "\x76", "\x77", "\x78", "\x8a", "\x8b", "\x8c", - "\x8d", "\x8e", "\x8f", "\x9a", "\x9b", "\x9c", "\x9d", "\x9e", "\x9f", - "\xaa", "\xab", "\xac", "\xad", "\xae", "\xaf", "\xba", "\xbb", "\xbc" + '\x00', '\x01', '\x02', '\x03', '\x37', '\x2d', '\x2e', '\x2f', '\x16', + '\x05', '\x25', '\x0b', '\x0c', '\x0d', '\x3f', '\x3f', '\x10', '\x11', + '\x12', '\x13', '\x3c', '\x3d', '\x32', '\x26', '\x18', '\x19', '\x3f', + '\x27', '\x1c', '\x1d', '\x1e', '\x1f', '\x40', '\x5a', '\x7f', '\x7b', + '\x5b', '\x6c', '\x50', '\x7d', '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', + '\x60', '\x4b', '\x61', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', + '\xf6', '\xf7', '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', + '\x6f', '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', + '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', + '\xe9', '\x70', '\xb2', '\x80', '\xb0', '\x6d', '\x79', '\x81', '\x82', + '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x91', '\x92', + '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\xa2', '\xa3', + '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xc0', '\x4f', '\xd0', + '\xa1', '\x07', '\x20', '\x21', '\x22', '\x23', '\x24', '\x15', '\x06', + '\x17', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x09', '\x0a', '\x1b', + '\x30', '\x31', '\x1a', '\x33', '\x34', '\x35', '\x36', '\x08', '\x38', + '\x39', '\x3a', '\x3b', '\x04', '\x14', '\x3e', '\xff', '\x3f', '\x4a', + '\x3f', '\x3f', '\x6a', '\x3f', '\x3f', '\x5f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\xa0', '\xe0', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', + '\x49', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', + '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x72', + '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x8a', '\x8b', '\x8c', + '\x8d', '\x8e', '\x8f', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', + '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', '\xba', '\xbb', '\xbc' }; static const struct gap __ucs4_to_ibm933db_idx[] = diff --git a/iconvdata/ibm935.c b/iconvdata/ibm935.c index 2d3065e..d6574e8 100644 --- a/iconvdata/ibm935.c +++ b/iconvdata/ibm935.c @@ -190,7 +190,6 @@ enum uint32_t ch = get32 (inptr); \ const struct gap *rp1 = __ucs4_to_ibm935sb_idx; \ const struct gap *rp2 = __ucs4_to_ibm935db_idx; \ - const char *cp; \ \ if (__glibc_unlikely (ch >= 0xffff)) \ { \ @@ -203,14 +202,16 @@ enum ++rp1; \ \ /* Use the UCS4 table for single byte. */ \ + unsigned char sbconv; \ if (__builtin_expect (ch < rp1->start, 0) \ - || (cp = __ucs4_to_ibm935sb[ch + rp1->idx], \ - __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0')) \ + || (sbconv = __ucs4_to_ibm935sb[ch + rp1->idx], \ + __builtin_expect (sbconv, L'\1') == L'\0' && ch != '\0')) \ { \ /* Use the UCS4 table for double byte. */ \ while (ch > rp2->end) \ ++rp2; \ \ + const char *cp; \ if (__builtin_expect (ch < rp2->start, 0) \ || (cp = __ucs4_to_ibm935db[ch + rp2->idx], \ __builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \ @@ -258,7 +259,7 @@ enum result = __GCONV_FULL_OUTPUT; \ break; \ } \ - *outptr++ = cp[0]; \ + *outptr++ = sbconv; \ } \ \ /* Now that we wrote the output increment the input pointer. */ \ diff --git a/iconvdata/ibm935.h b/iconvdata/ibm935.h index f7a96e9..30b44ab 100644 --- a/iconvdata/ibm935.h +++ b/iconvdata/ibm935.h @@ -1282,35 +1282,35 @@ static const struct gap __ucs4_to_ibm935sb_idx[] = { .start = 0xffff, .end = 0xffff, .idx = 0 } }; -static const char *__ucs4_to_ibm935sb[] = +static const unsigned char __ucs4_to_ibm935sb[] = { - "\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16", - "\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11", - "\x12", "\x13", "\x3c", "\x3d", "\x32", "\x26", "\x18", "\x19", "\x3f", - "\x27", "\x1c", "\x1d", "\x1e", "\x1f", "\x40", "\x5a", "\x7f", "\x7b", - "\xe0", "\x6c", "\x50", "\x7d", "\x4d", "\x5d", "\x5c", "\x4e", "\x6b", - "\x60", "\x4b", "\x61", "\xf0", "\xf1", "\xf2", "\xf3", "\xf4", "\xf5", - "\xf6", "\xf7", "\xf8", "\xf9", "\x7a", "\x5e", "\x4c", "\x7e", "\x6e", - "\x6f", "\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7", - "\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6", "\xd7", - "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6", "\xe7", "\xe8", - "\xe9", "\xba", "\xb2", "\xbb", "\xb0", "\x6d", "\x79", "\x81", "\x82", - "\x83", "\x84", "\x85", "\x86", "\x87", "\x88", "\x89", "\x91", "\x92", - "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\xa2", "\xa3", - "\xa4", "\xa5", "\xa6", "\xa7", "\xa8", "\xa9", "\xc0", "\x4f", "\xd0", - "\xa0", "\x07", "\x20", "\x21", "\x22", "\x23", "\x24", "\x15", "\x06", - "\x17", "\x28", "\x29", "\x2a", "\x2b", "\x2c", "\x09", "\x0a", "\x1b", - "\x30", "\x31", "\x1a", "\x33", "\x34", "\x35", "\x36", "\x08", "\x38", - "\x39", "\x3a", "\x3b", "\x04", "\x14", "\x3e", "\xff", "\x3f", "\x3f", - "\x3f", "\x4a", "\x5b", "\x6a", "\x3f", "\x3f", "\x3f", "\x5f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\xa1" + '\x00', '\x01', '\x02', '\x03', '\x37', '\x2d', '\x2e', '\x2f', '\x16', + '\x05', '\x25', '\x0b', '\x0c', '\x0d', '\x3f', '\x3f', '\x10', '\x11', + '\x12', '\x13', '\x3c', '\x3d', '\x32', '\x26', '\x18', '\x19', '\x3f', + '\x27', '\x1c', '\x1d', '\x1e', '\x1f', '\x40', '\x5a', '\x7f', '\x7b', + '\xe0', '\x6c', '\x50', '\x7d', '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', + '\x60', '\x4b', '\x61', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', + '\xf6', '\xf7', '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', + '\x6f', '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', + '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', + '\xe9', '\xba', '\xb2', '\xbb', '\xb0', '\x6d', '\x79', '\x81', '\x82', + '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x91', '\x92', + '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\xa2', '\xa3', + '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xc0', '\x4f', '\xd0', + '\xa0', '\x07', '\x20', '\x21', '\x22', '\x23', '\x24', '\x15', '\x06', + '\x17', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x09', '\x0a', '\x1b', + '\x30', '\x31', '\x1a', '\x33', '\x34', '\x35', '\x36', '\x08', '\x38', + '\x39', '\x3a', '\x3b', '\x04', '\x14', '\x3e', '\xff', '\x3f', '\x3f', + '\x3f', '\x4a', '\x5b', '\x6a', '\x3f', '\x3f', '\x3f', '\x5f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\xa1' }; static const struct gap __ucs4_to_ibm935db_idx[] = diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c index c0a75f7..5122975 100644 --- a/iconvdata/ibm939.c +++ b/iconvdata/ibm939.c @@ -190,7 +190,6 @@ enum uint32_t ch = get32 (inptr); \ const struct gap *rp1 = __ucs4_to_ibm939sb_idx; \ const struct gap *rp2 = __ucs4_to_ibm939db_idx; \ - const char *cp; \ \ if (__glibc_unlikely (ch >= 0xffff)) \ { \ @@ -202,14 +201,16 @@ enum ++rp1; \ \ /* Use the UCS4 table for single byte. */ \ + unsigned char sbconv; \ if (__builtin_expect (ch < rp1->start, 0) \ - || (cp = __ucs4_to_ibm939sb[ch + rp1->idx], \ - __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0')) \ + || (sbconv = __ucs4_to_ibm939sb[ch + rp1->idx], \ + __builtin_expect (sbconv, L'\1') == L'\0' && ch != '\0')) \ { \ /* Use the UCS4 table for double byte. */ \ while (ch > rp2->end) \ ++rp2; \ \ + const char *cp; \ if (__builtin_expect (ch < rp2->start, 0) \ || (cp = __ucs4_to_ibm939db[ch + rp2->idx], \ __builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \ @@ -263,7 +264,7 @@ enum else if (ch == 0x5c) \ *outptr++ = 0xb2; \ else \ - *outptr++ = cp[0]; \ + *outptr++ = sbconv; \ } \ \ /* Now that we wrote the output increment the input pointer. */ \ diff --git a/iconvdata/ibm939.h b/iconvdata/ibm939.h index bb8a8de..9c0a657 100644 --- a/iconvdata/ibm939.h +++ b/iconvdata/ibm939.h @@ -1499,46 +1499,46 @@ static const struct gap __ucs4_to_ibm939sb_idx[] = { .start = 0xffff, .end = 0xffff, .idx = 0 } }; -static const char * __ucs4_to_ibm939sb[] = +static const unsigned char __ucs4_to_ibm939sb[] = { - "\x00", "\x01", "\x02", "\x03", "\x37", "\x2d", "\x2e", "\x2f", "\x16", - "\x05", "\x25", "\x0b", "\x0c", "\x0d", "\x3f", "\x3f", "\x10", "\x11", - "\x12", "\x13", "\x3c", "\x3d", "\x32", "\x26", "\x18", "\x19", "\x3f", - "\x27", "\x1c", "\x1d", "\x1e", "\x1f", "\x40", "\x5a", "\x7f", "\x7b", - "\x5b", "\x6c", "\x50", "\x7d", "\x4d", "\x5d", "\x5c", "\x4e", "\x6b", - "\x60", "\x4b", "\x61", "\xf0", "\xf1", "\xf2", "\xf3", "\xf4", "\xf5", - "\xf6", "\xf7", "\xf8", "\xf9", "\x7a", "\x5e", "\x4c", "\x7e", "\x6e", - "\x6f", "\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7", - "\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6", "\xd7", - "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6", "\xe7", "\xe8", - "\xe9", "\xad", "\xe0", "\xbd", "\xb0", "\x6d", "\x79", "\x81", "\x82", - "\x83", "\x84", "\x85", "\x86", "\x87", "\x88", "\x89", "\x91", "\x92", - "\x93", "\x94", "\x95", "\x96", "\x97", "\x98", "\x99", "\xa2", "\xa3", - "\xa4", "\xa5", "\xa6", "\xa7", "\xa8", "\xa9", "\xc0", "\x4f", "\xd0", - "\xa1", "\x07", "\x20", "\x21", "\x22", "\x23", "\x24", "\x15", "\x06", - "\x17", "\x28", "\x29", "\x2a", "\x2b", "\x2c", "\x09", "\x0a", "\x1b", - "\x30", "\x31", "\x1a", "\x33", "\x34", "\x35", "\x36", "\x08", "\x38", - "\x39", "\x3a", "\x3b", "\x04", "\x14", "\x3e", "\xff", "\x3f", "\x3f", - "\x4a", "\xb1", "\x3f", "\xb2", "\x3f", "\x3f", "\x3f", "\x5f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\xa0", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f", "\x3f", "\x3f", "\x42", "\x43", "\x44", "\x45", "\x46", - "\x47", "\x48", "\x49", "\x51", "\x52", "\x53", "\x54", "\x55", "\x56", - "\x57", "\x58", "\x59", "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", - "\x68", "\x69", "\x70", "\x71", "\x72", "\x73", "\x74", "\x75", "\x76", - "\x77", "\x78", "\x8a", "\x8b", "\x8c", "\x8d", "\x8e", "\x8f", "\x9a", - "\x9b", "\x9c", "\x9d", "\x9e", "\x9f", "\xaa", "\xab", "\xac", "\xae", - "\xaf", "\xb3", "\xb4", "\xb5", "\xb6", "\xb7", "\xb8", "\xb9", "\xba", - "\xbb", "\xbc", "\xbe", "\xbf", "\x3f", "\x3f", "\x3f", "\x3f", "\x3f", - "\x3f", "\x3f" + '\x00', '\x01', '\x02', '\x03', '\x37', '\x2d', '\x2e', '\x2f', '\x16', + '\x05', '\x25', '\x0b', '\x0c', '\x0d', '\x3f', '\x3f', '\x10', '\x11', + '\x12', '\x13', '\x3c', '\x3d', '\x32', '\x26', '\x18', '\x19', '\x3f', + '\x27', '\x1c', '\x1d', '\x1e', '\x1f', '\x40', '\x5a', '\x7f', '\x7b', + '\x5b', '\x6c', '\x50', '\x7d', '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', + '\x60', '\x4b', '\x61', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', + '\xf6', '\xf7', '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', + '\x6f', '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7', + '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', + '\xe9', '\xad', '\xe0', '\xbd', '\xb0', '\x6d', '\x79', '\x81', '\x82', + '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x91', '\x92', + '\x93', '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\xa2', '\xa3', + '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xc0', '\x4f', '\xd0', + '\xa1', '\x07', '\x20', '\x21', '\x22', '\x23', '\x24', '\x15', '\x06', + '\x17', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x09', '\x0a', '\x1b', + '\x30', '\x31', '\x1a', '\x33', '\x34', '\x35', '\x36', '\x08', '\x38', + '\x39', '\x3a', '\x3b', '\x04', '\x14', '\x3e', '\xff', '\x3f', '\x3f', + '\x4a', '\xb1', '\x3f', '\xb2', '\x3f', '\x3f', '\x3f', '\x5f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\xa0', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f', '\x3f', '\x3f', '\x42', '\x43', '\x44', '\x45', '\x46', + '\x47', '\x48', '\x49', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', + '\x57', '\x58', '\x59', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', + '\x68', '\x69', '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', + '\x77', '\x78', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', '\x9a', + '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', '\xaa', '\xab', '\xac', '\xae', + '\xaf', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\xba', + '\xbb', '\xbc', '\xbe', '\xbf', '\x3f', '\x3f', '\x3f', '\x3f', '\x3f', + '\x3f', '\x3f' }; static const struct gap __ucs4_to_ibm939db_idx[] = |