diff src/mule-ccl.c @ 3690:d6a215ad08b8

[xemacs-hg @ 2006-11-20 19:21:47 by aidan] Eliminate a couple of CCL bugs with control-1 characters.
author aidan
date Mon, 20 Nov 2006 19:21:56 +0000
parents 551c008d3777
children aa28d959af41
line wrap: on
line diff
--- a/src/mule-ccl.c	Sun Nov 19 22:51:04 2006 +0000
+++ b/src/mule-ccl.c	Mon Nov 20 19:21:56 2006 +0000
@@ -850,13 +850,17 @@
    macro is only used in the MuleToUnicode transformation.  */
 #define CCL_MAKE_CHAR(charset, code, c)				\
   do {								\
+                                                                \
+    if (!POSSIBLE_LEADING_BYTE_P(charset))                      \
+      CCL_INVALID_CMD;                                          \
+                                                                \
     if ((charset) == LEADING_BYTE_ASCII)			\
       {								\
 	c = (code) & 0xFF;					\
       }								\
     else if ((charset) == LEADING_BYTE_CONTROL_1)		\
       {								\
-	c = ((code) & 0xFF) - 0xA0;				\
+	c = ((code) & 0x1F) + 0x80;				\
       }								\
     else if (!NILP(charset_by_leading_byte(charset))		\
 	     && ((code) >= 32)					\
@@ -1390,7 +1394,7 @@
 	      if (i == LEADING_BYTE_ASCII) 
 		i = reg[rrr] & 0xFF;
 	      else if (LEADING_BYTE_CONTROL_1 == i)
-		i = ((reg[rrr] & 0xFF) - 0xA0);
+		i = ((reg[rrr] & 0x1F) + 0x80);
 	      else if (POSSIBLE_LEADING_BYTE_P(i) &&
 		       !NILP(charset_by_leading_byte(i)))
 		{