Change all uses of __is_last.
authordrepper <drepper>
Tue, 6 Jun 2000 03:07:19 +0000 (03:07 +0000)
committerdrepper <drepper>
Tue, 6 Jun 2000 03:07:19 +0000 (03:07 +0000)
Don't return error for invald error if ignore flag is set.

iconvdata/iso-2022-cn.c
iconvdata/iso-2022-jp.c
iconvdata/iso-2022-kr.c

index 5ffbfa5..c89fc57 100644 (file)
@@ -93,7 +93,7 @@ enum
            {                                                                 \
              /* Write out the shift sequence.  */                            \
              *outbuf++ = SI;                                                 \
-             if (data->__is_last)                                            \
+             if (data->__flags & __GCONV_IS_LAST)                            \
                *written += 1;                                                \
              data->__outbuf = outbuf;                                        \
              data->__statep->__count = ASCII_set;                            \
@@ -123,8 +123,15 @@ enum
     /* This is a 7bit character set, disallow all 8bit characters.  */       \
     if (ch > 0x7f)                                                           \
       {                                                                              \
-       result = __GCONV_ILLEGAL_INPUT;                                       \
-       break;                                                                \
+       if (! ignore_errors_p ())                                             \
+         {                                                                   \
+           result = __GCONV_ILLEGAL_INPUT;                                   \
+           break;                                                            \
+         }                                                                   \
+                                                                             \
+       ++inptr;                                                              \
+       ++*converted;                                                         \
+       continue;                                                             \
       }                                                                              \
                                                                              \
     /* Recognize escape sequences.  */                                       \
@@ -187,9 +194,16 @@ enum
        ch = cns11643l2_to_ucs4 (&inptr, 2, 0);                               \
        if (ch == __UNKNOWN_10646_CHAR)                                       \
          {                                                                   \
-           inptr -= 2;                                                       \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               /* This is an illegal character.  */                          \
+               inptr -= 2;                                                   \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
       }                                                                              \
     else if (set == ASCII_set)                                               \
@@ -217,8 +231,16 @@ enum
          }                                                                   \
        else if (ch == __UNKNOWN_10646_CHAR)                                  \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               /* This is an illegal character.  */                          \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++inptr;                                                          \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
       }                                                                              \
                                                                              \
@@ -305,8 +327,15 @@ enum
                else                                                          \
                  {                                                           \
                    /* Even this does not work.  Error.  */                   \
-                   result = __GCONV_ILLEGAL_INPUT;                           \
-                   break;                                                    \
+                   if (! ignore_errors_p ())                                 \
+                     {                                                       \
+                       result = __GCONV_ILLEGAL_INPUT;                       \
+                       break;                                                \
+                     }                                                       \
+                                                                             \
+                   inptr += 4;                                               \
+                   ++*converted;                                             \
+                   continue;                                                 \
                  }                                                           \
              }                                                               \
          }                                                                   \
index 105fd47..51420fb 100644 (file)
@@ -217,7 +217,7 @@ gconv_end (struct __gconv_step *data)
              *outbuf++ = ESC;                                                \
              *outbuf++ = '(';                                                \
              *outbuf++ = 'B';                                                \
-             if (data->__is_last)                                            \
+             if (data->__flags & __GCONV_IS_LAST)                            \
                *written += 3;                                                \
              data->__outbuf = outbuf;                                        \
              /* Note that this also clears the G2 designation.  */           \
@@ -362,21 +362,42 @@ gconv_end (struct __gconv_step *data)
            /* We use the table from the ISO 8859-7 module.  */               \
            if (inptr[2] < 0x20 || inptr[2] > 0x80)                           \
              {                                                               \
-               result = __GCONV_ILLEGAL_INPUT;                               \
-               break;                                                        \
+               if (! ignore_errors_p ())                                     \
+                 {                                                           \
+                   result = __GCONV_ILLEGAL_INPUT;                           \
+                   break;                                                    \
+                 }                                                           \
+                                                                             \
+               ++inptr;                                                      \
+               ++*converted;                                                 \
+               continue;                                                     \
              }                                                               \
            ch = iso88597_to_ucs4[inptr[2] - 0x20];                           \
            if (ch == 0)                                                      \
              {                                                               \
-               result = __GCONV_ILLEGAL_INPUT;                               \
-               break;                                                        \
+               if (! ignore_errors_p ())                                     \
+                 {                                                           \
+                   result = __GCONV_ILLEGAL_INPUT;                           \
+                   break;                                                    \
+                 }                                                           \
+                                                                             \
+               inptr += 3;                                                   \
+               ++*converted;                                                 \
+               continue;                                                     \
              }                                                               \
            inptr += 3;                                                       \
          }                                                                   \
        else                                                                  \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++inptr;                                                          \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
       }                                                                              \
     else if (set == ASCII_set || (ch < 0x21 || ch == 0x7f))                  \
@@ -388,8 +409,15 @@ gconv_end (struct __gconv_step *data)
        ch = jisx0201_to_ucs4 (ch);                                           \
        if (ch == __UNKNOWN_10646_CHAR)                                       \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++inptr;                                                          \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
        ++inptr;                                                              \
       }                                                                              \
@@ -399,8 +427,15 @@ gconv_end (struct __gconv_step *data)
        ch = jisx0201_to_ucs4 (ch + 0x80);                                    \
        if (ch == __UNKNOWN_10646_CHAR)                                       \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++inptr;                                                          \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
        ++inptr;                                                              \
       }                                                                              \
@@ -437,8 +472,15 @@ gconv_end (struct __gconv_step *data)
          }                                                                   \
        else if (ch == __UNKNOWN_10646_CHAR)                                  \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++inptr;                                                          \
+           ++*converted;                                                     \
+           continue;                                                         \
          }                                                                   \
       }                                                                              \
                                                                              \
@@ -672,8 +714,13 @@ gconv_end (struct __gconv_step *data)
                else if (var == iso2022jp)                                    \
                  {                                                           \
                    /* We have no other choice.  */                           \
-                   result = __GCONV_ILLEGAL_INPUT;                           \
-                   break;                                                    \
+                   if (! ignore_errors_p ())                                 \
+                     {                                                       \
+                       result = __GCONV_ILLEGAL_INPUT;                       \
+                       break;                                                \
+                     }                                                       \
+                                                                             \
+                   ++*converted;                                             \
                  }                                                           \
                else                                                          \
                  {                                                           \
@@ -839,8 +886,13 @@ gconv_end (struct __gconv_step *data)
                                      }                                       \
                                    else                                      \
                                      {                                       \
-                                       result = __GCONV_ILLEGAL_INPUT;       \
-                                       break;                                \
+                                       if (! ignore_errors_p ())             \
+                                         {                                   \
+                                            result = __GCONV_ILLEGAL_INPUT;  \
+                                            break;                           \
+                                         }                                   \
+                                                                             \
+                                       ++*converted;                         \
                                      }                                       \
                                  }                                           \
                              }                                               \
index ab03472..e6db8c4 100644 (file)
@@ -95,7 +95,7 @@ enum
            {                                                                 \
              /* Write out the shift sequence.  */                            \
              *outbuf++ = SI;                                                 \
-             if (data->__is_last)                                            \
+             if (data->__flags & __GCONV_IS_LAST)                            \
                *written += 1;                                                \
              data->__outbuf = outbuf;                                        \
              data->__statep->__count = ASCII_set;                            \
@@ -125,8 +125,15 @@ enum
     /* This is a 7bit character set, disallow all 8bit characters.  */       \
     if (ch > 0x7f)                                                           \
       {                                                                              \
-       result = __GCONV_ILLEGAL_INPUT;                                       \
-       break;                                                                \
+       if (! ignore_errors_p ())                                             \
+         {                                                                   \
+           result = __GCONV_ILLEGAL_INPUT;                                   \
+           break;                                                            \
+         }                                                                   \
+                                                                             \
+       ++inptr;                                                              \
+       ++*converted;                                                         \
+       continue;                                                             \
       }                                                                              \
                                                                              \
     /* Recognize escape sequences.  */                                       \
@@ -187,8 +194,16 @@ enum
          }                                                                   \
        else if (ch == __UNKNOWN_10646_CHAR)                                  \
          {                                                                   \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               /* This is an illegal character.  */                          \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
+                                                                             \
+           ++*converted;                                                     \
+           ++inptr;                                                          \
+           continue;                                                         \
          }                                                                   \
       }                                                                              \
                                                                              \
@@ -240,26 +255,34 @@ enum
        if (written == __UNKNOWN_10646_CHAR)                                  \
          {                                                                   \
            /* Illegal character.  */                                         \
-           result = __GCONV_ILLEGAL_INPUT;                                   \
-           break;                                                            \
-         }                                                                   \
-       assert (written == 2);                                                \
+           if (! ignore_errors_p ())                                         \
+             {                                                               \
+               result = __GCONV_ILLEGAL_INPUT;                               \
+               break;                                                        \
+             }                                                               \
                                                                              \
-       /* We use KSC 5601.  */                                               \
-       if (set != KSC5601_set)                                               \
-         {                                                                   \
-           *outptr++ = SO;                                                   \
-           set = KSC5601_set;                                                \
+           ++*converted;                                                     \
          }                                                                   \
-                                                                             \
-       if (NEED_LENGTH_TEST && outptr + 2 > outend)                          \
+       else                                                                  \
          {                                                                   \
-           result = __GCONV_FULL_OUTPUT;                                     \
-           break;                                                            \
-         }                                                                   \
+           assert (written == 2);                                            \
+                                                                             \
+           /* We use KSC 5601.  */                                           \
+           if (set != KSC5601_set)                                           \
+             {                                                               \
+               *outptr++ = SO;                                               \
+               set = KSC5601_set;                                            \
+             }                                                               \
+                                                                             \
+           if (NEED_LENGTH_TEST && outptr + 2 > outend)                      \
+             {                                                               \
+               result = __GCONV_FULL_OUTPUT;                                 \
+               break;                                                        \
+             }                                                               \
                                                                              \
-       *outptr++ = buf[0];                                                   \
-       *outptr++ = buf[1];                                                   \
+           *outptr++ = buf[0];                                               \
+           *outptr++ = buf[1];                                               \
+         }                                                                   \
       }                                                                              \
                                                                              \
     /* Now that we wrote the output increment the input pointer.  */         \