This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
misc iconv fixes
- From: Bruno Haible <bruno at clisp dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 17 Apr 2002 16:50:05 +0200 (CEST)
- Subject: misc iconv fixes
Three small fixes:
1) The EUC-JP to Unicode converter could go into an endless loop when
encountering an invalid Katakana in the input and when iconv is called
with the -c option.
2) The EUC-JP to Unicode converter, when encountering a byte > 0x80 followed
by a byte < 0x80 (which is invalid input), would skip 2 bytes instead of
just one byte.
3) The usage message of the tst-table-from program is wrong.
2002-04-15 Bruno Haible <bruno@clisp.org>
* iconvdata/euc-jp.c (BODY for FROM_LOOP): When encountering an
invalid input (e.g. a byte > 0x80 followed by a byte < 0x80), skip
always one byte, not 0 bytes in some cases and 2 bytes in others.
* iconvdata/tst-table-from.c (main): Correct the usage message.
--- glibc-20020408/iconvdata/euc-jp.c.bak 2001-08-15 21:39:07.000000000 +0200
+++ glibc-20020408/iconvdata/euc-jp.c 2002-04-14 16:12:02.000000000 +0200
@@ -63,12 +63,12 @@
else \
{ \
/* Two or more byte character. First test whether the next \
- character is also available. */ \
+ byte is also available. */ \
int ch2; \
\
if (__builtin_expect (inptr + 1 >= inend, 0)) \
{ \
- /* The second character is not available. Store the \
+ /* The second byte is not available. Store the \
intermediate result. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
@@ -104,6 +104,10 @@
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
+ \
+ ++inptr; \
+ ++*irreversible; \
+ continue; \
} \
\
inptr += 2; \
@@ -143,7 +147,7 @@
break; \
} \
\
- inptr += 2; \
+ ++inptr; \
++*irreversible; \
continue; \
} \
--- glibc-20020408/iconvdata/tst-table-from.c.bak 2001-07-10 22:58:49.000000000 +0200
+++ glibc-20020408/iconvdata/tst-table-from.c 2002-04-15 04:28:15.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
@@ -184,7 +184,7 @@
if (argc != 2)
{
- fprintf (stderr, "Usage: tst-table-to charset\n");
+ fprintf (stderr, "Usage: tst-table-from charset\n");
exit (1);
}
charset = argv[1];