Fix const correctness issues
cppcheck correctly notes that a lot of variables in the new code can be
const. Make most of them const.
Tested: WIP
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8f37b6353fd707923f533e1d61c5b5419282bf23
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index c3372f8..a84052d 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -183,15 +183,15 @@
return "";
}
-inline bool
- extractEthernetInterfaceData(const std::string& ethifaceId,
- dbus::utility::ManagedObjectType& dbusData,
- EthernetInterfaceData& ethData)
+inline bool extractEthernetInterfaceData(
+ const std::string& ethifaceId,
+ const dbus::utility::ManagedObjectType& dbusData,
+ EthernetInterfaceData& ethData)
{
bool idFound = false;
- for (auto& objpath : dbusData)
+ for (const auto& objpath : dbusData)
{
- for (auto& ifacePair : objpath.second)
+ for (const auto& ifacePair : objpath.second)
{
if (objpath.first == "/xyz/openbmc_project/network/" + ethifaceId)
{
@@ -904,7 +904,7 @@
[ethifaceId{std::string{ethifaceId}},
callback{std::forward<CallbackFunc>(callback)}](
const boost::system::error_code errorCode,
- dbus::utility::ManagedObjectType& resp) {
+ const dbus::utility::ManagedObjectType& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
boost::container::flat_set<IPv6AddressData> ipv6Data;