changeset 89459:3e4c75be8383

(read_process_output): Handle carryover correctly.
author Kenichi Handa <handa@m17n.org>
date Thu, 05 Jun 2003 07:16:49 +0000
parents 1cab1d5a568e
children 57ba655366c4
files src/process.c
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Mon Jun 02 18:29:17 2003 +0000
+++ b/src/process.c	Thu Jun 05 07:16:49 2003 +0000
@@ -3050,10 +3050,12 @@
 	    }
 	}
 
-      carryover = nbytes - coding->consumed;
-      bcopy (chars + coding->consumed, XSTRING (p->decoding_buf)->data,
-	     carryover);
-      XSETINT (p->decoding_carryover, carryover);
+      if (coding->carryover_bytes > 0)
+	{
+	  bcopy (coding->carryover, XSTRING (p->decoding_buf)->data,
+		 coding->carryover_bytes);
+	  XSETINT (p->decoding_carryover, coding->carryover_bytes);
+	}
       nbytes = STRING_BYTES (XSTRING (text));
       nchars = XSTRING (text)->size;
       if (nbytes > 0)
@@ -3151,10 +3153,12 @@
 				   proc_encode_coding_system[XINT (p->outfd)]);
 	    }
 	}
-      carryover = nbytes - coding->consumed;
-      bcopy (chars + coding->consumed, XSTRING (p->decoding_buf)->data,
-	     carryover);
-      XSETINT (p->decoding_carryover, carryover);
+      if (coding->carryover_bytes > 0)
+	{
+	  bcopy (coding->carryover, XSTRING (p->decoding_buf)->data,
+		 coding->carryover_bytes);
+	  XSETINT (p->decoding_carryover, coding->carryover_bytes);
+	}
       /* Adjust the multibyteness of TEXT to that of the buffer.  */
       if (NILP (current_buffer->enable_multibyte_characters)
 	  != ! STRING_MULTIBYTE (text))