From 7c0b22d3bd777e89e55d6293606d59a80426880d Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 27 Oct 2021 00:06:11 +0200 Subject: [PATCH] Fix ctors that were missing explicit keyword --- src/dwarfs.cpp | 2 +- src/dwarfs/block_compressor.cpp | 2 +- src/dwarfs/block_manager.cpp | 2 +- src/dwarfs/python_script.cpp | 8 ++++---- src/dwarfs/string_table.cpp | 2 +- test/dwarfs_tools.cpp | 2 +- test/test_helpers.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dwarfs.cpp b/src/dwarfs.cpp index 341cb74e..fc2c5cee 100644 --- a/src/dwarfs.cpp +++ b/src/dwarfs.cpp @@ -72,7 +72,7 @@ struct options { }; struct dwarfs_userdata { - dwarfs_userdata(std::ostream& os) + explicit dwarfs_userdata(std::ostream& os) : lgr{os} {} options opts; diff --git a/src/dwarfs/block_compressor.cpp b/src/dwarfs/block_compressor.cpp index 2eadaacc..47826333 100644 --- a/src/dwarfs/block_compressor.cpp +++ b/src/dwarfs/block_compressor.cpp @@ -404,7 +404,7 @@ class zstd_block_compressor final : public block_compressor::impl { class scoped_context { public: - scoped_context(context_manager& mgr) + explicit scoped_context(context_manager& mgr) : mgr_{&mgr} , ctx_{mgr_->acquire()} {} ~scoped_context() { mgr_->release(ctx_); } diff --git a/src/dwarfs/block_manager.cpp b/src/dwarfs/block_manager.cpp index 8b953966..a7d80cc4 100644 --- a/src/dwarfs/block_manager.cpp +++ b/src/dwarfs/block_manager.cpp @@ -168,7 +168,7 @@ class bloom_filter { static constexpr size_t index_shift = bitcount(value_mask); static constexpr size_t alignment = 64; - bloom_filter(size_t size) + explicit bloom_filter(size_t size) : index_mask_{(std::max(size, value_mask + 1) >> index_shift) - 1} , size_{std::max(size, value_mask + 1)} { if (size & (size - 1)) { diff --git a/src/dwarfs/python_script.cpp b/src/dwarfs/python_script.cpp index 6b53f1b5..934e1d95 100644 --- a/src/dwarfs/python_script.cpp +++ b/src/dwarfs/python_script.cpp @@ -65,7 +65,7 @@ bool has_callable(py::object obj, char const* method) { class py_logger { public: - py_logger(logger& lgr) + explicit py_logger(logger& lgr) : log_(lgr) {} void error(std::string const& msg) { LOG_ERROR << "[script] " << msg; } @@ -82,7 +82,7 @@ class py_logger { template class basic_entry_wrapper { public: - basic_entry_wrapper(T& entry) + explicit basic_entry_wrapper(T& entry) : entry_(&entry) {} size_t size() const { return entry_->size(); } @@ -112,7 +112,7 @@ using mutable_entry_wrapper = basic_entry_wrapper; class inode_wrapper { public: - inode_wrapper(inode const* ino) + explicit inode_wrapper(inode const* ino) : ino_(ino) {} size_t similarity_hash() const { return ino_->similarity_hash(); } @@ -158,7 +158,7 @@ class python_script::impl { class timer { public: - timer(clock::duration& d) + explicit timer(clock::duration& d) : start_(clock::now()) , d_(d) {} diff --git a/src/dwarfs/string_table.cpp b/src/dwarfs/string_table.cpp index 103dd187..4382590f 100644 --- a/src/dwarfs/string_table.cpp +++ b/src/dwarfs/string_table.cpp @@ -34,7 +34,7 @@ namespace dwarfs { class legacy_string_table : public string_table::impl { public: - legacy_string_table(string_table::LegacyTableView v) + explicit legacy_string_table(string_table::LegacyTableView v) : v_{v} {} std::string lookup(size_t index) const override { diff --git a/test/dwarfs_tools.cpp b/test/dwarfs_tools.cpp index 3de9769b..379cd8f1 100644 --- a/test/dwarfs_tools.cpp +++ b/test/dwarfs_tools.cpp @@ -97,7 +97,7 @@ class process_guard { public: process_guard() = default; - process_guard(pid_t pid) + explicit process_guard(pid_t pid) : pid_{pid} { auto proc_dir = std::filesystem::path("/proc") / folly::to(pid); diff --git a/test/test_helpers.cpp b/test/test_helpers.cpp index 7cea372d..fbcdef65 100644 --- a/test/test_helpers.cpp +++ b/test/test_helpers.cpp @@ -128,7 +128,7 @@ void os_access_mock::mock_directory::add( class dir_reader_mock : public dir_reader { public: - dir_reader_mock(std::vector&& files) + explicit dir_reader_mock(std::vector&& files) : files_(files) , index_(0) {}