aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2000-07-21 02:32:21 +0000
committerKenichi Handa2000-07-21 02:32:21 +0000
commitd60660d6e9121bd2fc5184a5e9fea6a5d98dc39d (patch)
treeac214eb509fc8f3b8a2038ec9c0ee69fca5ef202
parent0b8c21c2efe37579c68e1c9f1093ac5c38766133 (diff)
downloademacs-d60660d6e9121bd2fc5184a5e9fea6a5d98dc39d.tar.gz
emacs-d60660d6e9121bd2fc5184a5e9fea6a5d98dc39d.zip
*** empty log message ***
-rw-r--r--src/xfns.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 7387d7165f8..eb72cddfc65 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2088,15 +2088,15 @@ x_set_scroll_bar_background (f, value, oldval)
2088 2088
2089 Store the byte length of resulting text in *TEXT_BYTES. 2089 Store the byte length of resulting text in *TEXT_BYTES.
2090 2090
2091 If the text contains only ASCII and Latin-1, store 1 in *LATIN1_P, 2091 If the text contains only ASCII and Latin-1, store 1 in *STRING_P,
2092 which means that the `encoding' of the result can be `STRING'. 2092 which means that the `encoding' of the result can be `STRING'.
2093 Otherwise store 0 in *LATIN1_P, which means that the `encoding' of 2093 Otherwise store 0 in *STRINGP, which means that the `encoding' of
2094 the result should be `COMPOUND_TEXT'. */ 2094 the result should be `COMPOUND_TEXT'. */
2095 2095
2096unsigned char * 2096unsigned char *
2097x_encode_text (string, coding_system, text_bytes, latin1_p) 2097x_encode_text (string, coding_system, text_bytes, stringp)
2098 Lisp_Object string, coding_system; 2098 Lisp_Object string, coding_system;
2099 int *text_bytes, *latin1_p; 2099 int *text_bytes, *stringp;
2100{ 2100{
2101 unsigned char *str = XSTRING (string)->data; 2101 unsigned char *str = XSTRING (string)->data;
2102 int chars = XSTRING (string)->size; 2102 int chars = XSTRING (string)->size;
@@ -2111,7 +2111,7 @@ x_encode_text (string, coding_system, text_bytes, latin1_p)
2111 { 2111 {
2112 /* No multibyte character in OBJ. We need not encode it. */ 2112 /* No multibyte character in OBJ. We need not encode it. */
2113 *text_bytes = bytes; 2113 *text_bytes = bytes;
2114 *latin1_p = 1; 2114 *stringp = 1;
2115 return str; 2115 return str;
2116 } 2116 }
2117 2117
@@ -2119,11 +2119,13 @@ x_encode_text (string, coding_system, text_bytes, latin1_p)
2119 coding.src_multibyte = 1; 2119 coding.src_multibyte = 1;
2120 coding.dst_multibyte = 0; 2120 coding.dst_multibyte = 0;
2121 coding.mode |= CODING_MODE_LAST_BLOCK; 2121 coding.mode |= CODING_MODE_LAST_BLOCK;
2122 if (coding.type == coding_type_iso2022)
2123 coding.flags |= CODING_FLAG_ISO_SAFE;
2122 bufsize = encoding_buffer_size (&coding, bytes); 2124 bufsize = encoding_buffer_size (&coding, bytes);
2123 buf = (unsigned char *) xmalloc (bufsize); 2125 buf = (unsigned char *) xmalloc (bufsize);
2124 encode_coding (&coding, str, buf, bytes, bufsize); 2126 encode_coding (&coding, str, buf, bytes, bufsize);
2125 *text_bytes = coding.produced; 2127 *text_bytes = coding.produced;
2126 *latin1_p = (charset_info == 1); 2128 *stringp = (charset_info == 1 || !EQ (coding_system, Qcompound_text));
2127 return buf; 2129 return buf;
2128} 2130}
2129 2131
@@ -2189,10 +2191,10 @@ x_set_name (f, name, explicit)
2189#ifdef HAVE_X11R4 2191#ifdef HAVE_X11R4
2190 { 2192 {
2191 XTextProperty text, icon; 2193 XTextProperty text, icon;
2192 int bytes, latin1_p; 2194 int bytes, stringp;
2193 2195
2194 text.value = x_encode_text (name, Qcompound_text, &bytes, &latin1_p); 2196 text.value = x_encode_text (name, Qcompound_text, &bytes, &stringp);
2195 text.encoding = (latin1_p ? XA_STRING 2197 text.encoding = (stringp ? XA_STRING
2196 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); 2198 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
2197 text.format = 8; 2199 text.format = 8;
2198 text.nitems = bytes; 2200 text.nitems = bytes;
@@ -2204,8 +2206,8 @@ x_set_name (f, name, explicit)
2204 else 2206 else
2205 { 2207 {
2206 icon.value = x_encode_text (f->icon_name, Qcompound_text, 2208 icon.value = x_encode_text (f->icon_name, Qcompound_text,
2207 &bytes, &latin1_p); 2209 &bytes, &stringp);
2208 icon.encoding = (latin1_p ? XA_STRING 2210 icon.encoding = (stringp ? XA_STRING
2209 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); 2211 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
2210 icon.format = 8; 2212 icon.format = 8;
2211 icon.nitems = bytes; 2213 icon.nitems = bytes;
@@ -2292,10 +2294,10 @@ x_set_title (f, name, old_name)
2292#ifdef HAVE_X11R4 2294#ifdef HAVE_X11R4
2293 { 2295 {
2294 XTextProperty text, icon; 2296 XTextProperty text, icon;
2295 int bytes, latin1_p; 2297 int bytes, stringp;
2296 2298
2297 text.value = x_encode_text (name, Qcompound_text, &bytes, &latin1_p); 2299 text.value = x_encode_text (name, Qcompound_text, &bytes, &stringp);
2298 text.encoding = (latin1_p ? XA_STRING 2300 text.encoding = (stringp ? XA_STRING
2299 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); 2301 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
2300 text.format = 8; 2302 text.format = 8;
2301 text.nitems = bytes; 2303 text.nitems = bytes;
@@ -2307,8 +2309,8 @@ x_set_title (f, name, old_name)
2307 else 2309 else
2308 { 2310 {
2309 icon.value = x_encode_text (f->icon_name, Qcompound_text, 2311 icon.value = x_encode_text (f->icon_name, Qcompound_text,
2310 &bytes, &latin1_p); 2312 &bytes, &stringp);
2311 icon.encoding = (latin1_p ? XA_STRING 2313 icon.encoding = (stringp ? XA_STRING
2312 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); 2314 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
2313 icon.format = 8; 2315 icon.format = 8;
2314 icon.nitems = bytes; 2316 icon.nitems = bytes;