diff options
author | Gerd Moellmann <[email protected]> | 2001-07-23 09:26:46 +0000 |
---|---|---|
committer | Gerd Moellmann <[email protected]> | 2001-07-23 09:26:46 +0000 |
commit | 70ad9fc448839de78b0aa2691e236ecf619cb06f (patch) | |
tree | b1b93574486b339cb7c7ec85fbcf13ec51a4cb53 /src/coding.c | |
parent | 722a451d1ae7ddb86449b20c9e2d6551f08d4f8a (diff) |
(code_convert_region): Handle the multibyte case if
decoding ends with CODING_FINISH_INSUFFICIENT_SRC.
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c index 8556591e92..b59bbce7ed 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1,6 +1,7 @@ /* Coding system handler (conversion, detection, and etc). Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. Licensed to the Free Software Foundation. + Copyright (C) 2001 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -5615,10 +5616,26 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) { /* The source text ends in invalid codes. Let's just make them valid buffer contents, and finish conversion. */ - inserted += len_byte; - inserted_byte += len_byte; - while (len_byte--) - *dst++ = *src++; + if (multibyte_p) + { + unsigned char *start = dst; + + inserted += len_byte; + while (len_byte--) + { + int c = *src++; + dst += CHAR_STRING (c, dst); + } + + inserted_byte += dst - start; + } + else + { + inserted += len_byte; + inserted_byte += len_byte; + while (len_byte--) + *dst++ = *src++; + } break; } if (result == CODING_FINISH_INTERRUPT) |