Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Fixed a few more -Wall warnings.

Kishore Nallanba49971ddd7c
diff --git a/test/array_test.cpp b/test/array_test.cpp
index e04b41a4..1efa0bd2 100644
--- a/test/array_test.cpp
+++ b/test/array_test.cpp
@@ -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);
}
diff --git a/test/art_test.cpp b/test/art_test.cpp
index 4efe70f9..f971e8e4 100644
--- a/test/art_test.cpp
+++ b/test/art_test.cpp
@@ -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);