OSDN Git Service

monitor: Fix uint64_t format specifier
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 10 Nov 2012 12:16:27 +0000 (14:16 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sat, 10 Nov 2012 12:19:33 +0000 (14:19 +0200)
To be compilable both on 32 and 64 bit architectures the PRIu64 macro
needs to be used as format specifier for uint64_t. Otherwise we'll get
the following type of error either on 32 bit (for %lx) or 64 bit (for
%llx) :

monitor/l2cap.c: In function 'sig_info_rsp':
monitor/l2cap.c:351:3: error: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'uint64_t' [-Werror=format]

monitor/l2cap.c

index 2e26510..017f7a3 100644 (file)
@@ -26,6 +26,8 @@
 #include <config.h>
 #endif
 
+#include <inttypes.h>
+
 #include <bluetooth/bluetooth.h>
 
 #include "bt.h"
@@ -348,7 +350,7 @@ static void sig_info_rsp(const void *data, uint16_t size)
                        break;
                }
                channels = bt_get_le64(data);
-               print_field("Channels: 0x%16.16lx", channels);
+               print_field("Channels: 0x%16.16" PRIu64, channels);
                break;
        default:
                packet_hexdump(data, size);