aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-29 21:14:05 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-29 21:14:05 +0000
commitc7c3b0e907efac218b329ebbe3fc7432ec4415c5 (patch)
tree9d7b90e399e6ee1e87e49dec92ec47f4476352f3
parent4dadd40cc72ddee017ebd0d278671398485dcbb6 (diff)
downloadglibc-c7c3b0e907efac218b329ebbe3fc7432ec4415c5.tar
glibc-c7c3b0e907efac218b329ebbe3fc7432ec4415c5.tar.gz
glibc-c7c3b0e907efac218b329ebbe3fc7432ec4415c5.tar.bz2
glibc-c7c3b0e907efac218b329ebbe3fc7432ec4415c5.zip
Update.
2000-08-29 Akira Higuchi <a@kondara.org> * iconv/gconv_db.c (increment_counter): Reset __init_fct, __fct, and __end_fct fields of struct __gconv_step. * iconv/Makefile (tests): Add iconv-bug2. * iconv/iconv-bug2.c: New file. * iconvdata/euc-kr.c (BODY for FROM_LOOP): Pass 'inend - inptr' instead of 'inptr - inend' to ksc5601_to_ucs4. * iconvdata/sjis.c (BODY for FROM_LOOP): Allow 0x7f character. * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): If an incomplete character or shift sequence is found at the end of the input string, return__GCONV_INCOMPLETE_INPUT instead of __GCONV_EMPTY_INPUT. * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Return __GCONV_ILLEGAL_INPUT for 8bit characters.
-rw-r--r--ChangeLog22
-rw-r--r--iconv/gconv_db.c9
-rw-r--r--iconvdata/Makefile2
-rw-r--r--iconvdata/bug-iconv2.c47
-rw-r--r--iconvdata/euc-kr.c2
-rw-r--r--iconvdata/iso-2022-cn.c4
-rw-r--r--iconvdata/iso-2022-jp.c16
-rw-r--r--iconvdata/iso-2022-kr.c4
-rw-r--r--iconvdata/sjis.c4
-rw-r--r--localedata/ChangeLog7
-rw-r--r--localedata/SUPPORTED2
-rw-r--r--localedata/charmaps/GB23122
-rw-r--r--localedata/charmaps/GBK2
13 files changed, 111 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 9caad1f2a6..bef84db3fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2000-08-29 Akira Higuchi <a@kondara.org>
+
+ * iconv/gconv_db.c (increment_counter): Reset __init_fct, __fct,
+ and __end_fct fields of struct __gconv_step.
+ * iconv/Makefile (tests): Add iconv-bug2.
+ * iconv/iconv-bug2.c: New file.
+
+ * iconvdata/euc-kr.c (BODY for FROM_LOOP): Pass 'inend - inptr'
+ instead of 'inptr - inend' to ksc5601_to_ucs4.
+
+ * iconvdata/sjis.c (BODY for FROM_LOOP): Allow 0x7f character.
+
+ * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): If an incomplete
+ character or shift sequence is found at the end of the input
+ string, return__GCONV_INCOMPLETE_INPUT instead of
+ __GCONV_EMPTY_INPUT.
+ * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise.
+
+ * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Return
+ __GCONV_ILLEGAL_INPUT for 8bit characters.
+
2000-08-29 Ulrich Drepper <drepper@redhat.com>
* signal/signal.h (sigpause): Move __THROW before __asm__.
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index 0caf310b91..50cedd6256 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -305,6 +305,15 @@ increment_counter (struct __gconv_step *steps, size_t nsteps)
result = __GCONV_NOCONV;
break;
}
+
+ steps[cnt].__init_fct = steps[cnt].__shlib_handle->init_fct;
+ steps[cnt].__fct = steps[cnt].__shlib_handle->fct;
+ steps[cnt].__end_fct = steps[cnt].__shlib_handle->end_fct;
+
+ if (steps[cnt].__end_fct != NULL)
+ DL_CALL_FCT (steps[cnt].__end_fct, &steps[cnt]);
+ if (steps[cnt].__init_fct != NULL)
+ DL_CALL_FCT (steps[cnt].__init_fct, &steps[cnt]);
}
return result;
}
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 195a81ec81..b309d751f3 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -49,7 +49,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
modules.so := $(addsuffix .so, $(modules))
-tests = bug-iconv1
+tests = bug-iconv1 bug-iconv2
include ../Makeconfig
diff --git a/iconvdata/bug-iconv2.c b/iconvdata/bug-iconv2.c
new file mode 100644
index 0000000000..a2bf44f419
--- /dev/null
+++ b/iconvdata/bug-iconv2.c
@@ -0,0 +1,47 @@
+/* Test case by Akira Higuchi <a@kondara.org>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iconv.h>
+
+int
+main (void)
+{
+ const char *dummy_codesets[] =
+ {
+ "ISO_8859-1", "ISO_8859-2", "ISO_8859-3", "ISO_8859-4",
+ "ISO_8859-5", "ISO_8859-6", "ISO_8859-7", "ISO_8859-8"
+ };
+ iconv_t dummy_cd[8], cd_a;
+ int i;
+ char buffer[1024], *to = buffer;
+ char *from = (char *) "foobar";
+ size_t to_left = 1024, from_left = 6;
+
+ /* load dummy modules */
+ for (i = 0; i < 8; i++)
+ if ((dummy_cd[i] = iconv_open (dummy_codesets[i], "UTF8")) == (iconv_t) -1)
+ exit (1);
+
+ /* load a module... */
+ if ((cd_a = iconv_open ("EUC-JP", "UTF8")) == (iconv_t) -1)
+ exit (1);
+ /* and close it once. we'll reload this later */
+ iconv_close (cd_a);
+
+ /* unload dummy modules */
+ for (i = 0; i < 8; i++)
+ iconv_close (dummy_cd[i]);
+
+ /* load the module again */
+ if ((cd_a = iconv_open ("EUC-JP", "UTF8")) == (iconv_t) -1)
+ exit (1);
+
+ puts ("This used to crash");
+ printf ("%d\n", iconv (cd_a, &from, &from_left, &to, &to_left));
+ iconv_close (cd_a);
+
+ puts ("works now");
+
+ return 0;
+}
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index 786695801c..9ea937c005 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -99,7 +99,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
{ \
/* Two-byte character. First test whether the next character \
is also available. */ \
- ch = ksc5601_to_ucs4 (&inptr, inptr - inend, 0x80); \
+ ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80); \
if (__builtin_expect (ch, 1) == 0) \
{ \
/* The second character is not available. */ \
diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c
index 6ffa18dc78..d45ed6b30a 100644
--- a/iconvdata/iso-2022-cn.c
+++ b/iconvdata/iso-2022-cn.c
@@ -151,7 +151,7 @@ enum
|| (inptr[1] == SS2_1 \
&& __builtin_expect (inptr + 3 > inend, 0))) \
{ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
if (inptr[1] == '$' \
@@ -225,7 +225,7 @@ enum
\
if (__builtin_expect (ch, 1) == 0) \
{ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
else if (__builtin_expect (ch, 1) == __UNKNOWN_10646_CHAR) \
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index fc34aaba96..bd2e033746 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -258,7 +258,7 @@ gconv_end (struct __gconv_step *data)
&& __builtin_expect (inptr + 3 >= inend, 0))) \
{ \
/* Not enough input available. */ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
\
@@ -399,6 +399,18 @@ gconv_end (struct __gconv_step *data)
continue; \
} \
} \
+ else if (ch >= 0x80) \
+ { \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*irreversible; \
+ continue; \
+ } \
else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f)) \
/* Almost done, just advance the input pointer. */ \
++inptr; \
@@ -462,7 +474,7 @@ gconv_end (struct __gconv_step *data)
\
if (__builtin_expect (ch, 1) == 0) \
{ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c
index 56e17a2f96..c0280fccea 100644
--- a/iconvdata/iso-2022-kr.c
+++ b/iconvdata/iso-2022-kr.c
@@ -149,7 +149,7 @@ enum
&& __builtin_expect (inptr + 3 > inend, 0))))) \
\
{ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
if (inptr[1] == '$' && inptr[2] == ')' && inptr[3] == 'C') \
@@ -188,7 +188,7 @@ enum
\
if (__builtin_expect (ch, 1) == 0) \
{ \
- result = __GCONV_EMPTY_INPUT; \
+ result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index 244cec6db4..7bbfef3e5d 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -1941,7 +1941,7 @@ static const char from_ucs4_lat1[0xf8][2] =
[0x0075] = "\x75\x00", [0x0076] = "\x76\x00", [0x0077] = "\x77\x00",
[0x0078] = "\x78\x00", [0x0079] = "\x79\x00", [0x007a] = "\x7a\x00",
[0x007b] = "\x7b\x00", [0x007c] = "\x7c\x00", [0x007d] = "\x7d\x00",
- [0x007e] = "\x7e\x00",
+ [0x007e] = "\x7e\x00", [0x007f] = "\x7f\x00",
[0x00a2] = "\x81\x91", [0x00a3] = "\x81\x92", [0x00a5] = "\x5c\x00",
[0x00a7] = "\x81\x98", [0x00a8] = "\x81\x4e", [0x00ac] = "\x81\xca",
[0x00b0] = "\x81\x8b", [0x00b1] = "\x81\x7d", [0x00b4] = "\x81\x4c",
@@ -4353,7 +4353,7 @@ static const char from_ucs4_extra[0x100][2] =
ch = 0x203e; \
++inptr; \
} \
- else if (ch < 0x7e) \
+ else if (ch < 0x80) \
++inptr; \
else if (ch >= 0xa1 && ch <= 0xdf) \
{ \
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 559d001528..4987943264 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,10 @@
+2000-08-29 Akira Higuchi <a@kondara.org>
+
+ * charmaps/GB2312: Fix ".." -> "..." in width definitions.
+ * charmaps/GBK: Likewise.
+
+ * SUPPORTED: Add zh_CN.GB2312 and zh_TW.BIG5.
+
2000-08-27 Ulrich Drepper <drepper@redhat.com>
* locales/sv_SE: Remove old LC_COLLATE definition. Use iso14651_t1
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
index 8522572e92..ae2a0d4db9 100644
--- a/localedata/SUPPORTED
+++ b/localedata/SUPPORTED
@@ -127,3 +127,5 @@ th_TH TIS-620
tr_TR ISO-8859-9
uk_UA KOI8-U
vi_VN UTF-8
+zh_CN GB2312
+zh_TW BIG5
diff --git a/localedata/charmaps/GB2312 b/localedata/charmaps/GB2312
index 3dd7b481b9..30d94effee 100644
--- a/localedata/charmaps/GB2312
+++ b/localedata/charmaps/GB2312
@@ -7634,5 +7634,5 @@ CHARMAP
END CHARMAP
WIDTH
-<U3000>..<U9F44> 2
+<U3000>...<U9F44> 2
END WIDTH
diff --git a/localedata/charmaps/GBK b/localedata/charmaps/GBK
index 7c8b3bfab2..de48a44183 100644
--- a/localedata/charmaps/GBK
+++ b/localedata/charmaps/GBK
@@ -21929,5 +21929,5 @@ CHARMAP
END CHARMAP
WIDTH
-<U4E02>..<UFA29> 2
+<U4E02>...<UFA29> 2
END WIDTH