diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 01:05:11 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 01:05:11 +0000 |
commit | 44a1cbfaad3079e29aec66aebb0a10d0c1980688 (patch) | |
tree | 7aa4371feb3a65a5a2482e0f27523af71cb3eb10 /base | |
parent | 4c0040c49331c5cb5b88960ecec04ce8a5f0756a (diff) | |
download | chromium_src-44a1cbfaad3079e29aec66aebb0a10d0c1980688.zip chromium_src-44a1cbfaad3079e29aec66aebb0a10d0c1980688.tar.gz chromium_src-44a1cbfaad3079e29aec66aebb0a10d0c1980688.tar.bz2 |
Fix more compiler warnings.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/pickle.cc | 6 | ||||
-rw-r--r-- | base/pickle_unittest.cc | 12 | ||||
-rw-r--r-- | base/sha2_unittest.cc | 12 | ||||
-rw-r--r-- | base/stack_container_unittest.cc | 2 | ||||
-rw-r--r-- | base/string_escape_unittest.cc | 1 | ||||
-rw-r--r-- | base/string_piece_unittest.cc | 168 | ||||
-rw-r--r-- | base/values_unittest.cc | 16 |
7 files changed, 108 insertions, 109 deletions
diff --git a/base/pickle.cc b/base/pickle.cc index 3c3c7e2..73a764a 100644 --- a/base/pickle.cc +++ b/base/pickle.cc @@ -58,7 +58,7 @@ Pickle::Pickle(int header_size) header_size_(AlignInt(header_size, sizeof(uint32))), capacity_(0), variable_buffer_offset_(0) { - DCHECK(header_size >= sizeof(Header)); + DCHECK(static_cast<size_t>(header_size) >= sizeof(Header)); DCHECK(header_size <= kPayloadUnit); Resize(kPayloadUnit); header_->payload_size = 0; @@ -293,7 +293,7 @@ bool Pickle::WriteData(const char* data, int length) { } char* Pickle::BeginWriteData(int length) { - DCHECK_EQ(variable_buffer_offset_, 0) << + DCHECK_EQ(variable_buffer_offset_, 0U) << "There can only be one variable buffer in a Pickle"; if (!WriteInt(length)) @@ -346,7 +346,7 @@ const char* Pickle::FindNext(size_t header_size, const char* start, const char* end) { DCHECK(header_size == AlignInt(header_size, sizeof(uint32))); - DCHECK(header_size <= kPayloadUnit); + DCHECK(header_size <= static_cast<size_t>(kPayloadUnit)); const Header* hdr = reinterpret_cast<const Header*>(start); const char* payload_base = start + header_size; diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index 4c38677..cfa0fda 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc @@ -179,18 +179,18 @@ TEST(PickleTest, IteratorHasRoom) { } TEST(PickleTest, Resize) { - int unit = Pickle::kPayloadUnit; + size_t unit = Pickle::kPayloadUnit; scoped_array<char> data(new char[unit]); char* data_ptr = data.get(); - for (int i = 0; i < unit; i++) + for (size_t i = 0; i < unit; i++) data_ptr[i] = 'G'; // construct a message that will be exactly the size of one payload unit, // note that any data will have a 4-byte header indicating the size - const int payload_size_after_header = unit - sizeof(uint32); + const size_t payload_size_after_header = unit - sizeof(uint32); Pickle pickle; pickle.WriteData(data_ptr, payload_size_after_header - sizeof(uint32)); - int cur_payload = payload_size_after_header; + size_t cur_payload = payload_size_after_header; EXPECT_EQ(pickle.capacity(), unit); EXPECT_EQ(pickle.payload_size(), payload_size_after_header); @@ -198,7 +198,7 @@ TEST(PickleTest, Resize) { // fill out a full page (noting data header) pickle.WriteData(data_ptr, unit - sizeof(uint32)); cur_payload += unit; - EXPECT_EQ(unit*2, pickle.capacity()); + EXPECT_EQ(unit * 2, pickle.capacity()); EXPECT_EQ(cur_payload, pickle.payload_size()); // one more byte should expand the capacity by one unit @@ -229,7 +229,7 @@ TEST(PickleTest, HeaderPadding) { int result; ASSERT_TRUE(pickle.ReadInt(&iter, &result)); - EXPECT_EQ(result, kMagic); + EXPECT_EQ(static_cast<uint32>(result), kMagic); } TEST(PickleTest, EqualsOperator) { diff --git a/base/sha2_unittest.cc b/base/sha2_unittest.cc index c0d6343..cfb788b 100644 --- a/base/sha2_unittest.cc +++ b/base/sha2_unittest.cc @@ -46,12 +46,12 @@ TEST(Sha256Test, Test1) { uint8 output1[base::SHA256_LENGTH]; base::SHA256HashString(input1, output1, sizeof(output1)); - for (int i = 0; i < base::SHA256_LENGTH; i++) + for (size_t i = 0; i < base::SHA256_LENGTH; i++) EXPECT_EQ(expected1[i], static_cast<int>(output1[i])); uint8 output_truncated1[4]; // 4 bytes == 32 bits base::SHA256HashString(input1, output_truncated1, sizeof(output_truncated1)); - for (int i = 0; i < sizeof(output_truncated1); i++) + for (size_t i = 0; i < sizeof(output_truncated1); i++) EXPECT_EQ(expected1[i], static_cast<int>(output_truncated1[i])); } @@ -70,12 +70,12 @@ TEST(Sha256Test, Test2) { uint8 output2[base::SHA256_LENGTH]; base::SHA256HashString(input2, output2, sizeof(output2)); - for (int i = 0; i < base::SHA256_LENGTH; i++) + for (size_t i = 0; i < base::SHA256_LENGTH; i++) EXPECT_EQ(expected2[i], static_cast<int>(output2[i])); uint8 output_truncated2[6]; base::SHA256HashString(input2, output_truncated2, sizeof(output_truncated2)); - for (int i = 0; i < sizeof(output_truncated2); i++) + for (size_t i = 0; i < sizeof(output_truncated2); i++) EXPECT_EQ(expected2[i], static_cast<int>(output_truncated2[i])); } @@ -93,11 +93,11 @@ TEST(Sha256Test, Test3) { uint8 output3[base::SHA256_LENGTH]; base::SHA256HashString(input3, output3, sizeof(output3)); - for (int i = 0; i < base::SHA256_LENGTH; i++) + for (size_t i = 0; i < base::SHA256_LENGTH; i++) EXPECT_EQ(expected3[i], static_cast<int>(output3[i])); uint8 output_truncated3[12]; base::SHA256HashString(input3, output_truncated3, sizeof(output_truncated3)); - for (int i = 0; i < sizeof(output_truncated3); i++) + for (size_t i = 0; i < sizeof(output_truncated3); i++) EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i])); } diff --git a/base/stack_container_unittest.cc b/base/stack_container_unittest.cc index a732995..09ed2a1 100644 --- a/base/stack_container_unittest.cc +++ b/base/stack_container_unittest.cc @@ -56,7 +56,7 @@ TEST(StackContainer, Vector) { const int* stack_buffer = &vect.stack_data().stack_buffer()[0]; // The initial |stack_size| elements should appear in the stack buffer. - EXPECT_EQ(stack_size, vect.container().capacity()); + EXPECT_EQ(static_cast<size_t>(stack_size), vect.container().capacity()); for (int i = 0; i < stack_size; i++) { vect.container().push_back(i); EXPECT_EQ(stack_buffer, &vect.container()[0]); diff --git a/base/string_escape_unittest.cc b/base/string_escape_unittest.cc index 91f15b7..dda0d2a7 100644 --- a/base/string_escape_unittest.cc +++ b/base/string_escape_unittest.cc @@ -33,7 +33,6 @@ TEST(StringEscapeTest, JavascriptDoubleQuote) { static const char* kToEscape = "\b\001aZ\"\\wee"; static const char* kEscaped = "\\b\\x01aZ\\\"\\\\wee"; - static const char* kEscapedQuoted = "\"\\b\\x01aZ\\\"\\\\wee\""; static const wchar_t* kUToEscape = L"\b\x0001" L"a\x123fZ\"\\wee"; static const char* kUEscaped = "\\b\\x01a\\u123FZ\\\"\\\\wee"; static const char* kUEscapedQuoted = "\"\\b\\x01a\\u123FZ\\\"\\\\wee\""; diff --git a/base/string_piece_unittest.cc b/base/string_piece_unittest.cc index af8f6f4..96cfca2 100644 --- a/base/string_piece_unittest.cc +++ b/base/string_piece_unittest.cc @@ -146,12 +146,12 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(*(c.rend() - 1), 'x'); ASSERT_TRUE(a.rbegin() + 26 == a.rend()); - ASSERT_EQ(a.size(), 26); - ASSERT_EQ(b.size(), 3); - ASSERT_EQ(c.size(), 3); - ASSERT_EQ(d.size(), 6); - ASSERT_EQ(e.size(), 0); - ASSERT_EQ(f.size(), 7); + ASSERT_EQ(a.size(), 26U); + ASSERT_EQ(b.size(), 3U); + ASSERT_EQ(c.size(), 3U); + ASSERT_EQ(d.size(), 6U); + ASSERT_EQ(e.size(), 0U); + ASSERT_EQ(f.size(), 7U); ASSERT_TRUE(!d.empty()); ASSERT_TRUE(d.begin() != d.end()); @@ -161,7 +161,7 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_TRUE(e.begin() == e.end()); d.clear(); - ASSERT_EQ(d.size(), 0); + ASSERT_EQ(d.size(), 0U); ASSERT_TRUE(d.empty()); ASSERT_TRUE(d.data() == NULL); ASSERT_TRUE(d.begin() == d.end()); @@ -170,17 +170,17 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_GE(a.capacity(), a.size()); char buf[4] = { '%', '%', '%', '%' }; - ASSERT_EQ(a.copy(buf, 4), 4); + ASSERT_EQ(a.copy(buf, 4), 4U); ASSERT_EQ(buf[0], a[0]); ASSERT_EQ(buf[1], a[1]); ASSERT_EQ(buf[2], a[2]); ASSERT_EQ(buf[3], a[3]); - ASSERT_EQ(a.copy(buf, 3, 7), 3); + ASSERT_EQ(a.copy(buf, 3, 7), 3U); ASSERT_EQ(buf[0], a[7]); ASSERT_EQ(buf[1], a[8]); ASSERT_EQ(buf[2], a[9]); ASSERT_EQ(buf[3], a[3]); - ASSERT_EQ(c.copy(buf, 99), 3); + ASSERT_EQ(c.copy(buf, 99), 3U); ASSERT_EQ(buf[0], c[0]); ASSERT_EQ(buf[1], c[1]); ASSERT_EQ(buf[2], c[2]); @@ -188,17 +188,17 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(StringPiece::npos, std::string::npos); - ASSERT_EQ(a.find(b), 0); + ASSERT_EQ(a.find(b), 0U); ASSERT_EQ(a.find(b, 1), StringPiece::npos); - ASSERT_EQ(a.find(c), 23); - ASSERT_EQ(a.find(c, 9), 23); + ASSERT_EQ(a.find(c), 23U); + ASSERT_EQ(a.find(c, 9), 23U); ASSERT_EQ(a.find(c, StringPiece::npos), StringPiece::npos); ASSERT_EQ(b.find(c), StringPiece::npos); ASSERT_EQ(b.find(c, StringPiece::npos), StringPiece::npos); - ASSERT_EQ(a.find(d), 0); - ASSERT_EQ(a.find(e), 0); - ASSERT_EQ(a.find(d, 12), 12); - ASSERT_EQ(a.find(e, 17), 17); + ASSERT_EQ(a.find(d), 0U); + ASSERT_EQ(a.find(e), 0U); + ASSERT_EQ(a.find(d, 12), 12U); + ASSERT_EQ(a.find(e, 17), 17U); StringPiece g("xx not found bb"); ASSERT_EQ(a.find(g), StringPiece::npos); // empty string nonsense @@ -217,17 +217,17 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(e.find(d, 4), std::string().find(std::string(), 4)); ASSERT_EQ(e.find(e, 4), std::string().find(std::string(), 4)); - ASSERT_EQ(a.find('a'), 0); - ASSERT_EQ(a.find('c'), 2); - ASSERT_EQ(a.find('z'), 25); + ASSERT_EQ(a.find('a'), 0U); + ASSERT_EQ(a.find('c'), 2U); + ASSERT_EQ(a.find('z'), 25U); ASSERT_EQ(a.find('$'), StringPiece::npos); ASSERT_EQ(a.find('\0'), StringPiece::npos); - ASSERT_EQ(f.find('\0'), 3); - ASSERT_EQ(f.find('3'), 2); - ASSERT_EQ(f.find('5'), 5); - ASSERT_EQ(g.find('o'), 4); - ASSERT_EQ(g.find('o', 4), 4); - ASSERT_EQ(g.find('o', 5), 8); + ASSERT_EQ(f.find('\0'), 3U); + ASSERT_EQ(f.find('3'), 2U); + ASSERT_EQ(f.find('5'), 5U); + ASSERT_EQ(g.find('o'), 4U); + ASSERT_EQ(g.find('o', 4), 4U); + ASSERT_EQ(g.find('o', 5), 8U); ASSERT_EQ(a.find('b', 5), StringPiece::npos); // empty string nonsense ASSERT_EQ(d.find('\0'), StringPiece::npos); @@ -239,9 +239,9 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(d.find('x', 4), StringPiece::npos); ASSERT_EQ(e.find('x', 7), StringPiece::npos); - ASSERT_EQ(a.rfind(b), 0); - ASSERT_EQ(a.rfind(b, 1), 0); - ASSERT_EQ(a.rfind(c), 23); + ASSERT_EQ(a.rfind(b), 0U); + ASSERT_EQ(a.rfind(b, 1), 0U); + ASSERT_EQ(a.rfind(c), 23U); ASSERT_EQ(a.rfind(c, 22), StringPiece::npos); ASSERT_EQ(a.rfind(c, 1), StringPiece::npos); ASSERT_EQ(a.rfind(c, 0), StringPiece::npos); @@ -249,8 +249,8 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(b.rfind(c, 0), StringPiece::npos); ASSERT_EQ(a.rfind(d), a.as_string().rfind(std::string())); ASSERT_EQ(a.rfind(e), a.as_string().rfind(std::string())); - ASSERT_EQ(a.rfind(d, 12), 12); - ASSERT_EQ(a.rfind(e, 17), 17); + ASSERT_EQ(a.rfind(d, 12), 12U); + ASSERT_EQ(a.rfind(e, 17), 17U); ASSERT_EQ(a.rfind(g), StringPiece::npos); ASSERT_EQ(d.rfind(b), StringPiece::npos); ASSERT_EQ(e.rfind(b), StringPiece::npos); @@ -266,33 +266,33 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(d.rfind(e), std::string().rfind(std::string())); ASSERT_EQ(e.rfind(e), std::string().rfind(std::string())); - ASSERT_EQ(g.rfind('o'), 8); + ASSERT_EQ(g.rfind('o'), 8U); ASSERT_EQ(g.rfind('q'), StringPiece::npos); - ASSERT_EQ(g.rfind('o', 8), 8); - ASSERT_EQ(g.rfind('o', 7), 4); + ASSERT_EQ(g.rfind('o', 8), 8U); + ASSERT_EQ(g.rfind('o', 7), 4U); ASSERT_EQ(g.rfind('o', 3), StringPiece::npos); - ASSERT_EQ(f.rfind('\0'), 3); - ASSERT_EQ(f.rfind('\0', 12), 3); - ASSERT_EQ(f.rfind('3'), 2); - ASSERT_EQ(f.rfind('5'), 5); + ASSERT_EQ(f.rfind('\0'), 3U); + ASSERT_EQ(f.rfind('\0', 12), 3U); + ASSERT_EQ(f.rfind('3'), 2U); + ASSERT_EQ(f.rfind('5'), 5U); // empty string nonsense ASSERT_EQ(d.rfind('o'), StringPiece::npos); ASSERT_EQ(e.rfind('o'), StringPiece::npos); ASSERT_EQ(d.rfind('o', 4), StringPiece::npos); ASSERT_EQ(e.rfind('o', 7), StringPiece::npos); - ASSERT_EQ(a.find_first_of(b), 0); - ASSERT_EQ(a.find_first_of(b, 0), 0); - ASSERT_EQ(a.find_first_of(b, 1), 1); - ASSERT_EQ(a.find_first_of(b, 2), 2); + ASSERT_EQ(a.find_first_of(b), 0U); + ASSERT_EQ(a.find_first_of(b, 0), 0U); + ASSERT_EQ(a.find_first_of(b, 1), 1U); + ASSERT_EQ(a.find_first_of(b, 2), 2U); ASSERT_EQ(a.find_first_of(b, 3), StringPiece::npos); - ASSERT_EQ(a.find_first_of(c), 23); - ASSERT_EQ(a.find_first_of(c, 23), 23); - ASSERT_EQ(a.find_first_of(c, 24), 24); - ASSERT_EQ(a.find_first_of(c, 25), 25); + ASSERT_EQ(a.find_first_of(c), 23U); + ASSERT_EQ(a.find_first_of(c, 23), 23U); + ASSERT_EQ(a.find_first_of(c, 24), 24U); + ASSERT_EQ(a.find_first_of(c, 25), 25U); ASSERT_EQ(a.find_first_of(c, 26), StringPiece::npos); - ASSERT_EQ(g.find_first_of(b), 13); - ASSERT_EQ(g.find_first_of(c), 0); + ASSERT_EQ(g.find_first_of(b), 13U); + ASSERT_EQ(g.find_first_of(c), 0U); ASSERT_EQ(a.find_first_of(f), StringPiece::npos); ASSERT_EQ(f.find_first_of(a), StringPiece::npos); // empty string nonsense @@ -305,14 +305,14 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(d.find_first_of(e), StringPiece::npos); ASSERT_EQ(e.find_first_of(e), StringPiece::npos); - ASSERT_EQ(a.find_first_not_of(b), 3); - ASSERT_EQ(a.find_first_not_of(c), 0); + ASSERT_EQ(a.find_first_not_of(b), 3U); + ASSERT_EQ(a.find_first_not_of(c), 0U); ASSERT_EQ(b.find_first_not_of(a), StringPiece::npos); ASSERT_EQ(c.find_first_not_of(a), StringPiece::npos); - ASSERT_EQ(f.find_first_not_of(a), 0); - ASSERT_EQ(a.find_first_not_of(f), 0); - ASSERT_EQ(a.find_first_not_of(d), 0); - ASSERT_EQ(a.find_first_not_of(e), 0); + ASSERT_EQ(f.find_first_not_of(a), 0U); + ASSERT_EQ(a.find_first_not_of(f), 0U); + ASSERT_EQ(a.find_first_not_of(d), 0U); + ASSERT_EQ(a.find_first_not_of(e), 0U); // empty string nonsense ASSERT_EQ(d.find_first_not_of(a), StringPiece::npos); ASSERT_EQ(e.find_first_not_of(a), StringPiece::npos); @@ -324,11 +324,11 @@ TEST(StringPieceTest, CheckSTL) { StringPiece h("===="); ASSERT_EQ(h.find_first_not_of('='), StringPiece::npos); ASSERT_EQ(h.find_first_not_of('=', 3), StringPiece::npos); - ASSERT_EQ(h.find_first_not_of('\0'), 0); - ASSERT_EQ(g.find_first_not_of('x'), 2); - ASSERT_EQ(f.find_first_not_of('\0'), 0); - ASSERT_EQ(f.find_first_not_of('\0', 3), 4); - ASSERT_EQ(f.find_first_not_of('\0', 2), 2); + ASSERT_EQ(h.find_first_not_of('\0'), 0U); + ASSERT_EQ(g.find_first_not_of('x'), 2U); + ASSERT_EQ(f.find_first_not_of('\0'), 0U); + ASSERT_EQ(f.find_first_not_of('\0', 3), 4U); + ASSERT_EQ(f.find_first_not_of('\0', 2), 2U); // empty string nonsense ASSERT_EQ(d.find_first_not_of('x'), StringPiece::npos); ASSERT_EQ(e.find_first_not_of('x'), StringPiece::npos); @@ -339,19 +339,19 @@ TEST(StringPieceTest, CheckSTL) { StringPiece i("56"); ASSERT_EQ(h.find_last_of(a), StringPiece::npos); ASSERT_EQ(g.find_last_of(a), g.size()-1); - ASSERT_EQ(a.find_last_of(b), 2); + ASSERT_EQ(a.find_last_of(b), 2U); ASSERT_EQ(a.find_last_of(c), a.size()-1); - ASSERT_EQ(f.find_last_of(i), 6); - ASSERT_EQ(a.find_last_of('a'), 0); - ASSERT_EQ(a.find_last_of('b'), 1); - ASSERT_EQ(a.find_last_of('z'), 25); - ASSERT_EQ(a.find_last_of('a', 5), 0); - ASSERT_EQ(a.find_last_of('b', 5), 1); + ASSERT_EQ(f.find_last_of(i), 6U); + ASSERT_EQ(a.find_last_of('a'), 0U); + ASSERT_EQ(a.find_last_of('b'), 1U); + ASSERT_EQ(a.find_last_of('z'), 25U); + ASSERT_EQ(a.find_last_of('a', 5), 0U); + ASSERT_EQ(a.find_last_of('b', 5), 1U); ASSERT_EQ(a.find_last_of('b', 0), StringPiece::npos); - ASSERT_EQ(a.find_last_of('z', 25), 25); + ASSERT_EQ(a.find_last_of('z', 25), 25U); ASSERT_EQ(a.find_last_of('z', 24), StringPiece::npos); - ASSERT_EQ(f.find_last_of(i, 5), 5); - ASSERT_EQ(f.find_last_of(i, 6), 6); + ASSERT_EQ(f.find_last_of(i, 5), 5U); + ASSERT_EQ(f.find_last_of(i, 6), 6U); ASSERT_EQ(f.find_last_of(a, 4), StringPiece::npos); // empty string nonsense ASSERT_EQ(f.find_last_of(d), StringPiece::npos); @@ -372,18 +372,18 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(e.find_last_of(f, 4), StringPiece::npos); ASSERT_EQ(a.find_last_not_of(b), a.size()-1); - ASSERT_EQ(a.find_last_not_of(c), 22); + ASSERT_EQ(a.find_last_not_of(c), 22U); ASSERT_EQ(b.find_last_not_of(a), StringPiece::npos); ASSERT_EQ(b.find_last_not_of(b), StringPiece::npos); - ASSERT_EQ(f.find_last_not_of(i), 4); - ASSERT_EQ(a.find_last_not_of(c, 24), 22); - ASSERT_EQ(a.find_last_not_of(b, 3), 3); + ASSERT_EQ(f.find_last_not_of(i), 4U); + ASSERT_EQ(a.find_last_not_of(c, 24), 22U); + ASSERT_EQ(a.find_last_not_of(b, 3), 3U); ASSERT_EQ(a.find_last_not_of(b, 2), StringPiece::npos); // empty string nonsense ASSERT_EQ(f.find_last_not_of(d), f.size()-1); ASSERT_EQ(f.find_last_not_of(e), f.size()-1); - ASSERT_EQ(f.find_last_not_of(d, 4), 4); - ASSERT_EQ(f.find_last_not_of(e, 4), 4); + ASSERT_EQ(f.find_last_not_of(d, 4), 4U); + ASSERT_EQ(f.find_last_not_of(e, 4), 4U); ASSERT_EQ(d.find_last_not_of(d), StringPiece::npos); ASSERT_EQ(d.find_last_not_of(e), StringPiece::npos); ASSERT_EQ(e.find_last_not_of(d), StringPiece::npos); @@ -399,10 +399,10 @@ TEST(StringPieceTest, CheckSTL) { ASSERT_EQ(h.find_last_not_of('x'), h.size() - 1); ASSERT_EQ(h.find_last_not_of('='), StringPiece::npos); - ASSERT_EQ(b.find_last_not_of('c'), 1); - ASSERT_EQ(h.find_last_not_of('x', 2), 2); + ASSERT_EQ(b.find_last_not_of('c'), 1U); + ASSERT_EQ(h.find_last_not_of('x', 2), 2U); ASSERT_EQ(h.find_last_not_of('=', 2), StringPiece::npos); - ASSERT_EQ(b.find_last_not_of('b', 1), 0); + ASSERT_EQ(b.find_last_not_of('b', 1), 0U); // empty string nonsense ASSERT_EQ(d.find_last_not_of('x'), StringPiece::npos); ASSERT_EQ(e.find_last_not_of('x'), StringPiece::npos); @@ -433,10 +433,10 @@ TEST(StringPieceTest, CheckCustom) { // CopyToString a.CopyToString(&s2); - ASSERT_EQ(s2.size(), 6); + ASSERT_EQ(s2.size(), 6U); ASSERT_EQ(s2, "foobar"); b.CopyToString(&s2); - ASSERT_EQ(s2.size(), 7); + ASSERT_EQ(s2.size(), 7U); ASSERT_EQ(s1, s2); e.CopyToString(&s2); ASSERT_TRUE(s2.empty()); @@ -444,10 +444,10 @@ TEST(StringPieceTest, CheckCustom) { // AppendToString s2.erase(); a.AppendToString(&s2); - ASSERT_EQ(s2.size(), 6); + ASSERT_EQ(s2.size(), 6U); ASSERT_EQ(s2, "foobar"); a.AppendToString(&s2); - ASSERT_EQ(s2.size(), 12); + ASSERT_EQ(s2.size(), 12U); ASSERT_EQ(s2, "foobarfoobar"); // starts_with @@ -523,11 +523,11 @@ TEST(StringPieceTest, CheckNULL) { // we used to crash here, but now we don't. StringPiece s(NULL); ASSERT_EQ(s.data(), (const char*)NULL); - ASSERT_EQ(s.size(), 0); + ASSERT_EQ(s.size(), 0U); s.set(NULL); ASSERT_EQ(s.data(), (const char*)NULL); - ASSERT_EQ(s.size(), 0); + ASSERT_EQ(s.size(), 0U); } TEST(StringPieceTest, CheckComparisons2) { diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 2080d07..2ddc603 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -70,7 +70,7 @@ TEST(ValuesTest, Basic) { ListValue* bookmark_list; ASSERT_TRUE(settings.GetList(L"global.toolbar.bookmarks", &bookmark_list)); DictionaryValue* bookmark; - ASSERT_EQ(1, bookmark_list->GetSize()); + ASSERT_EQ(1U, bookmark_list->GetSize()); ASSERT_TRUE(bookmark_list->GetDictionary(0, &bookmark)); std::wstring bookmark_name = L"Unnamed"; ASSERT_TRUE(bookmark->GetString(L"name", &bookmark_name)); @@ -93,7 +93,7 @@ TEST(ValuesTest, BinaryValue) { ASSERT_TRUE(binary); ASSERT_TRUE(binary->GetBuffer()); ASSERT_EQ(buffer, binary->GetBuffer()); - ASSERT_EQ(0, binary->GetSize()); + ASSERT_EQ(0U, binary->GetSize()); delete binary; binary = NULL; @@ -103,7 +103,7 @@ TEST(ValuesTest, BinaryValue) { ASSERT_TRUE(binary); ASSERT_TRUE(binary->GetBuffer()); ASSERT_EQ(buffer, binary->GetBuffer()); - ASSERT_EQ(15, binary->GetSize()); + ASSERT_EQ(15U, binary->GetSize()); delete binary; binary = NULL; @@ -113,7 +113,7 @@ TEST(ValuesTest, BinaryValue) { ASSERT_TRUE(binary); ASSERT_TRUE(binary->GetBuffer()); ASSERT_NE(stack_buffer, binary->GetBuffer()); - ASSERT_EQ(42, binary->GetSize()); + ASSERT_EQ(42U, binary->GetSize()); ASSERT_EQ(0, memcmp(stack_buffer, binary->GetBuffer(), binary->GetSize())); delete binary; } @@ -175,13 +175,13 @@ TEST(ValuesTest, ListRemoval) { ListValue list; list.Append(new DeletionTestValue(&deletion_flag)); EXPECT_FALSE(deletion_flag); - EXPECT_EQ(1, list.GetSize()); + EXPECT_EQ(1U, list.GetSize()); EXPECT_FALSE(list.Remove(std::numeric_limits<size_t>::max(), &removed_item)); EXPECT_FALSE(list.Remove(1, &removed_item)); EXPECT_TRUE(list.Remove(0, &removed_item)); ASSERT_TRUE(removed_item); - EXPECT_EQ(0, list.GetSize()); + EXPECT_EQ(0U, list.GetSize()); } EXPECT_FALSE(deletion_flag); delete removed_item; @@ -194,7 +194,7 @@ TEST(ValuesTest, ListRemoval) { EXPECT_FALSE(deletion_flag); EXPECT_TRUE(list.Remove(0, NULL)); EXPECT_TRUE(deletion_flag); - EXPECT_EQ(0, list.GetSize()); + EXPECT_EQ(0U, list.GetSize()); } } @@ -348,7 +348,7 @@ TEST(ValuesTest, DeepCopy) { ASSERT_NE(copy_value, original_list); ASSERT_TRUE(copy_value->IsType(Value::TYPE_LIST)); ListValue* copy_list = static_cast<ListValue*>(copy_value); - ASSERT_EQ(2, copy_list->GetSize()); + ASSERT_EQ(2U, copy_list->GetSize()); Value* copy_list_element_0; ASSERT_TRUE(copy_list->Get(0, ©_list_element_0)); |