aboutsummaryrefslogtreecommitdiffstats
path: root/src/w16select.c
diff options
context:
space:
mode:
authorStefan Monnier2019-03-21 23:55:28 -0400
committerStefan Monnier2019-03-21 23:55:28 -0400
commit76fea1eba1332440eab2e3daecce053daccd3782 (patch)
tree944ea8279b8a52cb715fe3493d909bc581776430 /src/w16select.c
parent57a60db2b88dfa5dea41a3a05b736cd7cd17a953 (diff)
downloademacs-76fea1eba1332440eab2e3daecce053daccd3782.tar.gz
emacs-76fea1eba1332440eab2e3daecce053daccd3782.zip
Fix misuses of NULL when talking about the NUL character
* lisp/subr.el (inhibit-null-byte-detection): Make it an obsolete alias. * src/coding.c (setup_coding_system): Use new name. (detect_coding): Rename null_byte_found => nul_byte_found. (detect_coding_system): Use new name. Rename null_byte_found => nul_byte_found. (Fdefine_coding_system_internal): Use new name. (syms_of_coding): Rename inhibit-null-byte-detection to inhibit-nul-byte-detection. * src/w16select.c (get_clipboard_data): null_char => nul_char. * src/json.c (check_string_without_embedded_nuls): Rename from check_string_without_embedded_nulls. (Fjson_parse_string): Adjust accordingly. * src/coding.h (enum define_coding_undecided_arg_index) (enum coding_attr_index): ...null_byte... => ...nul_byte.... * lisp/info.el (info-insert-file-contents, Info-insert-dir): * lisp/international/mule.el (define-coding-system): * lisp/vc/vc-git.el (vc-git--call): * doc/lispref/nonascii.texi (Lisp and Coding Systems): Use the new name.
Diffstat (limited to 'src/w16select.c')
-rw-r--r--src/w16select.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/w16select.c b/src/w16select.c
index b935b9f4f54..3eb219954af 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -220,7 +220,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
220 /* need to know final size after '\r' chars are inserted (the 220 /* need to know final size after '\r' chars are inserted (the
221 standard CF_OEMTEXT clipboard format uses CRLF line endings, 221 standard CF_OEMTEXT clipboard format uses CRLF line endings,
222 while Emacs uses just LF internally). */ 222 while Emacs uses just LF internally). */
223 truelen = Size + 1; /* +1 for the terminating null */ 223 truelen = Size + 1; /* +1 for the terminating NUL */
224 224
225 if (!Raw) 225 if (!Raw)
226 { 226 {
@@ -243,7 +243,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
243 { 243 {
244 dosmemput (Data, Size, xbuf_addr); 244 dosmemput (Data, Size, xbuf_addr);
245 245
246 /* Terminate with a null, otherwise Windows does strange things 246 /* Terminate with a NUL, otherwise Windows does strange things
247 when the text size is an integral multiple of 32 bytes. */ 247 when the text size is an integral multiple of 32 bytes. */
248 _farpokeb (_dos_ds, xbuf_addr + Size, '\0'); 248 _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
249 } 249 }
@@ -255,7 +255,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
255 while (Size--) 255 while (Size--)
256 { 256 {
257 /* Don't allow them to put binary data into the clipboard, since 257 /* Don't allow them to put binary data into the clipboard, since
258 it will cause yanked data to be truncated at the first null. */ 258 it will cause yanked data to be truncated at the first NUL. */
259 if (*dp == '\0') 259 if (*dp == '\0')
260 return 2; 260 return 2;
261 if (*dp == '\n') 261 if (*dp == '\n')
@@ -263,7 +263,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
263 _farnspokeb (buf_offset++, *dp++); 263 _farnspokeb (buf_offset++, *dp++);
264 } 264 }
265 265
266 /* Terminate with a null, otherwise Windows does strange things 266 /* Terminate with a NUL, otherwise Windows does strange things
267 when the text size is an integral multiple of 32 bytes. */ 267 when the text size is an integral multiple of 32 bytes. */
268 _farnspokeb (buf_offset, '\0'); 268 _farnspokeb (buf_offset, '\0');
269 } 269 }
@@ -354,13 +354,13 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
354 __dpmi_int (0x2f, &regs); 354 __dpmi_int (0x2f, &regs);
355 if (regs.x.ax != 0) 355 if (regs.x.ax != 0)
356 { 356 {
357 unsigned char null_char = '\0'; 357 unsigned char nul_char = '\0';
358 unsigned long xbuf_beg = xbuf_addr; 358 unsigned long xbuf_beg = xbuf_addr;
359 359
360 /* If last_clipboard_text is NULL, we don't want to slow down 360 /* If last_clipboard_text is NULL, we don't want to slow down
361 the next loop by an additional test. */ 361 the next loop by an additional test. */
362 register unsigned char *lcdp = 362 register unsigned char *lcdp =
363 last_clipboard_text == NULL ? &null_char : last_clipboard_text; 363 last_clipboard_text == NULL ? &nul_char : last_clipboard_text;
364 364
365 /* Copy data from low memory, remove CR 365 /* Copy data from low memory, remove CR
366 characters before LF if needed. */ 366 characters before LF if needed. */
@@ -383,7 +383,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
383 /* Windows reportedly rounds up the size of clipboard data 383 /* Windows reportedly rounds up the size of clipboard data
384 (passed in SIZE) to a multiple of 32, and removes trailing 384 (passed in SIZE) to a multiple of 32, and removes trailing
385 spaces from each line without updating SIZE. We therefore 385 spaces from each line without updating SIZE. We therefore
386 bail out when we see the first null character. */ 386 bail out when we see the first NUL character. */
387 else if (c == '\0') 387 else if (c == '\0')
388 break; 388 break;
389 } 389 }
@@ -392,7 +392,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
392 last time set_clipboard_data was called, pretend there's no 392 last time set_clipboard_data was called, pretend there's no
393 data in the clipboard. This is so we don't pass our own text 393 data in the clipboard. This is so we don't pass our own text
394 from the clipboard (which might be troublesome if the killed 394 from the clipboard (which might be troublesome if the killed
395 text includes null characters). */ 395 text includes NUL characters). */
396 if (last_clipboard_text && 396 if (last_clipboard_text &&
397 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text)) 397 xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
398 dp = (unsigned char *)Data + 1; 398 dp = (unsigned char *)Data + 1;