diff src/coding.c @ 111743:913b779aa4ee

Fix decoding of emacs-mule coding system.
author Kenichi Handa <handa@m17n.org>
date Thu, 25 Nov 2010 12:55:14 +0900
parents b87d8337c695
children 141d3f14d8c3 376148b31b5e
line wrap: on
line diff
--- a/src/coding.c	Wed Oct 20 09:46:21 2010 +0900
+++ b/src/coding.c	Thu Nov 25 12:55:14 2010 +0900
@@ -2078,7 +2078,7 @@
   const unsigned char *src_end = coding->source + coding->src_bytes;
   const unsigned char *src_base = src;
   int multibytep = coding->src_multibyte;
-  struct charset *charset;
+  int charset_id;
   unsigned code;
   int c;
   int consumed_chars = 0;
@@ -2088,7 +2088,7 @@
   if (c < 0)
     {
       c = -c;
-      charset = emacs_mule_charset[0];
+      charset_id = emacs_mule_charset[0];
     }
   else
     {
@@ -2124,7 +2124,7 @@
       switch (emacs_mule_bytes[c])
 	{
 	case 2:
-	  if (! (charset = emacs_mule_charset[c]))
+	  if ((charset_id = emacs_mule_charset[c]) < 0)
 	    goto invalid_code;
 	  ONE_MORE_BYTE (c);
 	  if (c < 0xA0)
@@ -2137,7 +2137,7 @@
 	      || c == EMACS_MULE_LEADING_CODE_PRIVATE_12)
 	    {
 	      ONE_MORE_BYTE (c);
-	      if (c < 0xA0 || ! (charset = emacs_mule_charset[c]))
+	      if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0)
 		goto invalid_code;
 	      ONE_MORE_BYTE (c);
 	      if (c < 0xA0)
@@ -2146,7 +2146,7 @@
 	    }
 	  else
 	    {
-	      if (! (charset = emacs_mule_charset[c]))
+	      if ((charset_id = emacs_mule_charset[c]) < 0)
 		goto invalid_code;
 	      ONE_MORE_BYTE (c);
 	      if (c < 0xA0)
@@ -2161,7 +2161,7 @@
 
 	case 4:
 	  ONE_MORE_BYTE (c);
-	  if (c < 0 || ! (charset = emacs_mule_charset[c]))
+	  if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0)
 	    goto invalid_code;
 	  ONE_MORE_BYTE (c);
 	  if (c < 0xA0)
@@ -2175,21 +2175,21 @@
 
 	case 1:
 	  code = c;
-	  charset = CHARSET_FROM_ID (ASCII_BYTE_P (code)
-				     ? charset_ascii : charset_eight_bit);
+	  charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
 	  break;
 
 	default:
 	  abort ();
 	}
-      CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, code, c);
+      CODING_DECODE_CHAR (coding, src, src_base, src_end,
+			  CHARSET_FROM_ID (charset_id), code, c);
       if (c < 0)
 	goto invalid_code;
     }
   *nbytes = src - src_base;
   *nchars = consumed_chars;
   if (id)
-    *id = charset->id;
+    *id = charset_id;
   return (mseq_found ? -c : c);
 
  no_more_source: