mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
Fix format specifier technicalities.
Various printf() format specifiers in the tree had minor technical issues which the Mac OS build reported, e.g. here: https://s3.amazonaws.com/archive.travis-ci.org/jobs/208718342/log.txt These tend to fall into two categories of harmless warnings: 1. Wrong width for types that are all promoted to 'int'. For example, both uint8_t and uint16_t are both promoted to 'int' as part of a call to printf(), but using PRIu8 for a uint16_t causes a warning. 2. Wrong format specifier for type promoted to 'int' due to arithmetic. For example, if 'x' is a uint8_t, then x >> 1 has type 'int' due to C's promotion rules, so the correct format specifier is %d and using PRIu8 will cause a warning. This commit fixes the warnings. I didn't see anything that rose to the level of a bug. These warnings only showed up on Mac OS X because of differences in the format specifiers that Mac OS uses for PRI*. Reported-by: Shu Shen <shu.shen@gmail.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -186,7 +186,7 @@ format_generic_odp_action(struct ds *ds, const struct nlattr *a)
|
||||
{
|
||||
size_t len = nl_attr_get_size(a);
|
||||
|
||||
ds_put_format(ds, "action%"PRId16, nl_attr_type(a));
|
||||
ds_put_format(ds, "action%d", nl_attr_type(a));
|
||||
if (len) {
|
||||
const uint8_t *unspec;
|
||||
unsigned int i;
|
||||
@@ -318,7 +318,7 @@ format_odp_userspace_action(struct ds *ds, const struct nlattr *attr)
|
||||
if (userdata_len == sizeof cookie.sflow
|
||||
&& cookie.type == USER_ACTION_COOKIE_SFLOW) {
|
||||
ds_put_format(ds, ",sFlow("
|
||||
"vid=%"PRIu16",pcp=%"PRIu8",output=%"PRIu32")",
|
||||
"vid=%"PRIu16",pcp=%d,output=%"PRIu32")",
|
||||
vlan_tci_to_vid(cookie.sflow.vlan_tci),
|
||||
vlan_tci_to_pcp(cookie.sflow.vlan_tci),
|
||||
cookie.sflow.output);
|
||||
@@ -478,7 +478,7 @@ format_odp_tnl_push_header(struct ds *ds, struct ovs_action_push_tnl *data)
|
||||
l3 = eth + 1;
|
||||
|
||||
/* Ethernet */
|
||||
ds_put_format(ds, "header(size=%"PRIu8",type=%"PRIu8",eth(dst=",
|
||||
ds_put_format(ds, "header(size=%"PRIu32",type=%"PRIu32",eth(dst=",
|
||||
data->header_len, data->tnl_type);
|
||||
ds_put_format(ds, ETH_ADDR_FMT, ETH_ADDR_ARGS(eth->eth_dst));
|
||||
ds_put_format(ds, ",src=");
|
||||
@@ -504,7 +504,7 @@ format_odp_tnl_push_header(struct ds *ds, struct ovs_action_push_tnl *data)
|
||||
ipv6_format_addr(&ip6->ip6_src, ds);
|
||||
ds_put_format(ds, ",dst=");
|
||||
ipv6_format_addr(&ip6->ip6_dst, ds);
|
||||
ds_put_format(ds, ",label=%i,proto=%"PRIu8",tclass=0x%"PRIx8
|
||||
ds_put_format(ds, ",label=%i,proto=%"PRIu8",tclass=0x%"PRIx32
|
||||
",hlimit=%"PRIu8"),",
|
||||
ntohl(ip6->ip6_flow) & IPV6_LABEL_MASK, ip6->ip6_nxt,
|
||||
(ntohl(ip6->ip6_flow) >> 20) & 0xff, ip6->ip6_hlim);
|
||||
|
Reference in New Issue
Block a user