]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/types.h: Define the C99-style PRIxGRUB_SIZE macro,
authorColin Watson <cjwatson@ubuntu.com>
Fri, 2 Jul 2010 17:04:54 +0000 (18:04 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Fri, 2 Jul 2010 17:04:54 +0000 (18:04 +0100)
suitable for using within the format argument of printf when
converting grub_size_t.
* disk/usbms.c (grub_usbms_transfer): Use PRIxGRUB_SIZE rather than
"x" to convert grub_size_t arguments.

ChangeLog
disk/usbms.c
include/grub/types.h

index 36dd9fb492fa3367d808aa948c62fc2d3ec76d60..47da0d981a8ec3c8e0a07ef8683a13333c8b42f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-07-02  Colin Watson  <cjwatson@ubuntu.com>
+
+       * include/grub/types.h: Define the C99-style PRIxGRUB_SIZE macro,
+       suitable for using within the format argument of printf when
+       converting grub_size_t.
+       * disk/usbms.c (grub_usbms_transfer): Use PRIxGRUB_SIZE rather than
+       "x" to convert grub_size_t arguments.
+
 2010-07-02  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * gfxmenu/gui_list.c (draw_menu): Use viewport to simplify code and fix
index a49b30e7ecf7fcb15c3dcfb5e11cd2e2a3816ef9..f913ee3f78006636aa664e5c26061593e2e65654 100644 (file)
@@ -312,7 +312,7 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
       grub_dprintf ("usb", "buf:\n");
       if (size <= 64)
         for (i=0; i<size; i++)
-          grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]);
+          grub_dprintf ("usb", "0x%02" PRIxGRUB_SIZE ": 0x%02x\n", i, buf[i]);
       else
           grub_dprintf ("usb", "Too much data for debug print...\n");
     }
@@ -330,7 +330,7 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
       /* Debug print of sent data. */
       if (size <= 256)
         for (i=0; i<size; i++)
-          grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]);
+          grub_dprintf ("usb", "0x%02" PRIxGRUB_SIZE ": 0x%02x\n", i, buf[i]);
       else
           grub_dprintf ("usb", "Too much data for debug print...\n");
     }
index a9e8adfd6730d7919fff5175f9939910ca328200..4499e453820319998d19c3dec2df2a0e4a903bf2 100644 (file)
@@ -92,10 +92,18 @@ typedef grub_int32_t        grub_target_ssize_t;
 typedef grub_uint64_t  grub_addr_t;
 typedef grub_uint64_t  grub_size_t;
 typedef grub_int64_t   grub_ssize_t;
+
+# if GRUB_CPU_SIZEOF_LONG == 8
+#  define PRIxGRUB_SIZE        "lx"
+# else
+#  define PRIxGRUB_SIZE        "llx"
+# endif
 #else
 typedef grub_uint32_t  grub_addr_t;
 typedef grub_uint32_t  grub_size_t;
 typedef grub_int32_t   grub_ssize_t;
+
+# define PRIxGRUB_SIZE "x"
 #endif
 
 #if GRUB_CPU_SIZEOF_LONG == 8