summaryrefslogtreecommitdiff
path: root/src/w16select.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>1999-03-03 14:51:07 +0000
committerEli Zaretskii <eliz@gnu.org>1999-03-03 14:51:07 +0000
commit4029384bd476658dbb3bc819ecba4448923b49da (patch)
tree2e01cdc09427189aaaac86e20e825ea04948f9c4 /src/w16select.c
parentc569512a3560cfc0f8e23e2397cbb06ce0470330 (diff)
downloademacs-4029384bd476658dbb3bc819ecba4448923b49da.tar.gz
(get_clipboard_data): Always stop at the first null byte.
Diffstat (limited to 'src/w16select.c')
-rw-r--r--src/w16select.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/w16select.c b/src/w16select.c
index b1f4b3adeba..674be37544e 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -369,15 +369,6 @@ get_clipboard_data (Format, Data, Size, Raw)
__dpmi_regs regs;
unsigned long xbuf_addr;
unsigned char *dp = Data;
- /* Copying text from the DOS box on Windows 95 evidently doubles the
- size of text as reported by the clipboard. So we must begin
- looking for the zeroes as if the actual size were half of what's
- reported. Jeez, what a mess! */
- unsigned half_size = Size > 32 ? Size / 2 : Size;
- /* Where we should begin looking for zeroes. See commentary below. */
- unsigned char *last_block = dp + ((half_size & 0x1f)
- ? (half_size & 0x20)
- : half_size - 0x20);
if (Format != CF_OEMTEXT)
return 0;
@@ -424,23 +415,22 @@ get_clipboard_data (Format, Data, Size, Raw)
dp--;
*dp++ = '\n';
xbuf_addr++;
- if (last_block > dp)
- last_block--; /* adjust the beginning of the last 32 bytes */
if (*lcdp == '\n')
lcdp++;
}
/* Windows reportedly rounds up the size of clipboard data
- (passed in SIZE) to a multiple of 32. We therefore bail
- out when we see the first null character in the last 32-byte
- block. */
- else if (c == '\0' && dp > last_block)
+ (passed in SIZE) to a multiple of 32, and removes trailing
+ spaces from each line without updating SIZE. We therefore
+ bail out when we see the first null character. */
+ else if (c == '\0')
break;
}
/* If the text in clipboard is identical to what we put there
last time set_clipboard_data was called, pretend there's no
data in the clipboard. This is so we don't pass our own text
- from the clipboard. */
+ from the clipboard (which might be troublesome if the killed
+ text includes null characters). */
if (last_clipboard_text &&
xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
dp = (unsigned char *)Data + 1;