Mercurial > emacs
comparison src/coding.c @ 38518:883da5f3dbac
(code_convert_region): Handle the multibyte case if
decoding ends with CODING_FINISH_INSUFFICIENT_SRC.
| author | Gerd Moellmann <gerd@gnu.org> |
|---|---|
| date | Mon, 23 Jul 2001 09:26:46 +0000 |
| parents | f5a9d9707da5 |
| children | 6d9fa06012a6 |
comparison
equal
deleted
inserted
replaced
| 38517:42f3fecfa483 | 38518:883da5f3dbac |
|---|---|
| 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 |
| 5 This file is part of GNU Emacs. | 6 This file is part of GNU Emacs. |
| 6 | 7 |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | 8 GNU Emacs is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
| 5613 } | 5614 } |
| 5614 if (result == CODING_FINISH_INSUFFICIENT_SRC) | 5615 if (result == CODING_FINISH_INSUFFICIENT_SRC) |
| 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) |
| 5625 { | 5642 { |
| 5626 /* The conversion procedure was interrupted by a user. */ | 5643 /* The conversion procedure was interrupted by a user. */ |
