From: Jim Meyering Date: Wed, 7 Jan 2015 01:08:20 +0000 (-0800) Subject: folly/test/RangeTest.cpp: avoid -Wsign-compare error (trivial) X-Git-Tag: v0.22.0~37 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c7e25e1a69d9ce7a8b9292065bf9f88faaaae6a7;p=folly.git folly/test/RangeTest.cpp: avoid -Wsign-compare error (trivial) Summary: * folly/test/RangeTest.cpp (NeedleFinderTest): Declare for-loop index to be of type size_t. OTherwise, gcc-4.9 fails: folly/test/RangeTest.cpp:910:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] Test Plan: Run this and note there are fewer errors than before: fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo Reviewed By: philipp@fb.com Subscribers: folly-diffs@ FB internal diff: D1768279 Tasks: 5941250 Signature: t1:1768279:1420593237:246040eebd40e313bdb19799bb11d6639f1481de --- diff --git a/folly/test/RangeTest.cpp b/folly/test/RangeTest.cpp index 02568dbc..850a9a67 100644 --- a/folly/test/RangeTest.cpp +++ b/folly/test/RangeTest.cpp @@ -907,7 +907,7 @@ TYPED_TEST(NeedleFinderTest, Unaligned) { string s = "0123456789ABCDEFGH"; for (size_t i = 0; i < s.size(); ++i) { StringPiece a(s.c_str() + i); - for (int j = 0; j < s.size(); ++j) { + for (size_t j = 0; j < s.size(); ++j) { StringPiece b(s.c_str() + j); EXPECT_EQ((i > j) ? 0 : j - i, this->find_first_byte_of(a, b)); }