summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-06-28 21:23:06 +0000
committerUlrich Drepper <drepper@redhat.com>2002-06-28 21:23:06 +0000
commite438a4684563c16b6d8bfb8e4066d277133e1912 (patch)
tree2b719edc95cbbb5a2f33f5588bb52a04daa9e717
parent8dae594a51bdac0e5a045196b1af25e8974812a8 (diff)
downloadglibc-e438a4684563c16b6d8bfb8e4066d277133e1912.tar.gz
Update.
2002-05-26 Bruno Haible <bruno@clisp.org> * iconv/loop.c (STANDARD_FROM_LOOP_ERR_HANDLER): New macro. (STANDARD_TO_LOOP_ERR_HANDLER): Renamed from STANDARD_ERR_HANDLER. All callers changed. * iconv/gconv_simple.c (ascii_internal_loop): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (utf8_internal_loop): Likewise. (ucs2_internal_loop): Likewise. (internal_ucs2_loop): Perform error handling like in STANDARD_FROM_LOOP_ERR_HANDLER. * iconvdata/unicode.c (BODY for TO_LOOP): Perform error handling like in STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error handling. * iconvdata/utf-16.c (BODY for TO_LOOP): Perform error handling like in STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error handling. * iconvdata/utf-32.c (BODY for TO_LOOP): Perform error handling like in STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error handling. * iconvdata/big5.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise. * iconvdata/8bit-gap.c (BODY for FROM_LOOP): Likewise. * iconvdata/8bit-generic.c (BODY for FROM_LOOP): Likewise. * iconvdata/ansi_x3.110.c (BODY for FROM_LOOP): Likewise. * iconvdata/armscii-8.c (BODY for FROM_LOOP): Likewise. * iconvdata/cp1255.c (BODY for FROM_LOOP): Likewise. * iconvdata/cp1258.c (BODY for FROM_LOOP): Likewise. * iconvdata/euc-cn.c (BODY for FROM_LOOP): Likewise. * iconvdata/euc-jisx0213.c (BODY for FROM_LOOP): Likewise. * iconvdata/euc-jp.c (BODY for FROM_LOOP): Likewise. * iconvdata/euc-kr.c (BODY for FROM_LOOP): Likewise. * iconvdata/euc-tw.c (BODY for FROM_LOOP): Likewise. * iconvdata/big5hkscs.c (BODY for FROM_LOOP): Likewise. * iconvdata/gb18030.c (BODY for FROM_LOOP): Likewise. * iconvdata/gbk.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-jp-3.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso646.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso_6937-2.c (BODY for FROM_LOOP): Likewise. * iconvdata/iso_6937.c (BODY for FROM_LOOP): Likewise. * iconvdata/johab.c (BODY for FROM_LOOP): Likewise. * iconvdata/shift_jisx0213.c (BODY for FROM_LOOP): Likewise. * iconvdata/sjis.c (BODY for FROM_LOOP): Likewise. * iconvdata/t.61.c (BODY for FROM_LOOP): Likewise. * iconvdata/uhc.c (BODY for FROM_LOOP): Likewise. * iconvdata/utf-7.c (BODY for FROM_LOOP): Likewise. * iconvdata/gbbig5.c (BODY for FROM_LOOP): Likewise. When ignoring an error, still set result = __GCONV_ILLEGAL_INPUT. (BODY for TO_LOOP): Likewise. * iconvdata/ibm930.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm932.c: Include <dlfcn.h> and <stdint.h>. (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error handling. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm933.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm935.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm937.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm939.c (BODY for FROM_LOOP): For error handling use STANDARD_FROM_LOOP_ERR_HANDLER. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/ibm943.c: Include <dlfcn.h> and <stdint.h>. (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error handling. (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER. * iconvdata/gbgbk.c (BODY for FROM_LOOP): Update. * iconvdata/iso8859-1.c (BODY for TO_LOOP): Update. * iconvdata/tcvn5712-1.c (BODY for TO_LOOP): Update. 2002-06-28 Kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/sh/dl-machine.h (elf_machine_load_address): Use local labels in assembler instructions.
-rw-r--r--ChangeLog90
-rw-r--r--iconv/gconv_simple.c76
-rw-r--r--iconv/loop.c33
-rw-r--r--iconvdata/8bit-gap.c12
-rw-r--r--iconvdata/8bit-generic.c14
-rw-r--r--iconvdata/ansi_x3.110.c27
-rw-r--r--iconvdata/armscii-8.c10
-rw-r--r--iconvdata/big5.c36
-rw-r--r--iconvdata/big5hkscs.c15
-rw-r--r--iconvdata/cp1255.c12
-rw-r--r--iconvdata/cp1258.c12
-rw-r--r--iconvdata/euc-cn.c40
-rw-r--r--iconvdata/euc-jisx0213.c49
-rw-r--r--iconvdata/euc-jp.c57
-rw-r--r--iconvdata/euc-kr.c35
-rw-r--r--iconvdata/euc-tw.c57
-rw-r--r--iconvdata/gb18030.c80
-rw-r--r--iconvdata/gbbig5.c58
-rw-r--r--iconvdata/gbgbk.c10
-rw-r--r--iconvdata/gbk.c36
-rw-r--r--iconvdata/ibm930.c30
-rw-r--r--iconvdata/ibm932.c26
-rw-r--r--iconvdata/ibm933.c32
-rw-r--r--iconvdata/ibm935.c30
-rw-r--r--iconvdata/ibm937.c30
-rw-r--r--iconvdata/ibm939.c23
-rw-r--r--iconvdata/ibm943.c26
-rw-r--r--iconvdata/iso-2022-cn-ext.c51
-rw-r--r--iconvdata/iso-2022-cn.c37
-rw-r--r--iconvdata/iso-2022-jp-3.c54
-rw-r--r--iconvdata/iso-2022-jp.c88
-rw-r--r--iconvdata/iso-2022-kr.c29
-rw-r--r--iconvdata/iso646.c13
-rw-r--r--iconvdata/iso8859-1.c4
-rw-r--r--iconvdata/iso_6937-2.c45
-rw-r--r--iconvdata/iso_6937.c45
-rw-r--r--iconvdata/johab.c67
-rw-r--r--iconvdata/shift_jisx0213.c32
-rw-r--r--iconvdata/sjis.c45
-rw-r--r--iconvdata/t.61.c30
-rw-r--r--iconvdata/tcvn5712-1.c2
-rw-r--r--iconvdata/uhc.c62
-rw-r--r--iconvdata/unicode.c19
-rw-r--r--iconvdata/utf-16.c34
-rw-r--r--iconvdata/utf-32.c21
-rw-r--r--iconvdata/utf-7.c37
-rw-r--r--sysdeps/sh/dl-machine.h12
47 files changed, 390 insertions, 1293 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b7234f10d..3ad57b6036 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,90 @@
-2002-06-26 Ulrich Drepper <drepper@redhat.com>
+2002-05-26 Bruno Haible <bruno@clisp.org>
- * sysdeps/powerpc/Versions: Export libgcc functions for GLIBC_2.0.
- * sysdeps/powerpc/libgcc-compat.c: Fix function names.
- Patch by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>.
+ * iconv/loop.c (STANDARD_FROM_LOOP_ERR_HANDLER): New macro.
+ (STANDARD_TO_LOOP_ERR_HANDLER): Renamed from STANDARD_ERR_HANDLER.
+ All callers changed.
+ * iconv/gconv_simple.c (ascii_internal_loop): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (utf8_internal_loop): Likewise.
+ (ucs2_internal_loop): Likewise.
+ (internal_ucs2_loop): Perform error handling like in
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ * iconvdata/unicode.c (BODY for TO_LOOP): Perform error handling like
+ in STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error
+ handling.
+ * iconvdata/utf-16.c (BODY for TO_LOOP): Perform error handling like
+ in STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error
+ handling.
+ * iconvdata/utf-32.c (BODY for TO_LOOP): Perform error handling like
+ in STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error
+ handling.
+ * iconvdata/big5.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ * iconvdata/iso-2022-jp.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/8bit-gap.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/8bit-generic.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/ansi_x3.110.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/armscii-8.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/cp1255.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/cp1258.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/euc-cn.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/euc-jisx0213.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/euc-jp.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/euc-kr.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/euc-tw.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/big5hkscs.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/gb18030.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/gbk.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso-2022-cn-ext.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso-2022-cn.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso-2022-jp-3.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso-2022-kr.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso646.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso_6937-2.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/iso_6937.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/johab.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/shift_jisx0213.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/sjis.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/t.61.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/uhc.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/utf-7.c (BODY for FROM_LOOP): Likewise.
+ * iconvdata/gbbig5.c (BODY for FROM_LOOP): Likewise. When ignoring
+ an error, still set result = __GCONV_ILLEGAL_INPUT.
+ (BODY for TO_LOOP): Likewise.
+ * iconvdata/ibm930.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm932.c: Include <dlfcn.h> and <stdint.h>.
+ (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error
+ handling.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm933.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm935.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm937.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm939.c (BODY for FROM_LOOP): For error handling use
+ STANDARD_FROM_LOOP_ERR_HANDLER.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/ibm943.c: Include <dlfcn.h> and <stdint.h>.
+ (BODY for FROM_LOOP): Use STANDARD_FROM_LOOP_ERR_HANDLER for error
+ handling.
+ (BODY for TO_LOOP): Here use STANDARD_TO_LOOP_ERR_HANDLER.
+ * iconvdata/gbgbk.c (BODY for FROM_LOOP): Update.
+ * iconvdata/iso8859-1.c (BODY for TO_LOOP): Update.
+ * iconvdata/tcvn5712-1.c (BODY for TO_LOOP): Update.
+
+2002-06-28 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/sh/dl-machine.h (elf_machine_load_address): Use local
+ labels in assembler instructions.
2002-06-25 Ulrich Drepper <drepper@redhat.com>
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index b4dcf93c32..fbdac832e0 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -770,15 +770,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
this is not an error because of the lack of possibilities to \
represent the result. This is a genuine bug in the input since \
ASCII does not allow such values. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is no correct ANSI_X3.4-1968 character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- ++inptr; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
/* It's an one byte sequence. */ \
@@ -808,7 +800,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if (__builtin_expect (*((const uint32_t *) inptr) > 0x7f, 0)) \
{ \
UNICODE_TAG_HANDLER (*((const uint32_t *) inptr), 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
/* It's an one byte sequence. */ \
@@ -872,7 +864,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
} \
else \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
inptr += 4; \
@@ -951,24 +943,16 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
int skipped; \
\
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal encoding. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
/* Search the end of this ill-formed UTF-8 character. This \
is the next byte with (x & 0xc0) != 0x80. */ \
- skipped = 0; \
- do \
- { \
- ++inptr; \
- ++skipped; \
- } \
- while (inptr < inend && (*inptr & 0xc0) == 0x80 && skipped < 5); \
+ skipped = 0; \
+ do \
+ ++skipped; \
+ while (inptr + skipped < inend \
+ && (*(inptr + skipped) & 0xc0) == 0x80 \
+ && skipped < 5); \
\
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (skipped); \
} \
\
if (__builtin_expect (inptr + cnt > inend, 0)) \
@@ -985,16 +969,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
break; \
} \
\
- if (ignore_errors_p ()) \
- { \
- /* Ignore it. */ \
- inptr += i; \
- ++*irreversible; \
- continue; \
- } \
- \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
/* Read the possible remaining bytes. */ \
@@ -1016,15 +991,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if (i < cnt || (cnt > 2 && (ch >> (5 * cnt - 4)) == 0)) \
{ \
/* This is an illegal encoding. */ \
- if (ignore_errors_p ()) \
- { \
- inptr += i; \
- ++*irreversible; \
- continue; \
- } \
- \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (i); \
} \
\
inptr += cnt; \
@@ -1164,14 +1131,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
*((uint32_t *) outptr)++ = u1; \
@@ -1203,7 +1163,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if (__builtin_expect (val >= 0x10000, 0)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
{ \
@@ -1213,11 +1173,9 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
surrogates pass through, attackers could make a security \
hole exploit by synthesizing any desired plane 1-16 \
character. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
inptr += 4; \
++*irreversible; \
continue; \
@@ -1293,7 +1251,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
if (__builtin_expect (val >= 0x10000, 0)) \
{ \
UNICODE_TAG_HANDLER (val, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else if (__builtin_expect (val >= 0xd800 && val < 0xe000, 0)) \
{ \
diff --git a/iconv/loop.c b/iconv/loop.c
index 0b1bce75c0..2fb73da7ea 100644
--- a/iconv/loop.c
+++ b/iconv/loop.c
@@ -178,10 +178,29 @@
(irreversible != NULL && (flags & __GCONV_IGNORE_ERRORS))
-/* Error handling with transliteration/transcription function use and
- ignoring of errors. Note that we cannot use the do while (0) trick
- since `break' and `continue' must reach certain points. */
-#define STANDARD_ERR_HANDLER(Incr) \
+/* Error handling for the FROM_LOOP direction, with ignoring of errors.
+ Note that we cannot use the do while (0) trick since `break' and
+ `continue' must reach certain points. */
+#define STANDARD_FROM_LOOP_ERR_HANDLER(Incr) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ \
+ if (! ignore_errors_p ()) \
+ break; \
+ \
+ /* We ignore the invalid input byte sequence. */ \
+ inptr += (Incr); \
+ ++*irreversible; \
+ /* But we keep result == __GCONV_ILLEGAL_INPUT, because of the constraint \
+ that "iconv -c" must give the same exitcode as "iconv". */ \
+ continue; \
+ }
+
+/* Error handling for the TO_LOOP direction, with use of transliteration/
+ transcription functions and ignoring of errors. Note that we cannot use
+ the do while (0) trick since `break' and `continue' must reach certain
+ points. */
+#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
{ \
struct __gconv_trans_data *trans; \
\
@@ -212,14 +231,16 @@
/* When we come here it means we ignore the character. */ \
++*irreversible; \
inptr += Incr; \
+ /* But we keep result == __GCONV_ILLEGAL_INPUT, because of the constraint \
+ that "iconv -c" must give the same exitcode as "iconv". */ \
continue; \
}
/* Handling of Unicode 3.1 TAG characters. Unicode recommends
"If language codes are not relevant to the particular processing
- operation, then they should be ignored."
- This macro is usually called right before STANDARD_ERR_HANDLER (Incr). */
+ operation, then they should be ignored." This macro is usually
+ called right before STANDARD_TO_LOOP_ERR_HANDLER (Incr). */
#define UNICODE_TAG_HANDLER(Character, Incr) \
{ \
/* TAG characters are those in the range U+E0000..U+E007F. */ \
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index 8959fcbd95..2ddc49eb64 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -1,6 +1,6 @@
/* Generic conversion to and from 8bit charsets,
converting from UCS using gaps.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -52,13 +52,7 @@ struct gap
if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -96,7 +90,7 @@ struct gap
__builtin_expect (res, '\1') == '\0' && ch != 0)) \
{ \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = res; \
diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c
index e0e20e293f..6ed5532693 100644
--- a/iconvdata/8bit-generic.c
+++ b/iconvdata/8bit-generic.c
@@ -1,5 +1,5 @@
/* Generic conversion to and from 8bit charsets.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -36,16 +36,10 @@
{ \
uint32_t ch = to_ucs4[*inptr]; \
\
- if (HAS_HOLES && __builtin_expect (ch, L'\1') == L'\0' && *inptr != '\0') \
+ if (HAS_HOLES && __builtin_expect (ch == L'\0', 0) && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
put32 (outptr, ch); \
@@ -70,7 +64,7 @@
UNICODE_TAG_HANDLER (ch, 4); \
\
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = from_ucs4[ch]; \
diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c
index 21de42dbcd..08746cf5f7 100644
--- a/iconvdata/ansi_x3.110.c
+++ b/iconvdata/ansi_x3.110.c
@@ -1,5 +1,5 @@
/* Generic conversion to and from ANSI_X3.110-1983.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -421,14 +421,7 @@ static const char from_ucs4[][2] =
|| __builtin_expect (ch2 >= 0x80, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- incr = 1; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -442,14 +435,10 @@ static const char from_ucs4[][2] =
incr = 1; \
} \
\
- if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch == 0, 0) && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (incr); \
} \
else \
{ \
@@ -496,7 +485,7 @@ static const char from_ucs4[][2] =
if (tmp[0] == '\0') \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
tmp[1] = '\0'; \
cp = tmp; \
@@ -510,7 +499,7 @@ static const char from_ucs4[][2] =
if (tmp[0] == '\0') \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
tmp[1] = '\0'; \
cp = tmp; \
@@ -552,7 +541,7 @@ static const char from_ucs4[][2] =
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
@@ -562,7 +551,7 @@ static const char from_ucs4[][2] =
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
\
diff --git a/iconvdata/armscii-8.c b/iconvdata/armscii-8.c
index 685736eb7d..b3db9a99a8 100644
--- a/iconvdata/armscii-8.c
+++ b/iconvdata/armscii-8.c
@@ -65,13 +65,7 @@ static const uint16_t map_from_armscii_8[0xfe - 0xa2 + 1] =
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
++inptr; \
@@ -132,7 +126,7 @@ static const unsigned char map_to_armscii_8[0x58a - 0x531 + 1] =
\
/* We have an illegal character. */ \
err: \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
++outptr; \
inptr += 4; \
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index e43229c6b3..22c3ab6ddd 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -1,5 +1,5 @@
/* Mapping tables for Big5 handling.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -8420,33 +8420,17 @@ static const char from_ucs4_tab15[][2] =
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
/* Get the value from the table. */ \
ch = big5_to_ucs[idx]; \
\
/* Is this character defined? */ \
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -8456,15 +8440,7 @@ static const char from_ucs4_tab15[][2] =
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
put32 (outptr, ch); \
@@ -8575,7 +8551,7 @@ static const char from_ucs4_tab15[][2] =
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index bdd9dbc062..0903968669 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -16836,23 +16836,14 @@ static struct
(ch = big5hkscs_to_ucs[idx]) == 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
inptr += 2; \
} \
else if (__builtin_expect (ch == 0xff, 0)) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
++inptr; \
@@ -16899,7 +16890,7 @@ static struct
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/cp1255.c b/iconvdata/cp1255.c
index af69e833da..19edb27a66 100644
--- a/iconvdata/cp1255.c
+++ b/iconvdata/cp1255.c
@@ -204,15 +204,7 @@ static const struct { unsigned int idx; unsigned int len; } comp_table[8] = {
if (__builtin_expect (ch == L'\0', 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
\
@@ -543,7 +535,7 @@ static const struct {
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
diff --git a/iconvdata/cp1258.c b/iconvdata/cp1258.c
index af206a2aff..853ef63531 100644
--- a/iconvdata/cp1258.c
+++ b/iconvdata/cp1258.c
@@ -379,15 +379,7 @@ static const struct
if (__builtin_expect (ch == L'\0', 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
\
@@ -853,7 +845,7 @@ static const struct
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c
index e3a0161cc3..c1bcadb35b 100644
--- a/iconvdata/euc-cn.c
+++ b/iconvdata/euc-cn.c
@@ -1,5 +1,5 @@
/* Mapping tables for EUC-CN handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -49,15 +49,7 @@
|| __builtin_expect (ch > 0xfe, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -77,36 +69,16 @@
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
if (__builtin_expect (ch < 0xa1, 0)) \
- { \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* This is code set 1: GB 2312-80. */ \
endp = inptr; \
\
ch = gb2312_to_ucs4 (&endp, 2, 0x80); \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -143,7 +115,7 @@
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* It's a GB 2312 character, adjust it for EUC-CN. */ \
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index 7f56f3cfe9..8a41756a35 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -127,33 +127,14 @@
if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
if (ch == 0x8e) \
{ \
/* Half-width katakana. */ \
if (__builtin_expect (ch2 > 0xdf, 0)) \
- { \
- /* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- break; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
ch = ch2 + 0xfec0; \
inptr += 2; \
@@ -188,18 +169,8 @@
} \
\
if (ch == 0) \
- { \
- /* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- break; \
- } \
+ /* This is an illegal character. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
if (ch < 0x80) \
{ \
@@ -230,15 +201,7 @@
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
put32 (outptr, ch); \
@@ -380,7 +343,7 @@ static const struct
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
if (jch & 0x0080) \
diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c
index 3c55e440b2..7faa080322 100644
--- a/iconvdata/euc-jp.c
+++ b/iconvdata/euc-jp.c
@@ -1,5 +1,5 @@
/* Mapping tables for EUC-JP handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -50,15 +50,7 @@
else if (ch == 0xff) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -78,37 +70,14 @@
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
if (__builtin_expect (ch2 < 0xa1, 0)) \
- { \
- /* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
if (ch == 0x8e) \
{ \
/* This is code set 2: half-width katakana. */ \
ch = jisx0201_to_ucs4 (ch2); \
if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
- { \
- /* Illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
inptr += 2; \
} \
@@ -137,20 +106,10 @@
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
- { \
- /* Illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ /* Illegal character. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
inptr = endp; \
} \
} \
@@ -234,7 +193,7 @@
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index 02c2f4b335..37ed71fd60 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -1,5 +1,5 @@
/* Mapping tables for EUC-KR handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
and Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -86,41 +86,22 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
|| __builtin_expect (ch == 0xc9, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
/* Two-byte character. First test whether the next character \
is also available. */ \
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80); \
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
- /* The second character is not available. */ \
+ /* The second byte is not available. */ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
- { \
- /* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
- } \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ /* This is an illegal character. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
put32 (outptr, ch); \
@@ -149,7 +130,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = cp[0]; \
diff --git a/iconvdata/euc-tw.c b/iconvdata/euc-tw.c
index 6b3c6bae91..8d3b1aa1b5 100644
--- a/iconvdata/euc-tw.c
+++ b/iconvdata/euc-tw.c
@@ -1,5 +1,5 @@
/* Mapping tables for EUC-TW handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -49,15 +49,7 @@
else if ((ch <= 0xa0 || ch > 0xfe) && ch != 0x8e) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -77,18 +69,7 @@
\
/* All second bytes of a multibyte character must be >= 0xa1. */ \
if (ch2 < 0xa1 || ch2 == 0xff) \
- { \
- /* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
if (ch == 0x8e) \
{ \
@@ -106,19 +87,8 @@
} \
\
if (ch == __UNKNOWN_10646_CHAR) \
- { \
- /* Illegal input. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ /* Illegal input. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
inptr += 4; \
} \
@@ -131,19 +101,8 @@
/* Please note that we need not test for the missing input \
characters here anymore. */ \
if (ch == __UNKNOWN_10646_CHAR) \
- { \
- /* Illegal input. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
- } \
+ /* Illegal input. */ \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
\
inptr += 2; \
} \
@@ -202,7 +161,7 @@
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* It's a CNS 11643 character, adjust it for EUC-TW. */ \
diff --git a/iconvdata/gb18030.c b/iconvdata/gb18030.c
index 9358b06494..f6b3576416 100644
--- a/iconvdata/gb18030.c
+++ b/iconvdata/gb18030.c
@@ -25671,15 +25671,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
if (ch < 0x81 || ch > 0xfe) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -25700,18 +25692,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
\
/* All second bytes of a multibyte character must be >= 0x30. */ \
if (ch2 < 0x30) \
- { \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
\
if (ch2 >= 0x30 && ch2 <= 0x39) \
{ \
@@ -25732,16 +25713,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
if (ch3 < 0x81 || ch3 > 0xfe) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 3; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (3); \
} \
\
ch4 = inptr[3]; \
@@ -25749,16 +25721,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
if (ch4 < 0x30 || ch4 > 0x39) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 4; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (4); \
} \
idx = (((ch - 0x81) * 10 + (ch2 - 0x30)) * 126 \
+ ch3 - 0x81) * 10 + ch4 - 0x30; \
@@ -25779,16 +25742,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
if (ch == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 4; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (4); \
} \
\
inptr += 4; \
@@ -25803,16 +25757,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
ch == 0 && *inptr != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -25820,16 +25765,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
} \
\
@@ -25895,7 +25831,7 @@ static const unsigned char __ucs_to_gb18030_tab2[8192][2] =
|| (len == 2 && __builtin_expect (cp[0], '\1') == '\0')) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
if (len == 2) \
diff --git a/iconvdata/gbbig5.c b/iconvdata/gbbig5.c
index a7d94053c9..695ffb2c07 100644
--- a/iconvdata/gbbig5.c
+++ b/iconvdata/gbbig5.c
@@ -1,5 +1,5 @@
/* Mapping tables from GB2312 to BIG5 and vice versa.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -4821,30 +4821,20 @@ const char __from_big5_to_gb2312 [13973][2] =
if (__builtin_expect (ch < 0xa1, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
idx += ch - 0xa1; \
\
/* Get the value from the table. */ \
cp = __from_gb2312_to_big5[idx]; \
- if (__builtin_expect (cp[0], '\1') == '\0') \
+ if (__builtin_expect (cp[0] == '\0', 0)) \
{ \
/* We do not have a mapping for this character. \
If ignore errors, map it to 0xa1bc - big5 box character */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
\
/* See if there is enough room to write the second byte. */ \
if (__builtin_expect (outptr + 1 >= outend, 0)) \
@@ -4880,15 +4870,7 @@ const char __from_big5_to_gb2312 [13973][2] =
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
}
#define LOOP_NEED_FLAGS
@@ -4932,28 +4914,18 @@ const char __from_big5_to_gb2312 [13973][2] =
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
/* Get the value from the table. */ \
cp = __from_big5_to_gb2312 [idx]; \
- if (__builtin_expect (cp[0], '\1') == '\0') \
+ if (__builtin_expect (cp[0] == '\0', 0)) \
{ \
/* We do not have a mapping for this character. \
If ignore errors, map it to 0xa1f5 - gb box character */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
\
/* See if there is enough room to write the second byte. */ \
if (__builtin_expect (outptr + 1 >= outend, 0)) \
@@ -4989,15 +4961,7 @@ const char __from_big5_to_gb2312 [13973][2] =
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
}
#define LOOP_NEED_FLAGS
diff --git a/iconvdata/gbgbk.c b/iconvdata/gbgbk.c
index 04deac6c7e..31c9e78300 100644
--- a/iconvdata/gbgbk.c
+++ b/iconvdata/gbgbk.c
@@ -1,5 +1,5 @@
/* Mapping tables from GBK to GB2312 and vice versa.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -101,14 +101,14 @@
|| __builtin_expect (inptr[1] < 0xa1, 0) \
/* Now test the exceptions. */ \
|| (__builtin_expect (ch >= 0xa2a1, 0) \
- && __builtin_expect (ch <= 0xa2aa, 0)) \
+ && __builtin_expect (ch <= 0xa2aa, 0)) \
|| (__builtin_expect (ch >= 0xa6e0, 0) \
- && __builtin_expect (ch <= 0xa6f5, 0)) \
+ && __builtin_expect (ch <= 0xa6f5, 0)) \
|| (__builtin_expect (ch >= 0xa8bb, 0) \
- && __builtin_expect (ch <= 0xa8c0, 0))) \
+ && __builtin_expect (ch <= 0xa8c0, 0))) \
{ \
/* One of the characters we cannot map. */ \
- STANDARD_ERR_HANDLER (2); \
+ STANDARD_TO_LOOP_ERR_HANDLER (2); \
} \
\
/* Copy the two bytes. */ \
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index 98f05371af..a738a9eb9d 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.c
@@ -1,5 +1,5 @@
/* Mapping tables for GBK handling.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Sean Chen <sean.chen@turbolinux.com>, 1999.
@@ -13149,15 +13149,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
|| __builtin_expect (ch > 0xfe, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -13182,16 +13174,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
|| (__builtin_expect (ch, 0x81) == 0xfe && ch2 > 0xa0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
/* This is code set 1: GBK. */ \
@@ -13202,16 +13185,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -13478,7 +13452,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
/* See whether there is enough room for the second byte we write. */ \
else if (cp[1] != '\0' && __builtin_expect (outptr + 1 >= outend, 0)) \
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 1be42e2d2c..f5e2cb1dd3 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -135,12 +135,7 @@ enum
if (__builtin_expect (res, L'\1') == L'\0' && ch != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -173,12 +168,7 @@ enum
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -211,14 +201,7 @@ enum
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 4; \
- continue; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
while (ch > rp1->end) \
@@ -238,12 +221,7 @@ enum
__builtin_expect (cp[0], L'\1')== L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/ibm932.c b/iconvdata/ibm932.c
index b81c14d05d..1e87067fef 100644
--- a/iconvdata/ibm932.c
+++ b/iconvdata/ibm932.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM932.
- 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 Masahide Washizawa <washi@jp.ibm.com>, 2000.
@@ -18,6 +18,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <dlfcn.h>
+#include <stdint.h>
#include "ibm932.h"
#ifndef TRUE
@@ -65,11 +67,7 @@
|| __builtin_expect (ch, 0) == 0xff) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -103,14 +101,7 @@
__builtin_expect (res, '\1') == 0 && ch !=0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 2; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -204,12 +195,7 @@
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
diff --git a/iconvdata/ibm933.c b/iconvdata/ibm933.c
index 43cf2b6c7a..389028ebc4 100644
--- a/iconvdata/ibm933.c
+++ b/iconvdata/ibm933.c
@@ -134,12 +134,7 @@ enum
if (__builtin_expect (res, L'\1') == L'\0' && ch != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -173,14 +168,7 @@ enum
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 2; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -213,14 +201,7 @@ enum
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 4; \
- continue; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
while (ch > rp1->end) \
@@ -240,12 +221,7 @@ enum
__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/ibm935.c b/iconvdata/ibm935.c
index 4585a49461..647573945f 100644
--- a/iconvdata/ibm935.c
+++ b/iconvdata/ibm935.c
@@ -134,12 +134,7 @@ enum
if (__builtin_expect (res, L'\1') == L'\0' && ch != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -173,12 +168,7 @@ enum
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -211,14 +201,7 @@ enum
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 4; \
- continue; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
while (ch > rp1->end) \
@@ -238,12 +221,7 @@ enum
__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/ibm937.c b/iconvdata/ibm937.c
index 4b0ea7ec64..2d46115942 100644
--- a/iconvdata/ibm937.c
+++ b/iconvdata/ibm937.c
@@ -134,12 +134,7 @@ enum
if (__builtin_expect (res, L'\1') == L'\0' && ch != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -173,12 +168,7 @@ enum
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -211,14 +201,7 @@ enum
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 4; \
- continue; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
while (ch > rp1->end) \
@@ -238,12 +221,7 @@ enum
__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c
index 8fcac1232a..aae08ba3d1 100644
--- a/iconvdata/ibm939.c
+++ b/iconvdata/ibm939.c
@@ -131,15 +131,10 @@ enum
{ \
/* Use the IBM939 table for single byte. */ \
res = __ibm939sb_to_ucs4[ch]; \
- if (__builtin_expect (res, L'\1') == L'\0' && ch != '\0') \
+ if (__builtin_expect (res == L'\0', 0) && ch != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -173,12 +168,7 @@ enum
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -233,12 +223,7 @@ enum
__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/ibm943.c b/iconvdata/ibm943.c
index 2819e25d74..818f6823c5 100644
--- a/iconvdata/ibm943.c
+++ b/iconvdata/ibm943.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM943.
- 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 Masahide Washizawa <washi@jp.ibm.com>, 2000.
@@ -18,6 +18,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <dlfcn.h>
+#include <stdint.h>
#include "ibm943.h"
#ifndef TRUE
@@ -65,11 +67,7 @@
|| __builtin_expect (ch, 0) == 0xff) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -103,14 +101,7 @@
__builtin_expect (res, '\1') == 0 && ch !=0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
- inptr += 2; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
else \
{ \
@@ -204,12 +195,7 @@
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c
index 2f213b8eb9..648b4b3213 100644
--- a/iconvdata/iso-2022-cn-ext.c
+++ b/iconvdata/iso-2022-cn-ext.c
@@ -174,16 +174,7 @@ enum
\
/* This is a 7bit character set, disallow all 8bit characters. */ \
if (ch > 0x7f) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* Recognize escape sequences. */ \
if (ch == ESC) \
@@ -283,13 +274,7 @@ enum
} \
else \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++inptr; \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
continue; \
} \
@@ -310,17 +295,7 @@ enum
inptr += 2; \
ch = cns11643l2_to_ucs4 (&inptr, 2, 0); \
if (ch == __UNKNOWN_10646_CHAR) \
- { \
- if (! ignore_errors_p ()) \
- { \
- inptr -= 2; \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- inptr += 2; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
/* Note that we can assume here that at least 4 bytes are available if \
the first byte is ESC since otherwise the first if would have been \
@@ -363,14 +338,7 @@ enum
} \
if (ch == __UNKNOWN_10646_CHAR) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- inptr += 4; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (4); \
} \
assert (tmp == buf + 3); \
inptr += 4; \
@@ -405,14 +373,7 @@ enum
} \
else if (ch == __UNKNOWN_10646_CHAR) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
} \
\
@@ -568,7 +529,7 @@ enum
if (used == ASCII_set) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c
index 939ec961d8..4e4ae768df 100644
--- a/iconvdata/iso-2022-cn.c
+++ b/iconvdata/iso-2022-cn.c
@@ -123,17 +123,7 @@ enum
\
/* This is a 7bit character set, disallow all 8bit characters. */ \
if (__builtin_expect (ch >= 0x7f, 0)) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* Recognize escape sequences. */ \
if (__builtin_expect (ch, 0) == ESC) \
@@ -197,16 +187,8 @@ enum
ch = cns11643l2_to_ucs4 (&inptr, 2, 0); \
if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
{ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- inptr -= 2; \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- continue; \
+ inptr -= 2; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
} \
else if (set == ASCII_set) \
@@ -232,16 +214,7 @@ enum
} \
else if (__builtin_expect (ch, 1) == __UNKNOWN_10646_CHAR) \
{ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
\
@@ -329,7 +302,7 @@ enum
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Even this does not work. Error. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
index 29e7be93fc..2bf666cb8f 100644
--- a/iconvdata/iso-2022-jp-3.c
+++ b/iconvdata/iso-2022-jp-3.c
@@ -232,15 +232,7 @@ enum
\
if (ch >= 0x80) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f)) \
/* Almost done, just advance the input pointer. */ \
@@ -251,15 +243,7 @@ enum
ch = jisx0201_to_ucs4 (ch); \
if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
++inptr; \
} \
@@ -269,15 +253,7 @@ enum
ch = jisx0201_to_ucs4 (ch + 0x80); \
if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
++inptr; \
} \
@@ -296,15 +272,7 @@ enum
} \
else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else /* (set == JISX0213_1_set || set == JISX0213_2_set) */ \
@@ -318,17 +286,7 @@ enum
ch = jisx0213_to_ucs4 (((set - JISX0213_1_set + (1 << 3)) << 5) + ch, \
inptr[1]); \
if (ch == 0) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
if (ch < 0x80) \
{ \
@@ -771,7 +729,7 @@ static const struct
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index 18a89cd16a..a9612e99ab 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -383,56 +383,20 @@ gconv_end (struct __gconv_step *data)
{ \
/* We use the table from the ISO 8859-7 module. */ \
if (inptr[2] < 0x20 || inptr[2] >= 0x80) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
ch = iso88597_to_ucs4[inptr[2] - 0x20]; \
if (ch == 0) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 3; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (3); \
inptr += 3; \
} \
else \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else if (ch >= 0x80) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f)) \
/* Almost done, just advance the input pointer. */ \
@@ -441,36 +405,16 @@ gconv_end (struct __gconv_step *data)
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch); \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
++inptr; \
} \
else if (set == JISX0201_Kana_set) \
{ \
/* Use the JIS X 0201 table. */ \
ch = jisx0201_to_ucs4 (ch + 0x80); \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
++inptr; \
} \
else \
@@ -495,22 +439,14 @@ gconv_end (struct __gconv_step *data)
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0); \
} \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
+ else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
\
@@ -1068,7 +1004,7 @@ static const cvlist_t conversion_lists[4] =
\
if (result == __GCONV_ILLEGAL_INPUT) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c
index e576e2a083..8df101b229 100644
--- a/iconvdata/iso-2022-kr.c
+++ b/iconvdata/iso-2022-kr.c
@@ -120,17 +120,7 @@ enum
\
/* This is a 7bit character set, disallow all 8bit characters. */ \
if (__builtin_expect (ch > 0x7f, 0)) \
- { \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
- } \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
\
/* Recognize escape sequences. */ \
if (__builtin_expect (ch, 0) == ESC) \
@@ -182,23 +172,14 @@ enum
/* Use the KSC 5601 table. */ \
ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0); \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
result = __GCONV_INCOMPLETE_INPUT; \
break; \
} \
- else if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
+ else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- ++inptr; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
\
@@ -252,7 +233,7 @@ enum
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c
index 894ad2bafd..f388ae7de2 100644
--- a/iconvdata/iso646.c
+++ b/iconvdata/iso646.c
@@ -1,5 +1,5 @@
/* Conversion to and from the various ISO 646 CCS.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -407,14 +407,7 @@ gconv_end (struct __gconv_step *data)
when we reach the default case in the `switch' statement. */ \
if (__builtin_expect (failure, __GCONV_OK) == __GCONV_ILLEGAL_INPUT) \
{ \
- if (! ignore_errors_p ()) \
- { \
- /* Exit the loop with an error. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -888,7 +881,7 @@ gconv_end (struct __gconv_step *data)
\
if (__builtin_expect (failure, __GCONV_OK) == __GCONV_ILLEGAL_INPUT) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = (unsigned char) ch; \
diff --git a/iconvdata/iso8859-1.c b/iconvdata/iso8859-1.c
index 67105a44f4..dc394007b8 100644
--- a/iconvdata/iso8859-1.c
+++ b/iconvdata/iso8859-1.c
@@ -1,5 +1,5 @@
/* Conversion to and from ISO 8859-1.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -51,7 +51,7 @@
UNICODE_TAG_HANDLER (ch, 4); \
\
/* We have an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
*outptr++ = (unsigned char) ch; \
diff --git a/iconvdata/iso_6937-2.c b/iconvdata/iso_6937-2.c
index bd4cd6774a..a2b174ee65 100644
--- a/iconvdata/iso_6937-2.c
+++ b/iconvdata/iso_6937-2.c
@@ -1,5 +1,5 @@
/* Generic conversion to and from ISO 6937-2.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -420,33 +420,15 @@ static const char from_ucs4[][2] =
|| __builtin_expect (ch2 >= 0x80, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* Illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -455,19 +437,10 @@ static const char from_ucs4[][2] =
{ \
ch = to_ucs4[ch]; \
\
- if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch == 0, 0) && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
++inptr; \
} \
@@ -570,13 +543,13 @@ static const char from_ucs4[][2] =
} \
if (cp == NULL) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
- else if (__builtin_expect (from_ucs4[ch][0], '\1') == '\0' && ch != 0) \
+ else if (__builtin_expect (from_ucs4[ch][0] == '\0', 0) && ch != 0) \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
cp = from_ucs4[ch]; \
diff --git a/iconvdata/iso_6937.c b/iconvdata/iso_6937.c
index 2340e53849..b800a4f860 100644
--- a/iconvdata/iso_6937.c
+++ b/iconvdata/iso_6937.c
@@ -1,5 +1,5 @@
/* Generic conversion to and from ISO 6937.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -412,33 +412,15 @@ static const char from_ucs4[][2] =
|| __builtin_expect (ch2 >= 0x80, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* Illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -447,19 +429,10 @@ static const char from_ucs4[][2] =
{ \
ch = to_ucs4[ch]; \
\
- if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch == 0, 0) && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
++inptr; \
} \
@@ -544,13 +517,13 @@ static const char from_ucs4[][2] =
if (__builtin_expect (fail, 0)) \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
- else if (__builtin_expect (from_ucs4[ch][0], '\1') == '\0' && ch != 0) \
+ else if (__builtin_expect (from_ucs4[ch][0] == '\0', 0) && ch != 0) \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
cp = from_ucs4[ch]; \
diff --git a/iconvdata/johab.c b/iconvdata/johab.c
index a94270a1e0..a83483e66e 100644
--- a/iconvdata/johab.c
+++ b/iconvdata/johab.c
@@ -1,5 +1,5 @@
/* Mapping tables for JOHAB handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
and Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -184,16 +184,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|| (__builtin_expect (ch > 0xd3, 0) && ch < 0xd9)) \
{ \
/* These are illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -226,16 +217,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|| __builtin_expect (f == -1, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else if (i > 0 && m > 0) \
ch = ((i - 1) * 21 + (m - 1)) * 28 + f + 0xac00; \
@@ -249,16 +231,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else \
@@ -272,16 +245,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
|| (__builtin_expect (ch, 0) == 0xde && ch2 > 0xf1)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -299,19 +263,10 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
} \
} \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -394,9 +349,9 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \
+ if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
outptr[0] -= 0x4a; \
@@ -423,11 +378,11 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written, 1) == __UNKNOWN_10646_CHAR \
+ if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0) \
|| (outptr[0] == 0x22 && outptr[1] > 0x65)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
temp = (outptr[0] < 0x4a ? outptr[0] + 0x191 : outptr[0] + 0x176);\
diff --git a/iconvdata/shift_jisx0213.c b/iconvdata/shift_jisx0213.c
index 79ea071a95..d48d67ef0f 100644
--- a/iconvdata/shift_jisx0213.c
+++ b/iconvdata/shift_jisx0213.c
@@ -139,15 +139,7 @@
if (__builtin_expect (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
/* Convert to row and column. */ \
@@ -180,15 +172,7 @@
if (ch == 0) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- break; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
if (ch < 0x80) \
@@ -219,15 +203,7 @@
else \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
put32 (outptr, ch); \
@@ -366,7 +342,7 @@ static const struct
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Convert it to shifted representation. */ \
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index 6f536461ec..285f24fdaf 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -4353,16 +4353,7 @@ static const char from_ucs4_extra[0x100][2] =
|| __builtin_expect (ch <= 0x80, 0)) \
{ \
/* These are illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -4382,22 +4373,13 @@ static const char from_ucs4_extra[0x100][2] =
ch2 = inptr[1]; \
idx = ch * 256 + ch2; \
if (__builtin_expect (ch2 < 0x40, 0) \
- || (__builtin_expect (idx > 0x84be, 0) && idx < 0x889f) \
- || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940) \
- || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040) \
+ || (__builtin_expect (idx > 0x84be, 0) && idx < 0x889f) \
+ || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940) \
+ || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040) \
|| __builtin_expect (idx > 0xeaa4, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -4416,19 +4398,10 @@ static const char from_ucs4_extra[0x100][2] =
inptr += 2; \
} \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
} \
\
@@ -4468,10 +4441,10 @@ static const char from_ucs4_extra[0x100][2] =
else \
cp = from_ucs4_lat1[ch]; \
\
- if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
+ if (__builtin_expect (cp[0] == '\0', 0) && ch != 0) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
diff --git a/iconvdata/t.61.c b/iconvdata/t.61.c
index 5ccd72bdad..5227802b22 100644
--- a/iconvdata/t.61.c
+++ b/iconvdata/t.61.c
@@ -1,5 +1,5 @@
/* Generic conversion to and from T.61.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997-1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -404,16 +404,7 @@ static const char from_ucs4[][2] =
|| __builtin_expect (ch2 >= 0x80, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20]; \
@@ -423,17 +414,10 @@ static const char from_ucs4[][2] =
else \
ch = to_ucs4[ch]; \
\
- if (__builtin_expect (ch, 1) == 0 && *inptr != '\0') \
+ if (__builtin_expect (ch == 0, 0) && *inptr != '\0') \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (increment); \
} \
else \
{ \
@@ -471,7 +455,7 @@ static const char from_ucs4[][2] =
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
@@ -486,10 +470,10 @@ static const char from_ucs4[][2] =
{ \
cp = from_ucs4[ch]; \
\
- if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
+ if (__builtin_expect (cp[0] == '\0', 0) && ch != 0) \
{ \
/* Illegal. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
\
diff --git a/iconvdata/tcvn5712-1.c b/iconvdata/tcvn5712-1.c
index 3bda8da9de..7cd6f0161e 100644
--- a/iconvdata/tcvn5712-1.c
+++ b/iconvdata/tcvn5712-1.c
@@ -698,7 +698,7 @@ static const struct
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c
index 51e38dcac6..87247689c9 100644
--- a/iconvdata/uhc.c
+++ b/iconvdata/uhc.c
@@ -1,5 +1,5 @@
/* Mapping tables for UHC handling.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jungshik Shin <jshin@pantheon.yale.edu>, 1998.
@@ -3069,16 +3069,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|| __builtin_expect (ch == 0xc9, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
else \
{ \
@@ -3124,16 +3115,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
|| (__builtin_expect (ch == 0xc6, 0) && ch2 > 0x52)) \
{ \
/* This is not legal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
ch = uhc_extra_to_ucs[ch2 - 0x41 \
@@ -3142,19 +3124,10 @@ static const char uhc_hangul_from_ucs[11172][2] =
? (ch - 0x81) * 178 \
: 5696 + (ch - 0xa1) * 84)]; \
\
- if (__builtin_expect (ch, 1) == 0) \
+ if (__builtin_expect (ch == 0, 0)) \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
inptr += 2; \
@@ -3162,19 +3135,10 @@ static const char uhc_hangul_from_ucs[11172][2] =
else \
{ \
ch = ksc5601_to_ucs4 (&inptr, 2, 0x80); \
- if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR) \
+ if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0)) \
{ \
/* Illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
} \
} \
@@ -3215,14 +3179,14 @@ static const char uhc_hangul_from_ucs[11172][2] =
{ \
size_t written = ucs4_to_ksc5601_hanja (ch, outptr, outend - outptr); \
\
- if (__builtin_expect (written, 1) == 0) \
+ if (__builtin_expect (written == 0, 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \
+ if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ |= 0x80; \
@@ -3236,15 +3200,15 @@ static const char uhc_hangul_from_ucs[11172][2] =
{ \
size_t written = ucs4_to_ksc5601_sym (ch, outptr, outend - outptr); \
\
- if (__builtin_expect (written, 1) == 0) \
+ if (__builtin_expect (written == 0, 0)) \
{ \
result = __GCONV_FULL_OUTPUT; \
break; \
} \
- if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \
+ if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0)) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ |= 0x80; \
diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c
index 7798ae330b..c88f75dd85 100644
--- a/iconvdata/unicode.c
+++ b/iconvdata/unicode.c
@@ -1,5 +1,5 @@
/* Conversion module for Unicode
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -155,7 +155,7 @@ gconv_end (struct __gconv_step *data)
if (__builtin_expect (c >= 0x10000, 0)) \
{ \
UNICODE_TAG_HANDLER (c, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0)) \
{ \
@@ -165,11 +165,9 @@ gconv_end (struct __gconv_step *data)
surrogates pass through, attackers could make a security \
hole exploit by synthesizing any desired plane 1-16 \
character. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
inptr += 4; \
++*irreversible; \
continue; \
@@ -203,14 +201,7 @@ gconv_end (struct __gconv_step *data)
{ \
/* Surrogate characters in UCS-2 input are not valid. Reject \
them. (Catching this here is not security relevant.) */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- inptr += 2; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
put32 (outptr, u1); \
diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c
index d17f6c3563..642340611d 100644
--- a/iconvdata/utf-16.c
+++ b/iconvdata/utf-16.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-16.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@@ -205,11 +205,9 @@ gconv_end (struct __gconv_step *data)
We must catch this. If we let surrogates pass through, \
attackers could make a security hole exploit by \
synthesizing any desired plane 1-16 character. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
inptr += 4; \
++*irreversible; \
continue; \
@@ -221,7 +219,7 @@ gconv_end (struct __gconv_step *data)
{ \
if (__builtin_expect (c >= 0x110000, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
@@ -245,7 +243,7 @@ gconv_end (struct __gconv_step *data)
{ \
if (__builtin_expect (c >= 0x110000, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
@@ -311,15 +309,8 @@ gconv_end (struct __gconv_step *data)
|| __builtin_expect (u2 == 0xdfff, 0)) \
{ \
/* This is no valid second word for a surrogate. */ \
- if (! ignore_errors_p ()) \
- { \
- inptr -= 2; \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- continue; \
+ inptr -= 2; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
put32 (outptr, ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00)); \
@@ -354,15 +345,8 @@ gconv_end (struct __gconv_step *data)
|| __builtin_expect (u2 >= 0xdfff, 0)) \
{ \
/* This is no valid second word for a surrogate. */ \
- if (! ignore_errors_p ()) \
- { \
- inptr -= 2; \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
- continue; \
+ inptr -= 2; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (2); \
} \
\
put32 (outptr, ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00)); \
diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c
index 03363a0f4d..01f4b881dc 100644
--- a/iconvdata/utf-32.c
+++ b/iconvdata/utf-32.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-32.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000-2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -198,7 +198,7 @@ gconv_end (struct __gconv_step *data)
\
if (__builtin_expect (c >= 0x110000, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0)) \
{ \
@@ -206,11 +206,9 @@ gconv_end (struct __gconv_step *data)
We must catch this. If we let surrogates pass through, \
attackers could make a security hole exploit by \
generating "irregular UTF-32" sequences. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ break; \
inptr += 4; \
++*irreversible; \
continue; \
@@ -244,16 +242,7 @@ gconv_end (struct __gconv_step *data)
if (__builtin_expect (u1 >= 0x110000, 0)) \
{ \
/* This is illegal. */ \
- if (! ignore_errors_p ()) \
- { \
- /* This is an illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- inptr += 4; \
- ++*irreversible; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (4); \
} \
\
put32 (outptr, u1); \
diff --git a/iconvdata/utf-7.c b/iconvdata/utf-7.c
index 4915e7751b..64cf614208 100644
--- a/iconvdata/utf-7.c
+++ b/iconvdata/utf-7.c
@@ -1,5 +1,5 @@
/* Conversion module for UTF-7.
- Copyright (C) 2000 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.
@@ -193,14 +193,7 @@ base64 (unsigned int i)
else \
{ \
/* The input is invalid. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else \
@@ -228,16 +221,7 @@ base64 (unsigned int i)
if (__builtin_expect (statep->__value.__wch != 0, 0) \
|| __builtin_expect ((statep->__count >> 3) <= 26, 0)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- statep->__count = 0; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER ((statep->__count = 0, 1)); \
} \
\
if (ch == '-') \
@@ -279,16 +263,7 @@ base64 (unsigned int i)
\
if (! __builtin_expect (wc2 >= 0xdc00 && wc2 < 0xe000, 1)) \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
- statep->__count = 0; \
- continue; \
+ STANDARD_FROM_LOOP_ERR_HANDLER ((statep->__count = 0, 1));\
} \
} \
\
@@ -364,7 +339,7 @@ base64 (unsigned int i)
else if (ch < 0x110000) \
count = 6; \
else \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
\
if (__builtin_expect (outptr + count > outend, 0)) \
{ \
@@ -429,7 +404,7 @@ base64 (unsigned int i)
else if (ch < 0x110000) \
count = ((statep->__count & 0x18) >= 0x18 ? 6 : 5); \
else \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
\
if (__builtin_expect (outptr + count > outend, 0)) \
{ \
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 1dcf84b07c..6ba7c42133 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -53,16 +53,16 @@ static inline Elf32_Addr __attribute__ ((unused))
elf_machine_load_address (void)
{
Elf32_Addr addr;
- asm ("mov.l .L1,r0\n\
- mov.l .L3,r2\n\
+ asm ("mov.l 1f,r0\n\
+ mov.l 3f,r2\n\
add r12,r2\n\
mov.l @(r0,r12),r0\n\
- bra .L2\n\
+ bra 2f\n\
sub r0,r2\n\
.align 2\n\
- .L1: .long _dl_start@GOT\n\
- .L3: .long _dl_start@GOTOFF\n\
- .L2: mov r2,%0"
+ 1: .long _dl_start@GOT\n\
+ 3: .long _dl_start@GOTOFF\n\
+ 2: mov r2,%0"
: "=r" (addr) : : "r0", "r1", "r2");
return addr;
}