summaryrefslogtreecommitdiff
path: root/redfish-core/include
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 /redfish-core/include
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 'redfish-core/include')
-rw-r--r--redfish-core/include/event_service_manager.hpp18
-rw-r--r--redfish-core/include/gzfile.hpp4
2 files changed, 11 insertions, 11 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 55485c63e8..051e49506e 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -95,7 +95,7 @@ static const Message*
std::span<const MessageEntry>::iterator messageIt =
std::find_if(registry.begin(), registry.end(),
[&messageKey](const MessageEntry& messageEntry) {
- return !messageKey.compare(messageEntry.first);
+ return messageKey.compare(messageEntry.first) == 0;
});
if (messageIt != registry.end())
{
@@ -708,7 +708,7 @@ class EventServiceManager
std::string id;
int retry = 3;
- while (retry)
+ while (retry != 0)
{
id = std::to_string(dist(gen));
if (gen.error())
@@ -764,7 +764,7 @@ class EventServiceManager
if (serviceEnabled != cfg.enabled)
{
serviceEnabled = cfg.enabled;
- if (serviceEnabled && noOfMetricReportSubscribers)
+ if (serviceEnabled && noOfMetricReportSubscribers != 0U)
{
registerMetricReportSignal();
}
@@ -827,7 +827,7 @@ class EventServiceManager
if (noOfMetricReportSubscribers != metricReportSubCount)
{
noOfMetricReportSubscribers = metricReportSubCount;
- if (noOfMetricReportSubscribers)
+ if (noOfMetricReportSubscribers != 0U)
{
registerMetricReportSignal();
}
@@ -860,7 +860,7 @@ class EventServiceManager
std::string id;
int retry = 3;
- while (retry)
+ while (retry != 0)
{
id = std::to_string(dist(gen));
if (gen.error())
@@ -989,7 +989,7 @@ class EventServiceManager
void sendEvent(const nlohmann::json& eventMessageIn,
const std::string& origin, const std::string& resType)
{
- if (!serviceEnabled || !noOfEventLogSubscribers)
+ if (!serviceEnabled || (noOfEventLogSubscribers == 0u))
{
BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
return;
@@ -1122,7 +1122,7 @@ class EventServiceManager
continue;
}
- if (!serviceEnabled || !noOfEventLogSubscribers)
+ if (!serviceEnabled || noOfEventLogSubscribers == 0)
{
// If Service is not enabled, no need to compute
// the remaining items below.
@@ -1153,7 +1153,7 @@ class EventServiceManager
messageKey, messageArgs);
}
- if (!serviceEnabled || !noOfEventLogSubscribers)
+ if (!serviceEnabled || noOfEventLogSubscribers == 0)
{
BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
return;
@@ -1340,7 +1340,7 @@ class EventServiceManager
const telemetry::TimestampReadings* readings =
std::get_if<telemetry::TimestampReadings>(&found->second);
- if (!readings)
+ if (readings == nullptr)
{
BMCWEB_LOG_INFO << "Failed to get Readings from Report properties";
return;
diff --git a/redfish-core/include/gzfile.hpp b/redfish-core/include/gzfile.hpp
index 2001756a74..567741dfd8 100644
--- a/redfish-core/include/gzfile.hpp
+++ b/redfish-core/include/gzfile.hpp
@@ -13,7 +13,7 @@ class GzFileReader
std::vector<std::string>& logEntries, size_t& logCount)
{
gzFile logStream = gzopen(filename.c_str(), "r");
- if (!logStream)
+ if (logStream == nullptr)
{
BMCWEB_LOG_ERROR << "Can't open gz file: " << filename << '\n';
return false;
@@ -71,7 +71,7 @@ class GzFileReader
BMCWEB_LOG_ERROR << "Error occurs during parsing host log.\n";
return false;
}
- } while (!gzeof(logStream));
+ } while (gzeof(logStream) != 1);
return true;
}