Mercurial > emacs
changeset 87710:df9e1c663162
(detect_coding_mask): Fix previous change.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 11 Jan 2008 11:28:45 +0000 |
parents | a3cca415f9e6 |
children | 7dc75a6bfb38 |
files | src/coding.c |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coding.c Fri Jan 11 09:59:48 2008 +0000 +++ b/src/coding.c Fri Jan 11 11:28:45 2008 +0000 @@ -4153,12 +4153,16 @@ 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;