summaryrefslogtreecommitdiff
path: root/include/openbmc_dbus_rest.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-25 21:39:19 +0300
committerEd Tanous <ed@tanous.net>2022-02-15 03:35:55 +0300
commite662eae819f545ef07193f216b42e161b7ff7a46 (patch)
tree2b13d88ae009fa7af3396252c8787992ff2cc6c8 /include/openbmc_dbus_rest.hpp
parentc5ba4c27ddb28c7844c0ea3078df4114f531dd25 (diff)
downloadbmcweb-e662eae819f545ef07193f216b42e161b7ff7a46.tar.xz
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
Diffstat (limited to 'include/openbmc_dbus_rest.hpp')
-rw-r--r--include/openbmc_dbus_rest.hpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 6861571073..b457935e84 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -656,16 +656,16 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
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 @@ inline int readArrayFromMessage(const std::string& typeCode,
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 @@ inline void findActionOnInterface(
transaction->methodFailed = true;
const sd_bus_error* e = m2.get_error();
- if (e)
+ if (e != nullptr)
{
setErrorResponse(
transaction->res,
@@ -2002,10 +2002,12 @@ inline void handlePut(const crow::Request& req,
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