fix constVariableReference cpp style check

Declaring the const-ness of a parameter is just another form of
type safety. The benefit of const correctness is that it prevents
you from inadvertently modifying something you didn’t expect
would be modified. The commit fixes places in the code where a
parameter could be a constant.

Change-Id: Ie6f1d4b37373979a3efef8cb617294d41dec888c
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/host-bmc/dbus_to_event_handler.cpp b/host-bmc/dbus_to_event_handler.cpp
index 4b11654..891a769 100644
--- a/host-bmc/dbus_to_event_handler.cpp
+++ b/host-bmc/dbus_to_event_handler.cpp
@@ -129,7 +129,7 @@
                         props.at(dbusMapping.propertyName));
 
                     auto values = pldm::utils::split(src, "||", " ");
-                    for (auto& value : values)
+                    for (const auto& value : values)
                     {
                         if (value == dst)
                         {
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index a9ef613..d9702ff 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -100,7 +100,7 @@
 
                 pldm_entity entity = *entityPtr;
 
-                for (auto& it : objToEntityNode)
+                for (const auto& it : objToEntityNode)
                 {
                     pldm_entity node = pldm_entity_extract(it.second);
                     if (node.entity_type == entity.entity_type)
diff --git a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
index 9bcf096..16c88f1 100644
--- a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
@@ -39,7 +39,7 @@
             "./bios_jsons/enum_attrs.json",
         };
 
-        for (auto& path : paths)
+        for (const auto& path : paths)
         {
             std::ifstream file;
             file.open(path);
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index 9e158dc..63cd51b 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -249,7 +249,7 @@
             std::string vspstring;
             std::string password;
 
-            for (auto& interface : interfaces)
+            for (const auto& interface : interfaces)
             {
                 if (interface.first == resDumpEntry)
                 {
@@ -288,7 +288,7 @@
             msg.read(path, interfaces);
             std::string csr;
 
-            for (auto& interface : interfaces)
+            for (const auto& interface : interfaces)
             {
                 if (interface.first == certAuthority)
                 {
diff --git a/pldmtool/pldm_platform_cmd.cpp b/pldmtool/pldm_platform_cmd.cpp
index 6a75cf8..e4d2a7c 100644
--- a/pldmtool/pldm_platform_cmd.cpp
+++ b/pldmtool/pldm_platform_cmd.cpp
@@ -675,7 +675,7 @@
         std::vector<std::string> data{};
         std::map<uint8_t, std::string> stateNameMaps;
 
-        for (auto& s : value)
+        for (const auto& s : value)
         {
             std::map<uint8_t, std::string> stateNameMaps;
             auto pstr = std::to_string(s);