]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(euckr_from_ucs4): Set cp[0] to '\0' in case of an error.
authorUlrich Drepper <drepper@redhat.com>
Wed, 28 Jul 1999 04:33:39 +0000 (04:33 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 28 Jul 1999 04:33:39 +0000 (04:33 +0000)
iconvdata/euc-kr.c

index 61046b392b26993f69f31f8bedf277a5f7707fe3..f74d7748f9f3cca914ec0bd33a901c5fb44f9a05 100644 (file)
@@ -1,5 +1,5 @@
 /* Mapping tables for EUC-KR handling.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
    and Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -28,11 +28,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
 {
   if (ch > 0x7f)
     {
-      if (ucs4_to_ksc5601 (ch, cp, 2) != UNKNOWN_10646_CHAR)
+      if (ucs4_to_ksc5601 (ch, cp, 2) != __UNKNOWN_10646_CHAR)
        {
          cp[0] |= 0x80;
          cp[1] |= 0x80;
        }
+      else
+       cp[0] = '\0';
     }
   /* XXX Think about 0x5c ; '\'.  */
   else
@@ -79,7 +81,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
     else if (ch <= 0xa0 || ch > 0xfe || ch == 0xc9)                          \
       {                                                                              \
        /* This is illegal.  */                                               \
-       result = GCONV_ILLEGAL_INPUT;                                         \
+       result = __GCONV_ILLEGAL_INPUT;                                       \
        break;                                                                \
       }                                                                              \
     else                                                                     \
@@ -91,13 +93,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
        if (NEED_LENGTH_TEST && ch == 0)                                      \
          {                                                                   \
            /* The second character is not available.  */                     \
-           result = GCONV_INCOMPLETE_INPUT;                                  \
+           result = __GCONV_INCOMPLETE_INPUT;                                \
            break;                                                            \
          }                                                                   \
-       if (ch == UNKNOWN_10646_CHAR)                                         \
+       if (ch == __UNKNOWN_10646_CHAR)                                       \
          {                                                                   \
            /* This is an illegal character.  */                              \
-           result = GCONV_ILLEGAL_INPUT;                                     \
+           result = __GCONV_ILLEGAL_INPUT;                                   \
            break;                                                            \
          }                                                                   \
       }                                                                              \
@@ -124,7 +126,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
     if (cp[0] == '\0' && ch != 0)                                            \
       {                                                                              \
        /* Illegal character.  */                                             \
-       result = GCONV_ILLEGAL_INPUT;                                         \
+       result = __GCONV_ILLEGAL_INPUT;                                       \
        break;                                                                \
       }                                                                              \
                                                                              \
@@ -136,7 +138,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
          {                                                                   \
            /* The result does not fit into the buffer.  */                   \
            --outptr;                                                         \
-           result = GCONV_FULL_OUTPUT;                                       \
+           result = __GCONV_FULL_OUTPUT;                                     \
            break;                                                            \
          }                                                                   \
        *outptr++ = cp[1];                                                    \