Commit 1b912a3b authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

(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.
parent 657ceaa0
2008-08-30 Eli Zaretskii <eliz@gnu.org>
 
* w16select.c (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.
* dispnew.c (init_display): Set `tty's association in frame's
parameters alist to the name of the terminal device, if that is
known.
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment