From 7aa9f970e88382f2508ee55122e27cdcfd8cdbda Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 1 May 2014 11:14:31 -0400 Subject: all: Use macros for printf/scanf format specifiers Any types that are fixed width should use the standard format specifier macros (PRI... for printf-type functions, SCN... for scanf-type functions) to ensure proper data access. Prior to this ifpps was crashing in 32-bit environments due to the following call mvwprintw(screen, (*voff)++, 2, "%s,%s %s (%s%s), t=%lums, cpus=%u%s/%u" " ", uts.release, machine, ifname, drvinf.driver, buff, ms_interval, top_cpus, top_cpus > 0 && top_cpus < cpus ? "+1" : "", cpus); since ms_interval is a uint64_t but %lu expects an unsigned long, which is only 32 bits. Signed-off-by: James McCoy Signed-off-by: Tobias Klauser --- proto_80211_mac_hdr.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'proto_80211_mac_hdr.c') diff --git a/proto_80211_mac_hdr.c b/proto_80211_mac_hdr.c index 23f9c7a..b3cc3ca 100644 --- a/proto_80211_mac_hdr.c +++ b/proto_80211_mac_hdr.c @@ -10,6 +10,7 @@ * with respect to endianess (little / big) */ +#include #include #include #include /* for ntohs() */ @@ -1741,7 +1742,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", basic->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(basic->start)); tprintf("Meas Duration: %fs", le16_to_cpu(basic->dur) * TU); @@ -1762,7 +1763,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", cca->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(cca->start)); tprintf("Meas Duration: %fs", le16_to_cpu(cca->dur) * TU); @@ -1782,7 +1783,7 @@ static int8_t inf_meas_req(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", rpi->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(rpi->start)); tprintf("Meas Duration: %fs", le16_to_cpu(rpi->dur) * TU); @@ -2119,7 +2120,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", basic->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(basic->start)); tprintf("Meas Duration: %fs", le16_to_cpu(basic->dur) * TU); @@ -2140,7 +2141,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", cca->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(cca->start)); tprintf("Meas Duration: %fs", le16_to_cpu(cca->dur) * TU); @@ -2160,7 +2161,7 @@ static int8_t inf_meas_rep(struct pkt_buff *pkt, u8 *id) } tprintf("Ch Nr: %uus, ", rpi->ch_nr); - tprintf("Meas Start Time: %lu, ", + tprintf("Meas Start Time: %"PRIu64", ", le64_to_cpu(rpi->start)); tprintf("Meas Duration: %fs", le16_to_cpu(rpi->dur) * TU); @@ -2918,7 +2919,7 @@ static int8_t beacon(struct pkt_buff *pkt) if (beacon == NULL) return 0; - tprintf("Timestamp 0x%.16lx, ", le64_to_cpu(beacon->timestamp)); + tprintf("Timestamp 0x%.16"PRIx64", ", le64_to_cpu(beacon->timestamp)); tprintf("Beacon Interval (%fs), ", le16_to_cpu(beacon->beacon_int)*TU); tprintf("Capabilities (0x%x <->", le16_to_cpu(beacon->capab_info)); cap_field(le16_to_cpu(beacon->capab_info)); -- cgit v1.2.3-54-g00ecf