Fix std::forwards
Static analyzer flags that these are wrong. Should only std::forward on
the same thing that's passed
[1] https://sonarcloud.io/project/issues?severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&types=BUG&id=edtanous_bmcweb&open=AZHJOZJsIkxRoiGIkzaq
Change-Id: Ib2b77a0c56e5dbf9e0d038f0eb1361ccce7ac1d9
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index dc1b0a0..ddf432e 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -412,9 +412,10 @@
"/xyz/openbmc_project/inventory", 0, interfaces,
[callback = std::forward<Callback>(callback), asyncResp,
chassisIdStr{std::string(chassisId)},
- chassisSubNode{std::string(chassisSubNode)}, sensorTypes](
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreePathsResponse& chassisPaths) {
+ chassisSubNode{std::string(chassisSubNode)},
+ sensorTypes](const boost::system::error_code& ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ chassisPaths) mutable {
BMCWEB_LOG_DEBUG("getChassis respHandler enter");
if (ec)
{
@@ -452,11 +453,11 @@
// Get the list of all sensors for this Chassis element
std::string sensorPath = *chassisPath + "/all_sensors";
dbus::utility::getAssociationEndPoints(
- sensorPath,
- [asyncResp, chassisSubNode, sensorTypes,
- callback = std::forward<const Callback>(callback)](
- const boost::system::error_code& ec2,
- const dbus::utility::MapperEndPoints& nodeSensorList) {
+ sensorPath, [asyncResp, chassisSubNode, sensorTypes,
+ callback = std::forward<Callback>(callback)](
+ const boost::system::error_code& ec2,
+ const dbus::utility::MapperEndPoints&
+ nodeSensorList) mutable {
if (ec2)
{
if (ec2.value() != EBADR)
@@ -994,7 +995,7 @@
[sensorsAsyncResp, inventoryItems, invConnections,
callback = std::forward<Callback>(callback), invConnectionsIndex](
const boost::system::error_code& ec,
- const dbus::utility::ManagedObjectType& resp) {
+ const dbus::utility::ManagedObjectType& resp) mutable {
BMCWEB_LOG_DEBUG("getInventoryItemsData respHandler enter");
if (ec)
{
@@ -1073,7 +1074,7 @@
[callback = std::forward<Callback>(callback), sensorsAsyncResp,
inventoryItems](
const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) mutable {
// Response handler for parsing output from GetSubTree
BMCWEB_LOG_DEBUG("getInventoryItemsConnections respHandler enter");
if (ec)
@@ -1149,7 +1150,7 @@
"xyz.openbmc_project.ObjectMapper", path,
[callback = std::forward<Callback>(callback), sensorsAsyncResp,
sensorNames](const boost::system::error_code& ec,
- const dbus::utility::ManagedObjectType& resp) {
+ const dbus::utility::ManagedObjectType& resp) mutable {
BMCWEB_LOG_DEBUG("getInventoryItemAssociations respHandler enter");
if (ec)
{
@@ -1323,8 +1324,9 @@
// Response handler for Get State property
auto respHandler =
[sensorsAsyncResp, inventoryItems, ledConnections, ledPath,
- callback = std::forward<Callback>(callback), ledConnectionsIndex](
- const boost::system::error_code& ec, const std::string& state) {
+ callback = std::forward<Callback>(callback),
+ ledConnectionsIndex](const boost::system::error_code& ec,
+ const std::string& state) mutable {
BMCWEB_LOG_DEBUG("getInventoryLedData respHandler enter");
if (ec)
{
@@ -1418,7 +1420,7 @@
[callback = std::forward<Callback>(callback), sensorsAsyncResp,
inventoryItems](
const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) mutable {
// Response handler for parsing output from GetSubTree
BMCWEB_LOG_DEBUG("getInventoryLeds respHandler enter");
if (ec)
@@ -1511,7 +1513,7 @@
auto respHandler = [sensorsAsyncResp, inventoryItems,
callback = std::forward<Callback>(callback)](
const boost::system::error_code& ec,
- const uint32_t value) {
+ uint32_t value) mutable {
BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData respHandler enter");
if (ec)
{
@@ -1594,7 +1596,7 @@
[callback = std::forward<Callback>(callback), sensorsAsyncResp,
inventoryItems](
const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) mutable {
// Response handler for parsing output from GetSubTree
BMCWEB_LOG_DEBUG("getPowerSupplyAttributes respHandler enter");
if (ec)
@@ -1676,21 +1678,25 @@
BMCWEB_LOG_DEBUG("getInventoryItems enter");
auto getInventoryItemAssociationsCb =
[sensorsAsyncResp, callback = std::forward<Callback>(callback)](
- std::shared_ptr<std::vector<InventoryItem>> inventoryItems) {
+ std::shared_ptr<std::vector<InventoryItem>>
+ inventoryItems) mutable {
BMCWEB_LOG_DEBUG("getInventoryItemAssociationsCb enter");
auto getInventoryItemsConnectionsCb =
[sensorsAsyncResp, inventoryItems,
- callback = std::forward<const Callback>(callback)](
- std::shared_ptr<std::set<std::string>> invConnections) {
+ callback = std::forward<Callback>(callback)](
+ std::shared_ptr<std::set<std::string>>
+ invConnections) mutable {
BMCWEB_LOG_DEBUG("getInventoryItemsConnectionsCb enter");
auto getInventoryItemsDataCb =
[sensorsAsyncResp, inventoryItems,
- callback{std::move(callback)}]() {
+ callback =
+ std::forward<Callback>(callback)]() mutable {
BMCWEB_LOG_DEBUG("getInventoryItemsDataCb enter");
auto getInventoryLedsCb =
[sensorsAsyncResp, inventoryItems,
- callback{std::move(callback)}]() {
+ callback = std::forward<Callback>(
+ callback)]() mutable {
BMCWEB_LOG_DEBUG(
"getInventoryLedsCb enter");
// Find Power Supply Attributes and get the
@@ -2062,7 +2068,7 @@
auto getInventoryItemsCb =
[sensorsAsyncResp, sensorNames, connections](
const std::shared_ptr<std::vector<InventoryItem>>&
- inventoryItems) {
+ inventoryItems) mutable {
BMCWEB_LOG_DEBUG("getInventoryItemsCb enter");
// Get sensor data and store results in JSON
getSensorData(sensorsAsyncResp, sensorNames, connections,