emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b897bbc: Fix encoding by ISO-2022-JP


From: Eli Zaretskii
Subject: master b897bbc: Fix encoding by ISO-2022-JP
Date: Sat, 27 Mar 2021 03:43:22 -0400 (EDT)

branch: master
commit b897bbc8135901c8edc24fc608a92d9deedeec60
Author: Kenichi Handa <handa@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix encoding by ISO-2022-JP
    
    * src/coding.c (encode_coding): Reset the CODING_MODE_LAST_BLOCK
    flag for all iterations but the last one.  (Bug#46933)
---
 src/coding.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/coding.c b/src/coding.c
index 739dd6a..46e7fca 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7799,7 +7799,13 @@ encode_coding (struct coding_system *coding)
     coding_set_source (coding);
     consume_chars (coding, translation_table, max_lookup);
     coding_set_destination (coding);
+    /* The CODING_MODE_LAST_BLOCK flag should be set only for the last
+       iteration of the encoding.  */
+    unsigned saved_mode = coding->mode;
+    if (coding->consumed_char < coding->src_chars)
+      coding->mode &= ~CODING_MODE_LAST_BLOCK;
     (*(coding->encoder)) (coding);
+    coding->mode = saved_mode;
   } while (coding->consumed_char < coding->src_chars);
 
   if (BUFFERP (coding->dst_object) && coding->produced_char > 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]