changeset 103442:db4ec1a977bd

(detect_coding_utf_16): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Tue, 16 Jun 2009 01:59:44 +0000
parents d08523c14cca
children e35644283ff0
files src/coding.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Tue Jun 16 01:17:10 2009 +0000
+++ b/src/coding.c	Tue Jun 16 01:59:44 2009 +0000
@@ -1665,10 +1665,11 @@
       e[c1] = 1;
       o[c2] = 1;
 
-      detect_info->rejected
-	|= (CATEGORY_MASK_UTF_16_BE | CATEGORY_MASK_UTF_16_LE);
-
-      while (1)
+      detect_info->rejected |= (CATEGORY_MASK_UTF_16_AUTO
+				|CATEGORY_MASK_UTF_16_BE
+				| CATEGORY_MASK_UTF_16_LE);
+
+      while (detect_info->rejected != CATEGORY_MASK_UTF_16)
 	{
 	  TWO_MORE_BYTES (c1, c2);
 	  if (c2 < 0)
@@ -1677,18 +1678,17 @@
 	    {
 	      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;
     }