changeset 89848:3edfa038a435

(detect_coding_emacs_mule): Fix counting of encoded byte sequence. (detect_coding_ccl): Fix setting of the variable valids.
author Kenichi Handa <handa@m17n.org>
date Mon, 08 Mar 2004 23:15:42 +0000
parents 5caa5e061a07
children 85a6eb05dc8f
files src/coding.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Mar 04 23:33:44 2004 +0000
+++ b/src/coding.c	Mon Mar 08 23:15:42 2004 +0000
@@ -1808,14 +1808,19 @@
 	}
       else
 	{
-	  const unsigned char *src_base = src - 1;
-
-	  do
+	  int more_bytes = emacs_mule_bytes[*src_base] - 1;
+
+	  while (more_bytes > 0)
 	    {
 	      ONE_MORE_BYTE (c);
+	      if (c < 0xA0)
+		{
+		  src--;	/* Unread the last byte.  */
+		  break;
+		}
+	      more_bytes--;
 	    }
-	  while (c >= 0xA0);
-	  if (src - src_base != emacs_mule_bytes[*src_base])
+	  if (more_bytes != 0)
 	    break;
 	  found = CATEGORY_MASK_EMACS_MULE;
 	}
@@ -4354,13 +4359,14 @@
   int multibytep = coding->src_multibyte;
   int consumed_chars = 0;
   int found = 0;
-  unsigned char *valids = CODING_CCL_VALIDS (coding);
+  unsigned char *valids;
   int head_ascii = coding->head_ascii;
   Lisp_Object attrs;
 
   detect_info->checked |= CATEGORY_MASK_CCL;
 
   coding = &coding_categories[coding_category_ccl];
+  valids = CODING_CCL_VALIDS (coding);
   attrs = CODING_ID_ATTRS (coding->id);
   if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
     src += head_ascii;