aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/coding.c b/src/coding.c
index bdfe771209a..9121d637b35 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -4537,7 +4537,6 @@ encode_coding_ccl (coding)
4537 int *charbuf_end = charbuf + coding->charbuf_used; 4537 int *charbuf_end = charbuf + coding->charbuf_used;
4538 unsigned char *dst = coding->destination + coding->produced; 4538 unsigned char *dst = coding->destination + coding->produced;
4539 unsigned char *dst_end = coding->destination + coding->dst_bytes; 4539 unsigned char *dst_end = coding->destination + coding->dst_bytes;
4540 unsigned char *adjusted_dst_end = dst_end - 1;
4541 int destination_charbuf[1024]; 4540 int destination_charbuf[1024];
4542 int i, produced_chars = 0; 4541 int i, produced_chars = 0;
4543 Lisp_Object attrs, charset_list; 4542 Lisp_Object attrs, charset_list;
@@ -4548,24 +4547,27 @@ encode_coding_ccl (coding)
4548 ccl.last_block = coding->mode & CODING_MODE_LAST_BLOCK; 4547 ccl.last_block = coding->mode & CODING_MODE_LAST_BLOCK;
4549 ccl.dst_multibyte = coding->dst_multibyte; 4548 ccl.dst_multibyte = coding->dst_multibyte;
4550 4549
4551 while (charbuf < charbuf_end && dst < adjusted_dst_end) 4550 while (charbuf < charbuf_end)
4552 { 4551 {
4553 int dst_bytes = dst_end - dst;
4554 if (dst_bytes > 1024)
4555 dst_bytes = 1024;
4556
4557 ccl_driver (&ccl, charbuf, destination_charbuf, 4552 ccl_driver (&ccl, charbuf, destination_charbuf,
4558 charbuf_end - charbuf, dst_bytes, charset_list); 4553 charbuf_end - charbuf, 1024, charset_list);
4559 charbuf += ccl.consumed;
4560 if (multibytep) 4554 if (multibytep)
4561 for (i = 0; i < ccl.produced; i++) 4555 {
4562 EMIT_ONE_BYTE (destination_charbuf[i] & 0xFF); 4556 ASSURE_DESTINATION (ccl.produced * 2);
4557 for (i = 0; i < ccl.produced; i++)
4558 EMIT_ONE_BYTE (destination_charbuf[i] & 0xFF);
4559 }
4563 else 4560 else
4564 { 4561 {
4562 ASSURE_DESTINATION (ccl.produced);
4565 for (i = 0; i < ccl.produced; i++) 4563 for (i = 0; i < ccl.produced; i++)
4566 *dst++ = destination_charbuf[i] & 0xFF; 4564 *dst++ = destination_charbuf[i] & 0xFF;
4567 produced_chars += ccl.produced; 4565 produced_chars += ccl.produced;
4568 } 4566 }
4567 charbuf += ccl.consumed;
4568 if (ccl.status == CCL_STAT_QUIT
4569 || ccl.status == CCL_STAT_INVALID_CMD)
4570 break;
4569 } 4571 }
4570 4572
4571 switch (ccl.status) 4573 switch (ccl.status)