clang-15: fixes for const-auto iterators
clang-tidy-15 is giving a number of warnings which it autofixed of
the form:
```
../src/perform_scan.cpp:407:10: error: 'auto &' can be declared as 'const auto &' [readability-qualified-auto,-warnings-as-errors]
for (auto& [configId, config] : systemConfiguration.items())
^
const
```
Apply autofixes.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I61870f7ab7b68aae61472056f0f707c6e229d7b3
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index 366414f..7d85d53 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -275,7 +275,7 @@
sdbusplus::asio::PropertyPermission permission =
sdbusplus::asio::PropertyPermission::readOnly)
{
- for (auto& [key, value] : dict.items())
+ for (const auto& [key, value] : dict.items())
{
auto type = value.type();
bool array = false;
@@ -566,7 +566,7 @@
{
// iterate through boards
- for (auto& [boardId, boardConfig] : newConfiguration.items())
+ for (const auto& [boardId, boardConfig] : newConfiguration.items())
{
std::string boardKey = boardConfig["Name"];
std::string boardKeyOrig = boardConfig["Name"];
@@ -614,7 +614,7 @@
boardIface, boardValues, objServer);
jsonPointerPath += "/";
// iterate through board properties
- for (auto& [propName, propValue] : boardValues.items())
+ for (const auto& [propName, propValue] : boardValues.items())
{
if (propValue.type() == nlohmann::json::value_t::object)
{
@@ -688,7 +688,7 @@
itemIface, item, objServer,
getPermission(itemType));
- for (auto& [name, config] : item.items())
+ for (const auto& [name, config] : item.items())
{
jsonPointerPath = jsonPointerPathBoard;
jsonPointerPath.append(std::to_string(exposesIndex))
diff --git a/src/perform_scan.cpp b/src/perform_scan.cpp
index f87965a..44f284c 100644
--- a/src/perform_scan.cpp
+++ b/src/perform_scan.cpp
@@ -404,7 +404,7 @@
return;
}
- for (auto& [configId, config] : systemConfiguration.items())
+ for (const auto& [configId, config] : systemConfiguration.items())
{
// don't disable ourselves
if (isDisable && configId == recordName)