summaryrefslogtreecommitdiff
path: root/lib/unistr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unistr')
-rw-r--r--lib/unistr/u16-check.c2
-rw-r--r--lib/unistr/u16-mblen.c9
-rw-r--r--lib/unistr/u16-mbtouc-unsafe-aux.c4
-rw-r--r--lib/unistr/u16-mbtouc-unsafe.c4
-rw-r--r--lib/unistr/u16-prev.c4
-rw-r--r--lib/unistr/u16-strmblen.c7
-rw-r--r--lib/unistr/u16-strmbtouc.c8
-rw-r--r--lib/unistr/u32-mblen.c2
-rw-r--r--lib/unistr/u32-mbtouc-unsafe.c4
-rw-r--r--lib/unistr/u32-next.c2
-rw-r--r--lib/unistr/u32-prev.c2
-rw-r--r--lib/unistr/u32-strmblen.c4
-rw-r--r--lib/unistr/u32-strmbtouc.c4
-rw-r--r--lib/unistr/u8-check.c30
-rw-r--r--lib/unistr/u8-mblen.c42
-rw-r--r--lib/unistr/u8-mbtouc-aux.c104
-rw-r--r--lib/unistr/u8-mbtouc-unsafe-aux.c121
-rw-r--r--lib/unistr/u8-mbtouc-unsafe.c121
-rw-r--r--lib/unistr/u8-mbtouc.c104
-rw-r--r--lib/unistr/u8-mbtoucr.c145
-rw-r--r--lib/unistr/u8-prev.c16
-rw-r--r--lib/unistr/u8-strmblen.c42
-rw-r--r--lib/unistr/u8-strmbtouc.c57
-rw-r--r--lib/unistr/u8-uctomb-aux.c13
-rw-r--r--lib/unistr/u8-uctomb.c13
25 files changed, 15 insertions, 849 deletions
diff --git a/lib/unistr/u16-check.c b/lib/unistr/u16-check.c
index 7bd5d3ee87..8210715ca6 100644
--- a/lib/unistr/u16-check.c
+++ b/lib/unistr/u16-check.c
@@ -27,7 +27,7 @@ u16_check (const uint16_t *s, size_t n)
while (s < s_end)
{
- /* Keep in sync with unistr.h and utf16-ucs4.c. */
+ /* Keep in sync with unistr.h and u16-mbtouc-aux.c. */
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
diff --git a/lib/unistr/u16-mblen.c b/lib/unistr/u16-mblen.c
index 17cb846379..9a42c18c45 100644
--- a/lib/unistr/u16-mblen.c
+++ b/lib/unistr/u16-mblen.c
@@ -26,24 +26,17 @@ u16_mblen (const uint16_t *s, size_t n)
{
if (n > 0)
{
- /* Keep in sync with unistr.h and utf16-ucs4.c. */
+ /* Keep in sync with unistr.h and u16-mbtouc-aux.c. */
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
return (c != 0 ? 1 : 0);
-#if CONFIG_UNICODE_SAFETY
if (c < 0xdc00)
{
if (n >= 2
&& s[1] >= 0xdc00 && s[1] < 0xe000)
return 2;
}
-#else
- {
- if (n >= 2)
- return 2;
- }
-#endif
}
/* invalid or incomplete multibyte character */
return -1;
diff --git a/lib/unistr/u16-mbtouc-unsafe-aux.c b/lib/unistr/u16-mbtouc-unsafe-aux.c
index 48d2bceb9a..500d8c1e8d 100644
--- a/lib/unistr/u16-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u16-mbtouc-unsafe-aux.c
@@ -27,15 +27,11 @@ u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n)
{
uint16_t c = *s;
-#if CONFIG_UNICODE_SAFETY
if (c < 0xdc00)
-#endif
{
if (n >= 2)
{
-#if CONFIG_UNICODE_SAFETY
if (s[1] >= 0xdc00 && s[1] < 0xe000)
-#endif
{
*puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00);
return 2;
diff --git a/lib/unistr/u16-mbtouc-unsafe.c b/lib/unistr/u16-mbtouc-unsafe.c
index 03cf2553f7..c5d7a16920 100644
--- a/lib/unistr/u16-mbtouc-unsafe.c
+++ b/lib/unistr/u16-mbtouc-unsafe.c
@@ -38,15 +38,11 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n)
*puc = c;
return 1;
}
-#if CONFIG_UNICODE_SAFETY
if (c < 0xdc00)
-#endif
{
if (n >= 2)
{
-#if CONFIG_UNICODE_SAFETY
if (s[1] >= 0xdc00 && s[1] < 0xe000)
-#endif
{
*puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00);
return 2;
diff --git a/lib/unistr/u16-prev.c b/lib/unistr/u16-prev.c
index 2c3e45a6ef..e9beb736ab 100644
--- a/lib/unistr/u16-prev.c
+++ b/lib/unistr/u16-prev.c
@@ -33,16 +33,12 @@ u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start)
*puc = c_1;
return s - 1;
}
-#if CONFIG_UNICODE_SAFETY
if (c_1 >= 0xdc00)
-#endif
if (s - 1 != start)
{
uint16_t c_2 = s[-2];
-#if CONFIG_UNICODE_SAFETY
if (c_2 >= 0xd800 && c_2 < 0xdc00)
-#endif
{
*puc = 0x10000 + ((c_2 - 0xd800) << 10) + (c_1 - 0xdc00);
return s - 2;
diff --git a/lib/unistr/u16-strmblen.c b/lib/unistr/u16-strmblen.c
index dd507c7158..20acb8c9a1 100644
--- a/lib/unistr/u16-strmblen.c
+++ b/lib/unistr/u16-strmblen.c
@@ -24,21 +24,16 @@
int
u16_strmblen (const uint16_t *s)
{
- /* Keep in sync with unistr.h and utf16-ucs4.c. */
+ /* Keep in sync with unistr.h and u16-mbtouc-aux.c. */
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
return (c != 0 ? 1 : 0);
-#if CONFIG_UNICODE_SAFETY
if (c < 0xdc00)
{
if (s[1] >= 0xdc00 && s[1] < 0xe000)
return 2;
}
-#else
- if (s[1] != 0)
- return 2;
-#endif
/* invalid or incomplete multibyte character */
return -1;
}
diff --git a/lib/unistr/u16-strmbtouc.c b/lib/unistr/u16-strmbtouc.c
index f1945fe0db..affa09b6aa 100644
--- a/lib/unistr/u16-strmbtouc.c
+++ b/lib/unistr/u16-strmbtouc.c
@@ -24,7 +24,7 @@
int
u16_strmbtouc (ucs4_t *puc, const uint16_t *s)
{
- /* Keep in sync with unistr.h and utf16-ucs4.c. */
+ /* Keep in sync with unistr.h and u16-mbtouc-aux.c. */
uint16_t c = *s;
if (c < 0xd800 || c >= 0xe000)
@@ -32,15 +32,9 @@ u16_strmbtouc (ucs4_t *puc, const uint16_t *s)
*puc = c;
return (c != 0 ? 1 : 0);
}
-#if CONFIG_UNICODE_SAFETY
if (c < 0xdc00)
-#endif
{
-#if CONFIG_UNICODE_SAFETY
if (s[1] >= 0xdc00 && s[1] < 0xe000)
-#else
- if (s[1] != 0)
-#endif
{
*puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00);
return 2;
diff --git a/lib/unistr/u32-mblen.c b/lib/unistr/u32-mblen.c
index a1d5823fc0..57a88cfac0 100644
--- a/lib/unistr/u32-mblen.c
+++ b/lib/unistr/u32-mblen.c
@@ -27,9 +27,7 @@ u32_mblen (const uint32_t *s, size_t n)
{
uint32_t c = *s;
-#if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
-#endif
return (c != 0 ? 1 : 0);
}
/* invalid or incomplete multibyte character */
diff --git a/lib/unistr/u32-mbtouc-unsafe.c b/lib/unistr/u32-mbtouc-unsafe.c
index 921b6d1a53..4b8dd3c325 100644
--- a/lib/unistr/u32-mbtouc-unsafe.c
+++ b/lib/unistr/u32-mbtouc-unsafe.c
@@ -33,15 +33,11 @@ u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n)
{
uint32_t c = *s;
-#if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
-#endif
*puc = c;
-#if CONFIG_UNICODE_SAFETY
else
/* invalid multibyte character */
*puc = 0xfffd;
-#endif
return 1;
}
diff --git a/lib/unistr/u32-next.c b/lib/unistr/u32-next.c
index cc04a9fa80..d2c7c32d65 100644
--- a/lib/unistr/u32-next.c
+++ b/lib/unistr/u32-next.c
@@ -30,10 +30,8 @@ u32_next (ucs4_t *puc, const uint32_t *s)
return s + count;
else
{
-#if CONFIG_UNICODE_SAFETY
if (count < 0)
*puc = 0xfffd;
-#endif
return NULL;
}
}
diff --git a/lib/unistr/u32-prev.c b/lib/unistr/u32-prev.c
index ad7f678c75..e44d82a6a2 100644
--- a/lib/unistr/u32-prev.c
+++ b/lib/unistr/u32-prev.c
@@ -27,9 +27,7 @@ u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start)
{
uint32_t c_1 = s[-1];
-#if CONFIG_UNICODE_SAFETY
if (c_1 < 0xd800 || (c_1 >= 0xe000 && c_1 < 0x110000))
-#endif
{
*puc = c_1;
return s - 1;
diff --git a/lib/unistr/u32-strmblen.c b/lib/unistr/u32-strmblen.c
index 396a0dd8a6..ea6c334364 100644
--- a/lib/unistr/u32-strmblen.c
+++ b/lib/unistr/u32-strmblen.c
@@ -25,12 +25,8 @@ u32_strmblen (const uint32_t *s)
{
uint32_t c = *s;
-#if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
-#endif
return (c != 0 ? 1 : 0);
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
return -1;
-#endif
}
diff --git a/lib/unistr/u32-strmbtouc.c b/lib/unistr/u32-strmbtouc.c
index e3b22b349a..c88c1a516d 100644
--- a/lib/unistr/u32-strmbtouc.c
+++ b/lib/unistr/u32-strmbtouc.c
@@ -25,15 +25,11 @@ u32_strmbtouc (ucs4_t *puc, const uint32_t *s)
{
uint32_t c = *s;
-#if CONFIG_UNICODE_SAFETY
if (c < 0xd800 || (c >= 0xe000 && c < 0x110000))
-#endif
{
*puc = c;
return (c != 0 ? 1 : 0);
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
return -1;
-#endif
}
diff --git a/lib/unistr/u8-check.c b/lib/unistr/u8-check.c
index b4f217cd1f..37e7471424 100644
--- a/lib/unistr/u8-check.c
+++ b/lib/unistr/u8-check.c
@@ -63,40 +63,12 @@ u8_check (const uint8_t *s, size_t n)
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
{
s += 4;
continue;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (s + 5 <= s_end
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88))
- {
- s += 5;
- continue;
- }
- }
- else if (c < 0xfe)
- {
- if (s + 6 <= s_end
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (s[5] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84))
- {
- s += 6;
- continue;
- }
- }
-#endif
}
/* invalid or incomplete multibyte character */
return s;
diff --git a/lib/unistr/u8-mblen.c b/lib/unistr/u8-mblen.c
index ba37161330..c88f4c9983 100644
--- a/lib/unistr/u8-mblen.c
+++ b/lib/unistr/u8-mblen.c
@@ -36,62 +36,26 @@ u8_mblen (const uint8_t *s, size_t n)
if (c < 0xe0)
{
if (n >= 2
-#if CONFIG_UNICODE_SAFETY
- && (s[1] ^ 0x80) < 0x40
-#endif
- )
+ && (s[1] ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
if (n >= 3
-#if CONFIG_UNICODE_SAFETY
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || s[1] >= 0xa0)
- && (c != 0xed || s[1] < 0xa0)
-#endif
- )
+ && (c != 0xed || s[1] < 0xa0))
return 3;
}
else if (c < 0xf8)
{
if (n >= 4
-#if CONFIG_UNICODE_SAFETY
&& (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
-#endif
- )
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
return 4;
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5
-#if CONFIG_UNICODE_SAFETY
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88)
-#endif
- )
- return 5;
- }
- else if (c < 0xfe)
- {
- if (n >= 6
-#if CONFIG_UNICODE_SAFETY
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (s[5] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84)
-#endif
- )
- return 6;
- }
-#endif
}
}
/* invalid or incomplete multibyte character */
diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c
index d546ae7afa..940f67e05f 100644
--- a/lib/unistr/u8-mbtouc-aux.c
+++ b/lib/unistr/u8-mbtouc-aux.c
@@ -95,10 +95,7 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if ((s[3] ^ 0x80) < 0x40)
{
if ((c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
@@ -132,105 +129,6 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n)
return 3;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5)
- {
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if (c >= 0xf9 || s[1] >= 0x88)
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 6)
- {
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if ((s[5] ^ 0x80) < 0x40)
- {
- if (c >= 0xfd || s[1] >= 0x84)
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c
index 61783e4ba3..4fab7bd975 100644
--- a/lib/unistr/u8-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u8-mbtouc-unsafe-aux.c
@@ -33,17 +33,13 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 2)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
-#endif
{
*puc = ((unsigned int) (c & 0x1f) << 6)
| (unsigned int) (s[1] ^ 0x80);
return 2;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
-#endif
}
else
{
@@ -56,21 +52,18 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 3)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
{
if ((s[2] ^ 0x80) < 0x40)
{
if ((c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
-#endif
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
@@ -80,7 +73,6 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
return 2;
}
/* invalid multibyte character */
-#endif
}
else
{
@@ -96,7 +88,6 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 4)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
{
if ((s[2] ^ 0x80) < 0x40)
@@ -104,11 +95,8 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
if ((s[3] ^ 0x80) < 0x40)
{
if ((c >= 0xf1 || s[1] >= 0x90)
-#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
)
-#endif
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
@@ -116,7 +104,6 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
@@ -130,7 +117,6 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
return 2;
}
/* invalid multibyte character */
-#endif
}
else
{
@@ -144,113 +130,6 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n)
return 3;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if (c >= 0xf9 || s[1] >= 0x88)
-#endif
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
-#if CONFIG_UNICODE_SAFETY
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
-#endif
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 6)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if ((s[5] ^ 0x80) < 0x40)
- {
- if (c >= 0xfd || s[1] >= 0x84)
-#endif
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
-#if CONFIG_UNICODE_SAFETY
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
-#endif
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c
index b73e99a1b7..477d5557cc 100644
--- a/lib/unistr/u8-mbtouc-unsafe.c
+++ b/lib/unistr/u8-mbtouc-unsafe.c
@@ -44,17 +44,13 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 2)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
-#endif
{
*puc = ((unsigned int) (c & 0x1f) << 6)
| (unsigned int) (s[1] ^ 0x80);
return 2;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
-#endif
}
else
{
@@ -67,21 +63,18 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 3)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
{
if ((s[2] ^ 0x80) < 0x40)
{
if ((c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
-#endif
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
| (unsigned int) (s[2] ^ 0x80);
return 3;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 3;
@@ -91,7 +84,6 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
return 2;
}
/* invalid multibyte character */
-#endif
}
else
{
@@ -107,7 +99,6 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
{
if (n >= 4)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
{
if ((s[2] ^ 0x80) < 0x40)
@@ -115,11 +106,8 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
if ((s[3] ^ 0x80) < 0x40)
{
if ((c >= 0xf1 || s[1] >= 0x90)
-#if 1
&& (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
)
-#endif
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
@@ -127,7 +115,6 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
| (unsigned int) (s[3] ^ 0x80);
return 4;
}
-#if CONFIG_UNICODE_SAFETY
/* invalid multibyte character */
*puc = 0xfffd;
return 4;
@@ -141,7 +128,6 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
return 2;
}
/* invalid multibyte character */
-#endif
}
else
{
@@ -155,113 +141,6 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n)
return 3;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if (c >= 0xf9 || s[1] >= 0x88)
-#endif
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
-#if CONFIG_UNICODE_SAFETY
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
-#endif
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 6)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if ((s[5] ^ 0x80) < 0x40)
- {
- if (c >= 0xfd || s[1] >= 0x84)
-#endif
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
-#if CONFIG_UNICODE_SAFETY
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
-#endif
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c
index bfb0e4df8a..21e20a5c06 100644
--- a/lib/unistr/u8-mbtouc.c
+++ b/lib/unistr/u8-mbtouc.c
@@ -105,10 +105,7 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
if ((s[3] ^ 0x80) < 0x40)
{
if ((c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
@@ -142,105 +139,6 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n)
return 3;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 5)
- {
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if (c >= 0xf9 || s[1] >= 0x88)
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 6)
- {
- if ((s[1] ^ 0x80) < 0x40)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if ((s[5] ^ 0x80) < 0x40)
- {
- if (c >= 0xfd || s[1] >= 0x84)
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 6;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 5;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 4;
- }
- /* invalid multibyte character */
- *puc = 0xfffd;
- return 3;
- }
- /* invalid multibyte character */
- return 2;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return n;
- }
- }
-#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index 5fd45b57e9..5586e5fb0c 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -92,10 +92,7 @@ u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n)
{
if ((s[1] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
{
if (n >= 3)
{
@@ -138,146 +135,6 @@ u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n)
return -2;
}
}
-#if 0
- else if (c < 0xfc)
- {
- if (n >= 2)
- {
- if ((s[1] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88))
- {
- if (n >= 3)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if (n >= 4)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if (n >= 5)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- else if (c < 0xfe)
- {
- if (n >= 2)
- {
- if ((s[1] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84))
- {
- if (n >= 3)
- {
- if ((s[2] ^ 0x80) < 0x40)
- {
- if (n >= 4)
- {
- if ((s[3] ^ 0x80) < 0x40)
- {
- if (n >= 5)
- {
- if ((s[4] ^ 0x80) < 0x40)
- {
- if (n >= 6)
- {
- if ((s[5] ^ 0x80) < 0x40)
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
- /* invalid multibyte character */
- }
- else
- {
- /* incomplete multibyte character */
- *puc = 0xfffd;
- return -2;
- }
- }
-#endif
}
/* invalid multibyte character */
*puc = 0xfffd;
diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c
index b609acf73b..1abbb41765 100644
--- a/lib/unistr/u8-prev.c
+++ b/lib/unistr/u8-prev.c
@@ -33,9 +33,7 @@ u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start)
*puc = c_1;
return s - 1;
}
-#if CONFIG_UNICODE_SAFETY
if ((c_1 ^ 0x80) < 0x40)
-#endif
if (s - 1 != start)
{
uint8_t c_2 = s[-2];
@@ -46,38 +44,28 @@ u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start)
| (unsigned int) (c_1 ^ 0x80);
return s - 2;
}
-#if CONFIG_UNICODE_SAFETY
if ((c_2 ^ 0x80) < 0x40)
-#endif
if (s - 2 != start)
{
uint8_t c_3 = s[-3];
if (c_3 >= 0xe0 && c_3 < 0xf0
-#if CONFIG_UNICODE_SAFETY
&& (c_3 >= 0xe1 || c_2 >= 0xa0)
- && (c_3 != 0xed || c_2 < 0xa0)
-#endif
- )
+ && (c_3 != 0xed || c_2 < 0xa0))
{
*puc = ((unsigned int) (c_3 & 0x0f) << 12)
| ((unsigned int) (c_2 ^ 0x80) << 6)
| (unsigned int) (c_1 ^ 0x80);
return s - 3;
}
-#if CONFIG_UNICODE_SAFETY
if ((c_3 ^ 0x80) < 0x40)
-#endif
if (s - 3 != start)
{
uint8_t c_4 = s[-4];
if (c_4 >= 0xf0 && c_4 < 0xf8
-#if CONFIG_UNICODE_SAFETY
&& (c_4 >= 0xf1 || c_3 >= 0x90)
- && (c_4 < 0xf4 || (c_4 == 0xf4 && c_3 < 0x90))
-#endif
- )
+ && (c_4 < 0xf4 || (c_4 == 0xf4 && c_3 < 0x90)))
{
*puc = ((unsigned int) (c_4 & 0x07) << 18)
| ((unsigned int) (c_3 ^ 0x80) << 12)
diff --git a/lib/unistr/u8-strmblen.c b/lib/unistr/u8-strmblen.c
index 49ba0e2202..5cb721416b 100644
--- a/lib/unistr/u8-strmblen.c
+++ b/lib/unistr/u8-strmblen.c
@@ -33,64 +33,24 @@ u8_strmblen (const uint8_t *s)
{
if (c < 0xe0)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
-#else
- if (s[1] != 0)
-#endif
return 2;
}
else if (c < 0xf0)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
-#else
- if (s[1] != 0 && s[2] != 0)
-#endif
return 3;
}
else if (c < 0xf8)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0)
-#endif
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
return 4;
}
-#if 0
- else if (c < 0xfc)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88))
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0)
-#endif
- return 5;
- }
- else if (c < 0xfe)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (s[5] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84))
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0)
-#endif
- return 6;
- }
-#endif
}
/* invalid or incomplete multibyte character */
return -1;
diff --git a/lib/unistr/u8-strmbtouc.c b/lib/unistr/u8-strmbtouc.c
index c8094d9b84..746d97287d 100644
--- a/lib/unistr/u8-strmbtouc.c
+++ b/lib/unistr/u8-strmbtouc.c
@@ -36,11 +36,7 @@ u8_strmbtouc (ucs4_t *puc, const uint8_t *s)
{
if (c < 0xe0)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40)
-#else
- if (s[1] != 0)
-#endif
{
*puc = ((unsigned int) (c & 0x1f) << 6)
| (unsigned int) (s[1] ^ 0x80);
@@ -49,13 +45,9 @@ u8_strmbtouc (ucs4_t *puc, const uint8_t *s)
}
else if (c < 0xf0)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (c >= 0xe1 || s[1] >= 0xa0)
&& (c != 0xed || s[1] < 0xa0))
-#else
- if (s[1] != 0 && s[2] != 0)
-#endif
{
*puc = ((unsigned int) (c & 0x0f) << 12)
| ((unsigned int) (s[1] ^ 0x80) << 6)
@@ -65,17 +57,10 @@ u8_strmbtouc (ucs4_t *puc, const uint8_t *s)
}
else if (c < 0xf8)
{
-#if CONFIG_UNICODE_SAFETY
if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
&& (s[3] ^ 0x80) < 0x40
&& (c >= 0xf1 || s[1] >= 0x90)
-#if 1
- && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90))
-#endif
- )
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0)
-#endif
+ && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))
{
*puc = ((unsigned int) (c & 0x07) << 18)
| ((unsigned int) (s[1] ^ 0x80) << 12)
@@ -84,46 +69,6 @@ u8_strmbtouc (ucs4_t *puc, const uint8_t *s)
return 4;
}
}
-#if 0
- else if (c < 0xfc)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (c >= 0xf9 || s[1] >= 0x88))
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0)
-#endif
- {
- *puc = ((unsigned int) (c & 0x03) << 24)
- | ((unsigned int) (s[1] ^ 0x80) << 18)
- | ((unsigned int) (s[2] ^ 0x80) << 12)
- | ((unsigned int) (s[3] ^ 0x80) << 6)
- | (unsigned int) (s[4] ^ 0x80);
- return 5;
- }
- }
- else if (c < 0xfe)
- {
-#if CONFIG_UNICODE_SAFETY
- if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40
- && (s[5] ^ 0x80) < 0x40
- && (c >= 0xfd || s[1] >= 0x84))
-#else
- if (s[1] != 0 && s[2] != 0 && s[3] != 0 && s[4] != 0 && s[5] != 0)
-#endif
- {
- *puc = ((unsigned int) (c & 0x01) << 30)
- | ((unsigned int) (s[1] ^ 0x80) << 24)
- | ((unsigned int) (s[2] ^ 0x80) << 18)
- | ((unsigned int) (s[3] ^ 0x80) << 12)
- | ((unsigned int) (s[4] ^ 0x80) << 6)
- | (unsigned int) (s[5] ^ 0x80);
- return 6;
- }
- }
-#endif
}
/* invalid or incomplete multibyte character */
return -1;
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index a41ffcf5a2..aa4dead56c 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -37,17 +37,8 @@ u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n)
else
return -1;
}
-#if 0
- else if (uc < 0x200000)
- count = 4;
- else if (uc < 0x4000000)
- count = 5;
- else if (uc <= 0x7fffffff)
- count = 6;
-#else
else if (uc < 0x110000)
count = 4;
-#endif
else
return -1;
@@ -56,10 +47,6 @@ u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n)
switch (count) /* note: code falls through cases! */
{
-#if 0
- case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000;
- case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000;
-#endif
case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
/* fallthrough */
case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index d62ad0fa10..4db2576eeb 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -52,17 +52,8 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n)
else
return -1;
}
-#if 0
- else if (uc < 0x200000)
- count = 4;
- else if (uc < 0x4000000)
- count = 5;
- else if (uc <= 0x7fffffff)
- count = 6;
-#else
else if (uc < 0x110000)
count = 4;
-#endif
else
return -1;
@@ -70,10 +61,6 @@ u8_uctomb (uint8_t *s, ucs4_t uc, int n)
{
switch (count) /* note: code falls through cases! */
{
-#if 0
- case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000;
- case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000;
-#endif
case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000;
case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800;
case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0;