From: Eli Zaretskii Date: Thu, 17 Aug 2000 06:11:09 +0000 (+0000) Subject: (set_clipboard_data): If there's not enough memory X-Git-Tag: emacs-pretest-21.0.90~2219 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aae41d97a4501836c911c61cec82bbb6cf955327;p=emacs.git (set_clipboard_data): If there's not enough memory to put text into clipboard, return 1, as Fw16_set_clipboard_data expects. In case of other failures, return 3. (system_error_msg): New error message. (Fw16_set_clipboard_data): If set_clipboard_data returns 3, print system_error_msg. --- diff --git a/src/ChangeLog b/src/ChangeLog index 77f7ffc9498..a17b16c4e2d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2000-08-17 Eli Zaretskii + + * w16select.c (set_clipboard_data): If there's not enough memory + to put text into clipboard, return 1, as Fw16_set_clipboard_data + expects. In case of other failures, return 3. + (system_error_msg): New error message. + (Fw16_set_clipboard_data): If set_clipboard_data returns 3, print + system_error_msg. + 2000-08-16 Gerd Moellmann * term.c (write_glyphs): Also turn off inverse video after turning diff --git a/src/w16select.c b/src/w16select.c index dec1af7726b..df739a1356c 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -248,7 +248,7 @@ set_clipboard_data (Format, Data, Size, Raw) unsigned char *dp = Data, *dstart = dp; if (Format != CF_OEMTEXT) - return 0; + return 3; /* need to know final size after '\r' chars are inserted (the standard CF_OEMTEXT clipboard format uses CRLF line endings, @@ -266,10 +266,10 @@ set_clipboard_data (Format, Data, Size, Raw) } if (clipboard_compact (truelen) < truelen) - return 0; + return 1; if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0) - return 0; + return 1; /* Move the buffer into the low memory, convert LF into CR-LF if needed. */ if (Raw) @@ -333,8 +333,8 @@ set_clipboard_data (Format, Data, Size, Raw) if (regs.x.ax == 0) *last_clipboard_text = '\0'; - /* Zero means success, otherwise (1 or 2) it's an error. */ - return regs.x.ax > 0 ? 0 : 1; + /* Zero means success, otherwise (1, 2, or 3) it's an error. */ + return regs.x.ax > 0 ? 0 : 3; } /* Return the size of the clipboard data of format FORMAT. */ @@ -477,6 +477,8 @@ static char no_mem_msg[] = "(Not enough DOS memory to put saved text into clipboard.)"; static char binary_msg[] = "(Binary characters in saved text; clipboard data not set.)"; +static char system_error_msg[] = + "(Clipboard interface failure; clipboard data not set.)"; 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.") @@ -577,6 +579,9 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat case 2: message2 (binary_msg, sizeof (binary_msg) - 1, 0); break; + case 3: + message2 (system_error_msg, sizeof (system_error_msg) - 1, 0); + break; } sit_for (2, 0, 0, 1, 1); }