Don't return error for invald error if ignore flag is set.
[kopensolaris-gnu/glibc.git] / iconvdata / 8bit-generic.c
index 3543bdf..3b6b47a 100644 (file)
     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;                                                         \
       }                                                                              \
                                                                              \
     put32 (outptr, ch);                                                              \
        || (ch != 0 && from_ucs4[ch] == '\0'))                                \
       {                                                                              \
        /* This is an illegal character.  */                                  \
-       result = __GCONV_ILLEGAL_INPUT;                                       \
-       break;                                                                \
+       if (! ignore_errors_p ())                                             \
+         {                                                                   \
+           result = __GCONV_ILLEGAL_INPUT;                                   \
+           break;                                                            \
+         }                                                                   \
+                                                                             \
+       ++*converted;                                                         \
       }                                                                              \
+    else                                                                     \
+      *outptr++ = from_ucs4[ch];                                             \
                                                                              \
-    *outptr++ = from_ucs4[ch];                                               \
     inptr += 4;                                                                      \
   }
 #include <iconv/loop.c>