[dpdk-dev] [PATCH] cmdline: fix type format from unsigned to size_t for buffer size

Daniel Mrzyglod danielx.t.mrzyglod at intel.com
Fri Feb 20 17:18:05 CET 2015


Function match_inst is used to take buffor using sizeof() which is size_t type.
This modification also involved changing '%u' to '%zu' in printf function.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod at intel.com>
---
 lib/librte_cmdline/cmdline_parse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index dfc885c..0821791 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -138,7 +138,7 @@ nb_common_chars(const char * s1, const char * s2)
  */
 static int
 match_inst(cmdline_parse_inst_t *inst, const char *buf,
-	   unsigned int nb_match_token, void *resbuf, unsigned resbuf_size)
+	   unsigned int nb_match_token, void *resbuf, size_t resbuf_size)
 {
 	unsigned int token_num=0;
 	cmdline_parse_token_hdr_t * token_p;
@@ -169,7 +169,7 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,
 
 			if (token_hdr.offset > resbuf_size) {
 				printf("Parse error(%s:%d): Token offset(%u) "
-					"exceeds maximum size(%u)\n",
+					"exceeds maximum size(%zu)\n",
 					__FILE__, __LINE__,
 					token_hdr.offset, resbuf_size);
 				return -ENOBUFS;
-- 
2.1.0



More information about the dev mailing list