From: Kenichi Handa Date: Fri, 11 Jan 2008 11:30:25 +0000 (+0000) Subject: (detect_coding_mask): Fix previous change. X-Git-Tag: emacs-pretest-23.0.90~8598 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=81cd7687abd636f4c9b4cc380909ab6a69b88d74;p=emacs.git (detect_coding_mask): Fix previous change. --- diff --git a/src/ChangeLog b/src/ChangeLog index 18b1e04a1d7..d56550fb1a3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-01-11 Kenichi Handa + + * coding.c (detect_coding_mask): Fix previous change. + 2008-01-10 Chong Yidong * process.c (wait_reading_process_output): Check for window diff --git a/src/coding.c b/src/coding.c index 4e4147370cb..dda3f0f854c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -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;