aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2002-05-14 13:03:45 +0000
committerKenichi Handa2002-05-14 13:03:45 +0000
commitac87bbef3e8a530277c5ef5b7149c002e215c66c (patch)
tree5aab8bc90b29fad48fea35bbf8ade03080e27a91 /src/coding.c
parentb954d58692f82f5e41bb3ec3d692c3a1e36e6c89 (diff)
downloademacs-ac87bbef3e8a530277c5ef5b7149c002e215c66c.tar.gz
emacs-ac87bbef3e8a530277c5ef5b7149c002e215c66c.zip
(encode_coding_object): Give correct arguments ot
pre-write-conversion. Ignore the return value of pre-write-conversion function. Pay attention for the case that pre-write-conversion change the current buffer. If dst_object is Qt, even if coding->src_bytes is zero, allocate at least one byte to coding->destination.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c
index 3aaf25e97ba..54bfb4ad770 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5979,8 +5979,6 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
5979 5979
5980 if (! NILP (CODING_ATTR_PRE_WRITE (attrs))) 5980 if (! NILP (CODING_ATTR_PRE_WRITE (attrs)))
5981 { 5981 {
5982 Lisp_Object val;
5983
5984 coding->src_object = make_conversion_work_buffer (coding->src_multibyte); 5982 coding->src_object = make_conversion_work_buffer (coding->src_multibyte);
5985 set_buffer_internal (XBUFFER (coding->src_object)); 5983 set_buffer_internal (XBUFFER (coding->src_object));
5986 if (STRINGP (src_object)) 5984 if (STRINGP (src_object))
@@ -5997,9 +5995,9 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
5997 set_buffer_internal (XBUFFER (coding->src_object)); 5995 set_buffer_internal (XBUFFER (coding->src_object));
5998 } 5996 }
5999 5997
6000 val = call2 (CODING_ATTR_PRE_WRITE (attrs), 5998 call2 (CODING_ATTR_PRE_WRITE (attrs),
6001 make_number (1), make_number (chars)); 5999 make_number (BEG), make_number (Z));
6002 CHECK_NATNUM (val); 6000 coding->src_object = Fcurrent_buffer ();
6003 if (BEG != GPT) 6001 if (BEG != GPT)
6004 move_gap_both (BEG, BEG_BYTE); 6002 move_gap_both (BEG, BEG_BYTE);
6005 coding->src_chars = Z - BEG; 6003 coding->src_chars = Z - BEG;
@@ -6042,8 +6040,10 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
6042 else if (EQ (dst_object, Qt)) 6040 else if (EQ (dst_object, Qt))
6043 { 6041 {
6044 coding->dst_object = Qnil; 6042 coding->dst_object = Qnil;
6045 coding->destination = (unsigned char *) xmalloc (coding->src_chars);
6046 coding->dst_bytes = coding->src_chars; 6043 coding->dst_bytes = coding->src_chars;
6044 if (coding->dst_bytes == 0)
6045 coding->dst_bytes = 1;
6046 coding->destination = (unsigned char *) xmalloc (coding->dst_bytes);
6047 coding->dst_multibyte = 0; 6047 coding->dst_multibyte = 0;
6048 } 6048 }
6049 else 6049 else