Fixed a few more -Wall warnings.

This commit is contained in:
Kishore Nallan 2018-01-26 13:38:02 +00:00
parent f8be8f4f6a
commit ba49971ddd
2 changed files with 10 additions and 12 deletions

View File

@ -10,13 +10,13 @@ TEST(ArrayTest, Append) {
// First try inserting sorted ints
for(uint32_t i=0; i < SIZE; i++) {
for(int i=0; i < SIZE; i++) {
arr.append(i);
}
EXPECT_EQ(arr.getLength(), SIZE);
for(uint32_t i=0; i < SIZE; i++) {
for(int i=0; i < SIZE; i++) {
EXPECT_EQ(arr.at(i), i);
EXPECT_EQ(arr.indexOf(i), i);
EXPECT_EQ(arr.contains(i), true);
@ -31,7 +31,7 @@ TEST(ArrayTest, Append) {
std::vector<uint32_t> unsorted;
for(uint32_t i=0; i < SIZE; i++) {
for(int i=0; i < SIZE; i++) {
uint32_t r = (uint32_t) rand();
unsorted.push_back(r);
arr2.append(r);
@ -39,7 +39,7 @@ TEST(ArrayTest, Append) {
EXPECT_EQ(arr2.getLength(), SIZE);
for(uint32_t i=0; i < SIZE; i++) {
for(int i=0; i < SIZE; i++) {
uint32_t value = unsorted.at(i);
EXPECT_EQ(arr2.at(i), value);
}

View File

@ -617,7 +617,7 @@ TEST(ArtTest, test_art_fuzzy_search) {
char buf[512];
FILE *f = fopen(words_file_path, "r");
uintptr_t line = 1, nlines;
uintptr_t line = 1;
while (fgets(buf, sizeof buf, f)) {
len = strlen(buf);
buf[len-1] = '\0';
@ -626,8 +626,6 @@ TEST(ArtTest, test_art_fuzzy_search) {
line++;
}
nlines = line - 1;
std::vector<art_leaf*> leaves;
// transpose
@ -676,7 +674,7 @@ TEST(ArtTest, test_art_fuzzy_search) {
ASSERT_EQ(10, leaves.size());
std::vector<const char*> words = {"town", "sown", "shown", "own", "mown", "lown", "howl", "howk", "howe", "how"};
for(auto leaf_index = 0; leaf_index < leaves.size(); leaf_index++) {
for(size_t leaf_index = 0; leaf_index < leaves.size(); leaf_index++) {
ASSERT_STREQ(words.at(leaf_index), (const char *)leaves.at(leaf_index)->key);
}
@ -764,7 +762,7 @@ TEST(ArtTest, test_int32_range_hundreds) {
{1981, 1985}, {1999, 2000, 2001, 2002}};
for(uint32_t i = 0; i < values.size(); i++) {
for(auto j = 0; j < values[i].size(); j++) {
for(size_t j = 0; j < values[i].size(); j++) {
encode_int32(values[i][j], chars);
doc.id = i;
art_insert(&t, (unsigned char*)chars, CHAR_LEN, &doc, 1);
@ -1008,13 +1006,13 @@ TEST(ArtTest, test_encode_int64) {
}
unsigned char chars_large_num[8] = {255, 255, 255, 255, 128, 0, 0, 199};
encode_int64(std::numeric_limits<std::int32_t>::max()+200, chars);
encode_int64((int64_t)(std::numeric_limits<std::int32_t>::max())+200, chars);
for(uint32_t i = 0; i < 8; i++) {
ASSERT_EQ(chars_large_num[i], chars[i]);
}
unsigned char chars_large_neg_num[8] = {0, 0, 0, 0, 127, 255, 255, 57};
encode_int64(-1 * (std::numeric_limits<std::int32_t>::max()+200), chars);
encode_int64(-1 * ((int64_t)(std::numeric_limits<std::int32_t>::max())+200), chars);
for(uint32_t i = 0; i < 8; i++) {
ASSERT_EQ(chars_large_neg_num[i], chars[i]);
}
@ -1123,7 +1121,7 @@ TEST(ArtTest, test_int32_array) {
{1999, 2000, 2001, 2002}};
for (uint32_t i = 0; i < values.size(); i++) {
for (auto j = 0; j < values[i].size(); j++) {
for (size_t j = 0; j < values[i].size(); j++) {
encode_int32(values[i][j], chars);
doc.id = i;
art_insert(&t, (unsigned char *) chars, CHAR_LEN, &doc, 1);