From: Eugene Syromyatnikov Date: Sun, 13 Nov 2016 18:30:25 +0000 (+0300) Subject: tests: fix "comparison between signed and unsigned" compilation warnings X-Git-Tag: v4.15~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35126cda20ed9c1077aa5a70e68301821b616fd1;p=strace tests: fix "comparison between signed and unsigned" compilation warnings preadv-pwritev.c: In function 'main': preadv-pwritev.c:162: warning: comparison between signed and unsigned readv.c: In function 'main': readv.c:148: warning: comparison between signed and unsigned recvmsg.c: In function 'main': recvmsg.c:148: warning: comparison between signed and unsigned * tests/preadv-pwritev.c (main): Cast r_len to int. * tests/readv.c (main): Likewise. * tests/recvmsg.c (main): Likewise. --- diff --git a/tests/preadv-pwritev.c b/tests/preadv-pwritev.c index 0770d694..b2d2a824 100644 --- a/tests/preadv-pwritev.c +++ b/tests/preadv-pwritev.c @@ -159,7 +159,7 @@ main(void) r_iov = tail_memdup(r1_iov_, sizeof(r1_iov_)); rc = preadv(0, r_iov, ARRAY_SIZE(r1_iov_), r_len); - if (rc != (int) w_len - r_len) + if (rc != (int) w_len - (int) r_len) perror_msg_and_fail("preadv: expected %d, returned %ld", (int) w_len - r_len, rc); tprintf("preadv(0, [{iov_base=\"%s\", iov_len=%u}" diff --git a/tests/readv.c b/tests/readv.c index c134d726..1015acdb 100644 --- a/tests/readv.c +++ b/tests/readv.c @@ -145,7 +145,7 @@ main(void) }; r_iov = tail_memdup(r1_iov_, sizeof(r1_iov_)); - assert(readv(0, r_iov, ARRAY_SIZE(r1_iov_)) == (int) w_len - r_len); + assert(readv(0, r_iov, ARRAY_SIZE(r1_iov_)) == (int) w_len - (int) r_len); tprintf("readv(0, [{iov_base=\"%s\", iov_len=%u}" ", {iov_base=\"\", iov_len=%u}], %u) = %u\n" " * %u bytes in buffer 0\n" diff --git a/tests/recvmsg.c b/tests/recvmsg.c index 19afe8fa..fa41a9d4 100644 --- a/tests/recvmsg.c +++ b/tests/recvmsg.c @@ -145,7 +145,7 @@ main(void) r_mh->msg_iov = r_iov; r_mh->msg_iovlen = ARRAY_SIZE(r1_iov_); - assert(recvmsg(0, r_mh, 0) == (int) w_len - r_len); + assert(recvmsg(0, r_mh, 0) == (int) w_len - (int) r_len); tprintf("recvmsg(0, {msg_name=NULL, msg_namelen=0, msg_iov=" "[{iov_base=\"%s\", iov_len=%u}, {iov_base=\"\", iov_len=%u}]" ", msg_iovlen=%u, msg_controllen=0, msg_flags=0}, 0) = %u\n"