summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1998-08-31 03:50:17 +0000
committerKenichi Handa <handa@m17n.org>1998-08-31 03:50:17 +0000
commitd4e57bcd5bedb4868574821064788561819690e7 (patch)
tree89197b81807e8351780eb2e256457d2573dedced
parente0e25273d2f53f155ca0bd183db9e148f6f3cd6c (diff)
downloademacs-d4e57bcd5bedb4868574821064788561819690e7.tar.gz
(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.
-rw-r--r--src/coding.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c
index 829d8ec1ebd..3d702c4b6f5 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -3651,7 +3651,9 @@ decode_coding (coding, source, destination, src_bytes, dst_bytes)
{
int result;
- if (src_bytes <= 0)
+ if (src_bytes <= 0
+ && ! (coding->mode & CODING_MODE_LAST_BLOCK
+ && CODING_REQUIRE_FLUSHING (coding)))
{
coding->produced = coding->produced_char = 0;
coding->consumed = coding->consumed_char = 0;
@@ -3731,7 +3733,9 @@ encode_coding (coding, source, destination, src_bytes, dst_bytes)
{
int result;
- if (src_bytes <= 0)
+ if (src_bytes <= 0
+ && ! (coding->mode & CODING_MODE_LAST_BLOCK
+ && CODING_REQUIRE_FLUSHING (coding)))
{
coding->produced = coding->produced_char = 0;
coding->consumed = coding->consumed_char = 0;
@@ -4184,7 +4188,9 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
shrink_encoding_region (&from_byte, &to_byte, coding, NULL);
else
shrink_decoding_region (&from_byte, &to_byte, coding, NULL);
- if (from_byte == to_byte)
+ if (from_byte == to_byte
+ && ! (coding->mode & CODING_MODE_LAST_BLOCK
+ && CODING_REQUIRE_FLUSHING (coding)))
{
coding->produced = len_byte;
coding->produced_char = multibyte ? len : len_byte;
@@ -4486,7 +4492,9 @@ code_convert_string (str, coding, encodep, nocopy)
else
shrink_decoding_region (&from, &to_byte, coding, XSTRING (str)->data);
}
- if (from == to_byte)
+ if (from == to_byte
+ && ! (coding->mode & CODING_MODE_LAST_BLOCK
+ && CODING_REQUIRE_FLUSHING (coding)))
return (nocopy ? str : Fcopy_sequence (str));
if (encodep)