mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-21 13:10:37 -08:00
(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.
This commit is contained in:
parent
b954d58692
commit
ac87bbef3e
2 changed files with 15 additions and 6 deletions
|
|
@ -1,5 +1,8 @@
|
|||
2002-05-14 Kenichi Handa <handa@etl.go.jp>
|
||||
|
||||
* xfns.c (x_encode_text): Allocate coding.destination here, and
|
||||
call encode_coding_object with dst_object Qnil.
|
||||
|
||||
* buffer.c (Fset_buffer_multibyte): Convert 8-bit bytes to
|
||||
multibyte form correctly.
|
||||
|
||||
|
|
@ -11,6 +14,12 @@
|
|||
(encode_coding_iso_2022): Setup coding->safe_charsets in advance.
|
||||
(decode_coding_object): Move point to coding->dst_pos before
|
||||
calling post-read-conversion function.
|
||||
(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.
|
||||
|
||||
* coding.h (JIS_TO_SJIS): Fix typo (j1->s1, j2->s2).
|
||||
|
||||
|
|
|
|||
12
src/coding.c
12
src/coding.c
|
|
@ -5979,8 +5979,6 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
|
|||
|
||||
if (! NILP (CODING_ATTR_PRE_WRITE (attrs)))
|
||||
{
|
||||
Lisp_Object val;
|
||||
|
||||
coding->src_object = make_conversion_work_buffer (coding->src_multibyte);
|
||||
set_buffer_internal (XBUFFER (coding->src_object));
|
||||
if (STRINGP (src_object))
|
||||
|
|
@ -5997,9 +5995,9 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
|
|||
set_buffer_internal (XBUFFER (coding->src_object));
|
||||
}
|
||||
|
||||
val = call2 (CODING_ATTR_PRE_WRITE (attrs),
|
||||
make_number (1), make_number (chars));
|
||||
CHECK_NATNUM (val);
|
||||
call2 (CODING_ATTR_PRE_WRITE (attrs),
|
||||
make_number (BEG), make_number (Z));
|
||||
coding->src_object = Fcurrent_buffer ();
|
||||
if (BEG != GPT)
|
||||
move_gap_both (BEG, BEG_BYTE);
|
||||
coding->src_chars = Z - BEG;
|
||||
|
|
@ -6042,8 +6040,10 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte,
|
|||
else if (EQ (dst_object, Qt))
|
||||
{
|
||||
coding->dst_object = Qnil;
|
||||
coding->destination = (unsigned char *) xmalloc (coding->src_chars);
|
||||
coding->dst_bytes = coding->src_chars;
|
||||
if (coding->dst_bytes == 0)
|
||||
coding->dst_bytes = 1;
|
||||
coding->destination = (unsigned char *) xmalloc (coding->dst_bytes);
|
||||
coding->dst_multibyte = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue