summaryrefslogtreecommitdiff
path: root/redfish-core/lib/sensors.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-25 21:19:23 +0300
committerEd Tanous <ed@tanous.net>2022-02-09 23:45:00 +0300
commit9eb808c1a84a76e92b0e01fa95d3f160f38d7c3f (patch)
treef3631a3f2a97fb0f048fb1dd5d295b867e8d37fc /redfish-core/lib/sensors.hpp
parentb3db89663256a462e9c90bf260d5058014765137 (diff)
downloadbmcweb-9eb808c1a84a76e92b0e01fa95d3f160f38d7c3f.tar.xz
Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the variables are const. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r--redfish-core/lib/sensors.hpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 121223efc6..f3fa52c6fe 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -761,11 +761,11 @@ inline std::string
// Check if sensor has critical threshold alarm
- for (auto& [interface, values] : interfacesDict)
+ for (const auto& [interface, values] : interfacesDict)
{
if (interface == "xyz.openbmc_project.Sensor.Threshold.Critical")
{
- for (auto& [valueName, value] : values)
+ for (const auto& [valueName, value] : values)
{
if (valueName == "CriticalAlarmHigh" ||
valueName == "CriticalAlarmLow")
@@ -798,11 +798,11 @@ inline std::string
}
// Check if sensor has warning threshold alarm
- for (auto& [interface, values] : interfacesDict)
+ for (const auto& [interface, values] : interfacesDict)
{
if (interface == "xyz.openbmc_project.Sensor.Threshold.Warning")
{
- for (auto& [valueName, value] : values)
+ for (const auto& [valueName, value] : values)
{
if (valueName == "WarningAlarmHigh" ||
valueName == "WarningAlarmLow")
@@ -866,11 +866,11 @@ inline void objectInterfacesToJson(
{
// Assume values exist as is (10^0 == 1) if no scale exists
int64_t scaleMultiplier = 0;
- for (auto& [interface, values] : interfacesDict)
+ for (const auto& [interface, values] : interfacesDict)
{
if (interface == "xyz.openbmc_project.Sensor.Value")
{
- for (auto& [valueName, value] : values)
+ for (const auto& [valueName, value] : values)
{
if (valueName == "Scale")
{
@@ -1194,13 +1194,15 @@ inline void populateFanRedundancy(
return;
}
- auto allowedFailures = std::get_if<uint8_t>(
- &(findFailures->second));
- auto collection =
+ const uint8_t* allowedFailures =
+ std::get_if<uint8_t>(
+ &(findFailures->second));
+ const std::vector<std::string>* collection =
std::get_if<std::vector<std::string>>(
&(findCollection->second));
- auto status = std::get_if<std::string>(
- &(findStatus->second));
+ const std::string* status =
+ std::get_if<std::string>(
+ &(findStatus->second));
if (allowedFailures == nullptr ||
collection == nullptr || status == nullptr)
@@ -1467,11 +1469,11 @@ inline void storeInventoryItemData(
{
// Get properties from Inventory.Item interface
- for (auto& [interface, values] : interfacesDict)
+ for (const auto& [interface, values] : interfacesDict)
{
if (interface == "xyz.openbmc_project.Inventory.Item")
{
- for (auto& [name, dbusValue] : values)
+ for (const auto& [name, dbusValue] : values)
{
if (name == "Present")
{
@@ -1493,7 +1495,7 @@ inline void storeInventoryItemData(
// Get properties from Inventory.Decorator.Asset interface
if (interface == "xyz.openbmc_project.Inventory.Decorator.Asset")
{
- for (auto& [name, dbusValue] : values)
+ for (const auto& [name, dbusValue] : values)
{
if (name == "Manufacturer")
{
@@ -1537,7 +1539,7 @@ inline void storeInventoryItemData(
if (interface ==
"xyz.openbmc_project.State.Decorator.OperationalStatus")
{
- for (auto& [name, dbusValue] : values)
+ for (const auto& [name, dbusValue] : values)
{
if (name == "Functional")
{