-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>
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. */ \
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. */ \
} \
else \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
inptr += 4; \
{ \
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)) \
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. */ \
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; \
{ \
/* 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; \
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)) \
{ \
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; \
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)) \
{ \
(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; \
\
/* 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. */ \
/* 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.
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 \
{ \
__builtin_expect (res, '\1') == '\0' && ch != 0)) \
{ \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = res; \
/* 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.
{ \
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); \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = from_ucs4[ch]; \
/* 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.
|| __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 \
{ \
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 \
{ \
if (tmp[0] == '\0') \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
tmp[1] = '\0'; \
cp = tmp; \
if (tmp[0] == '\0') \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
tmp[1] = '\0'; \
cp = tmp; \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
\
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
\
++inptr; \
\
/* We have an illegal character. */ \
err: \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
++outptr; \
inptr += 4; \
/* 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.
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; \
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); \
if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
(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; \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
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); \
} \
} \
\
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
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); \
} \
} \
\
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
/* 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.
|| __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 \
{ \
\
/* 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; \
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. */ \
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; \
} \
\
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) \
{ \
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); \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
if (jch & 0x0080) \
/* 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.
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 \
{ \
\
/* 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; \
} \
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; \
} \
} \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
/* 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.
|| __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); \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = cp[0]; \
/* 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.
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 \
{ \
\
/* 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) \
{ \
} \
\
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; \
} \
/* 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; \
} \
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. */ \
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 \
{ \
\
/* 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) \
{ \
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]; \
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; \
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; \
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; \
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); \
} \
} \
\
|| (len == 2 && __builtin_expect (cp[0], '\1') == '\0')) \
{ \
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
if (len == 2) \
/* 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.
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)) \
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
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)) \
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
/* 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.
|| __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. */ \
/* 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.
|| __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 \
{ \
|| (__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. */ \
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; \
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)) \
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 \
{ \
__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 \
{ \
{ \
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) \
__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 \
{ \
/* 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.
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <dlfcn.h>
+#include <stdint.h>
#include "ibm932.h"
#ifndef TRUE
|| __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 \
{ \
__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 \
{ \
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
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 \
{ \
__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 \
{ \
{ \
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) \
__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 \
{ \
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 \
{ \
__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 \
{ \
{ \
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) \
__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 \
{ \
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 \
{ \
__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 \
{ \
{ \
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) \
__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 \
{ \
{ \
/* 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 \
{ \
__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 \
{ \
__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 \
{ \
/* 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.
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <dlfcn.h>
+#include <stdint.h>
#include "ibm943.h"
#ifndef TRUE
|| __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 \
{ \
__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 \
{ \
else \
{ \
/* This is an illegal character. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++*irreversible; \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
else \
\
/* 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) \
} \
else \
{ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- ++inptr; \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
continue; \
} \
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 \
} \
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; \
} \
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); \
} \
} \
\
if (used == ASCII_set) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
\
/* 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) \
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) \
} \
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); \
} \
} \
\
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Even this does not work. Error. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
\
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. */ \
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; \
} \
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; \
} \
} \
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) */ \
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) \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
{ \
/* 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. */ \
{ \
/* 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 \
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); \
} \
} \
\
\
if (result == __GCONV_ILLEGAL_INPUT) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
} \
\
/* 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) \
/* 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); \
} \
} \
\
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
/* 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.
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 \
{ \
\
if (__builtin_expect (failure, __GCONV_OK) == __GCONV_ILLEGAL_INPUT) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
*outptr++ = (unsigned char) ch; \
/* 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.
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; \
/* 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.
|| __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; \
{ \
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; \
} \
} \
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]; \
/* 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.
|| __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; \
{ \
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; \
} \
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]; \
/* 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.
|| (__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 \
{ \
|| __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; \
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 \
|| (__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 \
{ \
} \
} \
\
- 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; \
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; \
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);\
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. */ \
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) \
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); \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Convert it to shifted representation. */ \
|| __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 \
{ \
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 \
{ \
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); \
} \
} \
\
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 \
{ \
/* 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.
|| __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]; \
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 \
{ \
UNICODE_TAG_HANDLER (ch, 4); \
\
/* Illegal characters. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
else \
{ \
{ \
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); \
} \
} \
\
\
failed: \
/* This is an illegal character. */ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
} \
}
/* 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.
|| __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 \
{ \
|| (__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 \
? (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; \
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); \
} \
} \
} \
{ \
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; \
{ \
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; \
/* 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.
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)) \
{ \
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; \
{ \
/* 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); \
/* 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.
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; \
{ \
if (__builtin_expect (c >= 0x110000, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
{ \
if (__builtin_expect (c >= 0x110000, 0)) \
{ \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
\
/* Generate a surrogate character. */ \
|| __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)); \
|| __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)); \
/* 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
\
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)) \
{ \
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; \
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); \
/* 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.
else \
{ \
/* The input is invalid. */ \
- if (! ignore_errors_p ()) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- \
- ++inptr; \
- ++*irreversible; \
+ STANDARD_FROM_LOOP_ERR_HANDLER (1); \
} \
} \
else \
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 == '-') \
\
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));\
} \
} \
\
else if (ch < 0x110000) \
count = 6; \
else \
- STANDARD_ERR_HANDLER (4); \
+ STANDARD_TO_LOOP_ERR_HANDLER (4); \
\
if (__builtin_expect (outptr + count > outend, 0)) \
{ \
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)) \
{ \
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;
}