diff options
| author | Eli Zaretskii | 2008-08-30 12:32:59 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-08-30 12:32:59 +0000 |
| commit | 1b912a3b4e5e763c24ef1af6528f6ebe53f4744a (patch) | |
| tree | 93afb44a11eb8b0c1b78c11cc9678bb3021ea702 /src | |
| parent | 657ceaa03e351d272036473c8ba52ca15e95e077 (diff) | |
| download | emacs-1b912a3b4e5e763c24ef1af6528f6ebe53f4744a.tar.gz emacs-1b912a3b4e5e763c24ef1af6528f6ebe53f4744a.zip | |
(Fw16_set_clipboard_data): Don't encode text if clipboard is unavailable.
Set dst to NULL if it doesn't point to malloc'ed data.
(Fw16_get_clipboard_data): Initialize htext to NULL, to avoid passing random
values to xfree.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w16select.c | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fc64f7e33f8..f02db31f0b7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2008-08-30 Eli Zaretskii <eliz@gnu.org> | 1 | 2008-08-30 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * w16select.c (Fw16_set_clipboard_data): Don't encode text if | ||
| 4 | clipboard is unavailable. Set dst to NULL if it doesn't point to | ||
| 5 | malloc'ed data. | ||
| 6 | (Fw16_get_clipboard_data): Initialize htext to NULL, to avoid | ||
| 7 | passing random values to xfree. | ||
| 8 | |||
| 3 | * dispnew.c (init_display): Set `tty's association in frame's | 9 | * dispnew.c (init_display): Set `tty's association in frame's |
| 4 | parameters alist to the name of the terminal device, if that is | 10 | parameters alist to the name of the terminal device, if that is |
| 5 | known. | 11 | known. |
diff --git a/src/w16select.c b/src/w16select.c index 2a2b05f72e5..9498d7adfe8 100644 --- a/src/w16select.c +++ b/src/w16select.c | |||
| @@ -500,6 +500,9 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 500 | 500 | ||
| 501 | BLOCK_INPUT; | 501 | BLOCK_INPUT; |
| 502 | 502 | ||
| 503 | if (!open_clipboard ()) | ||
| 504 | goto error; | ||
| 505 | |||
| 503 | nbytes = SBYTES (string); | 506 | nbytes = SBYTES (string); |
| 504 | src = SDATA (string); | 507 | src = SDATA (string); |
| 505 | 508 | ||
| @@ -515,6 +518,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 515 | will have to convert it to DOS CR-LF style. */ | 518 | will have to convert it to DOS CR-LF style. */ |
| 516 | no_crlf_conversion = 0; | 519 | no_crlf_conversion = 0; |
| 517 | Vlast_coding_system_used = Qraw_text; | 520 | Vlast_coding_system_used = Qraw_text; |
| 521 | dst = NULL; /* so we don't try to free a random pointer */ | ||
| 518 | } | 522 | } |
| 519 | else | 523 | else |
| 520 | { | 524 | { |
| @@ -541,9 +545,6 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat | |||
| 541 | src = dst; | 545 | src = dst; |
| 542 | } | 546 | } |
| 543 | 547 | ||
| 544 | if (!open_clipboard ()) | ||
| 545 | goto error; | ||
| 546 | |||
| 547 | ok = empty_clipboard () | 548 | ok = empty_clipboard () |
| 548 | && ((put_status | 549 | && ((put_status |
| 549 | = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) | 550 | = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) |
| @@ -595,7 +596,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat | |||
| 595 | Lisp_Object frame; | 596 | Lisp_Object frame; |
| 596 | { | 597 | { |
| 597 | unsigned data_size, truelen; | 598 | unsigned data_size, truelen; |
| 598 | unsigned char *htext; | 599 | unsigned char *htext = NULL; |
| 599 | Lisp_Object ret = Qnil; | 600 | Lisp_Object ret = Qnil; |
| 600 | int no_crlf_conversion, require_decoding = 0; | 601 | int no_crlf_conversion, require_decoding = 0; |
| 601 | 602 | ||