diff options
| author | Kenichi Handa | 2000-05-20 00:05:51 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2000-05-20 00:05:51 +0000 |
| commit | b34cf36ca8477f9e9a852e67737d4b374c154022 (patch) | |
| tree | d8784a5985789694d16dfb558e04fb8118ab71e2 /src | |
| parent | 68526af59486811f1e773dfeb4301843d52a28e3 (diff) | |
| download | emacs-b34cf36ca8477f9e9a852e67737d4b374c154022.tar.gz emacs-b34cf36ca8477f9e9a852e67737d4b374c154022.zip | |
(Fw16_set_clipboard_data): Setup members
src_multibyte and dst_multibyte of coding. Adjusted for the
change for find_charset_in_str.
(Fw16_get_clipboard_data): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w16select.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/w16select.c b/src/w16select.c index 674be37544e..c662716807e 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -486,8 +486,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 486 | unsigned ok = 1, put_status = 0; | 486 | unsigned ok = 1, put_status = 0; |
| 487 | int nbytes; | 487 | int nbytes; |
| 488 | unsigned char *src, *dst = NULL; | 488 | unsigned char *src, *dst = NULL; |
| 489 | int charsets[MAX_CHARSET + 1]; | 489 | int charset_info; |
| 490 | int num; | ||
| 491 | int no_crlf_conversion; | 490 | int no_crlf_conversion; |
| 492 | 491 | ||
| 493 | CHECK_STRING (string, 0); | 492 | CHECK_STRING (string, 0); |
| @@ -506,14 +505,10 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 506 | 505 | ||
| 507 | /* Since we are now handling multilingual text, we must consider | 506 | /* Since we are now handling multilingual text, we must consider |
| 508 | encoding text for the clipboard. */ | 507 | encoding text for the clipboard. */ |
| 509 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); | 508 | charset_info = find_charset_in_text (src, XSTRING (string)->size, nbytes, |
| 510 | num = ((nbytes <= 1 /* Check the possibility of short cut. */ | 509 | NULL, Qnil); |
| 511 | || !STRING_MULTIBYTE (string) | 510 | |
| 512 | || nbytes == XSTRING (string)->size) | 511 | if (charset_info == 0) |
| 513 | ? 0 | ||
| 514 | : find_charset_in_str (src, nbytes, charsets, Qnil, 0, 1)); | ||
| 515 | |||
| 516 | if (!num || (num == 1 && charsets[CHARSET_ASCII])) | ||
| 517 | { | 512 | { |
| 518 | /* No multibyte character in OBJ. We need not encode it, but we | 513 | /* No multibyte character in OBJ. We need not encode it, but we |
| 519 | will have to convert it to DOS CR-LF style. */ | 514 | will have to convert it to DOS CR-LF style. */ |
| @@ -531,6 +526,8 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 531 | Vnext_selection_coding_system = Vselection_coding_system; | 526 | Vnext_selection_coding_system = Vselection_coding_system; |
| 532 | setup_coding_system | 527 | setup_coding_system |
| 533 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 528 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 529 | coding->src_multibyte = 1; | ||
| 530 | coding->dst_multibyte = 0; | ||
| 534 | Vnext_selection_coding_system = Qnil; | 531 | Vnext_selection_coding_system = Qnil; |
| 535 | coding.mode |= CODING_MODE_LAST_BLOCK; | 532 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 536 | Vlast_coding_system_used = coding.symbol; | 533 | Vlast_coding_system_used = coding.symbol; |
| @@ -654,16 +651,16 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 654 | Vnext_selection_coding_system = Vselection_coding_system; | 651 | Vnext_selection_coding_system = Vselection_coding_system; |
| 655 | setup_coding_system | 652 | setup_coding_system |
| 656 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); | 653 | (Fcheck_coding_system (Vnext_selection_coding_system), &coding); |
| 654 | coding.src_multibyte = 0; | ||
| 655 | coding.dst_multibyte = 1; | ||
| 657 | Vnext_selection_coding_system = Qnil; | 656 | Vnext_selection_coding_system = Qnil; |
| 658 | coding.mode |= CODING_MODE_LAST_BLOCK; | 657 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 659 | truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1); | 658 | truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1); |
| 660 | bufsize = decoding_buffer_size (&coding, truelen); | 659 | bufsize = decoding_buffer_size (&coding, truelen); |
| 661 | buf = (unsigned char *) xmalloc (bufsize); | 660 | buf = (unsigned char *) xmalloc (bufsize); |
| 662 | decode_coding (&coding, htext, buf, truelen, bufsize); | 661 | decode_coding (&coding, htext, buf, truelen, bufsize); |
| 663 | truelen = (coding.fake_multibyte | 662 | ret = make_string_from_bytes ((char *) buf, |
| 664 | ? multibyte_chars_in_text (buf, coding.produced) | 663 | coding.produced_char, coding.produced); |
| 665 | : coding.produced_char); | ||
| 666 | ret = make_string_from_bytes ((char *) buf, truelen, coding.produced); | ||
| 667 | xfree (buf); | 664 | xfree (buf); |
| 668 | Vlast_coding_system_used = coding.symbol; | 665 | Vlast_coding_system_used = coding.symbol; |
| 669 | } | 666 | } |