diff options
Diffstat (limited to 'iconvdata/sjis.c')
-rw-r--r-- | iconvdata/sjis.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c index 0f38362fb3..2641b24743 100644 --- a/iconvdata/sjis.c +++ b/iconvdata/sjis.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 <wchar.h> @@ -4377,7 +4378,7 @@ static const char from_ucs4_extra[0x100][2] = uint32_t ch2; \ uint_fast32_t idx; \ \ - 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. */ \ @@ -4441,6 +4442,7 @@ static const char from_ucs4_extra[0x100][2] = put32 (outptr, ch); \ outptr += 4; \ } +#define LOOP_NEED_FLAGS #include <iconv/loop.c> @@ -4466,15 +4468,26 @@ static const char from_ucs4_extra[0x100][2] = else \ { \ /* Illegal character. */ \ - 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; \ } \ } \ @@ -4484,14 +4497,26 @@ static const char from_ucs4_extra[0x100][2] = if (__builtin_expect (cp[0], '\1') == '\0' && ch != 0) \ { \ /* Illegal character. */ \ - 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; \ } \ - \ - ++*irreversible; \ + else \ + { \ + inptr += 4; \ + ++*irreversible; \ + } \ + continue; \ } \ else \ { \ @@ -4499,7 +4524,7 @@ static const char from_ucs4_extra[0x100][2] = /* Now test for a possible second byte and write this if possible. */\ if (cp[1] != '\0') \ { \ - if (NEED_LENGTH_TEST && __builtin_expect (outptr >= outend, 0)) \ + if (__builtin_expect (outptr >= outend, 0)) \ { \ /* The result does not fit into the buffer. */ \ result = __GCONV_FULL_OUTPUT; \ @@ -4511,6 +4536,7 @@ static const char from_ucs4_extra[0x100][2] = \ inptr += 4; \ } +#define LOOP_NEED_FLAGS #include <iconv/loop.c> |