diff options
author | James McCoy <vega.james@gmail.com> | 2014-05-01 11:14:31 -0400 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2014-05-03 13:36:36 +0200 |
commit | 7aa9f970e88382f2508ee55122e27cdcfd8cdbda (patch) | |
tree | 03ff36cfad0f1cc88c92b7764fd3b8145207d651 /trafgen_parser.y | |
parent | 7231039ec891acee246549410c70f1151a0c0175 (diff) |
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 <vega.james@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r-- | trafgen_parser.y | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y index fd7da76..ef753da 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -546,17 +546,17 @@ static void dump_conf(void) printf("\n"); for (j = 0; j < packet_dyn[i].clen; ++j) - printf(" cnt%zu [%u,%u], inc %u, off %ld type %s\n", j, + printf(" cnt%zu [%u,%u], inc %u, off %jd type %s\n", j, packet_dyn[i].cnt[j].min, packet_dyn[i].cnt[j].max, packet_dyn[i].cnt[j].inc, - packet_dyn[i].cnt[j].off, + (intmax_t)packet_dyn[i].cnt[j].off, packet_dyn[i].cnt[j].type == TYPE_INC ? "inc" : "dec"); for (j = 0; j < packet_dyn[i].rlen; ++j) - printf(" rnd%zu off %ld\n", j, - packet_dyn[i].rnd[j].off); + printf(" rnd%zu off %jd\n", j, + (intmax_t)packet_dyn[i].rnd[j].off); } } |