comparison src/w16select.c @ 24251:2394581ada26

(set_clipboard_data): Correctly null-terminate the string to be put into the Windows clipboard. Use xbuf_addr.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 02 Feb 1999 13:43:14 +0000
parents 5048f069091e
children 7507c0552393
comparison
equal deleted inserted replaced
24250:98056b9021a6 24251:2394581ada26
261 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0) 261 if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0)
262 return 0; 262 return 0;
263 263
264 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */ 264 /* Move the buffer into the low memory, convert LF into CR-LF if needed. */
265 if (Raw) 265 if (Raw)
266 dosmemput (Data, truelen, __tb); 266 {
267 dosmemput (Data, Size, xbuf_addr);
268
269 /* Terminate with a null, otherwise Windows does strange things
270 when the text size is an integral multiple of 32 bytes. */
271 _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
272 }
267 else 273 else
268 { 274 {
269 dp = Data; 275 dp = Data;
270 buf_offset = xbuf_addr; 276 buf_offset = xbuf_addr;
271 _farsetsel (_dos_ds); 277 _farsetsel (_dos_ds);
277 return 2; 283 return 2;
278 if (*dp == '\n') 284 if (*dp == '\n')
279 _farnspokeb (buf_offset++, '\r'); 285 _farnspokeb (buf_offset++, '\r');
280 _farnspokeb (buf_offset++, *dp++); 286 _farnspokeb (buf_offset++, *dp++);
281 } 287 }
282 } 288
283 289 /* Terminate with a null, otherwise Windows does strange things
284 /* Terminate with a null, otherwise Windows does strange things when 290 when the text size is an integral multiple of 32 bytes. */
285 the text size is an integral multiple of 32 bytes. */ 291 _farnspokeb (buf_offset, '\0');
286 _farnspokeb (buf_offset, *dp); 292 }
287 293
288 /* Calls Int 2Fh/AX=1703h with: 294 /* Calls Int 2Fh/AX=1703h with:
289 DX = WinOldAp-Supported Clipboard format 295 DX = WinOldAp-Supported Clipboard format
290 ES:BX = Pointer to data 296 ES:BX = Pointer to data
291 SI:CX = Size of data in bytes 297 SI:CX = Size of data in bytes