comparison src/coding.c @ 23153:b2770410c752

(decode_coding): Even if SRC_BYTES is zero, try processing if CODING requires flushing. (encode_coding): Likewise. (code_convert_region): Likewise. (code_convert_string): Likewise.
author Kenichi Handa <handa@m17n.org>
date Mon, 31 Aug 1998 03:50:17 +0000
parents 7a72a7b8718c
children 392b44751a22
comparison
equal deleted inserted replaced
23152:7cd25ebef713 23153:b2770410c752
3649 unsigned char *source, *destination; 3649 unsigned char *source, *destination;
3650 int src_bytes, dst_bytes; 3650 int src_bytes, dst_bytes;
3651 { 3651 {
3652 int result; 3652 int result;
3653 3653
3654 if (src_bytes <= 0) 3654 if (src_bytes <= 0
3655 && ! (coding->mode & CODING_MODE_LAST_BLOCK
3656 && CODING_REQUIRE_FLUSHING (coding)))
3655 { 3657 {
3656 coding->produced = coding->produced_char = 0; 3658 coding->produced = coding->produced_char = 0;
3657 coding->consumed = coding->consumed_char = 0; 3659 coding->consumed = coding->consumed_char = 0;
3658 coding->fake_multibyte = 0; 3660 coding->fake_multibyte = 0;
3659 return CODING_FINISH_NORMAL; 3661 return CODING_FINISH_NORMAL;
3729 unsigned char *source, *destination; 3731 unsigned char *source, *destination;
3730 int src_bytes, dst_bytes; 3732 int src_bytes, dst_bytes;
3731 { 3733 {
3732 int result; 3734 int result;
3733 3735
3734 if (src_bytes <= 0) 3736 if (src_bytes <= 0
3737 && ! (coding->mode & CODING_MODE_LAST_BLOCK
3738 && CODING_REQUIRE_FLUSHING (coding)))
3735 { 3739 {
3736 coding->produced = coding->produced_char = 0; 3740 coding->produced = coding->produced_char = 0;
3737 coding->consumed = coding->consumed_char = 0; 3741 coding->consumed = coding->consumed_char = 0;
3738 coding->fake_multibyte = 0; 3742 coding->fake_multibyte = 0;
3739 return CODING_FINISH_NORMAL; 3743 return CODING_FINISH_NORMAL;
4182 move_gap_both (from, from_byte); 4186 move_gap_both (from, from_byte);
4183 if (encodep) 4187 if (encodep)
4184 shrink_encoding_region (&from_byte, &to_byte, coding, NULL); 4188 shrink_encoding_region (&from_byte, &to_byte, coding, NULL);
4185 else 4189 else
4186 shrink_decoding_region (&from_byte, &to_byte, coding, NULL); 4190 shrink_decoding_region (&from_byte, &to_byte, coding, NULL);
4187 if (from_byte == to_byte) 4191 if (from_byte == to_byte
4192 && ! (coding->mode & CODING_MODE_LAST_BLOCK
4193 && CODING_REQUIRE_FLUSHING (coding)))
4188 { 4194 {
4189 coding->produced = len_byte; 4195 coding->produced = len_byte;
4190 coding->produced_char = multibyte ? len : len_byte; 4196 coding->produced_char = multibyte ? len : len_byte;
4191 if (!replace) 4197 if (!replace)
4192 /* We must record and adjust for this new text now. */ 4198 /* We must record and adjust for this new text now. */
4484 if (encodep) 4490 if (encodep)
4485 shrink_encoding_region (&from, &to_byte, coding, XSTRING (str)->data); 4491 shrink_encoding_region (&from, &to_byte, coding, XSTRING (str)->data);
4486 else 4492 else
4487 shrink_decoding_region (&from, &to_byte, coding, XSTRING (str)->data); 4493 shrink_decoding_region (&from, &to_byte, coding, XSTRING (str)->data);
4488 } 4494 }
4489 if (from == to_byte) 4495 if (from == to_byte
4496 && ! (coding->mode & CODING_MODE_LAST_BLOCK
4497 && CODING_REQUIRE_FLUSHING (coding)))
4490 return (nocopy ? str : Fcopy_sequence (str)); 4498 return (nocopy ? str : Fcopy_sequence (str));
4491 4499
4492 if (encodep) 4500 if (encodep)
4493 len = encoding_buffer_size (coding, to_byte - from); 4501 len = encoding_buffer_size (coding, to_byte - from);
4494 else 4502 else