summaryrefslogtreecommitdiff
path: root/iconvdata/iso-2022-cn.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-18 22:41:47 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-18 22:41:47 +0000
commit755104edc75c53f4a0e7440334e944ad3c6b32fc (patch)
tree536824a5d458248d7fc12dc94ae882f8fce58871 /iconvdata/iso-2022-cn.c
parent8a98b84708dd7438c7ee7055b8b1bda983a53fff (diff)
Update.
2000-09-18 Ulrich Drepper <drepper@redhat.com> * version.h (VERSION): Bump to 2.1.94. * malloc/mtrace.c (mtrace): Mark stream as close on exec. 2000-09-17 Bruno Haible <haible@clisp.cons.org> * iconvdata/utf-16.c (BODY for TO_LOOP): Reject UCS-4 input in the range 0xD800..0xDFFF. * iconvdata/unicode.c (BODY for TO_LOOP): Likewise. (BODY for FROM_LOOP): Likewise. * iconv/gconv_simple.c (ucs2_internal_loop): Likewise. (internal_ucs2_loop): Likewise. (ucs2reverse_internal_loop): Likewise. (internal_ucs2reverse_loop): Likewise. 2000-09-17 Bruno Haible <haible@clisp.cons.org> * iconvdata/utf-16.c (gconv_init): Add missing slashes to encoding names. 2000-09-17 Bruno Haible <haible@clisp.cons.org> * iconvdata/tst-table-from.c (main): Fix test for error on stdout. * iconvdata/tst-table-to.c (main): Likewise. 2000-09-17 Bruno Haible <haible@clisp.cons.org> * iconvdata/iso-ir-165.c (__isoir165_from_tab): Renamed from __isoir165_tab. * iconvdata/cns11643.h (__cns11643l1_to_ucs4_tab): New declaration. * iconvdata/iso-2022-cn-ext.c: Include "cns11643.h". (GB7590_set, GB13132_set, CNS11643_3_set, CNS11643_4_set, CNS11643_5_set, CNS11643_6_set, CNS11643_7_set): Change enum values. (BODY for FROM_LOOP): Fix buffer overrun. Treat CNS11643 plane 3. Return __GCONV_INCOMPLETE_INPUT instead of __GCONV_EMPTY_INPUT. (BODY for TO_LOOP): Fix usage of `set' vs. `used'. Fix typo that caused GB2312 to be used instead of ISO-IR-165. Treat CNS11643 plane 3. Fix shift sequences. Output announcement for SS2 and SS3 encodings when needed. When outputting an announcement, don't clear most other announcements. 2000-09-17 Bruno Haible <haible@clisp.cons.org> * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): Fix buffer overrun. (BODY for TO_LOOP): Fix usage of `set' vs. `used'. 2000-09-14 Bruno Haible <haible@clisp.cons.org> * intl/Versions: Add bind_textdomain_codeset.
Diffstat (limited to 'iconvdata/iso-2022-cn.c')
-rw-r--r--iconvdata/iso-2022-cn.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c
index d45ed6b30a..6040e1294f 100644
--- a/iconvdata/iso-2022-cn.c
+++ b/iconvdata/iso-2022-cn.c
@@ -141,15 +141,15 @@ enum
line; we can simply ignore them \
- the initial byte of the SS2 sequence. \
*/ \
- if (__builtin_expect (inptr + 1 > inend, 0) \
+ if (__builtin_expect (inptr + 2 > inend, 0) \
|| (inptr[1] == '$' \
- && (__builtin_expect (inptr + 2 > inend, 0) \
+ && (__builtin_expect (inptr + 3 > inend, 0) \
|| (inptr[2] == ')' \
- && __builtin_expect (inptr + 3 > inend, 0)) \
+ && __builtin_expect (inptr + 4 > inend, 0)) \
|| (inptr[2] == '*' \
- && __builtin_expect (inptr + 3 > inend, 0)))) \
+ && __builtin_expect (inptr + 4 > inend, 0)))) \
|| (inptr[1] == SS2_1 \
- && __builtin_expect (inptr + 3 > inend, 0))) \
+ && __builtin_expect (inptr + 4 > inend, 0))) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -313,14 +313,14 @@ enum
else \
{ \
/* Well, see whether we have to change the SO set. */ \
- if (set == GB2312_set) \
+ if (used == GB2312_set) \
written = ucs4_to_cns11643l1 (ch, buf, 2); \
else \
written = ucs4_to_gb2312 (ch, buf, 2); \
\
if (__builtin_expect (written, 0) != __UNKNOWN_10646_CHAR) \
/* Oh well, then switch SO. */ \
- used = GB2312_set + CNS11643_1_set - set; \
+ used = GB2312_set + CNS11643_1_set - used; \
else \
{ \
/* Even this does not work. Error. */ \
@@ -335,7 +335,7 @@ enum
{ \
/* First see whether we announced that we use this \
character set. */ \
- if ((ann & (2 << used)) == 0) \
+ if ((ann & (16 << (used >> 3))) == 0) \
{ \
const char *escseq; \
\
@@ -345,10 +345,10 @@ enum
break; \
} \
\
- assert (used >= 1 && used <= 3); \
- escseq = "\e$)A\e$)G\e$*H" + (used - 1) * 4; \
- *outptr++ = *escseq++; \
- *outptr++ = *escseq++; \
+ assert ((used >> 3) >= 1 && (used >> 3) <= 3); \
+ escseq = ")A)G*H" + ((used >> 3) - 1) * 2; \
+ *outptr++ = ESC; \
+ *outptr++ = '$'; \
*outptr++ = *escseq++; \
*outptr++ = *escseq++; \
\
@@ -402,6 +402,7 @@ enum
\
*outptr++ = buf[0]; \
*outptr++ = buf[1]; \
+ set = used; \
} \
\
/* Now that we wrote the output increment the input pointer. */ \