OSDN Git Service

Fix some -Wformat errors in scanpci
authorJeremy Huddleston <jeremyhu@apple.com>
Wed, 9 Nov 2011 17:46:30 +0000 (09:46 -0800)
committerJeremy Huddleston <jeremyhu@apple.com>
Wed, 9 Nov 2011 17:47:16 +0000 (09:47 -0800)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
scanpci/scanpci.c

index 219c814..1f5f8bd 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #ifdef HAVE_ERR_H
 #include <err.h>
 static void
 print_pci_bridge( const struct pci_bridge_info * info )
 {
-    printf( "  Bus: primary=%02x, secondary=%02x, subordinate=%02x, "
-           "sec-latency=%u\n",
+    printf( "  Bus: primary=%02"PRIx8", secondary=%02"PRIx8", subordinate=%02"PRIx8", "
+           "sec-latency=%"PRIu8"\n",
            info->primary_bus,
            info->secondary_bus,
            info->subordinate_bus,
            info->secondary_latency_timer );
-    printf( "  I/O behind bridge: %08x-%08x\n",
+    printf( "  I/O behind bridge: %08"PRIx32"-%08"PRIx32"\n",
            info->io_base,
            info->io_limit );
-    printf( "  Memory behind bridge: %08x-%08x\n",
+    printf( "  Memory behind bridge: %08"PRIx32"-%08"PRIx32"\n",
            info->mem_base,
            info->mem_limit );
-    printf( "  Prefetchable memory behind bridge: %08llx-%08llx\n",
+    printf( "  Prefetchable memory behind bridge: %08"PRIx64"-%08"PRIx64"\n",
            info->prefetch_mem_base,
            info->prefetch_mem_limit );
 }
@@ -150,7 +151,7 @@ print_pci_device( struct pci_device * dev, int verbose )
        pci_device_probe( dev );
        for ( i = 0 ; i < 6 ; i++ ) {
            if ( dev->regions[i].base_addr != 0 ) {
-               printf( "  BASE%u     0x%08x SIZE %d  %s",
+               printf( "  BASE%u     0x%08"PRIxPTR" SIZE %zu  %s",
                        i,
                        (intptr_t) dev->regions[i].base_addr,
                        (size_t) dev->regions[i].size,