changeset 54320:a7e59b39de35

(decode_coding_emacs_mule): Handle insufficent source correctly.
author Kenichi Handa <handa@m17n.org>
date Tue, 09 Mar 2004 12:27:04 +0000
parents 2d1d046af00a
children 62092d234b96
files src/coding.c
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Tue Mar 09 01:25:27 2004 +0000
+++ b/src/coding.c	Tue Mar 09 12:27:04 2004 +0000
@@ -1024,9 +1024,26 @@
 	}
       else
 	{
-	  bytes = CHAR_STRING (*src, tmp);
-	  p = tmp;
+	  int i, c;
+
+	  bytes = BYTES_BY_CHAR_HEAD (*src);
 	  src++;
+	  for (i = 1; i < bytes; i++)
+	    {
+	      ONE_MORE_BYTE (c);
+	      if (CHAR_HEAD_P (c))
+		break;
+	    }
+	  if (i < bytes)
+	    {
+	      bytes = CHAR_STRING (*src_base, tmp);
+	      p = tmp;
+	      src = src_base + 1;
+	    }
+	  else
+	    {
+	      p = src_base;
+	    }
 	}
       if (dst + bytes >= (dst_bytes ? dst_end : src))
 	{