diff mbox

[dpdk-dev,2/3] app/test: Fix size_t printf formart issue

Message ID 1425561339-13300-3-git-send-email-michael.qiu@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Michael Qiu March 5, 2015, 1:15 p.m. UTC
test_hash.c: In function ‘test_crc32_hash_alg_equiv’:
error: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 2 has type ‘size_t’ [-Werror=format]

According to C99, for size_t type should use formart "%zu"

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 app/test/test_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bruce Richardson March 5, 2015, 1:22 p.m. UTC | #1
On Thu, Mar 05, 2015 at 09:15:38PM +0800, Michael Qiu wrote:
> test_hash.c: In function ‘test_crc32_hash_alg_equiv’:
> error: format ‘%lu’ expects argument of type ‘long unsigned int’,
> but argument 2 has type ‘size_t’ [-Werror=format]
> 
> According to C99, for size_t type should use formart "%zu"
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>

Typo in title. Otherwise
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  app/test/test_hash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_hash.c b/app/test/test_hash.c
> index 653dd86..c489b8b 100644
> --- a/app/test/test_hash.c
> +++ b/app/test/test_hash.c
> @@ -226,7 +226,7 @@ test_crc32_hash_alg_equiv(void)
>  	if (i == CRC32_ITERATIONS)
>  		return 0;
>  
> -	printf("Failed test data (hex, %lu bytes total):\n", data_len);
> +	printf("Failed test data (hex, %zu bytes total):\n", data_len);
>  	for (j = 0; j < data_len; j++)
>  		printf("%02X%c", ((uint8_t *)data64)[j],
>  				((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : ' ');
> -- 
> 1.9.3
>
diff mbox

Patch

diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 653dd86..c489b8b 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -226,7 +226,7 @@  test_crc32_hash_alg_equiv(void)
 	if (i == CRC32_ITERATIONS)
 		return 0;
 
-	printf("Failed test data (hex, %lu bytes total):\n", data_len);
+	printf("Failed test data (hex, %zu bytes total):\n", data_len);
 	for (j = 0; j < data_len; j++)
 		printf("%02X%c", ((uint8_t *)data64)[j],
 				((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : ' ');