1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

(detect_coding_utf_16): Fix previous change.

This commit is contained in:
Kenichi Handa 2009-06-16 02:04:25 +00:00
parent 9c6d2887cd
commit cc13543e84
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2009-06-16 Kenichi Handa <handa@m17n.org>
* coding.c (detect_coding_utf_16): Fix the logic of rejecting
UTF-16 by checking the dispersion of Eth and Oth bytes.
2009-06-15 Andreas Schwab <schwab@linux-m68k.org> 2009-06-15 Andreas Schwab <schwab@linux-m68k.org>
* coding.c (detect_coding_utf_16): Fix typo counting odd bytes. * coding.c (detect_coding_utf_16): Fix typo counting odd bytes.

View file

@ -1665,10 +1665,11 @@ detect_coding_utf_16 (coding, detect_info)
e[c1] = 1; e[c1] = 1;
o[c2] = 1; o[c2] = 1;
detect_info->rejected detect_info->rejected |= (CATEGORY_MASK_UTF_16_AUTO
|= (CATEGORY_MASK_UTF_16_BE | CATEGORY_MASK_UTF_16_LE); |CATEGORY_MASK_UTF_16_BE
| CATEGORY_MASK_UTF_16_LE);
while (1) while (detect_info->rejected != CATEGORY_MASK_UTF_16)
{ {
TWO_MORE_BYTES (c1, c2); TWO_MORE_BYTES (c1, c2);
if (c2 < 0) if (c2 < 0)
@ -1677,18 +1678,17 @@ detect_coding_utf_16 (coding, detect_info)
{ {
e[c1] = 1; e[c1] = 1;
e_num++; e_num++;
if (e_num >= 128 && o_num >= 128) if (e_num >= 128)
break; detect_info->rejected |= CATEGORY_MASK_UTF_16_BE_NOSIG;
} }
if (! o[c2]) if (! o[c2])
{ {
o[c2] = 1; o[c2] = 1;
o_num++; o_num++;
if (e_num >= 128 && o_num >= 128) if (o_num >= 128)
break; detect_info->rejected |= CATEGORY_MASK_UTF_16_LE_NOSIG;
} }
} }
detect_info->rejected |= CATEGORY_MASK_UTF_16;
return 0; return 0;
} }