Fix some warnings by cppcheck
Warnign message:
evdev.hpp:23:9: warning: Assignment of function parameter has no
effect outside the function. Did you forget dereferencing it?
[uselessAssignmentPtrArg]
event = sd_event_unref(event);
^
evdev.hpp:33:9: warning: Assignment of function parameter has no
effect outside the function. Did you forget dereferencing it?
[uselessAssignmentPtrArg]
eventSource = sd_event_source_unref(eventSource);
^
file.hpp:28:5: style: Class 'FileDescriptor' has a constructor with 1
argument that is not explicit. [noExplicitConstructor]
FileDescriptor(int fd) : fd(fd)
^
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I66cc8a3faebb39dabcaac71b6930c22acc351447
diff --git a/evdev.hpp b/evdev.hpp
index 9efe14e..2cb1dde 100644
--- a/evdev.hpp
+++ b/evdev.hpp
@@ -20,7 +20,7 @@
{
void operator()(sd_event* event) const
{
- event = sd_event_unref(event);
+ sd_event_unref(event);
}
};
using EventPtr = std::unique_ptr<sd_event, EventDeleter>;
@@ -30,7 +30,7 @@
{
void operator()(sd_event_source* eventSource) const
{
- eventSource = sd_event_source_unref(eventSource);
+ sd_event_source_unref(eventSource);
}
};
using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>;
diff --git a/file.hpp b/file.hpp
index 500d8be..bc970bf 100644
--- a/file.hpp
+++ b/file.hpp
@@ -25,7 +25,7 @@
*
* @param[in] fd - File descriptor
*/
- FileDescriptor(int fd) : fd(fd)
+ explicit FileDescriptor(int fd) : fd(fd)
{
// Nothing
}