Resolve a few clang-tidy suggestions and warnings (thanks to @ardazishvili)

Fixes part of #52.
This commit is contained in:
sangelovic
2019-06-10 21:54:02 +02:00
parent dcad208ffe
commit 236c10ff56
2 changed files with 6 additions and 6 deletions

View File

@ -127,7 +127,7 @@ namespace sdbus {
Message& enterStruct(const std::string& signature); Message& enterStruct(const std::string& signature);
Message& exitStruct(); Message& exitStruct();
operator bool() const; explicit operator bool() const;
void clearFlags(); void clearFlags();
std::string getInterfaceName() const; std::string getInterfaceName() const;
@ -144,7 +144,7 @@ namespace sdbus {
protected: protected:
Message() = default; Message() = default;
Message(internal::ISdBus* sdbus) noexcept; explicit Message(internal::ISdBus* sdbus) noexcept;
Message(void *msg, internal::ISdBus* sdbus) noexcept; Message(void *msg, internal::ISdBus* sdbus) noexcept;
Message(void *msg, internal::ISdBus* sdbus, adopt_message_t) noexcept; Message(void *msg, internal::ISdBus* sdbus, adopt_message_t) noexcept;
@ -188,7 +188,7 @@ namespace sdbus {
using Slot = std::unique_ptr<void, std::function<void(void*)>>; using Slot = std::unique_ptr<void, std::function<void(void*)>>;
AsyncMethodCall() = default; AsyncMethodCall() = default;
AsyncMethodCall(MethodCall&& call) noexcept; explicit AsyncMethodCall(MethodCall&& call) noexcept;
Slot send(void* callback, void* userData) const; Slot send(void* callback, void* userData) const;
}; };

View File

@ -602,7 +602,7 @@ bool Message::isValid() const
bool Message::isEmpty() const bool Message::isEmpty() const
{ {
return sd_bus_message_is_empty((sd_bus_message*)msg_); return sd_bus_message_is_empty((sd_bus_message*)msg_) != 0;
} }
void MethodCall::dontExpectReply() void MethodCall::dontExpectReply()
@ -615,7 +615,7 @@ bool MethodCall::doesntExpectReply() const
{ {
auto r = sd_bus_message_get_expect_reply((sd_bus_message*)msg_); auto r = sd_bus_message_get_expect_reply((sd_bus_message*)msg_);
SDBUS_THROW_ERROR_IF(r < 0, "Failed to get the dont-expect-reply flag", -r); SDBUS_THROW_ERROR_IF(r < 0, "Failed to get the dont-expect-reply flag", -r);
return r > 0 ? false : true; return r == 0;
} }
MethodReply MethodCall::send() const MethodReply MethodCall::send() const
@ -721,7 +721,7 @@ PlainMessage createPlainMessage()
thread_local struct BusReferenceKeeper thread_local struct BusReferenceKeeper
{ {
BusReferenceKeeper(sd_bus* bus) : bus_(sd_bus_ref(bus)) { sd_bus_flush(bus_); } explicit BusReferenceKeeper(sd_bus* bus) : bus_(sd_bus_ref(bus)) { sd_bus_flush(bus_); }
~BusReferenceKeeper() { sd_bus_flush_close_unref(bus_); } ~BusReferenceKeeper() { sd_bus_flush_close_unref(bus_); }
sd_bus* bus_{}; sd_bus* bus_{};
} busReferenceKeeper{bus}; } busReferenceKeeper{bus};