about summary refs log tree commit diff
path: root/iconvdata/8bit-gap.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/8bit-gap.c')
-rw-r--r--iconvdata/8bit-gap.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index b633c475b8..c805d5e57c 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -51,12 +51,20 @@ struct gap
     if (HAS_HOLES && ch == L'\0' && *inptr != '\0')			      \
       {									      \
 	/* This is an illegal character.  */				      \
-	result = __GCONV_ILLEGAL_INPUT;					      \
-	break;								      \
+	if (! ignore_errors_p ())					      \
+	  {								      \
+	    result = __GCONV_ILLEGAL_INPUT;				      \
+	    break;							      \
+	  }								      \
+									      \
+	++*converted; 							      \
+      }									      \
+    else								      \
+      {									      \
+	put32 (outptr, ch);						      \
+	outptr += 4;							      \
       }									      \
 									      \
-    put32 (outptr, ch);							      \
-    outptr += 4;							      \
     ++inptr;								      \
   }
 #include <iconv/loop.c>
@@ -75,24 +83,45 @@ struct gap
     if (ch >= 0xffff)							      \
       {									      \
 	/* This is an illegal character.  */				      \
-	result = __GCONV_ILLEGAL_INPUT;					      \
-	break;								      \
+	if (! ignore_errors_p ())					      \
+	  {								      \
+	    result = __GCONV_ILLEGAL_INPUT;				      \
+	    break;							      \
+	  }								      \
+									      \
+	++*converted; 							      \
+	inptr += 4;							      \
+	continue;							      \
       }									      \
     while (ch > rp->end)						      \
       ++rp;								      \
     if (ch < rp->start)							      \
       {									      \
 	/* This is an illegal character.  */				      \
-	result = __GCONV_ILLEGAL_INPUT;					      \
-	break;								      \
+	if (! ignore_errors_p ())					      \
+	  {								      \
+	    result = __GCONV_ILLEGAL_INPUT;				      \
+	    break;							      \
+	  }								      \
+									      \
+	++*converted; 							      \
+	inptr += 4;							      \
+	continue;							      \
       }									      \
 									      \
     res = from_ucs4[ch + rp->idx];					      \
     if (ch != 0 && res == '\0')						      \
       {									      \
 	/* This is an illegal character.  */				      \
-	result = __GCONV_ILLEGAL_INPUT;					      \
-	break;								      \
+	if (! ignore_errors_p ())					      \
+	  {								      \
+	    result = __GCONV_ILLEGAL_INPUT;				      \
+	    break;							      \
+	  }								      \
+									      \
+	++*converted; 							      \
+	inptr += 4;							      \
+	continue;							      \
       }									      \
 									      \
     *outptr++ = res;							      \