summaryrefslogtreecommitdiff
path: root/iconvdata/gbk.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/gbk.c')
-rw-r--r--iconvdata/gbk.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index 952f76ab73..f82059195e 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.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 <gconv.h>
#include <stdint.h>
#include <stdlib.h>
@@ -13109,7 +13110,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
#define MIN_NEEDED_TO 4
-/* First define the conversion function from ISO 8859-1 to UCS4. */
+/* First define the conversion function from GBK to UCS4. */
#define MIN_NEEDED_INPUT MIN_NEEDED_FROM
#define MAX_NEEDED_INPUT MAX_NEEDED_FROM
#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO
@@ -13142,7 +13143,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
uint32_t ch2; \
int 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. */ \
@@ -13194,6 +13195,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
put32 (outptr, ch); \
outptr += 4; \
}
+#define LOOP_NEED_FLAGS
#include <iconv/loop.c>
@@ -13450,17 +13452,29 @@ static const char __gbk_from_ucs4_tab12[][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 ()) \
{ \
result = __GCONV_ILLEGAL_INPUT; \
break; \
} \
- \
- ++*irreversible; \
+ else \
+ { \
+ inptr += 4; \
+ ++*irreversible; \
+ } \
+ continue; \
} \
/* See whether there is enough room for the second byte we write. */ \
- else if (NEED_LENGTH_TEST && cp[1] != '\0' \
- && __builtin_expect (outptr + 1 >= outend, 0)) \
+ else if (cp[1] != '\0' && __builtin_expect (outptr + 1 >= outend, 0)) \
{ \
/* We have not enough room. */ \
result = __GCONV_FULL_OUTPUT; \
@@ -13476,6 +13490,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
\
inptr += 4; \
}
+#define LOOP_NEED_FLAGS
#include <iconv/loop.c>