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/sensors.hpp b/redfish-core/lib/sensors.hpp
index 8b97b7c..6e72fea 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1332,7 +1332,7 @@
         if (entry != response.end())
         {
             std::sort(entry->begin(), entry->end(),
-                      [](nlohmann::json& c1, nlohmann::json& c2) {
+                      [](const nlohmann::json& c1, const nlohmann::json& c2) {
                 return c1["Name"] < c2["Name"];
             });
 
@@ -1613,9 +1613,9 @@
         // Response handler for GetManagedObjects
         auto respHandler =
             [sensorsAsyncResp, inventoryItems, invConnections, objectMgrPaths,
-             callback{std::forward<Callback>(callback)},
-             invConnectionsIndex](const boost::system::error_code ec,
-                                  dbus::utility::ManagedObjectType& resp) {
+             callback{std::forward<Callback>(callback)}, invConnectionsIndex](
+                const boost::system::error_code ec,
+                const dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler enter";
             if (ec)
             {
@@ -1781,10 +1781,10 @@
     BMCWEB_LOG_DEBUG << "getInventoryItemAssociations enter";
 
     // Response handler for GetManagedObjects
-    auto respHandler = [callback{std::forward<Callback>(callback)},
-                        sensorsAsyncResp,
-                        sensorNames](const boost::system::error_code ec,
-                                     dbus::utility::ManagedObjectType& resp) {
+    auto respHandler =
+        [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
+         sensorNames](const boost::system::error_code ec,
+                      const dbus::utility::ManagedObjectType& resp) {
         BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler enter";
         if (ec)
         {
@@ -2468,7 +2468,7 @@
         auto getManagedObjectsCb =
             [sensorsAsyncResp, sensorNames,
              inventoryItems](const boost::system::error_code ec,
-                             dbus::utility::ManagedObjectType& resp) {
+                             const dbus::utility::ManagedObjectType& resp) {
             BMCWEB_LOG_DEBUG << "getManagedObjectsCb enter";
             if (ec)
             {
@@ -2742,7 +2742,7 @@
  */
 inline bool
     findSensorNameUsingSensorPath(std::string_view sensorName,
-                                  std::set<std::string>& sensorsList,
+                                  const std::set<std::string>& sensorsList,
                                   std::set<std::string>& sensorsModified)
 {
     for (const auto& chassisSensor : sensorsList)