aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2017-09-14 20:46:59 +0300
committerEli Zaretskii2017-09-14 20:46:59 +0300
commit7d33ebc1f0d68b0b2a5bb089e5b62e7e1f6fc3f6 (patch)
treec6bdeec7bcdb20ae7e4f5289203352c14821d8c8
parent2c29280e7a360f55a8110bb1e3985cc09eb94577 (diff)
downloademacs-7d33ebc1f0d68b0b2a5bb089e5b62e7e1f6fc3f6.tar.gz
emacs-7d33ebc1f0d68b0b2a5bb089e5b62e7e1f6fc3f6.zip
Avoid 64-bit compilation warnings in unexw32.c
* src/unexw32.c (pDWP): New macro. (COPY_CHUNK, COPY_PROC_CHUNK): Declare 'count' as DWORD_PTR. Use pDWP for printing values that can be either 32-bit or 64-bit wide.
-rw-r--r--src/unexw32.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/unexw32.c b/src/unexw32.c
index 73d23056263..d3d6a90f686 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -470,6 +470,12 @@ get_section_info (file_data *p_infile)
470 } 470 }
471} 471}
472 472
473/* Format to print a DWORD_PTR value. */
474#ifdef MINGW_W64
475# define pDWP "16llx"
476#else
477# define pDWP "08lx"
478#endif
473 479
474/* The dump routines. */ 480/* The dump routines. */
475 481
@@ -490,13 +496,13 @@ copy_executable_and_dump_data (file_data *p_infile,
490#define COPY_CHUNK(message, src, size, verbose) \ 496#define COPY_CHUNK(message, src, size, verbose) \
491 do { \ 497 do { \
492 unsigned char *s = (void *)(src); \ 498 unsigned char *s = (void *)(src); \
493 unsigned long count = (size); \ 499 DWORD_PTR count = (size); \
494 if (verbose) \ 500 if (verbose) \
495 { \ 501 { \
496 printf ("%s\n", (message)); \ 502 printf ("%s\n", (message)); \
497 printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \ 503 printf ("\t0x%"pDWP" Offset in input file.\n", s - p_infile->file_base); \
498 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ 504 printf ("\t0x%"pDWP" Offset in output file.\n", dst - p_outfile->file_base); \
499 printf ("\t0x%08lx Size in bytes.\n", count); \ 505 printf ("\t0x%"pDWP" Size in bytes.\n", count); \
500 } \ 506 } \
501 memcpy (dst, s, count); \ 507 memcpy (dst, s, count); \
502 dst += count; \ 508 dst += count; \
@@ -505,15 +511,15 @@ copy_executable_and_dump_data (file_data *p_infile,
505#define COPY_PROC_CHUNK(message, src, size, verbose) \ 511#define COPY_PROC_CHUNK(message, src, size, verbose) \
506 do { \ 512 do { \
507 unsigned char *s = (void *)(src); \ 513 unsigned char *s = (void *)(src); \
508 unsigned long count = (size); \ 514 DWORD_PTR count = (size); \
509 if (verbose) \ 515 if (verbose) \
510 { \ 516 { \
511 printf ("%s\n", (message)); \ 517 printf ("%s\n", (message)); \
512 printf ("\t0x%p Address in process.\n", s); \ 518 printf ("\t0x%p Address in process.\n", s); \
513 printf ("\t0x%p Base output file.\n", p_outfile->file_base); \ 519 printf ("\t0x%p Base output file.\n", p_outfile->file_base); \
514 printf ("\t0x%p Offset in output file.\n", dst - p_outfile->file_base); \ 520 printf ("\t0x%"pDWP" Offset in output file.\n", dst - p_outfile->file_base); \
515 printf ("\t0x%p Address in output file.\n", dst); \ 521 printf ("\t0x%p Address in output file.\n", dst); \
516 printf ("\t0x%p Size in bytes.\n", count); \ 522 printf ("\t0x%"pDWP" Size in bytes.\n", count); \
517 } \ 523 } \
518 memcpy (dst, s, count); \ 524 memcpy (dst, s, count); \
519 dst += count; \ 525 dst += count; \