diff options
Diffstat (limited to 'iconvdata/iso-2022-kr.c')
-rw-r--r-- | iconvdata/iso-2022-kr.c | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c index ab03472..e6db8c4 100644 --- a/iconvdata/iso-2022-kr.c +++ b/iconvdata/iso-2022-kr.c @@ -95,7 +95,7 @@ enum { \ /* 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; \ @@ -125,8 +125,15 @@ enum /* 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. */ \ @@ -187,8 +194,16 @@ enum } \ 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; \ } \ } \ \ @@ -240,26 +255,34 @@ enum 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. */ \ |