diff options
| author | Kenichi Handa | 2003-05-06 08:16:37 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-05-06 08:16:37 +0000 |
| commit | 2cb260576168c54f9e6a475f3cc5d48c1bfa6444 (patch) | |
| tree | cb4a18d82c64ba4edd6f9b9b8b55a0ed409b20e8 /src/coding.c | |
| parent | da6b532cb0e3295b4dd75bd82031472a7760d795 (diff) | |
| download | emacs-2cb260576168c54f9e6a475f3cc5d48c1bfa6444.tar.gz emacs-2cb260576168c54f9e6a475f3cc5d48c1bfa6444.zip | |
(coding_set_source): Fix for the case that the current
buffer is different from coding->src_object.
(decode_coding_object): Don't use the conversion work buffer if
DST_OBJECT is a buffer.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/coding.c b/src/coding.c index 3869550a97e..0099c68a812 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -899,18 +899,12 @@ coding_set_source (coding) | |||
| 899 | { | 899 | { |
| 900 | if (BUFFERP (coding->src_object)) | 900 | if (BUFFERP (coding->src_object)) |
| 901 | { | 901 | { |
| 902 | struct buffer *buf = XBUFFER (coding->src_object); | ||
| 903 | |||
| 902 | if (coding->src_pos < 0) | 904 | if (coding->src_pos < 0) |
| 903 | coding->source = GAP_END_ADDR + coding->src_pos_byte; | 905 | coding->source = BUF_GAP_END_ADDR (buf) + coding->src_pos_byte; |
| 904 | else | 906 | else |
| 905 | { | 907 | coding->source = BUF_BYTE_ADDRESS (buf, coding->src_pos_byte); |
| 906 | struct buffer *buf = XBUFFER (coding->src_object); | ||
| 907 | EMACS_INT gpt_byte = BUF_GPT_BYTE (buf); | ||
| 908 | unsigned char *beg_addr = BUF_BEG_ADDR (buf); | ||
| 909 | |||
| 910 | coding->source = beg_addr + coding->src_pos_byte - 1; | ||
| 911 | if (coding->src_pos_byte >= gpt_byte) | ||
| 912 | coding->source += BUF_GAP_SIZE (buf); | ||
| 913 | } | ||
| 914 | } | 908 | } |
| 915 | else if (STRINGP (coding->src_object)) | 909 | else if (STRINGP (coding->src_object)) |
| 916 | { | 910 | { |
| @@ -6231,7 +6225,7 @@ encode_coding_gap (coding, chars, bytes) | |||
| 6231 | set in CODING->dst_object. | 6225 | set in CODING->dst_object. |
| 6232 | 6226 | ||
| 6233 | If it is Qnil, the decoded text is stored at CODING->destination. | 6227 | If it is Qnil, the decoded text is stored at CODING->destination. |
| 6234 | The called must allocate CODING->dst_bytes bytes at | 6228 | The caller must allocate CODING->dst_bytes bytes at |
| 6235 | CODING->destination by xmalloc. If the decoded text is longer than | 6229 | CODING->destination by xmalloc. If the decoded text is longer than |
| 6236 | CODING->dst_bytes, CODING->destination is relocated by xrealloc. | 6230 | CODING->dst_bytes, CODING->destination is relocated by xrealloc. |
| 6237 | */ | 6231 | */ |
| @@ -6293,8 +6287,9 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 6293 | detect_coding (coding); | 6287 | detect_coding (coding); |
| 6294 | attrs = CODING_ID_ATTRS (coding->id); | 6288 | attrs = CODING_ID_ATTRS (coding->id); |
| 6295 | 6289 | ||
| 6296 | if (! NILP (CODING_ATTR_POST_READ (attrs)) | 6290 | if (EQ (dst_object, Qt) |
| 6297 | || EQ (dst_object, Qt)) | 6291 | || (! NILP (CODING_ATTR_POST_READ (attrs)) |
| 6292 | && NILP (dst_object))) | ||
| 6298 | { | 6293 | { |
| 6299 | coding->dst_object = make_conversion_work_buffer (1); | 6294 | coding->dst_object = make_conversion_work_buffer (1); |
| 6300 | coding->dst_pos = BEG; | 6295 | coding->dst_pos = BEG; |