Format strings in ds_put_format() for printing out returned values from
vlan_tci_to_pcp() were updated to ensure PRIu8 or PRIx8 are used for
portability.

Signed-off-by: Shu Shen <[email protected]>
---
 lib/dpctl.c    | 2 +-
 lib/match.c    | 2 +-
 lib/odp-util.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/dpctl.c b/lib/dpctl.c
index 23837ce..7b2f4cf 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -1496,7 +1496,7 @@ dpctl_normalize_actions(int argc, const char *argv[],
         sort_output_actions(af->actions.data, af->actions.size);
 
         if (af->flow.vlan_tci != htons(0)) {
-            dpctl_print(dpctl_p, "vlan(vid=%"PRIu16",pcp=%d): ",
+            dpctl_print(dpctl_p, "vlan(vid=%"PRIu16",pcp="PRIu8): ",
                         vlan_tci_to_vid(af->flow.vlan_tci),
                         vlan_tci_to_pcp(af->flow.vlan_tci));
         } else {
diff --git a/lib/match.c b/lib/match.c
index 3fcaec5..d3c6c5a 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -1221,7 +1221,7 @@ match_format(const struct match *match, struct ds *s, int 
priority)
                               colors.end, vlan_tci_to_vid(f->vlan_tci));
             }
             if (pcp_mask) {
-                ds_put_format(s, "%sdl_vlan_pcp=%s%d,", colors.param,
+                ds_put_format(s, "%sdl_vlan_pcp=%s"PRIu8",", colors.param,
                               colors.end, vlan_tci_to_pcp(f->vlan_tci));
             }
         } else if (wc->masks.vlan_tci == htons(0xffff)) {
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 4106738..52a585a 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -384,9 +384,9 @@ format_vlan_tci(struct ds *ds, ovs_be16 tci, ovs_be16 mask, 
bool verbose)
         ds_put_char(ds, ',');
     }
     if (verbose || vlan_tci_to_pcp(tci) || vlan_tci_to_pcp(mask)) {
-        ds_put_format(ds, "pcp=%d", vlan_tci_to_pcp(tci));
+        ds_put_format(ds, "pcp=%"PRIu8, vlan_tci_to_pcp(tci));
         if (vlan_tci_to_pcp(mask) != (VLAN_PCP_MASK >> VLAN_PCP_SHIFT)) {
-            ds_put_format(ds, "/0x%x", vlan_tci_to_pcp(mask));
+            ds_put_format(ds, "/0x%"PRIx8, vlan_tci_to_pcp(mask));
         }
         ds_put_char(ds, ',');
     }
-- 
1.9.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to