diff options
author | Kenichi Handa <handa@m17n.org> | 2009-06-16 02:04:25 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2009-06-16 02:04:25 +0000 |
commit | cc13543e84480b8361da607ba9b859c9bd2f42d5 (patch) | |
tree | f9837d577556a757ceaad25c5b61006fa4442762 | |
parent | 9c6d2887cd59552a64247426dbfddfc8a610b2ee (diff) | |
download | emacs-cc13543e84480b8361da607ba9b859c9bd2f42d5.tar.gz |
(detect_coding_utf_16): Fix previous change.
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/coding.c | 16 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bc4ce2aa0af..6a6e90aafb9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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> * coding.c (detect_coding_utf_16): Fix typo counting odd bytes. diff --git a/src/coding.c b/src/coding.c index 8d90297db0f..cde56d9af42 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1665,10 +1665,11 @@ detect_coding_utf_16 (coding, detect_info) e[c1] = 1; o[c2] = 1; - detect_info->rejected - |= (CATEGORY_MASK_UTF_16_BE | CATEGORY_MASK_UTF_16_LE); + detect_info->rejected |= (CATEGORY_MASK_UTF_16_AUTO + |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); if (c2 < 0) @@ -1677,18 +1678,17 @@ detect_coding_utf_16 (coding, detect_info) { e[c1] = 1; e_num++; - if (e_num >= 128 && o_num >= 128) - break; + if (e_num >= 128) + detect_info->rejected |= CATEGORY_MASK_UTF_16_BE_NOSIG; } if (! o[c2]) { o[c2] = 1; o_num++; - if (e_num >= 128 && o_num >= 128) - break; + if (o_num >= 128) + detect_info->rejected |= CATEGORY_MASK_UTF_16_LE_NOSIG; } } - detect_info->rejected |= CATEGORY_MASK_UTF_16; return 0; } |