changeset 21709:64adf1f4d54d

(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.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 22 Apr 1998 13:39:59 +0000
parents 280e4b4cbd2a
children 70d6549a4105
files src/w16select.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/w16select.c	Wed Apr 22 11:40:18 1998 +0000
+++ b/src/w16select.c	Wed Apr 22 13:39:59 1998 +0000
@@ -1,4 +1,4 @@
-/* Win16 Selection processing for emacs on MS-Windows
+/* 16-bit Windows Selection processing for emacs on MS-Windows
    Copyright (C) 1996, 1997 Free Software Foundation.
    
 This file is part of GNU Emacs.
@@ -169,6 +169,11 @@
   if (want_size <= _go32_info_block.size_of_transfer_buffer)
     return __tb & 0xfffff;
 
+  /* Don't even try to allocate more than 1MB of memory: DOS cannot
+     possibly handle that (it will overflow the BX register below).  */
+  if (want_size > 0xfffff)
+    return 0;
+
   /* Need size rounded up to the nearest paragraph, and in
      paragraph units (1 paragraph = 16 bytes).  */
   clipboard_xfer_buf_info.size = (want_size + 15) >> 4;
@@ -389,7 +394,7 @@
 static char no_mem_msg[] =
   "(Not enough DOS memory to put saved text into clipboard.)";
 
-DEFUN ("win16-set-clipboard-data", Fwin16_set_clipboard_data, Swin16_set_clipboard_data, 1, 2, 0,
+DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
        "This sets the clipboard data to the given text.")
     (string, frame)
     Lisp_Object string, frame;
@@ -444,7 +449,7 @@
   return (ok ? string : Qnil);
 }
 
-DEFUN ("win16-get-clipboard-data", Fwin16_get_clipboard_data, Swin16_get_clipboard_data, 0, 1, 0,
+DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
        "This gets the clipboard data in text format.")
      (frame)
      Lisp_Object frame;
@@ -540,8 +545,8 @@
 void 
 syms_of_win16select ()
 {
-  defsubr (&Swin16_set_clipboard_data);
-  defsubr (&Swin16_get_clipboard_data);
+  defsubr (&Sw16_set_clipboard_data);
+  defsubr (&Sw16_get_clipboard_data);
   defsubr (&Sx_selection_exists_p);
 
   QPRIMARY   = intern ("PRIMARY");	staticpro (&QPRIMARY);