Enable readability-implicit-bool-conversion checks
These checks ensure that we're not implicitly converting ints or
pointers into bools, which makes the code easier to read.
Tested:
Ran series through redfish service validator. No changes observed.
UUID failing in Qemu both before and after.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1ca0be980d136bd4e5474341f4fd62f2f6bbdbae
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 6861571..b457935 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -656,16 +656,16 @@
else if (argCode == "b")
{
// lots of ways bool could be represented here. Try them all
- int boolInt = false;
+ int boolInt = 0;
if (intValue != nullptr)
{
if (*intValue == 1)
{
- boolInt = true;
+ boolInt = 1;
}
else if (*intValue == 0)
{
- boolInt = false;
+ boolInt = 0;
}
else
{
@@ -1025,7 +1025,7 @@
while (true)
{
- r = sd_bus_message_at_end(m.get(), false);
+ r = sd_bus_message_at_end(m.get(), 0);
if (r < 0)
{
BMCWEB_LOG_ERROR << "sd_bus_message_at_end failed";
@@ -1483,7 +1483,7 @@
transaction->methodFailed = true;
const sd_bus_error* e = m2.get_error();
- if (e)
+ if (e != nullptr)
{
setErrorResponse(
transaction->res,
@@ -2002,10 +2002,12 @@
boost::beast::http::
status::
forbidden,
- (e) ? e->name
+ (e) != nullptr
+ ? e->name
: ec.category()
.name(),
- (e) ? e->message
+ (e) != nullptr
+ ? e->message
: ec.message());
}
else