aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii1998-04-22 13:39:59 +0000
committerEli Zaretskii1998-04-22 13:39:59 +0000
commit767079a8c6c282e63559f0e4a862546abd04db01 (patch)
tree5e24af8f22766bfdc3c106349b0612868686658b /src
parent306a5e68ac3e991ef4a5e970cfa357a26db42073 (diff)
downloademacs-767079a8c6c282e63559f0e4a862546abd04db01.tar.gz
emacs-767079a8c6c282e63559f0e4a862546abd04db01.zip
(alloc_xfer_buf): If want_size is more than 1MB,
return immediately with failure. (Fw16_set_clipboard_data, Fw16_get_clipboard_data): Replace win16 with w16.
Diffstat (limited to 'src')
-rw-r--r--src/w16select.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/w16select.c b/src/w16select.c
index 7ddda5a5a8e..a181c8466b6 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -1,4 +1,4 @@
1/* Win16 Selection processing for emacs on MS-Windows 1/* 16-bit Windows Selection processing for emacs on MS-Windows
2 Copyright (C) 1996, 1997 Free Software Foundation. 2 Copyright (C) 1996, 1997 Free Software Foundation.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
@@ -169,6 +169,11 @@ alloc_xfer_buf (want_size)
169 if (want_size <= _go32_info_block.size_of_transfer_buffer) 169 if (want_size <= _go32_info_block.size_of_transfer_buffer)
170 return __tb & 0xfffff; 170 return __tb & 0xfffff;
171 171
172 /* Don't even try to allocate more than 1MB of memory: DOS cannot
173 possibly handle that (it will overflow the BX register below). */
174 if (want_size > 0xfffff)
175 return 0;
176
172 /* Need size rounded up to the nearest paragraph, and in 177 /* Need size rounded up to the nearest paragraph, and in
173 paragraph units (1 paragraph = 16 bytes). */ 178 paragraph units (1 paragraph = 16 bytes). */
174 clipboard_xfer_buf_info.size = (want_size + 15) >> 4; 179 clipboard_xfer_buf_info.size = (want_size + 15) >> 4;
@@ -389,7 +394,7 @@ clipboard_compact (Size)
389static char no_mem_msg[] = 394static char no_mem_msg[] =
390 "(Not enough DOS memory to put saved text into clipboard.)"; 395 "(Not enough DOS memory to put saved text into clipboard.)";
391 396
392DEFUN ("win16-set-clipboard-data", Fwin16_set_clipboard_data, Swin16_set_clipboard_data, 1, 2, 0, 397DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
393 "This sets the clipboard data to the given text.") 398 "This sets the clipboard data to the given text.")
394 (string, frame) 399 (string, frame)
395 Lisp_Object string, frame; 400 Lisp_Object string, frame;
@@ -444,7 +449,7 @@ DEFUN ("win16-set-clipboard-data", Fwin16_set_clipboard_data, Swin16_set_clipboa
444 return (ok ? string : Qnil); 449 return (ok ? string : Qnil);
445} 450}
446 451
447DEFUN ("win16-get-clipboard-data", Fwin16_get_clipboard_data, Swin16_get_clipboard_data, 0, 1, 0, 452DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
448 "This gets the clipboard data in text format.") 453 "This gets the clipboard data in text format.")
449 (frame) 454 (frame)
450 Lisp_Object frame; 455 Lisp_Object frame;
@@ -540,8 +545,8 @@ and t is the same as `SECONDARY'.")
540void 545void
541syms_of_win16select () 546syms_of_win16select ()
542{ 547{
543 defsubr (&Swin16_set_clipboard_data); 548 defsubr (&Sw16_set_clipboard_data);
544 defsubr (&Swin16_get_clipboard_data); 549 defsubr (&Sw16_get_clipboard_data);
545 defsubr (&Sx_selection_exists_p); 550 defsubr (&Sx_selection_exists_p);
546 551
547 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); 552 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);