Don't return error for invald error if ignore flag is set.
{ \
/* Write out the shift sequence. */ \
*outbuf++ = SI; \
- if (data->__is_last) \
+ if (data->__flags & __GCONV_IS_LAST) \
*written += 1; \
data->__outbuf = outbuf; \
data->__statep->__count = ASCII_set; \
/* This is a 7bit character set, disallow all 8bit characters. */ \
if (ch > 0x7f) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
\
/* Recognize escape sequences. */ \
ch = cns11643l2_to_ucs4 (&inptr, 2, 0); \
if (ch == __UNKNOWN_10646_CHAR) \
{ \
- inptr -= 2; \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ /* This is an illegal character. */ \
+ inptr -= 2; \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++*converted; \
+ continue; \
} \
} \
else if (set == ASCII_set) \
} \
else if (ch == __UNKNOWN_10646_CHAR) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ /* This is an illegal character. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
} \
\
else \
{ \
/* Even this does not work. Error. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ inptr += 4; \
+ ++*converted; \
+ continue; \
} \
} \
} \
*outbuf++ = ESC; \
*outbuf++ = '('; \
*outbuf++ = 'B'; \
- if (data->__is_last) \
+ if (data->__flags & __GCONV_IS_LAST) \
*written += 3; \
data->__outbuf = outbuf; \
/* Note that this also clears the G2 designation. */ \
/* We use the table from the ISO 8859-7 module. */ \
if (inptr[2] < 0x20 || inptr[2] > 0x80) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
ch = iso88597_to_ucs4[inptr[2] - 0x20]; \
if (ch == 0) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ inptr += 3; \
+ ++*converted; \
+ continue; \
} \
inptr += 3; \
} \
else \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
} \
else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f)) \
ch = jisx0201_to_ucs4 (ch); \
if (ch == __UNKNOWN_10646_CHAR) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
++inptr; \
} \
ch = jisx0201_to_ucs4 (ch + 0x80); \
if (ch == __UNKNOWN_10646_CHAR) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
++inptr; \
} \
} \
else if (ch == __UNKNOWN_10646_CHAR) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
} \
\
else if (var == iso2022jp) \
{ \
/* We have no other choice. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++*converted; \
} \
else \
{ \
} \
else \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++*converted; \
} \
} \
} \
{ \
/* Write out the shift sequence. */ \
*outbuf++ = SI; \
- if (data->__is_last) \
+ if (data->__flags & __GCONV_IS_LAST) \
*written += 1; \
data->__outbuf = outbuf; \
data->__statep->__count = ASCII_set; \
/* This is a 7bit character set, disallow all 8bit characters. */ \
if (ch > 0x7f) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++inptr; \
+ ++*converted; \
+ continue; \
} \
\
/* Recognize escape sequences. */ \
} \
else if (ch == __UNKNOWN_10646_CHAR) \
{ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
+ if (! ignore_errors_p ()) \
+ { \
+ /* This is an illegal character. */ \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
+ \
+ ++*converted; \
+ ++inptr; \
+ continue; \
} \
} \
\
if (written == __UNKNOWN_10646_CHAR) \
{ \
/* Illegal character. */ \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
- assert (written == 2); \
+ if (! ignore_errors_p ()) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ break; \
+ } \
\
- /* We use KSC 5601. */ \
- if (set != KSC5601_set) \
- { \
- *outptr++ = SO; \
- set = KSC5601_set; \
+ ++*converted; \
} \
- \
- if (NEED_LENGTH_TEST && outptr + 2 > outend) \
+ else \
{ \
- result = __GCONV_FULL_OUTPUT; \
- break; \
- } \
+ assert (written == 2); \
+ \
+ /* We use KSC 5601. */ \
+ if (set != KSC5601_set) \
+ { \
+ *outptr++ = SO; \
+ set = KSC5601_set; \
+ } \
+ \
+ if (NEED_LENGTH_TEST && outptr + 2 > outend) \
+ { \
+ result = __GCONV_FULL_OUTPUT; \
+ break; \
+ } \
\
- *outptr++ = buf[0]; \
- *outptr++ = buf[1]; \
+ *outptr++ = buf[0]; \
+ *outptr++ = buf[1]; \
+ } \
} \
\
/* Now that we wrote the output increment the input pointer. */ \