aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/coding.c12
2 files changed, 15 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9a7a6bc650b..a220ec2bd00 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12002-05-14 Kenichi Handa <handa@etl.go.jp> 12002-05-14 Kenichi Handa <handa@etl.go.jp>
2 2
3 * xfns.c (x_encode_text): Allocate coding.destination here, and
4 call encode_coding_object with dst_object Qnil.
5
3 * buffer.c (Fset_buffer_multibyte): Convert 8-bit bytes to 6 * buffer.c (Fset_buffer_multibyte): Convert 8-bit bytes to
4 multibyte form correctly. 7 multibyte form correctly.
5 8
@@ -11,6 +14,12 @@
11 (encode_coding_iso_2022): Setup coding->safe_charsets in advance. 14 (encode_coding_iso_2022): Setup coding->safe_charsets in advance.
12 (decode_coding_object): Move point to coding->dst_pos before 15 (decode_coding_object): Move point to coding->dst_pos before
13 calling post-read-conversion function. 16 calling post-read-conversion function.
17 (encode_coding_object): Give correct arguments ot
18 pre-write-conversion. Ignore the return value of
19 pre-write-conversion function. Pay attention for the case that
20 pre-write-conversion change the current buffer. If dst_object is
21 Qt, even if coding->src_bytes is zero, allocate at least one byte
22 to coding->destination.
14 23
15 * coding.h (JIS_TO_SJIS): Fix typo (j1->s1, j2->s2). 24 * coding.h (JIS_TO_SJIS): Fix typo (j1->s1, j2->s2).
16 25
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