From be91f858adbb54be83da5bf1820142a6ff6d34c6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 28 Jul 1999 04:33:39 +0000 Subject: [PATCH] (euckr_from_ucs4): Set cp[0] to '\0' in case of an error. --- iconvdata/euc-kr.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c index 61046b392b2..f74d7748f9f 100644 --- a/iconvdata/euc-kr.c +++ b/iconvdata/euc-kr.c @@ -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 and Ulrich Drepper , 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]; \ -- 2.47.3