diff options
author | Maxim Pimenov <m@maps.me> | 2019-04-15 17:47:05 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-04-15 21:01:06 +0300 |
commit | 1d0428d056aa2e6b0024f991991f5c513cff9f73 (patch) | |
tree | cff44256529314ec8fcc9ea22fab87520a76e33a /indexer | |
parent | 25087ac0bf7e8c41e0d0684e43b5285a8b8be47c (diff) |
Several explicit constructors per the Cppcheck report.
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/categories_index.hpp | 2 | ||||
-rw-r--r-- | indexer/feature.cpp | 2 | ||||
-rw-r--r-- | indexer/indexer_tests/categories_test.cpp | 6 | ||||
-rw-r--r-- | indexer/indexer_tests/search_string_utils_test.cpp | 2 | ||||
-rw-r--r-- | indexer/indexer_tests/visibility_test.cpp | 2 | ||||
-rw-r--r-- | indexer/locality_index_builder.cpp | 2 | ||||
-rw-r--r-- | indexer/rank_table.cpp | 2 | ||||
-rw-r--r-- | indexer/search_delimiters.hpp | 2 | ||||
-rw-r--r-- | indexer/search_string_utils.hpp | 2 |
9 files changed, 12 insertions, 10 deletions
diff --git a/indexer/categories_index.hpp b/indexer/categories_index.hpp index 752e89ffd0..74cd98245a 100644 --- a/indexer/categories_index.hpp +++ b/indexer/categories_index.hpp @@ -22,7 +22,7 @@ public: CategoriesIndex() : m_catHolder(&GetDefaultCategories()) {} - CategoriesIndex(CategoriesHolder const & catHolder) : m_catHolder(&catHolder) {} + explicit CategoriesIndex(CategoriesHolder const & catHolder) : m_catHolder(&catHolder) {} CategoriesIndex(CategoriesIndex && other) : m_catHolder(other.m_catHolder), m_trie(move(other.m_trie)) diff --git a/indexer/feature.cpp b/indexer/feature.cpp index bc298a399d..6babbbad26 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -141,7 +141,7 @@ class BitSource uint8_t m_pos; public: - BitSource(char const * p) : m_ptr(p), m_pos(0) {} + explicit BitSource(char const * p) : m_ptr(p), m_pos(0) {} uint8_t Read(uint8_t count) { diff --git a/indexer/indexer_tests/categories_test.cpp b/indexer/indexer_tests/categories_test.cpp index 618eca832f..1c12f37659 100644 --- a/indexer/indexer_tests/categories_test.cpp +++ b/indexer/indexer_tests/categories_test.cpp @@ -31,8 +31,8 @@ char const g_testCategoriesTxt[] = struct Checker { - size_t & m_count; - Checker(size_t & count) : m_count(count) {} + explicit Checker(size_t & count) : m_count(count) {} + void operator()(CategoriesHolder::Category const & cat) { switch (m_count) @@ -89,6 +89,8 @@ struct Checker TEST(false, ("Too many categories")); } } + + size_t & m_count; }; UNIT_TEST(LoadCategories) diff --git a/indexer/indexer_tests/search_string_utils_test.cpp b/indexer/indexer_tests/search_string_utils_test.cpp index f4a64fc234..dea12767c9 100644 --- a/indexer/indexer_tests/search_string_utils_test.cpp +++ b/indexer/indexer_tests/search_string_utils_test.cpp @@ -18,7 +18,7 @@ namespace class Utf8StreetTokensFilter { public: - Utf8StreetTokensFilter(vector<pair<string, size_t>> & cont) + explicit Utf8StreetTokensFilter(vector<pair<string, size_t>> & cont) : m_cont(cont) , m_filter([&](UniString const & token, size_t tag) { diff --git a/indexer/indexer_tests/visibility_test.cpp b/indexer/indexer_tests/visibility_test.cpp index 3d708f5d04..dd6b7f5499 100644 --- a/indexer/indexer_tests/visibility_test.cpp +++ b/indexer/indexer_tests/visibility_test.cpp @@ -32,7 +32,7 @@ class DoGetMaxLowMinHighZoom } public: - DoGetMaxLowMinHighZoom(Classificator const & c) + explicit DoGetMaxLowMinHighZoom(Classificator const & c) : m_classif(classif()), m_res(-1, 1000) { char const * arr[][2] = { diff --git a/indexer/locality_index_builder.cpp b/indexer/locality_index_builder.cpp index 13d1cd53d2..a8a4ca4d75 100644 --- a/indexer/locality_index_builder.cpp +++ b/indexer/locality_index_builder.cpp @@ -21,7 +21,7 @@ class LocalityVector DISALLOW_COPY(LocalityVector); public: - LocalityVector(Reader const & reader) : m_recordReader(reader, 256 /* expectedRecordSize */) {} + explicit LocalityVector(Reader const & reader) : m_recordReader(reader, 256 /* expectedRecordSize */) {} template <class ToDo> void ForEach(ToDo && toDo) const diff --git a/indexer/rank_table.cpp b/indexer/rank_table.cpp index be6aab988c..621fc02008 100644 --- a/indexer/rank_table.cpp +++ b/indexer/rank_table.cpp @@ -90,7 +90,7 @@ class RankTableV0 : public RankTable public: RankTableV0() = default; - RankTableV0(vector<uint8_t> const & ranks) : m_coding(ranks) {} + explicit RankTableV0(vector<uint8_t> const & ranks) : m_coding(ranks) {} // RankTable overrides: uint8_t Get(uint64_t i) const override diff --git a/indexer/search_delimiters.hpp b/indexer/search_delimiters.hpp index cc8bc90452..2cd660c12f 100644 --- a/indexer/search_delimiters.hpp +++ b/indexer/search_delimiters.hpp @@ -15,7 +15,7 @@ public: class DelimitersWithExceptions { public: - DelimitersWithExceptions(std::vector<strings::UniChar> const & exceptions); + explicit DelimitersWithExceptions(std::vector<strings::UniChar> const & exceptions); bool operator()(strings::UniChar c) const; diff --git a/indexer/search_string_utils.hpp b/indexer/search_string_utils.hpp index 74de6a716b..7f3f2fbe41 100644 --- a/indexer/search_string_utils.hpp +++ b/indexer/search_string_utils.hpp @@ -97,7 +97,7 @@ public: using Callback = std::function<void(strings::UniString const & token, size_t tag)>; template <typename TC> - StreetTokensFilter(TC && callback) : m_callback(std::forward<TC>(callback)) + explicit StreetTokensFilter(TC && callback) : m_callback(std::forward<TC>(callback)) { } |