diff options
Diffstat (limited to 'iconvdata/uhc.c')
-rw-r--r-- | iconvdata/uhc.c | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c index d62f93bf29..232e5c8416 100644 --- a/iconvdata/uhc.c +++ b/iconvdata/uhc.c @@ -18,6 +18,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <dlfcn.h> #include <stdint.h> #include <ksc5601.h> @@ -3085,7 +3086,7 @@ static const char uhc_hangul_from_ucs[11172][2] = is also available. */ \ uint32_t ch2; \ \ - if (NEED_LENGTH_TEST && __builtin_expect (inptr + 1 >= inend, 0)) \ + if (__builtin_expect (inptr + 1 >= inend, 0)) \ { \ /* The second character is not available. Store \ the intermediate result. */ \ @@ -3180,6 +3181,7 @@ static const char uhc_hangul_from_ucs[11172][2] = put32 (outptr, ch); \ outptr += 4; \ } +#define LOOP_NEED_FLAGS #include <iconv/loop.c> @@ -3199,7 +3201,7 @@ static const char uhc_hangul_from_ucs[11172][2] = { \ const char *s = uhc_hangul_from_ucs[ch - 0xac00]; \ \ - if (NEED_LENGTH_TEST && __builtin_expect (outptr + 2 > outend, 0)) \ + if (__builtin_expect (outptr + 2 > outend, 0)) \ { \ result = __GCONV_FULL_OUTPUT; \ break; \ @@ -3210,26 +3212,35 @@ static const char uhc_hangul_from_ucs[11172][2] = } \ else if ((ch >= 0x4e00 && ch <= 0x9fa5) || (ch >= 0xf900 && ch <= 0xfa0b))\ { \ - size_t written = ucs4_to_ksc5601_hanja (ch, outptr, \ - (NEED_LENGTH_TEST \ - ? outend - outptr : 2)); \ + size_t written = ucs4_to_ksc5601_hanja (ch, outptr, outend - outptr); \ \ - if (NEED_LENGTH_TEST && __builtin_expect (written, 1) == 0) \ + if (__builtin_expect (written, 1) == 0) \ { \ result = __GCONV_FULL_OUTPUT; \ break; \ } \ if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \ { \ - if (! ignore_errors_p ()) \ + if (step_data->__trans.__trans_fct != NULL) \ + { \ + result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ + (step, step_data, *inptrp, &inptr, \ + inend, *outptrp, &outptr, outend, \ + irreversible)); \ + if (result != __GCONV_OK) \ + break; \ + } \ + else if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ result = __GCONV_ILLEGAL_INPUT; \ break; \ } \ - \ - inptr += 4; \ - ++*irreversible; \ + else \ + { \ + inptr += 4; \ + ++*irreversible; \ + } \ continue; \ } \ \ @@ -3242,26 +3253,35 @@ static const char uhc_hangul_from_ucs[11172][2] = */ \ else \ { \ - size_t written = ucs4_to_ksc5601_sym (ch, outptr, \ - (NEED_LENGTH_TEST \ - ? outend - outptr : 2)); \ + size_t written = ucs4_to_ksc5601_sym (ch, outptr, outend - outptr); \ \ - if (NEED_LENGTH_TEST && __builtin_expect (written, 1) == 0) \ + if (__builtin_expect (written, 1) == 0) \ { \ result = __GCONV_FULL_OUTPUT; \ break; \ } \ if (__builtin_expect (written, 0) == __UNKNOWN_10646_CHAR) \ { \ - if (! ignore_errors_p ()) \ + if (step_data->__trans.__trans_fct != NULL) \ + { \ + result = DL_CALL_FCT (step_data->__trans.__trans_fct, \ + (step, step_data, *inptrp, &inptr, \ + inend, *outptrp, &outptr, outend, \ + irreversible)); \ + if (result != __GCONV_OK) \ + break; \ + } \ + else if (! ignore_errors_p ()) \ { \ /* This is an illegal character. */ \ result = __GCONV_ILLEGAL_INPUT; \ break; \ } \ - \ - inptr += 4; \ - ++*irreversible; \ + else \ + { \ + inptr += 4; \ + ++*irreversible; \ + } \ continue; \ } \ \ @@ -3271,6 +3291,7 @@ static const char uhc_hangul_from_ucs[11172][2] = \ inptr += 4; \ } +#define LOOP_NEED_FLAGS #include <iconv/loop.c> |