Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jan 2017 04:09:01 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312110 - head/tests/sys/vm
Message-ID:  <201701140409.v0E4914j043297@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Jan 14 04:09:01 2017
New Revision: 312110
URL: https://svnweb.freebsd.org/changeset/base/312110

Log:
  Fix -Wsign-compare warnings
  
  The loop index (i) doesn't need to be size_t as its comparison is signed
  
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Modified:
  head/tests/sys/vm/mmap_test.c

Modified: head/tests/sys/vm/mmap_test.c
==============================================================================
--- head/tests/sys/vm/mmap_test.c	Sat Jan 14 04:00:26 2017	(r312109)
+++ head/tests/sys/vm/mmap_test.c	Sat Jan 14 04:09:01 2017	(r312110)
@@ -184,8 +184,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_priva
 ATF_TC_BODY(mmap__dev_zero_private, tc)
 {
 	char *p1, *p2, *p3;
-	size_t i;
-	int fd, pagesize;
+	int fd, i, pagesize;
 
 	ATF_REQUIRE((pagesize = getpagesize()) > 0);
 	ATF_REQUIRE((fd = open("/dev/zero", O_RDONLY)) >= 0);
@@ -197,7 +196,7 @@ ATF_TC_BODY(mmap__dev_zero_private, tc)
 	ATF_REQUIRE(p2 != MAP_FAILED);
 
 	for (i = 0; i < pagesize; i++)
-		ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]);
+		ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]);
 
 	ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0);
 
@@ -224,8 +223,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_share
 ATF_TC_BODY(mmap__dev_zero_shared, tc)
 {
 	char *p1, *p2, *p3;
-	size_t i;
-	int fd, pagesize;
+	int fd, i, pagesize;
 
 	ATF_REQUIRE((pagesize = getpagesize()) > 0);
 	ATF_REQUIRE((fd = open("/dev/zero", O_RDWR)) >= 0);
@@ -237,7 +235,7 @@ ATF_TC_BODY(mmap__dev_zero_shared, tc)
 	ATF_REQUIRE(p2 != MAP_FAILED);
 
 	for (i = 0; i < pagesize; i++)
-		ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]);
+		ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]);
 
 	ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701140409.v0E4914j043297>