diff options
author | Eli Zaretskii <eliz@gnu.org> | 2008-08-30 12:32:59 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2008-08-30 12:32:59 +0000 |
commit | 1b912a3b4e5e763c24ef1af6528f6ebe53f4744a (patch) | |
tree | 93afb44a11eb8b0c1b78c11cc9678bb3021ea702 /src/w16select.c | |
parent | 657ceaa03e351d272036473c8ba52ca15e95e077 (diff) | |
download | emacs-1b912a3b4e5e763c24ef1af6528f6ebe53f4744a.tar.gz emacs-1b912a3b4e5e763c24ef1af6528f6ebe53f4744a.tar.bz2 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/w16select.c')
-rw-r--r-- | src/w16select.c | 9 |
1 files changed, 5 insertions, 4 deletions
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 BLOCK_INPUT; + if (!open_clipboard ()) + goto error; + nbytes = SBYTES (string); src = SDATA (string); @@ -515,6 +518,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat will have to convert it to DOS CR-LF style. */ no_crlf_conversion = 0; Vlast_coding_system_used = Qraw_text; + dst = NULL; /* so we don't try to free a random pointer */ } else { @@ -541,9 +545,6 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat src = dst; } - if (!open_clipboard ()) - goto error; - ok = empty_clipboard () && ((put_status = 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 Lisp_Object frame; { unsigned data_size, truelen; - unsigned char *htext; + unsigned char *htext = NULL; Lisp_Object ret = Qnil; int no_crlf_conversion, require_decoding = 0; |