aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-11-06 10:43:50 -0800
committerBen Pfaff <blp@nicira.com>2009-11-09 10:30:10 -0800
commit2886875a385df582354ac916431b278f2fe698e0 (patch)
tree7ba5e3d899fab2d271c2a4cfaeda3d98cfd44573
parentcc56746aed6d53046b17b01756362e566734241c (diff)
Fix incorrect printf format specifiers.
GCC reported these during a 64-bit build.
-rw-r--r--lib/cfg.c2
-rw-r--r--lib/dpif.c2
-rw-r--r--lib/fault.c2
-rw-r--r--lib/leak-checker.c2
-rw-r--r--lib/odp-util.c5
-rw-r--r--lib/pcap.c2
-rw-r--r--lib/poll-loop.c3
-rw-r--r--lib/vconn.c12
-rw-r--r--secchan/ofproto.c4
-rw-r--r--utilities/ovs-dpctl.c8
-rw-r--r--utilities/ovs-ofctl.c2
-rw-r--r--vswitchd/bridge.c2
-rw-r--r--vswitchd/mgmt.c2
13 files changed, 26 insertions, 22 deletions
diff --git a/lib/cfg.c b/lib/cfg.c
index 225827ef..d0170b60 100644
--- a/lib/cfg.c
+++ b/lib/cfg.c
@@ -136,7 +136,7 @@ cfg_set_file(const char *file_name)
slash = strrchr(file_name, '/');
if (slash) {
lock_name = xasprintf("%.*s/.%s.~lock~",
- slash - file_name, file_name, slash + 1);
+ (int) (slash - file_name), file_name, slash + 1);
} else {
lock_name = xasprintf(".%s.~lock~", file_name);
}
diff --git a/lib/dpif.c b/lib/dpif.c
index 4475913c..78e8ec3c 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -706,7 +706,7 @@ dpif_recv(struct dpif *dpif, struct ofpbuf **bufp)
return 0;
} else {
VLOG_WARN_RL(&error_rl, "dp%u: discarding message truncated "
- "from %zu bytes to %d",
+ "from %"PRIu32" bytes to %d",
dpif->minor, msg->length, retval);
error = ERANGE;
}
diff --git a/lib/fault.c b/lib/fault.c
index 3882eff7..14e229ed 100644
--- a/lib/fault.c
+++ b/lib/fault.c
@@ -54,7 +54,7 @@ log_backtrace(void)
if (!dladdr(frame[1], &addrinfo) || !addrinfo.dli_sname) {
fprintf(stderr, " 0x%08"PRIxPTR"\n", (uintptr_t) frame[1]);
} else {
- fprintf(stderr, " 0x%08"PRIxPTR" (%s+0x%x)\n",
+ fprintf(stderr, " 0x%08"PRIxPTR" (%s+0x%tx)\n",
(uintptr_t) frame[1], addrinfo.dli_sname,
(char *) frame[1] - (char *) addrinfo.dli_saddr);
}
diff --git a/lib/leak-checker.c b/lib/leak-checker.c
index c2c4348f..8d256bc8 100644
--- a/lib/leak-checker.c
+++ b/lib/leak-checker.c
@@ -141,7 +141,7 @@ log_callers(const char *format, ...)
putc(':', file);
backtrace_capture(&backtrace);
for (i = 0; i < backtrace.n_frames; i++) {
- fprintf(file, " 0x%x", backtrace.frames[i]);
+ fprintf(file, " 0x%"PRIxPTR, backtrace.frames[i]);
}
putc('\n', file);
}
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 21bc9a51..a8001620 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -111,8 +111,9 @@ format_odp_actions(struct ds *ds, const union odp_action *actions,
void
format_odp_flow_stats(struct ds *ds, const struct odp_flow_stats *s)
{
- ds_put_format(ds, "packets:%"PRIu64", bytes:%"PRIu64", used:",
- s->n_packets, s->n_bytes);
+ ds_put_format(ds, "packets:%llu, bytes:%llu, used:",
+ (unsigned long long int) s->n_packets,
+ (unsigned long long int) s->n_bytes);
if (s->used_sec) {
long long int used = s->used_sec * 1000 + s->used_nsec / 1000000;
ds_put_format(ds, "%.3fs", (time_msec() - used) / 1000.0);
diff --git a/lib/pcap.c b/lib/pcap.c
index 4330c575..967bb5c3 100644
--- a/lib/pcap.c
+++ b/lib/pcap.c
@@ -128,7 +128,7 @@ pcap_read(FILE *file, struct ofpbuf **bufp)
((len & 0x0000ff00) << 8) |
((len & 0x000000ff) << 24));
if (swapped_len > 0xffff) {
- VLOG_WARN("bad packet length %"PRIu32" or %"PRIu32" "
+ VLOG_WARN("bad packet length %zu or %"PRIu32" "
"reading pcap file",
len, swapped_len);
return EPROTO;
diff --git a/lib/poll-loop.c b/lib/poll-loop.c
index aff2c335..945b5c44 100644
--- a/lib/poll-loop.c
+++ b/lib/poll-loop.c
@@ -18,6 +18,7 @@
#include "poll-loop.h"
#include <assert.h>
#include <errno.h>
+#include <inttypes.h>
#include <poll.h>
#include <stdlib.h>
#include <string.h>
@@ -122,7 +123,7 @@ log_wakeup(const struct backtrace *backtrace, const char *format, ...)
ds_put_char(&ds, ':');
for (i = 0; i < backtrace->n_frames; i++) {
- ds_put_format(&ds, " 0x%x", backtrace->frames[i]);
+ ds_put_format(&ds, " 0x%"PRIxPTR, backtrace->frames[i]);
}
}
VLOG_DBG("%s", ds_cstr(&ds));
diff --git a/lib/vconn.c b/lib/vconn.c
index d1b8353b..288a0958 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -1059,7 +1059,7 @@ check_ofp_message(const struct ofp_header *msg, uint8_t type, size_t size)
if (got_size != size) {
char *type_name = ofp_message_type_to_string(type);
VLOG_WARN_RL(&bad_ofmsg_rl,
- "received %s message of length %"PRIu16" (expected %zu)",
+ "received %s message of length %zu (expected %zu)",
type_name, got_size, size);
free(type_name);
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LENGTH);
@@ -1094,7 +1094,7 @@ check_ofp_message_array(const struct ofp_header *msg, uint8_t type,
got_size = ntohs(msg->length);
if (got_size < min_size) {
char *type_name = ofp_message_type_to_string(type);
- VLOG_WARN_RL(&bad_ofmsg_rl, "received %s message of length %"PRIu16" "
+ VLOG_WARN_RL(&bad_ofmsg_rl, "received %s message of length %zu "
"(expected at least %zu)",
type_name, got_size, min_size);
free(type_name);
@@ -1103,7 +1103,7 @@ check_ofp_message_array(const struct ofp_header *msg, uint8_t type,
if ((got_size - min_size) % array_elt_size) {
char *type_name = ofp_message_type_to_string(type);
VLOG_WARN_RL(&bad_ofmsg_rl,
- "received %s message of bad length %"PRIu16": the "
+ "received %s message of bad length %zu: the "
"excess over %zu (%zu) is not evenly divisible by %zu "
"(remainder is %zu)",
type_name, got_size, min_size, got_size - min_size,
@@ -1136,13 +1136,13 @@ check_ofp_packet_out(const struct ofp_header *oh, struct ofpbuf *data,
actions_len = ntohs(opo->actions_len);
if (actions_len > extra) {
- VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out claims %zu bytes of actions "
+ VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out claims %u bytes of actions "
"but message has room for only %zu bytes",
actions_len, extra);
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LENGTH);
}
if (actions_len % sizeof(union ofp_action)) {
- VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out claims %zu bytes of actions, "
+ VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out claims %u bytes of actions, "
"which is not a multiple of %zu",
actions_len, sizeof(union ofp_action));
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LENGTH);
@@ -1329,7 +1329,7 @@ validate_actions(const union ofp_action *actions, size_t n_actions,
if (n_slots > slots_left) {
VLOG_DBG_RL(&bad_ofmsg_rl,
- "action requires %u slots but only %td remain",
+ "action requires %u slots but only %u remain",
n_slots, slots_left);
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
}
diff --git a/secchan/ofproto.c b/secchan/ofproto.c
index cdb94b50..6319b032 100644
--- a/secchan/ofproto.c
+++ b/secchan/ofproto.c
@@ -2945,7 +2945,7 @@ handle_ofmp(struct ofproto *p, struct ofconn *ofconn,
{
size_t msg_len = ntohs(ofmph->header.header.length);
if (msg_len < sizeof(*ofmph)) {
- VLOG_WARN_RL(&rl, "dropping short managment message: %d\n", msg_len);
+ VLOG_WARN_RL(&rl, "dropping short managment message: %zu\n", msg_len);
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LENGTH);
}
@@ -2953,7 +2953,7 @@ handle_ofmp(struct ofproto *p, struct ofconn *ofconn,
struct ofmp_capability_request *ofmpcr;
if (msg_len < sizeof(struct ofmp_capability_request)) {
- VLOG_WARN_RL(&rl, "dropping short capability request: %d\n",
+ VLOG_WARN_RL(&rl, "dropping short capability request: %zu\n",
msg_len);
return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LENGTH);
}
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 886cdb3a..0dd93351 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -408,9 +408,11 @@ show_dpif(struct dpif *dpif)
printf("\tports: cur:%"PRIu32", max:%"PRIu32"\n",
stats.n_ports, stats.max_ports);
printf("\tgroups: max:%"PRIu16"\n", stats.max_groups);
- printf("\tlookups: frags:%"PRIu64", hit:%"PRIu64", missed:%"PRIu64", "
- "lost:%"PRIu64"\n",
- stats.n_frags, stats.n_hit, stats.n_missed, stats.n_lost);
+ printf("\tlookups: frags:%llu, hit:%llu, missed:%llu, lost:%llu\n",
+ (unsigned long long int) stats.n_frags,
+ (unsigned long long int) stats.n_hit,
+ (unsigned long long int) stats.n_missed,
+ (unsigned long long int) stats.n_lost);
printf("\tqueues: max-miss:%"PRIu16", max-action:%"PRIu16"\n",
stats.max_miss_queue, stats.max_action_queue);
}
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 76114159..7c20d7ad 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1135,7 +1135,7 @@ do_ping(const struct settings *s UNUSED, int argc, char *argv[])
printf("Reply:\n");
ofp_print(stdout, reply, reply->size, 2);
}
- printf("%d bytes from %s: xid=%08"PRIx32" time=%.1f ms\n",
+ printf("%zu bytes from %s: xid=%08"PRIx32" time=%.1f ms\n",
reply->size - sizeof *rpy_hdr, argv[1], rpy_hdr->xid,
(1000*(double)(end.tv_sec - start.tv_sec))
+ (.001*(end.tv_usec - start.tv_usec)));
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index ad9b46ef..f4b2fb2c 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2550,7 +2550,7 @@ bond_unixctl_show(struct unixctl_conn *conn, const char *args)
continue;
}
- ds_put_format(&ds, "\thash %d: %lld kB load\n",
+ ds_put_format(&ds, "\thash %d: %"PRIu64" kB load\n",
hash, be->tx_bytes / 1024);
/* MACs. */
diff --git a/vswitchd/mgmt.c b/vswitchd/mgmt.c
index d15b4ba4..8da640fe 100644
--- a/vswitchd/mgmt.c
+++ b/vswitchd/mgmt.c
@@ -700,7 +700,7 @@ recv_ofmp_extended_data(uint32_t xid, const struct ofmp_header *ofmph,
* OpenFlow message. */
new_oh = ofpbuf_at(&ext_data_buffer, 0, 65536);
if (!new_oh) {
- VLOG_WARN_RL(&rl, "received short embedded message: %d\n",
+ VLOG_WARN_RL(&rl, "received short embedded message: %zu\n",
ext_data_buffer.size);
return -EINVAL;
}