]> git.eshelyaron.com Git - emacs.git/commitdiff
(detect_coding_mask): Fix previous change.
authorKenichi Handa <handa@m17n.org>
Fri, 11 Jan 2008 11:30:25 +0000 (11:30 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 11 Jan 2008 11:30:25 +0000 (11:30 +0000)
src/ChangeLog
src/coding.c

index 18b1e04a1d75a23af9bfe13517eb21c2eda83fb2..d56550fb1a34369459b59d4c8a1d043fe8e3baa9 100644 (file)
@@ -1,3 +1,7 @@
+2008-01-11  Kenichi Handa  <handa@ni.aist.go.jp>
+
+       * coding.c (detect_coding_mask): Fix previous change.
+
 2008-01-10  Chong Yidong  <cyd@stupidchicken.com>
 
        * process.c (wait_reading_process_output): Check for window
index 4e4147370cb2216fbe392f69b287a9b91ac6aaaa..dda3f0f854cd818f9b2bc6073cebf705b503e2d8 100644 (file)
@@ -4153,12 +4153,16 @@ detect_coding_mask (source, src_bytes, priorities, skip, multibytep)
 
  label_loop_detect_coding:
   null_byte_found = 0;
-  while (src < src_end && ascii_skip_code[*src])
+  /* We stop this loop before the last byte because it may be a NULL
+     anchor byte.  */
+  while (src < src_end - 1 && ascii_skip_code[*src])
     null_byte_found |= (! *src++);
-  if (! null_byte_found)
+  if (ascii_skip_code[*src])
+    src++;
+  else if (! null_byte_found)
     {
       unsigned char *p = src + 1;
-      while (p < src_end)
+      while (p < src_end - 1)
        null_byte_found |= (! *p++);
     }
   *skip = src - source;