emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7d33ebc: Avoid 64-bit compilation warnings in unexw


From: Eli Zaretskii
Subject: [Emacs-diffs] master 7d33ebc: Avoid 64-bit compilation warnings in unexw32.c
Date: Thu, 14 Sep 2017 13:47:45 -0400 (EDT)

branch: master
commit 7d33ebc1f0d68b0b2a5bb089e5b62e7e1f6fc3f6
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 src/unexw32.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/unexw32.c b/src/unexw32.c
index 73d2305..d3d6a90 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -470,6 +470,12 @@ get_section_info (file_data *p_infile)
     }
 }
 
+/* Format to print a DWORD_PTR value.  */
+#ifdef MINGW_W64
+# define pDWP  "16llx"
+#else
+# define pDWP  "08lx"
+#endif
 
 /* The dump routines.  */
 
@@ -490,13 +496,13 @@ copy_executable_and_dump_data (file_data *p_infile,
 #define COPY_CHUNK(message, src, size, verbose)                                
        \
   do {                                                                         
\
     unsigned char *s = (void *)(src);                                          
\
-    unsigned long count = (size);                                              
\
+    DWORD_PTR count = (size);                                          \
     if (verbose)                                                               
\
       {                                                                        
        \
        printf ("%s\n", (message));                                             
\
-       printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base);   
\
-       printf ("\t0x%08x Offset in output file.\n", dst - 
p_outfile->file_base); \
-       printf ("\t0x%08lx Size in bytes.\n", count);                           
\
+       printf ("\t0x%"pDWP" Offset in input file.\n", s - 
p_infile->file_base);        \
+       printf ("\t0x%"pDWP" Offset in output file.\n", dst - 
p_outfile->file_base); \
+       printf ("\t0x%"pDWP" Size in bytes.\n", count);                         
\
       }                                                                        
        \
     memcpy (dst, s, count);                                                    
\
     dst += count;                                                              
\
@@ -505,15 +511,15 @@ copy_executable_and_dump_data (file_data *p_infile,
 #define COPY_PROC_CHUNK(message, src, size, verbose)                           
\
   do {                                                                         
\
     unsigned char *s = (void *)(src);                                          
\
-    unsigned long count = (size);                                              
\
+    DWORD_PTR count = (size);                                          \
     if (verbose)                                                               
\
       {                                                                        
        \
        printf ("%s\n", (message));                                             
\
        printf ("\t0x%p Address in process.\n", s);                             
\
        printf ("\t0x%p Base       output file.\n", p_outfile->file_base); \
-       printf ("\t0x%p Offset  in output file.\n", dst - 
p_outfile->file_base); \
+       printf ("\t0x%"pDWP" Offset  in output file.\n", dst - 
p_outfile->file_base); \
        printf ("\t0x%p Address in output file.\n", dst); \
-       printf ("\t0x%p Size in bytes.\n", count);                              
\
+       printf ("\t0x%"pDWP" Size in bytes.\n", count);                         
\
       }                                                                        
        \
     memcpy (dst, s, count);                                                    
\
     dst += count;                                                              
\



reply via email to

[Prev in Thread] Current Thread [Next in Thread]