Fix -Wsign-compare
[folly.git] / folly / experimental / io / test / AsyncIOTest.cpp
index c21691f6f68809a0afdb72740d63e1f5dda2dcf9..721e56007ad4a0598731583117ecc420883f4ccf 100644 (file)
@@ -136,7 +136,7 @@ void testReadsSerially(const std::vector<TestSpec>& specs,
     ::close(fd);
   };
 
-  for (int i = 0; i < specs.size(); i++) {
+  for (size_t i = 0; i < specs.size(); i++) {
     auto buf = allocateAligned(specs[i].size);
     op.pread(fd, buf.get(), specs[i].size, specs[i].start);
     aioReader.submit(&op);
@@ -171,14 +171,14 @@ void testReadsParallel(const std::vector<TestSpec>& specs,
   if (multithreaded) {
     threads.reserve(specs.size());
   }
-  for (int i = 0; i < specs.size(); i++) {
+  for (size_t i = 0; i < specs.size(); i++) {
     bufs.push_back(allocateAligned(specs[i].size));
   }
-  auto submit = [&] (int i) {
+  auto submit = [&] (size_t i) {
     ops[i].pread(fd, bufs[i].get(), specs[i].size, specs[i].start);
     aioReader.submit(&ops[i]);
   };
-  for (int i = 0; i < specs.size(); i++) {
+  for (size_t i = 0; i < specs.size(); i++) {
     if (multithreaded) {
       threads.emplace_back([&submit, i] { submit(i); });
     } else {
@@ -198,7 +198,7 @@ void testReadsParallel(const std::vector<TestSpec>& specs,
     EXPECT_NE(nrRead, 0);
     remaining -= nrRead;
 
-    for (int i = 0; i < nrRead; i++) {
+    for (size_t i = 0; i < nrRead; i++) {
       int id = completed[i] - ops.get();
       EXPECT_GE(id, 0);
       EXPECT_LT(id, specs.size());
@@ -212,7 +212,7 @@ void testReadsParallel(const std::vector<TestSpec>& specs,
   EXPECT_EQ(specs.size(), aioReader.totalSubmits());
 
   EXPECT_EQ(aioReader.pending(), 0);
-  for (int i = 0; i < pending.size(); i++) {
+  for (size_t i = 0; i < pending.size(); i++) {
     EXPECT_FALSE(pending[i]);
   }
 }
@@ -230,7 +230,7 @@ void testReadsQueued(const std::vector<TestSpec>& specs,
   SCOPE_EXIT {
     ::close(fd);
   };
-  for (int i = 0; i < specs.size(); i++) {
+  for (size_t i = 0; i < specs.size(); i++) {
     bufs.push_back(allocateAligned(specs[i].size));
     ops[i].pread(fd, bufs[i].get(), specs[i].size, specs[i].start);
     aioQueue.submit(&ops[i]);
@@ -251,7 +251,7 @@ void testReadsQueued(const std::vector<TestSpec>& specs,
     EXPECT_NE(nrRead, 0);
     remaining -= nrRead;
 
-    for (int i = 0; i < nrRead; i++) {
+    for (size_t i = 0; i < nrRead; i++) {
       int id = completed[i] - ops.get();
       EXPECT_GE(id, 0);
       EXPECT_LT(id, specs.size());
@@ -265,7 +265,7 @@ void testReadsQueued(const std::vector<TestSpec>& specs,
   EXPECT_EQ(specs.size(), aioReader.totalSubmits());
   EXPECT_EQ(aioReader.pending(), 0);
   EXPECT_EQ(aioQueue.queued(), 0);
-  for (int i = 0; i < pending.size(); i++) {
+  for (size_t i = 0; i < pending.size(); i++) {
     EXPECT_FALSE(pending[i]);
   }
 }