summaryrefslogtreecommitdiff
path: root/utilities/ovs-ofctl.c
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2013-11-25 23:38:48 -0800
committerBen Pfaff <blp@nicira.com>2013-11-25 23:38:59 -0800
commit34582733d9aad82bba60f4bf986b62d58412502a (patch)
tree9f42e24f813d7059b6c0ef529e1b631b443e53cb /utilities/ovs-ofctl.c
parent4d3daf048134e8c375fdadcec7e51d1dc28fe0b6 (diff)
downloadopenvswitch-34582733d9aad82bba60f4bf986b62d58412502a.tar.gz
Avoid printf type modifiers not supported by MSVC C runtime library.
The MSVC C library printf() implementation does not support the 'z', 't', 'j', or 'hh' format specifiers. This commit changes the Open vSwitch code to avoid those format specifiers, switching to standard macros from <inttypes.h> where available and inventing new macros resembling them where necessary. It also updates CodingStyle to specify the macros' use and adds a Makefile rule to report violations. Signed-off-by: Alin Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities/ovs-ofctl.c')
-rw-r--r--utilities/ovs-ofctl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 1d1b47f95..5eb8cf4ae 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1805,7 +1805,7 @@ ofctl_ofp_parse(int argc OVS_UNUSED, char *argv[])
length = ntohs(oh->length);
if (length < sizeof *oh) {
- ovs_fatal(0, "%s: %zu-byte message is too short for OpenFlow",
+ ovs_fatal(0, "%s: %"PRIuSIZE"-byte message is too short for OpenFlow",
filename, length);
}
@@ -1835,7 +1835,7 @@ ofctl_ping(int argc, char *argv[])
payload = argc > 2 ? atoi(argv[2]) : 64;
if (payload > max_payload) {
- ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload);
+ ovs_fatal(0, "payload must be between 0 and %"PRIuSIZE" bytes", max_payload);
}
open_vconn(argv[1], &vconn);
@@ -1863,7 +1863,7 @@ ofctl_ping(int argc, char *argv[])
printf("Reply:\n");
ofp_print(stdout, reply, reply->size, verbosity + 2);
}
- printf("%zu bytes from %s: xid=%08"PRIx32" time=%.1f ms\n",
+ printf("%"PRIuSIZE" bytes from %s: xid=%08"PRIx32" time=%.1f ms\n",
reply->size, argv[1], ntohl(rpy_hdr->xid),
(1000*(double)(end.tv_sec - start.tv_sec))
+ (.001*(end.tv_usec - start.tv_usec)));
@@ -1886,7 +1886,7 @@ ofctl_benchmark(int argc OVS_UNUSED, char *argv[])
payload_size = atoi(argv[2]);
if (payload_size > max_payload) {
- ovs_fatal(0, "payload must be between 0 and %zu bytes", max_payload);
+ ovs_fatal(0, "payload must be between 0 and %"PRIuSIZE" bytes", max_payload);
}
message_size = sizeof(struct ofp_header) + payload_size;
@@ -2766,15 +2766,15 @@ print_differences(const char *prefix,
for (i = 0; i < MIN(a_len, b_len); i++) {
if (a[i] != b[i]) {
- printf("%s%2zu: %02"PRIx8" -> %02"PRIx8"\n",
+ printf("%s%2"PRIuSIZE": %02"PRIx8" -> %02"PRIx8"\n",
prefix, i, a[i], b[i]);
}
}
for (i = a_len; i < b_len; i++) {
- printf("%s%2zu: (none) -> %02"PRIx8"\n", prefix, i, b[i]);
+ printf("%s%2"PRIuSIZE": (none) -> %02"PRIx8"\n", prefix, i, b[i]);
}
for (i = b_len; i < a_len; i++) {
- printf("%s%2zu: %02"PRIx8" -> (none)\n", prefix, i, a[i]);
+ printf("%s%2"PRIuSIZE": %02"PRIx8" -> (none)\n", prefix, i, a[i]);
}
}
@@ -2875,7 +2875,7 @@ ofctl_parse_ofp10_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
ovs_fatal(0, "Trailing garbage in hex data");
}
if (match_expout.size != sizeof(struct ofp10_match)) {
- ovs_fatal(0, "Input is %zu bytes, expected %zu",
+ ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE,
match_expout.size, sizeof(struct ofp10_match));
}
@@ -2890,7 +2890,7 @@ ofctl_parse_ofp10_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
ovs_fatal(0, "Trailing garbage in hex data");
}
if (match_in.size != sizeof(struct ofp10_match)) {
- ovs_fatal(0, "Input is %zu bytes, expected %zu",
+ ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE,
match_in.size, sizeof(struct ofp10_match));
}
@@ -2939,7 +2939,7 @@ ofctl_parse_ofp11_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
ovs_fatal(0, "Trailing garbage in hex data");
}
if (match_in.size != sizeof(struct ofp11_match)) {
- ovs_fatal(0, "Input is %zu bytes, expected %zu",
+ ovs_fatal(0, "Input is %"PRIuSIZE" bytes, expected %"PRIuSIZE,
match_in.size, sizeof(struct ofp11_match));
}