aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog31
-rw-r--r--src/alloc.c5
-rw-r--r--src/bidi.c2
-rw-r--r--src/charset.c8
-rw-r--r--src/coding.c12
-rw-r--r--src/data.c7
-rw-r--r--src/dbusbind.c6
-rw-r--r--src/doc.c4
-rw-r--r--src/fns.c2
-rw-r--r--src/font.c15
-rw-r--r--src/intervals.c2
-rw-r--r--src/keyboard.c8
-rw-r--r--src/lisp.h4
-rw-r--r--src/m/amdx86-64.h2
-rw-r--r--src/m/ia64.h2
-rw-r--r--src/m/ibms390x.h2
-rw-r--r--src/print.c38
-rw-r--r--src/process.c2
-rw-r--r--src/region-cache.c8
-rw-r--r--src/sysdep.c2
-rw-r--r--src/xdisp.c6
-rw-r--r--src/xfns.c2
-rw-r--r--src/xrdb.c4
-rw-r--r--src/xselect.c10
24 files changed, 101 insertions, 83 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 42c7d06168f..9aff9fbbc53 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,33 @@
12011-04-18 Paul Eggert <eggert@cs.ucla.edu> 12011-04-19 Paul Eggert <eggert@cs.ucla.edu>
2
3 Replace pEd with more-general pI, and fix some printf arg casts.
4 * lisp.h (pI): New macro, generalizing old pEd macro to other
5 conversion specifiers. For example, use "...%"pI"d..." rather
6 than "...%"pEd"...".
7 (pEd): Remove. All uses replaced with similar uses of pI.
8 * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
9 * alloc.c (check_pure_size): Don't overflow by converting size to int.
10 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
11 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
12 * dbusbind.c (xd_append_arg): Use pI to avoid cast.
13 (Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
14 * font.c (font_unparse_xlfd): Avoid potential buffer overrun on
15 64-bit hosts.
16 (font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
17 * keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
18 * print.c (safe_debug_print, print_object): Likewise.
19 (print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
20 to int.
21 Use pI instead of if-then-else-abort. Use %p to avoid casts.
22 * process.c (Fmake_network_process): Use pI to avoid cast.
23 * region-cache.c (pp_cache): Likewise.
24 * xdisp.c (decode_mode_spec): Likewise.
25 * xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
26 behavior on 64-bit hosts with printf arg.
27 * xselect.c (x_queue_event): Use %p to avoid casts.
28 (x_stop_queuing_selection_requests): Likewise.
29 (x_get_window_property): Don't truncate byte count to an 'int'
30 when tracing.
2 31
3 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right 32 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
4 here, since it parses constructs like leading '-' and spaces, 33 here, since it parses constructs like leading '-' and spaces,
diff --git a/src/alloc.c b/src/alloc.c
index f2aeaa938eb..423c1f167db 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4563,8 +4563,9 @@ void
4563check_pure_size (void) 4563check_pure_size (void)
4564{ 4564{
4565 if (pure_bytes_used_before_overflow) 4565 if (pure_bytes_used_before_overflow)
4566 message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)", 4566 message (("emacs:0:Pure Lisp storage overflow (approx. %"pI"d"
4567 (int) (pure_bytes_used + pure_bytes_used_before_overflow)); 4567 " bytes needed)"),
4568 pure_bytes_used + pure_bytes_used_before_overflow);
4568} 4569}
4569 4570
4570 4571
diff --git a/src/bidi.c b/src/bidi.c
index 447abb48469..88c45e24a14 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1807,6 +1807,6 @@ bidi_dump_cached_states (void)
1807 fputs ("\n", stderr); 1807 fputs ("\n", stderr);
1808 fputs ("pos ", stderr); 1808 fputs ("pos ", stderr);
1809 for (i = 0; i < bidi_cache_idx; i++) 1809 for (i = 0; i < bidi_cache_idx; i++)
1810 fprintf (stderr, "%*ld", ndigits, (long)bidi_cache[i].charpos); 1810 fprintf (stderr, "%*"pI"d", ndigits, bidi_cache[i].charpos);
1811 fputs ("\n", stderr); 1811 fputs ("\n", stderr);
1812} 1812}
diff --git a/src/charset.c b/src/charset.c
index c4699dcb0a7..9a7a56d9379 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -999,7 +999,7 @@ usage: (define-charset-internal ...) */)
999 { 999 {
1000 CHECK_NUMBER (val); 1000 CHECK_NUMBER (val);
1001 if (XINT (val) < '0' || XINT (val) > 127) 1001 if (XINT (val) < '0' || XINT (val) > 127)
1002 error ("Invalid iso-final-char: %"pEd, XINT (val)); 1002 error ("Invalid iso-final-char: %"pI"d", XINT (val));
1003 charset.iso_final = XINT (val); 1003 charset.iso_final = XINT (val);
1004 } 1004 }
1005 1005
@@ -1021,7 +1021,7 @@ usage: (define-charset-internal ...) */)
1021 { 1021 {
1022 CHECK_NATNUM (val); 1022 CHECK_NATNUM (val);
1023 if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256) 1023 if ((XINT (val) > 0 && XINT (val) <= 128) || XINT (val) >= 256)
1024 error ("Invalid emacs-mule-id: %"pEd, XINT (val)); 1024 error ("Invalid emacs-mule-id: %"pI"d", XINT (val));
1025 charset.emacs_mule_id = XINT (val); 1025 charset.emacs_mule_id = XINT (val);
1026 } 1026 }
1027 1027
@@ -1439,10 +1439,10 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars, Lisp_Obje
1439 CHECK_NATNUM (final_char); 1439 CHECK_NATNUM (final_char);
1440 1440
1441 if (XINT (dimension) > 3) 1441 if (XINT (dimension) > 3)
1442 error ("Invalid DIMENSION %"pEd", it should be 1, 2, or 3", 1442 error ("Invalid DIMENSION %"pI"d, it should be 1, 2, or 3",
1443 XINT (dimension)); 1443 XINT (dimension));
1444 if (XINT (chars) != 94 && XINT (chars) != 96) 1444 if (XINT (chars) != 94 && XINT (chars) != 96)
1445 error ("Invalid CHARS %"pEd", it should be 94 or 96", XINT (chars)); 1445 error ("Invalid CHARS %"pI"d, it should be 94 or 96", XINT (chars));
1446 if (XINT (final_char) < '0' || XINT (final_char) > '~') 1446 if (XINT (final_char) < '0' || XINT (final_char) > '~')
1447 { 1447 {
1448 unsigned char str[MAX_MULTIBYTE_LENGTH + 1]; 1448 unsigned char str[MAX_MULTIBYTE_LENGTH + 1];
diff --git a/src/coding.c b/src/coding.c
index b49070e5e16..38e41e7a99e 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9037,14 +9037,14 @@ Return the corresponding character. */)
9037 9037
9038 if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF 9038 if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
9039 || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) 9039 || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
9040 error ("Invalid code: %"pEd, ch); 9040 error ("Invalid code: %"pI"d", ch);
9041 c = ch; 9041 c = ch;
9042 SJIS_TO_JIS (c); 9042 SJIS_TO_JIS (c);
9043 charset = charset_kanji; 9043 charset = charset_kanji;
9044 } 9044 }
9045 c = DECODE_CHAR (charset, c); 9045 c = DECODE_CHAR (charset, c);
9046 if (c < 0) 9046 if (c < 0)
9047 error ("Invalid code: %"pEd, ch); 9047 error ("Invalid code: %"pI"d", ch);
9048 return make_number (c); 9048 return make_number (c);
9049} 9049}
9050 9050
@@ -9111,13 +9111,13 @@ Return the corresponding character. */)
9111 int b2 = ch & 0x7F; 9111 int b2 = ch & 0x7F;
9112 if (b1 < 0xA1 || b1 > 0xFE 9112 if (b1 < 0xA1 || b1 > 0xFE
9113 || b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE) 9113 || b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE)
9114 error ("Invalid code: %"pEd, ch); 9114 error ("Invalid code: %"pI"d", ch);
9115 c = ch; 9115 c = ch;
9116 charset = charset_big5; 9116 charset = charset_big5;
9117 } 9117 }
9118 c = DECODE_CHAR (charset, c); 9118 c = DECODE_CHAR (charset, c);
9119 if (c < 0) 9119 if (c < 0)
9120 error ("Invalid code: %"pEd, ch); 9120 error ("Invalid code: %"pI"d", ch);
9121 return make_number (c); 9121 return make_number (c);
9122} 9122}
9123 9123
@@ -9289,7 +9289,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
9289 || (EQ (operation, Qinsert_file_contents) && CONSP (target) 9289 || (EQ (operation, Qinsert_file_contents) && CONSP (target)
9290 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) 9290 && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
9291 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) 9291 || (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
9292 error ("Invalid %"pEd"th argument", XFASTINT (target_idx) + 1); 9292 error ("Invalid %"pI"dth argument", XFASTINT (target_idx) + 1);
9293 if (CONSP (target)) 9293 if (CONSP (target))
9294 target = XCAR (target); 9294 target = XCAR (target);
9295 9295
@@ -9765,7 +9765,7 @@ usage: (define-coding-system-internal ...) */)
9765 CHECK_CHARSET_GET_ID (tmp1, id); 9765 CHECK_CHARSET_GET_ID (tmp1, id);
9766 CHECK_NATNUM_CDR (val); 9766 CHECK_NATNUM_CDR (val);
9767 if (XINT (XCDR (val)) >= 4) 9767 if (XINT (XCDR (val)) >= 4)
9768 error ("Invalid graphic register number: %"pEd, XINT (XCDR (val))); 9768 error ("Invalid graphic register number: %"pI"d", XINT (XCDR (val)));
9769 XSETCAR (val, make_number (id)); 9769 XSETCAR (val, make_number (id));
9770 } 9770 }
9771 9771
diff --git a/src/data.c b/src/data.c
index c9250a67bf0..8ece1905243 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2374,12 +2374,7 @@ NUMBER may be an integer or a floating point number. */)
2374 return build_string (pigbuf); 2374 return build_string (pigbuf);
2375 } 2375 }
2376 2376
2377 if (sizeof (int) == sizeof (EMACS_INT)) 2377 sprintf (buffer, "%"pI"d", XINT (number));
2378 sprintf (buffer, "%d", (int) XINT (number));
2379 else if (sizeof (long) == sizeof (EMACS_INT))
2380 sprintf (buffer, "%ld", (long) XINT (number));
2381 else
2382 abort ();
2383 return build_string (buffer); 2378 return build_string (buffer);
2384} 2379}
2385 2380
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 792414b23d8..4c0b9bd017a 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -506,7 +506,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
506 CHECK_NUMBER (object); 506 CHECK_NUMBER (object);
507 { 507 {
508 dbus_uint64_t val = XUINT (object); 508 dbus_uint64_t val = XUINT (object);
509 XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); 509 XD_DEBUG_MESSAGE ("%c %"pI"u", dtype, XUINT (object));
510 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 510 if (!dbus_message_iter_append_basic (iter, dtype, &val))
511 XD_SIGNAL2 (build_string ("Unable to append argument"), object); 511 XD_SIGNAL2 (build_string ("Unable to append argument"), object);
512 return; 512 return;
@@ -1377,7 +1377,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1377 CHECK_STRING (service); 1377 CHECK_STRING (service);
1378 GCPRO3 (bus, serial, service); 1378 GCPRO3 (bus, serial, service);
1379 1379
1380 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); 1380 XD_DEBUG_MESSAGE ("%"pI"u %s ", XUINT (serial), SDATA (service));
1381 1381
1382 /* Open a connection to the bus. */ 1382 /* Open a connection to the bus. */
1383 connection = xd_initialize (bus, TRUE); 1383 connection = xd_initialize (bus, TRUE);
@@ -1465,7 +1465,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1465 CHECK_STRING (service); 1465 CHECK_STRING (service);
1466 GCPRO3 (bus, serial, service); 1466 GCPRO3 (bus, serial, service);
1467 1467
1468 XD_DEBUG_MESSAGE ("%lu %s ", (unsigned long) XUINT (serial), SDATA (service)); 1468 XD_DEBUG_MESSAGE ("%"pI"u %s ", XUINT (serial), SDATA (service));
1469 1469
1470 /* Open a connection to the bus. */ 1470 /* Open a connection to the bus. */
1471 connection = xd_initialize (bus, TRUE); 1471 connection = xd_initialize (bus, TRUE);
diff --git a/src/doc.c b/src/doc.c
index 354aff84979..74e06cce6b3 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -156,7 +156,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
156 if (0 > lseek (fd, position - offset, 0)) 156 if (0 > lseek (fd, position - offset, 0))
157 { 157 {
158 emacs_close (fd); 158 emacs_close (fd);
159 error ("Position %"pEd" out of range in doc string file \"%s\"", 159 error ("Position %"pI"d out of range in doc string file \"%s\"",
160 position, name); 160 position, name);
161 } 161 }
162 162
@@ -671,7 +671,7 @@ the same file name is found in the `doc-directory'. */)
671 ; /* Just a source file name boundary marker. Ignore it. */ 671 ; /* Just a source file name boundary marker. Ignore it. */
672 672
673 else 673 else
674 error ("DOC file invalid at position %"pEd, pos); 674 error ("DOC file invalid at position %"pI"d", pos);
675 } 675 }
676 } 676 }
677 pos += end - buf; 677 pos += end - buf;
diff --git a/src/fns.c b/src/fns.c
index c057f64469c..3771820753e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1072,7 +1072,7 @@ an error is signaled. */)
1072 EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0); 1072 EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0);
1073 1073
1074 if (converted < chars) 1074 if (converted < chars)
1075 error ("Can't convert the %"pEd"th character to unibyte", converted); 1075 error ("Can't convert the %"pI"dth character to unibyte", converted);
1076 string = make_unibyte_string ((char *) str, chars); 1076 string = make_unibyte_string ((char *) str, chars);
1077 xfree (str); 1077 xfree (str);
1078 } 1078 }
diff --git a/src/font.c b/src/font.c
index 7fe0815d80e..2a8cf2e48a7 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1271,9 +1271,9 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1271 f[XLFD_SPACING_INDEX] = "*", len += 2; 1271 f[XLFD_SPACING_INDEX] = "*", len += 2;
1272 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) 1272 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
1273 { 1273 {
1274 f[XLFD_AVGWIDTH_INDEX] = p = alloca (11); 1274 f[XLFD_AVGWIDTH_INDEX] = p = alloca (22);
1275 len += sprintf (p, "%ld", 1275 len += sprintf (p, "%"pI"d",
1276 (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; 1276 XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
1277 } 1277 }
1278 else 1278 else
1279 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; 1279 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2;
@@ -1598,7 +1598,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1598 } 1598 }
1599 1599
1600 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) 1600 if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
1601 len += sprintf (work, ":dpi=%ld", (long)XINT (AREF (font, FONT_DPI_INDEX))); 1601 len += sprintf (work, ":dpi=%"pI"d", XINT (AREF (font, FONT_DPI_INDEX)));
1602 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) 1602 if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
1603 len += strlen (":spacing=100"); 1603 len += strlen (":spacing=100");
1604 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) 1604 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
@@ -1611,7 +1611,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1611 if (STRINGP (value)) 1611 if (STRINGP (value))
1612 len += SBYTES (value); 1612 len += SBYTES (value);
1613 else if (INTEGERP (value)) 1613 else if (INTEGERP (value))
1614 len += sprintf (work, "%ld", (long) XINT (value)); 1614 len += sprintf (work, "%"pI"d", XINT (value));
1615 else if (SYMBOLP (value)) 1615 else if (SYMBOLP (value))
1616 len += (NILP (value) ? 5 : 4); /* for "false" or "true" */ 1616 len += (NILP (value) ? 5 : 4); /* for "false" or "true" */
1617 } 1617 }
@@ -1638,10 +1638,9 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1638 p += sprintf (p, ":%s=%s", style_names[i], 1638 p += sprintf (p, ":%s=%s", style_names[i],
1639 SDATA (SYMBOL_NAME (styles[i]))); 1639 SDATA (SYMBOL_NAME (styles[i])));
1640 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) 1640 if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
1641 p += sprintf (p, ":dpi=%ld", (long) XINT (AREF (font, FONT_DPI_INDEX))); 1641 p += sprintf (p, ":dpi=%"pI"d", XINT (AREF (font, FONT_DPI_INDEX)));
1642 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) 1642 if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
1643 p += sprintf (p, ":spacing=%ld", 1643 p += sprintf (p, ":spacing=%"pI"d", XINT (AREF (font, FONT_SPACING_INDEX)));
1644 (long) XINT (AREF (font, FONT_SPACING_INDEX)));
1645 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) 1644 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
1646 { 1645 {
1647 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0) 1646 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0)
diff --git a/src/intervals.c b/src/intervals.c
index 7ce1796d8eb..3e73110845d 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -778,7 +778,7 @@ update_interval (register INTERVAL i, EMACS_INT pos)
778 i = i->right; /* Move to the right child */ 778 i = i->right; /* Move to the right child */
779 } 779 }
780 else if (NULL_PARENT (i)) 780 else if (NULL_PARENT (i))
781 error ("Point %"pEd" after end of properties", pos); 781 error ("Point %"pI"d after end of properties", pos);
782 else 782 else
783 i = INTERVAL_PARENT (i); 783 i = INTERVAL_PARENT (i);
784 continue; 784 continue;
diff --git a/src/keyboard.c b/src/keyboard.c
index c601649ebca..b0ae1b1868d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3313,7 +3313,7 @@ record_char (Lisp_Object c)
3313 if (XUINT (c) < 0x100) 3313 if (XUINT (c) < 0x100)
3314 putc (XINT (c), dribble); 3314 putc (XINT (c), dribble);
3315 else 3315 else
3316 fprintf (dribble, " 0x%x", (int) XUINT (c)); 3316 fprintf (dribble, " 0x%"pI"x", XUINT (c));
3317 } 3317 }
3318 else 3318 else
3319 { 3319 {
@@ -6443,8 +6443,8 @@ modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object s
6443 { 6443 {
6444 int len = SBYTES (name_alist_or_stem); 6444 int len = SBYTES (name_alist_or_stem);
6445 char *buf = (char *) alloca (len + 50); 6445 char *buf = (char *) alloca (len + 50);
6446 sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem), 6446 sprintf (buf, "%s-%"pI"d", SDATA (name_alist_or_stem),
6447 (long) XINT (symbol_int) + 1); 6447 XINT (symbol_int) + 1);
6448 value = intern (buf); 6448 value = intern (buf);
6449 } 6449 }
6450 else if (name_table != 0 && name_table[symbol_num]) 6450 else if (name_table != 0 && name_table[symbol_num])
@@ -6462,7 +6462,7 @@ modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object s
6462 if (NILP (value)) 6462 if (NILP (value))
6463 { 6463 {
6464 char buf[20]; 6464 char buf[20];
6465 sprintf (buf, "key-%ld", (long)symbol_num); 6465 sprintf (buf, "key-%"pI"d", symbol_num);
6466 value = intern (buf); 6466 value = intern (buf);
6467 } 6467 }
6468 6468
diff --git a/src/lisp.h b/src/lisp.h
index 581835dd32b..893c00d5137 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -38,7 +38,7 @@ extern void check_cons_list (void);
38#ifndef EMACS_INT 38#ifndef EMACS_INT
39#define EMACS_INT long 39#define EMACS_INT long
40#define BITS_PER_EMACS_INT BITS_PER_LONG 40#define BITS_PER_EMACS_INT BITS_PER_LONG
41#define pEd "ld" 41#define pI "l"
42#endif 42#endif
43#ifndef EMACS_UINT 43#ifndef EMACS_UINT
44#define EMACS_UINT unsigned long 44#define EMACS_UINT unsigned long
@@ -47,7 +47,7 @@ extern void check_cons_list (void);
47#ifndef EMACS_INT 47#ifndef EMACS_INT
48#define EMACS_INT int 48#define EMACS_INT int
49#define BITS_PER_EMACS_INT BITS_PER_INT 49#define BITS_PER_EMACS_INT BITS_PER_INT
50#define pEd "d" 50#define pI ""
51#endif 51#endif
52#ifndef EMACS_UINT 52#ifndef EMACS_UINT
53#define EMACS_UINT unsigned int 53#define EMACS_UINT unsigned int
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index dbca9b5b838..50fcf8e7872 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -28,7 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29/* Define the type to use. */ 29/* Define the type to use. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define pEd "ld" 31#define pI "l"
32#define EMACS_UINT unsigned long 32#define EMACS_UINT unsigned long
33 33
34/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ 34/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
diff --git a/src/m/ia64.h b/src/m/ia64.h
index a1374d7c224..7a8866a9503 100644
--- a/src/m/ia64.h
+++ b/src/m/ia64.h
@@ -28,7 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29/* Define the type to use. */ 29/* Define the type to use. */
30#define EMACS_INT long 30#define EMACS_INT long
31#define pEd "ld" 31#define pI "l"
32#define EMACS_UINT unsigned long 32#define EMACS_UINT unsigned long
33 33
34#ifdef REL_ALLOC 34#ifdef REL_ALLOC
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
index 14228b61e56..04092d6e1ac 100644
--- a/src/m/ibms390x.h
+++ b/src/m/ibms390x.h
@@ -24,7 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24 24
25/* Define the type to use. */ 25/* Define the type to use. */
26#define EMACS_INT long 26#define EMACS_INT long
27#define pEd "ld" 27#define pI "l"
28#define EMACS_UINT unsigned long 28#define EMACS_UINT unsigned long
29 29
30/* On the 64 bit architecture, we can use 60 bits for addresses */ 30/* On the 64 bit architecture, we can use 60 bits for addresses */
diff --git a/src/print.c b/src/print.c
index 6a331cb11f2..d837a533818 100644
--- a/src/print.c
+++ b/src/print.c
@@ -808,10 +808,9 @@ safe_debug_print (Lisp_Object arg)
808 if (valid > 0) 808 if (valid > 0)
809 debug_print (arg); 809 debug_print (arg);
810 else 810 else
811 fprintf (stderr, "#<%s_LISP_OBJECT 0x%08lx>\r\n", 811 fprintf (stderr, "#<%s_LISP_OBJECT 0x%08"pI"x>\r\n",
812 !valid ? "INVALID" : "SOME", 812 !valid ? "INVALID" : "SOME",
813 (unsigned long) XHASH (arg) 813 XHASH (arg));
814 );
815} 814}
816 815
817 816
@@ -1338,11 +1337,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1338 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); 1337 Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
1339 if (INTEGERP (num)) 1338 if (INTEGERP (num))
1340 { 1339 {
1341 int n = XINT (num); 1340 EMACS_INT n = XINT (num);
1342 if (n < 0) 1341 if (n < 0)
1343 { /* Add a prefix #n= if OBJ has not yet been printed; 1342 { /* Add a prefix #n= if OBJ has not yet been printed;
1344 that is, its status field is nil. */ 1343 that is, its status field is nil. */
1345 sprintf (buf, "#%d=", -n); 1344 sprintf (buf, "#%"pI"d=", -n);
1346 strout (buf, -1, -1, printcharfun); 1345 strout (buf, -1, -1, printcharfun);
1347 /* OBJ is going to be printed. Remember that fact. */ 1346 /* OBJ is going to be printed. Remember that fact. */
1348 Fputhash (obj, make_number (- n), Vprint_number_table); 1347 Fputhash (obj, make_number (- n), Vprint_number_table);
@@ -1350,7 +1349,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1350 else 1349 else
1351 { 1350 {
1352 /* Just print #n# if OBJ has already been printed. */ 1351 /* Just print #n# if OBJ has already been printed. */
1353 sprintf (buf, "#%d#", n); 1352 sprintf (buf, "#%"pI"d#", n);
1354 strout (buf, -1, -1, printcharfun); 1353 strout (buf, -1, -1, printcharfun);
1355 return; 1354 return;
1356 } 1355 }
@@ -1363,12 +1362,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1363 switch (XTYPE (obj)) 1362 switch (XTYPE (obj))
1364 { 1363 {
1365 case_Lisp_Int: 1364 case_Lisp_Int:
1366 if (sizeof (int) == sizeof (EMACS_INT)) 1365 sprintf (buf, "%"pI"d", XINT (obj));
1367 sprintf (buf, "%d", (int) XINT (obj));
1368 else if (sizeof (long) == sizeof (EMACS_INT))
1369 sprintf (buf, "%ld", (long) XINT (obj));
1370 else
1371 abort ();
1372 strout (buf, -1, -1, printcharfun); 1366 strout (buf, -1, -1, printcharfun);
1373 break; 1367 break;
1374 1368
@@ -1701,7 +1695,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1701 1695
1702 PRINTCHAR ('#'); 1696 PRINTCHAR ('#');
1703 PRINTCHAR ('&'); 1697 PRINTCHAR ('&');
1704 sprintf (buf, "%ld", (long) XBOOL_VECTOR (obj)->size); 1698 sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size);
1705 strout (buf, -1, -1, printcharfun); 1699 strout (buf, -1, -1, printcharfun);
1706 PRINTCHAR ('\"'); 1700 PRINTCHAR ('\"');
1707 1701
@@ -1754,7 +1748,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1754 else if (WINDOWP (obj)) 1748 else if (WINDOWP (obj))
1755 { 1749 {
1756 strout ("#<window ", -1, -1, printcharfun); 1750 strout ("#<window ", -1, -1, printcharfun);
1757 sprintf (buf, "%ld", (long) XFASTINT (XWINDOW (obj)->sequence_number)); 1751 sprintf (buf, "%"pI"d", XFASTINT (XWINDOW (obj)->sequence_number));
1758 strout (buf, -1, -1, printcharfun); 1752 strout (buf, -1, -1, printcharfun);
1759 if (!NILP (XWINDOW (obj)->buffer)) 1753 if (!NILP (XWINDOW (obj)->buffer))
1760 { 1754 {
@@ -1881,7 +1875,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1881 ? "#<frame " : "#<dead frame "), 1875 ? "#<frame " : "#<dead frame "),
1882 -1, -1, printcharfun); 1876 -1, -1, printcharfun);
1883 print_string (XFRAME (obj)->name, printcharfun); 1877 print_string (XFRAME (obj)->name, printcharfun);
1884 sprintf (buf, " 0x%lx", (unsigned long) (XFRAME (obj))); 1878 sprintf (buf, " %p", XFRAME (obj));
1885 strout (buf, -1, -1, printcharfun); 1879 strout (buf, -1, -1, printcharfun);
1886 PRINTCHAR ('>'); 1880 PRINTCHAR ('>');
1887 } 1881 }
@@ -1978,7 +1972,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1978 strout ("in no buffer", -1, -1, printcharfun); 1972 strout ("in no buffer", -1, -1, printcharfun);
1979 else 1973 else
1980 { 1974 {
1981 sprintf (buf, "at %ld", (long)marker_position (obj)); 1975 sprintf (buf, "at %"pI"d", marker_position (obj));
1982 strout (buf, -1, -1, printcharfun); 1976 strout (buf, -1, -1, printcharfun);
1983 strout (" in ", -1, -1, printcharfun); 1977 strout (" in ", -1, -1, printcharfun);
1984 print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun); 1978 print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
@@ -1992,9 +1986,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1992 strout ("in no buffer", -1, -1, printcharfun); 1986 strout ("in no buffer", -1, -1, printcharfun);
1993 else 1987 else
1994 { 1988 {
1995 sprintf (buf, "from %ld to %ld in ", 1989 sprintf (buf, "from %"pI"d to %"pI"d in ",
1996 (long)marker_position (OVERLAY_START (obj)), 1990 marker_position (OVERLAY_START (obj)),
1997 (long)marker_position (OVERLAY_END (obj))); 1991 marker_position (OVERLAY_END (obj)));
1998 strout (buf, -1, -1, printcharfun); 1992 strout (buf, -1, -1, printcharfun);
1999 print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name), 1993 print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
2000 printcharfun); 1994 printcharfun);
@@ -2010,8 +2004,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2010 2004
2011 case Lisp_Misc_Save_Value: 2005 case Lisp_Misc_Save_Value:
2012 strout ("#<save_value ", -1, -1, printcharfun); 2006 strout ("#<save_value ", -1, -1, printcharfun);
2013 sprintf(buf, "ptr=0x%08lx int=%d", 2007 sprintf(buf, "ptr=%08p int=%d",
2014 (unsigned long) XSAVE_VALUE (obj)->pointer, 2008 XSAVE_VALUE (obj)->pointer,
2015 XSAVE_VALUE (obj)->integer); 2009 XSAVE_VALUE (obj)->integer);
2016 strout (buf, -1, -1, printcharfun); 2010 strout (buf, -1, -1, printcharfun);
2017 PRINTCHAR ('>'); 2011 PRINTCHAR ('>');
@@ -2031,7 +2025,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2031 if (MISCP (obj)) 2025 if (MISCP (obj))
2032 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj)); 2026 sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
2033 else if (VECTORLIKEP (obj)) 2027 else if (VECTORLIKEP (obj))
2034 sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size); 2028 sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR (obj)->size);
2035 else 2029 else
2036 sprintf (buf, "(0x%02x)", (int) XTYPE (obj)); 2030 sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
2037 strout (buf, -1, -1, printcharfun); 2031 strout (buf, -1, -1, printcharfun);
diff --git a/src/process.c b/src/process.c
index d8851c56cf0..8fbd8ac92e2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3041,7 +3041,7 @@ usage: (make-network-process &rest ARGS) */)
3041 portstring = "0"; 3041 portstring = "0";
3042 else if (INTEGERP (service)) 3042 else if (INTEGERP (service))
3043 { 3043 {
3044 sprintf (portbuf, "%ld", (long) XINT (service)); 3044 sprintf (portbuf, "%"pI"d", XINT (service));
3045 portstring = portbuf; 3045 portstring = portbuf;
3046 } 3046 }
3047 else 3047 else
diff --git a/src/region-cache.c b/src/region-cache.c
index a0b85039e74..d701f4d71b0 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -790,9 +790,9 @@ pp_cache (struct region_cache *c)
790 EMACS_INT end_u = c->buffer_end - c->end_unchanged; 790 EMACS_INT end_u = c->buffer_end - c->end_unchanged;
791 791
792 fprintf (stderr, 792 fprintf (stderr,
793 "basis: %ld..%ld modified: %ld..%ld\n", 793 "basis: %"pI"d..%"pI"d modified: %"pI"d..%"pI"d\n",
794 (long)c->buffer_beg, (long)c->buffer_end, 794 c->buffer_beg, c->buffer_end,
795 (long)beg_u, (long)end_u); 795 beg_u, end_u);
796 796
797 for (i = 0; i < c->cache_len; i++) 797 for (i = 0; i < c->cache_len; i++)
798 { 798 {
@@ -806,6 +806,6 @@ pp_cache (struct region_cache *c)
806 : (pos == end_u) ? '-' 806 : (pos == end_u) ? '-'
807 : ' '), 807 : ' '),
808 stderr); 808 stderr);
809 fprintf (stderr, "%ld : %d\n", (long)pos, BOUNDARY_VALUE (c, i)); 809 fprintf (stderr, "%"pI"d : %d\n", pos, BOUNDARY_VALUE (c, i));
810 } 810 }
811} 811}
diff --git a/src/sysdep.c b/src/sysdep.c
index 45e80ac0155..a57b8c0382d 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2383,7 +2383,7 @@ serial_configure (struct Lisp_Process *p,
2383 CHECK_NUMBER (tem); 2383 CHECK_NUMBER (tem);
2384 err = cfsetspeed (&attr, XINT (tem)); 2384 err = cfsetspeed (&attr, XINT (tem));
2385 if (err != 0) 2385 if (err != 0)
2386 error ("cfsetspeed(%"pEd") failed: %s", XINT (tem), 2386 error ("cfsetspeed(%"pI"d) failed: %s", XINT (tem),
2387 emacs_strerror (errno)); 2387 emacs_strerror (errno));
2388 childp2 = Fplist_put (childp2, QCspeed, tem); 2388 childp2 = Fplist_put (childp2, QCspeed, tem);
2389 2389
diff --git a/src/xdisp.c b/src/xdisp.c
index eaab8dac18d..e6aa05b4973 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19564,7 +19564,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19564 so get us a 2-digit number that is close. */ 19564 so get us a 2-digit number that is close. */
19565 if (total == 100) 19565 if (total == 100)
19566 total = 99; 19566 total = 99;
19567 sprintf (decode_mode_spec_buf, "%2ld%%", (long)total); 19567 sprintf (decode_mode_spec_buf, "%2"pI"d%%", total);
19568 return decode_mode_spec_buf; 19568 return decode_mode_spec_buf;
19569 } 19569 }
19570 } 19570 }
@@ -19595,9 +19595,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19595 if (total == 100) 19595 if (total == 100)
19596 total = 99; 19596 total = 99;
19597 if (toppos <= BUF_BEGV (b)) 19597 if (toppos <= BUF_BEGV (b))
19598 sprintf (decode_mode_spec_buf, "Top%2ld%%", (long)total); 19598 sprintf (decode_mode_spec_buf, "Top%2"pI"d%%", total);
19599 else 19599 else
19600 sprintf (decode_mode_spec_buf, "%2ld%%", (long)total); 19600 sprintf (decode_mode_spec_buf, "%2"pI"d%%", total);
19601 return decode_mode_spec_buf; 19601 return decode_mode_spec_buf;
19602 } 19602 }
19603 } 19603 }
diff --git a/src/xfns.c b/src/xfns.c
index 51aca3e9670..7a575150687 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -216,7 +216,7 @@ check_x_display_info (Lisp_Object object)
216 struct terminal *t = get_terminal (object, 1); 216 struct terminal *t = get_terminal (object, 1);
217 217
218 if (t->type != output_x_window) 218 if (t->type != output_x_window)
219 error ("Terminal %"pEd" is not an X display", XINT (object)); 219 error ("Terminal %"pI"d is not an X display", XINT (object));
220 220
221 dpyinfo = t->display_info.x; 221 dpyinfo = t->display_info.x;
222 } 222 }
diff --git a/src/xrdb.c b/src/xrdb.c
index b01e344edf2..b490afdabaa 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -536,10 +536,10 @@ x_load_resources (Display *display, const char *xrm_string,
536 dialog from `double-click-time'. */ 536 dialog from `double-click-time'. */
537 if (INTEGERP (Vdouble_click_time) && XINT (Vdouble_click_time) > 0) 537 if (INTEGERP (Vdouble_click_time) && XINT (Vdouble_click_time) > 0)
538 { 538 {
539 sprintf (line, "%s*fsb*DirList.doubleClickInterval: %d", 539 sprintf (line, "%s*fsb*DirList.doubleClickInterval: %"pI"d",
540 myclass, XFASTINT (Vdouble_click_time)); 540 myclass, XFASTINT (Vdouble_click_time));
541 XrmPutLineResource (&rdb, line); 541 XrmPutLineResource (&rdb, line);
542 sprintf (line, "%s*fsb*ItemsList.doubleClickInterval: %d", 542 sprintf (line, "%s*fsb*ItemsList.doubleClickInterval: %"pI"d",
543 myclass, XFASTINT (Vdouble_click_time)); 543 myclass, XFASTINT (Vdouble_click_time));
544 XrmPutLineResource (&rdb, line); 544 XrmPutLineResource (&rdb, line);
545 } 545 }
diff --git a/src/xselect.c b/src/xselect.c
index 2d656cfec9a..edf00226404 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -169,7 +169,7 @@ x_queue_event (struct input_event *event)
169 { 169 {
170 if (!memcmp (&queue_tmp->event, event, sizeof (*event))) 170 if (!memcmp (&queue_tmp->event, event, sizeof (*event)))
171 { 171 {
172 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); 172 TRACE1 ("DECLINE DUP SELECTION EVENT %08p", queue_tmp);
173 x_decline_selection_request (event); 173 x_decline_selection_request (event);
174 return; 174 return;
175 } 175 }
@@ -180,7 +180,7 @@ x_queue_event (struct input_event *event)
180 180
181 if (queue_tmp != NULL) 181 if (queue_tmp != NULL)
182 { 182 {
183 TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp); 183 TRACE1 ("QUEUE SELECTION EVENT %08p", queue_tmp);
184 queue_tmp->event = *event; 184 queue_tmp->event = *event;
185 queue_tmp->next = selection_queue; 185 queue_tmp->next = selection_queue;
186 selection_queue = queue_tmp; 186 selection_queue = queue_tmp;
@@ -213,7 +213,7 @@ x_stop_queuing_selection_requests (void)
213 while (selection_queue != NULL) 213 while (selection_queue != NULL)
214 { 214 {
215 struct selection_event_queue *queue_tmp = selection_queue; 215 struct selection_event_queue *queue_tmp = selection_queue;
216 TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp); 216 TRACE1 ("RESTORE SELECTION EVENT %08p", queue_tmp);
217 kbd_buffer_unget_event (&queue_tmp->event); 217 kbd_buffer_unget_event (&queue_tmp->event);
218 selection_queue = queue_tmp->next; 218 selection_queue = queue_tmp->next;
219 xfree ((char *)queue_tmp); 219 xfree ((char *)queue_tmp);
@@ -1444,7 +1444,7 @@ x_get_window_property (Display *display, Window window, Atom property,
1444 while (bytes_remaining) 1444 while (bytes_remaining)
1445 { 1445 {
1446#ifdef TRACE_SELECTION 1446#ifdef TRACE_SELECTION
1447 int last = bytes_remaining; 1447 unsigned long last = bytes_remaining;
1448#endif 1448#endif
1449 result 1449 result
1450 = XGetWindowProperty (display, window, property, 1450 = XGetWindowProperty (display, window, property,
@@ -1454,7 +1454,7 @@ x_get_window_property (Display *display, Window window, Atom property,
1454 actual_type_ret, actual_format_ret, 1454 actual_type_ret, actual_format_ret,
1455 actual_size_ret, &bytes_remaining, &tmp_data); 1455 actual_size_ret, &bytes_remaining, &tmp_data);
1456 1456
1457 TRACE2 ("Read %ld bytes from property %s", 1457 TRACE2 ("Read %lu bytes from property %s",
1458 last - bytes_remaining, 1458 last - bytes_remaining,
1459 XGetAtomName (display, property)); 1459 XGetAtomName (display, property));
1460 1460