diff options
| author | Kenichi Handa | 2007-02-23 06:02:23 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-02-23 06:02:23 +0000 |
| commit | 287c57d78eef8cba4bc15bac9f0bcd2803ae8669 (patch) | |
| tree | 46293609beb6a2eb61695d43eb9d7ba1a0af324b | |
| parent | 683c9740ec6a77be459e3485b7589cf6cb06eadb (diff) | |
| download | emacs-287c57d78eef8cba4bc15bac9f0bcd2803ae8669.tar.gz emacs-287c57d78eef8cba4bc15bac9f0bcd2803ae8669.zip | |
(coding_alloc_by_making_gap): New arg offset.
(alloc_destination): Call coding_alloc_by_making_gap with the arg
offset.
(decode_coding_iso_2022): Update coding->safe_charsets.
(decode_coding_gap): Temporarily set
current_buffer->text->inhibit_shrinking to 1.
| -rw-r--r-- | src/coding.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index aa58884fded..d3a82ae75b8 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -878,7 +878,7 @@ static void coding_set_source P_ ((struct coding_system *)); | |||
| 878 | static void coding_set_destination P_ ((struct coding_system *)); | 878 | static void coding_set_destination P_ ((struct coding_system *)); |
| 879 | static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); | 879 | static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); |
| 880 | static void coding_alloc_by_making_gap P_ ((struct coding_system *, | 880 | static void coding_alloc_by_making_gap P_ ((struct coding_system *, |
| 881 | EMACS_INT)); | 881 | EMACS_INT, EMACS_INT)); |
| 882 | static unsigned char *alloc_destination P_ ((struct coding_system *, | 882 | static unsigned char *alloc_destination P_ ((struct coding_system *, |
| 883 | EMACS_INT, unsigned char *)); | 883 | EMACS_INT, unsigned char *)); |
| 884 | static void setup_iso_safe_charsets P_ ((Lisp_Object)); | 884 | static void setup_iso_safe_charsets P_ ((Lisp_Object)); |
| @@ -1034,18 +1034,20 @@ coding_alloc_by_realloc (coding, bytes) | |||
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | static void | 1036 | static void |
| 1037 | coding_alloc_by_making_gap (coding, bytes) | 1037 | coding_alloc_by_making_gap (coding, offset, bytes) |
| 1038 | struct coding_system *coding; | 1038 | struct coding_system *coding; |
| 1039 | EMACS_INT bytes; | 1039 | EMACS_INT offset, bytes; |
| 1040 | { | 1040 | { |
| 1041 | if (BUFFERP (coding->dst_object) | 1041 | if (BUFFERP (coding->dst_object) |
| 1042 | && EQ (coding->src_object, coding->dst_object)) | 1042 | && EQ (coding->src_object, coding->dst_object)) |
| 1043 | { | 1043 | { |
| 1044 | EMACS_INT add = coding->src_bytes - coding->consumed; | 1044 | EMACS_INT add = offset + (coding->src_bytes - coding->consumed); |
| 1045 | 1045 | ||
| 1046 | GPT += offset, GPT_BYTE += offset; | ||
| 1046 | GAP_SIZE -= add; ZV += add; Z += add; ZV_BYTE += add; Z_BYTE += add; | 1047 | GAP_SIZE -= add; ZV += add; Z += add; ZV_BYTE += add; Z_BYTE += add; |
| 1047 | make_gap (bytes); | 1048 | make_gap (bytes); |
| 1048 | GAP_SIZE += add; ZV -= add; Z -= add; ZV_BYTE -= add; Z_BYTE -= add; | 1049 | GAP_SIZE += add; ZV -= add; Z -= add; ZV_BYTE -= add; Z_BYTE -= add; |
| 1050 | GPT -= offset, GPT_BYTE -= offset; | ||
| 1049 | } | 1051 | } |
| 1050 | else | 1052 | else |
| 1051 | { | 1053 | { |
| @@ -1068,7 +1070,7 @@ alloc_destination (coding, nbytes, dst) | |||
| 1068 | EMACS_INT offset = dst - coding->destination; | 1070 | EMACS_INT offset = dst - coding->destination; |
| 1069 | 1071 | ||
| 1070 | if (BUFFERP (coding->dst_object)) | 1072 | if (BUFFERP (coding->dst_object)) |
| 1071 | coding_alloc_by_making_gap (coding, nbytes); | 1073 | coding_alloc_by_making_gap (coding, offset, nbytes); |
| 1072 | else | 1074 | else |
| 1073 | coding_alloc_by_realloc (coding, nbytes); | 1075 | coding_alloc_by_realloc (coding, nbytes); |
| 1074 | record_conversion_result (coding, CODING_RESULT_SUCCESS); | 1076 | record_conversion_result (coding, CODING_RESULT_SUCCESS); |
| @@ -2949,6 +2951,9 @@ decode_coding_iso_2022 (coding) | |||
| 2949 | 2951 | ||
| 2950 | CODING_GET_INFO (coding, attrs, charset_list); | 2952 | CODING_GET_INFO (coding, attrs, charset_list); |
| 2951 | setup_iso_safe_charsets (attrs); | 2953 | setup_iso_safe_charsets (attrs); |
| 2954 | /* Charset list may have been changed. */ | ||
| 2955 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); | ||
| 2956 | coding->safe_charsets = (char *) SDATA (CODING_ATTR_SAFE_CHARSETS(attrs)); | ||
| 2952 | 2957 | ||
| 2953 | while (1) | 2958 | while (1) |
| 2954 | { | 2959 | { |
| @@ -3807,7 +3812,7 @@ encode_coding_iso_2022 (coding) | |||
| 3807 | 3812 | ||
| 3808 | setup_iso_safe_charsets (attrs); | 3813 | setup_iso_safe_charsets (attrs); |
| 3809 | /* Charset list may have been changed. */ | 3814 | /* Charset list may have been changed. */ |
| 3810 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); \ | 3815 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); |
| 3811 | coding->safe_charsets = (char *) SDATA (CODING_ATTR_SAFE_CHARSETS(attrs)); | 3816 | coding->safe_charsets = (char *) SDATA (CODING_ATTR_SAFE_CHARSETS(attrs)); |
| 3812 | 3817 | ||
| 3813 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); | 3818 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); |
| @@ -6756,7 +6761,9 @@ decode_coding_gap (coding, chars, bytes) | |||
| 6756 | detect_coding (coding); | 6761 | detect_coding (coding); |
| 6757 | 6762 | ||
| 6758 | coding->mode |= CODING_MODE_LAST_BLOCK; | 6763 | coding->mode |= CODING_MODE_LAST_BLOCK; |
| 6764 | current_buffer->text->inhibit_shrinking = 1; | ||
| 6759 | decode_coding (coding); | 6765 | decode_coding (coding); |
| 6766 | current_buffer->text->inhibit_shrinking = 0; | ||
| 6760 | 6767 | ||
| 6761 | attrs = CODING_ID_ATTRS (coding->id); | 6768 | attrs = CODING_ID_ATTRS (coding->id); |
| 6762 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | 6769 | if (! NILP (CODING_ATTR_POST_READ (attrs))) |