diff options
| author | Kenichi Handa | 2000-05-20 00:07:08 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-05-20 00:07:08 +0000 |
| commit | 69ebbf81b16055de5f02501e0cb056e45352d423 (patch) | |
| tree | b4c109b325d7ca9f23cfec46ffcfadd2ea9afdf7 /src | |
| parent | aab5ac4409ffabc544c0719db45c09e010dc264a (diff) | |
| download | emacs-69ebbf81b16055de5f02501e0cb056e45352d423.tar.gz emacs-69ebbf81b16055de5f02501e0cb056e45352d423.zip | |
(Fw32_set_clipboard_data): Setup members
src_multibyte and dst_multibyte of coding. Adjusted for the
change for find_charset_in_str.
(Fw32_get_clipboard_data): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32select.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/w32select.c b/src/w32select.c index ad28d17f9c3..2cb527c04ce 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -126,17 +126,10 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, Sw32_set_clipboard_dat | |||
| 126 | { | 126 | { |
| 127 | /* Since we are now handling multilingual text, we must consider | 127 | /* Since we are now handling multilingual text, we must consider |
| 128 | encoding text for the clipboard. */ | 128 | encoding text for the clipboard. */ |
| 129 | int charsets[MAX_CHARSET + 1]; | 129 | int charset_info = find_charset_in_text (src, XSTRING (string)->size, |
| 130 | int num; | 130 | nbytes, NULL, QNil); |
| 131 | 131 | ||
| 132 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); | 132 | if (charset_info == 0) |
| 133 | num = ((nbytes <= 1 /* Check the possibility of short cut. */ | ||
| 134 | || !STRING_MULTIBYTE (string) | ||
| 135 | || nbytes == XSTRING (string)->size) | ||
| 136 | ? 0 | ||
| 137 | : find_charset_in_str (src, nbytes, charsets, Qnil, 1)); | ||
| 138 | |||
| 139 | if (!num || (num == 1 && charsets[CHARSET_ASCII])) | ||
| 140 | { | 133 | { |
| 141 | /* No multibyte character in OBJ. We need not encode it. */ | 134 | /* No multibyte character in OBJ. We need not encode it. */ |
| 142 | 135 | ||
| @@ -192,6 +185,8 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, Sw32_set_clipboard_dat | |||
| 192 | Vnext_selection_coding_system = Vselection_coding_system; | 185 | Vnext_selection_coding_system = Vselection_coding_system; |
| 193 | setup_coding_system | 186 | setup_coding_system |
| 194 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 187 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 188 | coding.src_multibyte = 1; | ||
| 189 | coding.dst_multibyte = 0; | ||
| 195 | Vnext_selection_coding_system = Qnil; | 190 | Vnext_selection_coding_system = Qnil; |
| 196 | coding.mode |= CODING_MODE_LAST_BLOCK; | 191 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 197 | bufsize = encoding_buffer_size (&coding, nbytes); | 192 | bufsize = encoding_buffer_size (&coding, nbytes); |
| @@ -291,16 +286,16 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, Sw32_get_clipboard_dat | |||
| 291 | Vnext_selection_coding_system = Vselection_coding_system; | 286 | Vnext_selection_coding_system = Vselection_coding_system; |
| 292 | setup_coding_system | 287 | setup_coding_system |
| 293 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 288 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 289 | coding.src_multibyte = 0; | ||
| 290 | coding.dst_multibyte = 1; | ||
| 294 | Vnext_selection_coding_system = Qnil; | 291 | Vnext_selection_coding_system = Qnil; |
| 295 | coding.mode |= CODING_MODE_LAST_BLOCK; | 292 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 296 | bufsize = decoding_buffer_size (&coding, nbytes); | 293 | bufsize = decoding_buffer_size (&coding, nbytes); |
| 297 | buf = (unsigned char *) xmalloc (bufsize); | 294 | buf = (unsigned char *) xmalloc (bufsize); |
| 298 | decode_coding (&coding, src, buf, nbytes, bufsize); | 295 | decode_coding (&coding, src, buf, nbytes, bufsize); |
| 299 | Vlast_coding_system_used = coding.symbol; | 296 | Vlast_coding_system_used = coding.symbol; |
| 300 | truelen = (coding.fake_multibyte | 297 | ret = make_string_from_bytes ((char *) buf, |
| 301 | ? multibyte_chars_in_text (buf, coding.produced) | 298 | coding.produced_char, coding.produced); |
| 302 | : coding.produced_char); | ||
| 303 | ret = make_string_from_bytes ((char *) buf, truelen, coding.produced); | ||
| 304 | xfree (buf); | 299 | xfree (buf); |
| 305 | } | 300 | } |
| 306 | else | 301 | else |