]> git.eshelyaron.com Git - emacs.git/commitdiff
(encode_coding_string): Don't encode unibyte strings. (Bug#4047)
authorEli Zaretskii <eliz@gnu.org>
Sat, 22 Aug 2009 10:33:19 +0000 (10:33 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 22 Aug 2009 10:33:19 +0000 (10:33 +0000)
src/ChangeLog
src/coding.h

index c1ac10486d80e895bcd9d81c1b6f4fe58086a60a..53e440f014147123bc19246a392cdfc7eee32438 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * coding.h (encode_coding_string): Don't encode unibyte strings.
+       (Bug#4047)
+
 2009-07-29  Chong Yidong  <cyd@stupidchicken.com>
 
        * Version 23.1 released.
index 450433fda968a8c42221ecda221177645746e3cb..bfe699ae2e41ba7fb2ea790671f0c32421a2227c 100644 (file)
@@ -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 {                                                                 \