summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/stringattribute
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@yahooinc.com>2022-06-21 11:26:58 +0000
committerHåvard Pettersen <havardpe@yahooinc.com>2022-06-21 14:15:01 +0000
commit60e28dcd0b4c1ea9eff2e4f26da7ec53ed24e64a (patch)
tree80a479d5f62a8bb7c5ce52a5d531a434075cfe57 /searchlib/src/tests/attribute/stringattribute
parent1f9c4d5b83b314785cd9c83bbecec21cb00b192b (diff)
avoid nullptr deref
Diffstat (limited to 'searchlib/src/tests/attribute/stringattribute')
-rw-r--r--searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
index aa2c475e7b6..96039bee15b 100644
--- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
+++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
@@ -48,7 +48,7 @@ checkCount(Attribute & vec, uint32_t doc, uint32_t valueCount,
{
std::vector<vespalib::string> buffer(valueCount);
EXPECT_TRUE(static_cast<uint32_t>(vec.getValueCount(doc)) == valueCount);
- EXPECT_TRUE(vec.get(doc, &buffer[0], buffer.size()) == valueCount);
+ EXPECT_TRUE(vec.get(doc, buffer.data(), buffer.size()) == valueCount);
EXPECT_TRUE(std::count(buffer.begin(), buffer.end(), value) == numValues);
}
@@ -125,10 +125,10 @@ testMultiValue(Attribute & attr, uint32_t numDocs)
// test get all
std::vector<vespalib::string> values(valueCount);
- ASSERT_TRUE(attr.get(doc, &values[0], valueCount) == valueCount);
+ ASSERT_TRUE(attr.get(doc, values.data(), valueCount) == valueCount);
std::vector<uint32_t> enums(valueCount);
- ASSERT_TRUE((static_cast<search::attribute::IAttributeVector &>(attr)).get(doc, &enums[0], valueCount) == valueCount);
+ ASSERT_TRUE((static_cast<search::attribute::IAttributeVector &>(attr)).get(doc, enums.data(), valueCount) == valueCount);
auto combined = zipped_and_sorted_by_first(values, enums);
for (uint32_t j = 0; j < valueCount; ++j) {
@@ -167,10 +167,10 @@ testMultiValue(Attribute & attr, uint32_t numDocs)
// test get all
std::vector<vespalib::string> values(valueCount);
- EXPECT_TRUE(attr.get(doc, &values[0], valueCount) == valueCount);
+ EXPECT_TRUE(attr.get(doc, values.data(), valueCount) == valueCount);
std::vector<uint32_t> enums(valueCount);
- EXPECT_TRUE((static_cast<search::attribute::IAttributeVector &>(attr)).get(doc, &enums[0], valueCount) == valueCount);
+ EXPECT_TRUE((static_cast<search::attribute::IAttributeVector &>(attr)).get(doc, enums.data(), valueCount) == valueCount);
auto combined = zipped_and_sorted_by_first(values, enums);
for (uint32_t j = 0; j < valueCount; ++j) {