[ovs-dev] [PATCH] [PATCHv2] ofp-meter: Fix ds_put_format that treats enum type as short integer

Yifeng Sun pkusunyifeng at gmail.com
Tue Jun 26 21:23:49 UTC 2018


Travis job fails because of the below error and this patch solves this issue.

lib/ofp-meter.c:340:48: error: format specifies type 'unsigned short'
but the argument has underlying type 'unsigned int' [-Werror,-Wformat]
        ds_put_format(s, "flags:0x%"PRIx16" ", flags);

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
v1 -> v2: Use the correct way to cast enum types as described by Ben.

 lib/ofp-meter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-meter.c b/lib/ofp-meter.c
index e63daabaf5f9..4e5cb52fd748 100644
--- a/lib/ofp-meter.c
+++ b/lib/ofp-meter.c
@@ -337,7 +337,7 @@ ofp_print_meter_flags(struct ds *s, enum ofp13_meter_flags flags)
 
     flags &= ~(OFPMF13_KBPS | OFPMF13_PKTPS | OFPMF13_BURST | OFPMF13_STATS);
     if (flags) {
-        ds_put_format(s, "flags:0x%"PRIx16" ", flags);
+        ds_put_format(s, "flags:0x%x", (unsigned)flags);
     }
 }
 
-- 
2.7.4



More information about the dev mailing list