mirror of
https://github.com/google/snappy.git
synced 2024-11-28 05:44:33 +00:00
Fixed comparison between signed and unsigned integer expressions in snappy_unittest.cc
This commit is contained in:
parent
ed3b7b242b
commit
0977b4f9e3
|
@ -848,7 +848,7 @@ TEST(Snappy, FourByteOffset) {
|
|||
}
|
||||
AppendCopy(&compressed, src.size(), fragment1.size());
|
||||
src += fragment1;
|
||||
CHECK_EQ(length, src.size());
|
||||
CHECK_EQ(unsigned(length), src.size());
|
||||
|
||||
string uncompressed;
|
||||
CHECK(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size()));
|
||||
|
@ -867,7 +867,7 @@ TEST(Snappy, IOVecEdgeCases) {
|
|||
static const int kLengths[] = { 2, 1, 4, 8, 128 };
|
||||
|
||||
struct iovec iov[ARRAYSIZE(kLengths)];
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
iov[i].iov_base = new char[kLengths[i]];
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
@ -919,7 +919,7 @@ TEST(Snappy, IOVecEdgeCases) {
|
|||
CHECK_EQ(0, memcmp(iov[3].iov_base, "23123123", 8));
|
||||
CHECK_EQ(0, memcmp(iov[4].iov_base, "123bc12", 7));
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
delete[] reinterpret_cast<char *>(iov[i].iov_base);
|
||||
}
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ TEST(Snappy, IOVecLiteralOverflow) {
|
|||
static const int kLengths[] = { 3, 4 };
|
||||
|
||||
struct iovec iov[ARRAYSIZE(kLengths)];
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
iov[i].iov_base = new char[kLengths[i]];
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ TEST(Snappy, IOVecLiteralOverflow) {
|
|||
CHECK(!snappy::RawUncompressToIOVec(
|
||||
compressed.data(), compressed.size(), iov, ARRAYSIZE(iov)));
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
delete[] reinterpret_cast<char *>(iov[i].iov_base);
|
||||
}
|
||||
}
|
||||
|
@ -950,7 +950,7 @@ TEST(Snappy, IOVecCopyOverflow) {
|
|||
static const int kLengths[] = { 3, 4 };
|
||||
|
||||
struct iovec iov[ARRAYSIZE(kLengths)];
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
iov[i].iov_base = new char[kLengths[i]];
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
@ -964,7 +964,7 @@ TEST(Snappy, IOVecCopyOverflow) {
|
|||
CHECK(!snappy::RawUncompressToIOVec(
|
||||
compressed.data(), compressed.size(), iov, ARRAYSIZE(iov)));
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(kLengths); ++i) {
|
||||
delete[] reinterpret_cast<char *>(iov[i].iov_base);
|
||||
}
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ TEST(Snappy, FindMatchLengthRandom) {
|
|||
DataEndingAtUnreadablePage u(s);
|
||||
DataEndingAtUnreadablePage v(t);
|
||||
int matched = TestFindMatchLength(u.data(), v.data(), t.size());
|
||||
if (matched == t.size()) {
|
||||
if (unsigned(matched) == t.size()) {
|
||||
EXPECT_EQ(s, t);
|
||||
} else {
|
||||
EXPECT_NE(s[matched], t[matched]);
|
||||
|
@ -1354,7 +1354,7 @@ static void BM_UFlat(int iters, int arg) {
|
|||
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
CHECK_LT(unsigned(arg), ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
|
||||
|
@ -1380,7 +1380,7 @@ static void BM_UValidate(int iters, int arg) {
|
|||
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
CHECK_LT(unsigned(arg), ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ static void BM_UIOVec(int iters, int arg) {
|
|||
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
CHECK_LT(unsigned(arg), ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ static void BM_UIOVec(int iters, int arg) {
|
|||
int used_so_far = 0;
|
||||
for (int i = 0; i < kNumEntries; ++i) {
|
||||
iov[i].iov_base = dst + used_so_far;
|
||||
if (used_so_far == contents.size()) {
|
||||
if (unsigned(used_so_far) == contents.size()) {
|
||||
iov[i].iov_len = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -1449,7 +1449,7 @@ static void BM_UFlatSink(int iters, int arg) {
|
|||
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
CHECK_LT(unsigned(arg), ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ static void BM_ZFlat(int iters, int arg) {
|
|||
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
CHECK_LT(unsigned(arg), ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
|
||||
|
|
Loading…
Reference in a new issue