about summary refs log tree commit diff
path: root/iconvdata/euc-jisx0213.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/euc-jisx0213.c')
-rw-r--r--iconvdata/euc-jisx0213.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index a0062c8847..7f56f3cfe9 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -44,9 +44,14 @@
 #define TO_LOOP			to_euc_jisx0213
 #define DEFINE_INIT		1
 #define DEFINE_FINI		1
-#define MIN_NEEDED_FROM		1
-#define MAX_NEEDED_FROM		3
-#define MIN_NEEDED_TO		4
+#define FROM_LOOP_MIN_NEEDED_FROM	1
+#define FROM_LOOP_MAX_NEEDED_FROM	3
+#define FROM_LOOP_MIN_NEEDED_TO		4
+#define FROM_LOOP_MAX_NEEDED_TO		8
+#define TO_LOOP_MIN_NEEDED_FROM		4
+#define TO_LOOP_MAX_NEEDED_FROM		4
+#define TO_LOOP_MIN_NEEDED_TO		1
+#define TO_LOOP_MAX_NEEDED_TO		3
 #define PREPARE_LOOP \
   int saved_state;							      \
   int *statep = &data->__statep->__count;
@@ -92,9 +97,10 @@
 
 
 /* First define the conversion function from EUC-JISX0213 to UCS-4.  */
-#define MIN_NEEDED_INPUT	MIN_NEEDED_FROM
-#define MAX_NEEDED_INPUT	MAX_NEEDED_FROM
-#define MIN_NEEDED_OUTPUT	MIN_NEEDED_TO
+#define MIN_NEEDED_INPUT	FROM_LOOP_MIN_NEEDED_FROM
+#define MAX_NEEDED_INPUT	FROM_LOOP_MAX_NEEDED_FROM
+#define MIN_NEEDED_OUTPUT	FROM_LOOP_MIN_NEEDED_TO
+#define MAX_NEEDED_OUTPUT	FROM_LOOP_MAX_NEEDED_TO
 #define LOOPFCT			FROM_LOOP
 #define BODY \
   {									      \
@@ -195,8 +201,6 @@
 		break;							      \
 	      }								      \
 									      \
-	    inptr = endp;						      \
-									      \
 	    if (ch < 0x80)						      \
 	      {								      \
 		/* It's a combining character.  */			      \
@@ -206,6 +210,7 @@
 		/* See whether we have room for two characters.  */	      \
 		if (outptr + 8 <= outend)				      \
 		  {							      \
+		    inptr = endp;					      \
 		    put32 (outptr, u1);					      \
 		    outptr += 4;					      \
 		    put32 (outptr, u2);					      \
@@ -218,6 +223,8 @@
 		    break;						      \
 		  }							      \
 	      }								      \
+									      \
+	    inptr = endp;						      \
 	  }								      \
       }									      \
     else								      \
@@ -288,9 +295,10 @@ static const struct
   { 0xa6f5, 0xa6f8 }, /* 0x12678 = 0x12675 U+309A */
 };
 
-#define MIN_NEEDED_INPUT	MIN_NEEDED_TO
-#define MIN_NEEDED_OUTPUT	MIN_NEEDED_FROM
-#define MAX_NEEDED_OUTPUT	MAX_NEEDED_FROM
+#define MIN_NEEDED_INPUT	TO_LOOP_MIN_NEEDED_FROM
+#define MAX_NEEDED_INPUT	TO_LOOP_MAX_NEEDED_FROM
+#define MIN_NEEDED_OUTPUT	TO_LOOP_MIN_NEEDED_TO
+#define MAX_NEEDED_OUTPUT	TO_LOOP_MAX_NEEDED_TO
 #define LOOPFCT			TO_LOOP
 #define BODY \
   {									      \