comparison src/coding.c @ 87710:df9e1c663162

(detect_coding_mask): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Fri, 11 Jan 2008 11:28:45 +0000
parents 2aeceff24280
children 0ec6f8d26078
comparison
equal deleted inserted replaced
87709:a3cca415f9e6 87710:df9e1c663162
4151 ascii_skip_code[ISO_CODE_SI] = 0; 4151 ascii_skip_code[ISO_CODE_SI] = 0;
4152 ascii_skip_code[ISO_CODE_ESC] = 0; 4152 ascii_skip_code[ISO_CODE_ESC] = 0;
4153 4153
4154 label_loop_detect_coding: 4154 label_loop_detect_coding:
4155 null_byte_found = 0; 4155 null_byte_found = 0;
4156 while (src < src_end && ascii_skip_code[*src]) 4156 /* We stop this loop before the last byte because it may be a NULL
4157 anchor byte. */
4158 while (src < src_end - 1 && ascii_skip_code[*src])
4157 null_byte_found |= (! *src++); 4159 null_byte_found |= (! *src++);
4158 if (! null_byte_found) 4160 if (ascii_skip_code[*src])
4161 src++;
4162 else if (! null_byte_found)
4159 { 4163 {
4160 unsigned char *p = src + 1; 4164 unsigned char *p = src + 1;
4161 while (p < src_end) 4165 while (p < src_end - 1)
4162 null_byte_found |= (! *p++); 4166 null_byte_found |= (! *p++);
4163 } 4167 }
4164 *skip = src - source; 4168 *skip = src - source;
4165 4169
4166 if (src >= src_end) 4170 if (src >= src_end)