From d6735140a0069e86e7fe746bc42f5206dd1aecf0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 22 Aug 2009 10:33:19 +0000 Subject: [PATCH] (encode_coding_string): Don't encode unibyte strings. (Bug#4047) --- src/ChangeLog | 5 +++++ src/coding.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c1ac10486d8..53e440f0141 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-08-22 Eli Zaretskii + + * coding.h (encode_coding_string): Don't encode unibyte strings. + (Bug#4047) + 2009-07-29 Chong Yidong * Version 23.1 released. diff --git a/src/coding.h b/src/coding.h index 450433fda96..bfe699ae2e4 100644 --- a/src/coding.h +++ b/src/coding.h @@ -738,10 +738,10 @@ extern void encode_coding_object P_ ((struct coding_system *, STRING_BYTES (XSTRING (string)), Qt) #define encode_coding_string(coding, string, nocopy) \ - (encode_coding_object (coding, string, 0, 0, XSTRING (string)->size, \ - STRING_BYTES (XSTRING (string)), Qt), \ - (coding)->dst_object) - + (STRING_MULTIBYTE(string) ? \ + (encode_coding_object (coding, string, 0, 0, SCHARS (string), \ + SBYTES (string), Qt), \ + (coding)->dst_object) : (string)) #define decode_coding_c_string(coding, src, bytes, dst_object) \ do { \ -- 2.39.2