1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 12:40:56 -08:00

Replace pEd with more-general pI, and fix some printf arg casts.

* lisp.h (pI): New macro, generalizing old pEd macro to other
conversion specifiers.  For example, use "...%"pI"d..." rather
than "...%"pEd"...".
(pEd): Remove.  All uses replaced with similar uses of pI.
* src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
* alloc.c (check_pure_size): Don't overflow by converting size to int.
* bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
* data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
* dbusbind.c (xd_append_arg): Use pI to avoid cast.
(Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
* font.c (font_unparse_xlfd): Avoid potential buffer overrun on
64-bit hosts.
(font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
* keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
* print.c (safe_debug_print, print_object): Likewise.
(print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
to int.
Use pI instead of if-then-else-abort.  Use %p to avoid casts.
* process.c (Fmake_network_process): Use pI to avoid cast.
* region-cache.c (pp_cache): Likewise.
* xdisp.c (decode_mode_spec): Likewise.
* xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
behavior on 64-bit hosts with printf arg.
* xselect.c (x_queue_event): Use %p to avoid casts.
(x_stop_queuing_selection_requests): Likewise.
(x_get_window_property): Don't truncate byte count to an 'int'
when tracing.
This commit is contained in:
Paul Eggert 2011-04-18 17:34:42 -07:00
parent 5e073ec738
commit c2982e87d3
24 changed files with 101 additions and 83 deletions

View file

@ -9037,14 +9037,14 @@ Return the corresponding character. */)
if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
|| c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
error ("Invalid code: %"pEd, ch);
error ("Invalid code: %"pI"d", ch);
c = ch;
SJIS_TO_JIS (c);
charset = charset_kanji;
}
c = DECODE_CHAR (charset, c);
if (c < 0)
error ("Invalid code: %"pEd, ch);
error ("Invalid code: %"pI"d", ch);
return make_number (c);
}
@ -9111,13 +9111,13 @@ Return the corresponding character. */)
int b2 = ch & 0x7F;
if (b1 < 0xA1 || b1 > 0xFE
|| b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE)
error ("Invalid code: %"pEd, ch);
error ("Invalid code: %"pI"d", ch);
c = ch;
charset = charset_big5;
}
c = DECODE_CHAR (charset, c);
if (c < 0)
error ("Invalid code: %"pEd, ch);
error ("Invalid code: %"pI"d", ch);
return make_number (c);
}
@ -9289,7 +9289,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
|| (EQ (operation, Qinsert_file_contents) && CONSP (target)
&& STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
|| (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
error ("Invalid %"pEd"th argument", XFASTINT (target_idx) + 1);
error ("Invalid %"pI"dth argument", XFASTINT (target_idx) + 1);
if (CONSP (target))
target = XCAR (target);
@ -9765,7 +9765,7 @@ usage: (define-coding-system-internal ...) */)
CHECK_CHARSET_GET_ID (tmp1, id);
CHECK_NATNUM_CDR (val);
if (XINT (XCDR (val)) >= 4)
error ("Invalid graphic register number: %"pEd, XINT (XCDR (val)));
error ("Invalid graphic register number: %"pI"d", XINT (XCDR (val)));
XSETCAR (val, make_number (id));
}