changeset 100936:5c5e6d041634

(decode_coding_utf_8): Check byte_after_cr before breaking the loop. (decode_coding_utf_16, decode_coding_emacs_mule) (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5) (decode_coding_charset): Likewise.
author Kenichi Handa <handa@m17n.org>
date Wed, 07 Jan 2009 06:49:37 +0000
parents e55ce6002e3d
children 85686225ed37
files src/coding.c
diffstat 1 files changed, 35 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Wed Jan 07 02:15:37 2009 +0000
+++ b/src/coding.c	Wed Jan 07 06:49:37 2009 +0000
@@ -1376,7 +1376,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	c1 = byte_after_cr, byte_after_cr = -1;
@@ -1682,7 +1686,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf + 2 >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr1 >= 0)
+	    src_base -= 2;
+	  break;
+	}
 
       if (byte_after_cr1 >= 0)
 	c1 = byte_after_cr1, byte_after_cr1 = -1;
@@ -2286,7 +2294,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	c = byte_after_cr, byte_after_cr = -1;
@@ -3197,7 +3209,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	c1 = byte_after_cr, byte_after_cr = -1;
@@ -4371,7 +4387,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	c = byte_after_cr, byte_after_cr = -1;
@@ -4479,7 +4499,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	c = byte_after_cr, byte_after_cr = -1;
@@ -5144,7 +5168,11 @@
       consumed_chars_base = consumed_chars;
 
       if (charbuf >= charbuf_end)
-	break;
+	{
+	  if (byte_after_cr >= 0)
+	    src_base--;
+	  break;
+	}
 
       if (byte_after_cr >= 0)
 	{