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

Yifeng Sun pkusunyifeng at gmail.com
Tue Jun 26 17:30:30 UTC 2018


Travis job fails because of the below error:

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);

This patch fixes it by treating enum type as int type.
(6.7.2.2 Enumerationspecifiers)

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 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..0a01cba60be2 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%"PRIx32" ", flags);
     }
 }
 
-- 
2.7.4



More information about the dev mailing list