Fix some warnings by cppcheck
Warning message:
sysfs.hpp:27:5: style: Class 'SysfsLed' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
SysfsLed(std::filesystem::path&& root) : root(std::move(root))
^
test/sysfs.cpp:53:5: style: Class 'FakeSysfsLed' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
FakeSysfsLed(fs::path&& path) : SysfsLed(std::move(path))
Tested: Use cppcheck to build successfully and eliminate the above
warning message.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ib6cef5cb4eb6f44f3b8dcc0e9d2b95bd15c9818a
diff --git a/sysfs.hpp b/sysfs.hpp
index fbf5e78..752bc57 100644
--- a/sysfs.hpp
+++ b/sysfs.hpp
@@ -24,7 +24,7 @@
class SysfsLed
{
public:
- SysfsLed(std::filesystem::path&& root) : root(std::move(root))
+ explicit SysfsLed(std::filesystem::path&& root) : root(std::move(root))
{}
SysfsLed() = delete;
SysfsLed(const SysfsLed& other) = delete;
diff --git a/test/sysfs.cpp b/test/sysfs.cpp
index 7a65b94..7a23ed5 100644
--- a/test/sysfs.cpp
+++ b/test/sysfs.cpp
@@ -50,7 +50,7 @@
}
private:
- FakeSysfsLed(fs::path&& path) : SysfsLed(std::move(path))
+ explicit FakeSysfsLed(fs::path&& path) : SysfsLed(std::move(path))
{
std::string attrs[4] = {BRIGHTNESS, TRIGGER, DELAY_ON, DELAY_OFF};
for (const auto& attr : attrs)