diff mbox series

[V2] tests/nsm_client: Fix nsm_client compile warnings

Message ID tencent_9E711ED0F5A07CEDABFDD0D9856693648609@qq.com (mailing list archive)
State New
Headers show
Series [V2] tests/nsm_client: Fix nsm_client compile warnings | expand

Commit Message

597607025@qq.com July 19, 2024, 2:39 a.m. UTC
From: Zhang Yaqi <zhangyaqi@kylinos.cn>

when  compiling after make
cd tests/nsm_client
make nsm_client
then it shows:

nsm_client.c: In function hex2bin:
nsm_client.c:104:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
nsm_client.c: In function bin2hex:
nsm_client.c:122:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Zhang Yaqi <zhangyaqi@kylinos.cn>
---
 tests/nsm_client/nsm_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Benjamin Coddington July 19, 2024, 11:12 a.m. UTC | #1
On 18 Jul 2024, at 22:39, 597607025@qq.com wrote:

> From: Zhang Yaqi <zhangyaqi@kylinos.cn>
>
> when  compiling after make
> cd tests/nsm_client
> make nsm_client
> then it shows:
>
> nsm_client.c: In function hex2bin:
> nsm_client.c:104:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
> nsm_client.c: In function bin2hex:
> nsm_client.c:122:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>
> Signed-off-by: Zhang Yaqi <zhangyaqi@kylinos.cn>

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

If you address this patch to the maintainer Steve Dickson, its more likely
to get picked up.

Ben
diff mbox series

Patch

diff --git a/tests/nsm_client/nsm_client.c b/tests/nsm_client/nsm_client.c
index 8dc05917..d34be1b2 100644
--- a/tests/nsm_client/nsm_client.c
+++ b/tests/nsm_client/nsm_client.c
@@ -98,7 +98,7 @@  usage(char *program)
 static int
 hex2bin(char *dst, size_t dstlen, char *src)
 {
-	int i;
+	size_t i;
 	unsigned int tmp;
 
 	for (i = 0; *src && i < dstlen; i++) {
@@ -117,7 +117,7 @@  hex2bin(char *dst, size_t dstlen, char *src)
 static void
 bin2hex(char *dst, char *src, size_t srclen)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < srclen; i++)
 		dst += sprintf(dst, "%02x", 0xff & src[i]);