aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c21
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;