aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-07-23 09:26:46 +0000
committerGerd Moellmann2001-07-23 09:26:46 +0000
commit70ad9fc448839de78b0aa2691e236ecf619cb06f (patch)
treeb1b93574486b339cb7c7ec85fbcf13ec51a4cb53 /src
parent722a451d1ae7ddb86449b20c9e2d6551f08d4f8a (diff)
downloademacs-70ad9fc448839de78b0aa2691e236ecf619cb06f.tar.gz
emacs-70ad9fc448839de78b0aa2691e236ecf619cb06f.zip
(code_convert_region): Handle the multibyte case if
decoding ends with CODING_FINISH_INSUFFICIENT_SRC.
Diffstat (limited to 'src')
-rw-r--r--src/coding.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c
index 8556591e92b..b59bbce7edd 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1,6 +1,7 @@
1/* Coding system handler (conversion, detection, and etc). 1/* Coding system handler (conversion, detection, and etc).
2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. 2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation. 3 Licensed to the Free Software Foundation.
4 Copyright (C) 2001 Free Software Foundation, Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
@@ -5615,10 +5616,26 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5615 { 5616 {
5616 /* The source text ends in invalid codes. Let's just 5617 /* The source text ends in invalid codes. Let's just
5617 make them valid buffer contents, and finish conversion. */ 5618 make them valid buffer contents, and finish conversion. */
5618 inserted += len_byte; 5619 if (multibyte_p)
5619 inserted_byte += len_byte; 5620 {
5620 while (len_byte--) 5621 unsigned char *start = dst;
5621 *dst++ = *src++; 5622
5623 inserted += len_byte;
5624 while (len_byte--)
5625 {
5626 int c = *src++;
5627 dst += CHAR_STRING (c, dst);
5628 }
5629
5630 inserted_byte += dst - start;
5631 }
5632 else
5633 {
5634 inserted += len_byte;
5635 inserted_byte += len_byte;
5636 while (len_byte--)
5637 *dst++ = *src++;
5638 }
5622 break; 5639 break;
5623 } 5640 }
5624 if (result == CODING_FINISH_INTERRUPT) 5641 if (result == CODING_FINISH_INTERRUPT)