about summary refs log tree commit diff
path: root/iconvdata/euckr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-26 10:28:28 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-26 10:28:28 +0000
commitbc900b1118e1fc7b065b37e4d28aa7c998ce5a66 (patch)
treea357833b862e355303d57f645f5e2d52f3e775c3 /iconvdata/euckr.c
parent918b9d72a9980efd4622bd25506da9531a952dbe (diff)
downloadglibc-bc900b1118e1fc7b065b37e4d28aa7c998ce5a66.tar.gz
glibc-bc900b1118e1fc7b065b37e4d28aa7c998ce5a66.tar.xz
glibc-bc900b1118e1fc7b065b37e4d28aa7c998ce5a66.zip
Update.
1998-04-26  Ulrich Drepper  <drepper@cygnus.com>

	* iconvdata/gconv-modules: Add entry for ISO-2022-JP and
	ISO-2022-JP-2.
Diffstat (limited to 'iconvdata/euckr.c')
-rw-r--r--iconvdata/euckr.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/iconvdata/euckr.c b/iconvdata/euckr.c
index 1a2ff89568..61046b392b 100644
--- a/iconvdata/euckr.c
+++ b/iconvdata/euckr.c
@@ -28,13 +28,11 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
 {
   if (ch > 0x7f)
     {
-      uint16_t idx = 0;
-
-      if (ucs4_to_ksc5601 (ch, &idx))
-	idx |= 0x8080;
-
-      cp[0] = (unsigned char) (idx / 256);
-      cp[1] = (unsigned char) (idx & 0xff);
+      if (ucs4_to_ksc5601 (ch, cp, 2) != UNKNOWN_10646_CHAR)
+	{
+	  cp[0] |= 0x80;
+	  cp[1] |= 0x80;
+	}
     }
   /* XXX Think about 0x5c ; '\'.  */
   else
@@ -89,14 +87,14 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
 	/* Two-byte character.  First test whether the next character	      \
 	   is also available.  */					      \
 	ch = ksc5601_to_ucs4 (&inptr,					      \
-			      NEED_LENGTH_TEST ? inptr - inbufend : 2, x080); \
+			      NEED_LENGTH_TEST ? inptr - inend : 2, 0x80);    \
 	if (NEED_LENGTH_TEST && ch == 0)				      \
 	  {								      \
 	    /* The second character is not available.  */		      \
 	    result = GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
 	  }								      \
-	if (ch == UNKNOWN_10646_CHAR))					      \
+	if (ch == UNKNOWN_10646_CHAR)					      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    result = GCONV_ILLEGAL_INPUT;				      \