summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2023-03-04 07:07:25 +0300
committerEd Tanous <edtanous@google.com>2023-03-06 20:47:27 +0300
commit70cbdf538e658a2d9591303b02da9d6b78002cd9 (patch)
tree42ab56581de24b95d9a6886ad9e902f43b8a339a /redfish-core
parent8108fd30d379ad92145bcd887a8fd8f46ddde38a (diff)
downloadbmcweb-70cbdf538e658a2d9591303b02da9d6b78002cd9.tar.xz
Fix local CI failure issue
Error message: redfish-core/lib/virtual_media.hpp:308:72: style: Parameter 'item' can be declared as reference to const. However it seems that 'afterGetVmData' is a callback function, if 'item' is declared with const you might also need to cast function pointer(s). [constParameterCallback] dbus::utility::DBusInteracesMap>& item) ^ redfish-core/lib/virtual_media.hpp:346:41: note: You might need to cast the function pointer here std::bind_front(&afterGetVmData, name)); ^ redfish-core/lib/virtual_media.hpp:308:72: note: Parameter 'item' can be declared as reference to const dbus::utility::DBusInteracesMap>& item) ^ This regressed in commit: 79fdf63e2c4148593bb7aec4a3f471ade4c5cba0 Tested: Local CI passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ia68e63ccaa069aedda01a11ce02aa2ef41021a07
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/virtual_media.hpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 442fad8fca..c153f2f1dc 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -85,8 +85,8 @@ inline VmMode
using CheckItemHandler =
std::function<void(const std::string& service, const std::string& resName,
const std::shared_ptr<bmcweb::AsyncResp>&,
- std::pair<sdbusplus::message::object_path,
- dbus::utility::DBusInteracesMap>&)>;
+ const std::pair<sdbusplus::message::object_path,
+ dbus::utility::DBusInteracesMap>&)>;
inline void findAndParseObject(const std::string& service,
const std::string& resName,
@@ -96,7 +96,7 @@ inline void findAndParseObject(const std::string& service,
crow::connections::systemBus->async_method_call(
[service, resName, aResp,
handler](const boost::system::error_code ec,
- dbus::utility::ManagedObjectType& subtree) {
+ const dbus::utility::ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -104,7 +104,7 @@ inline void findAndParseObject(const std::string& service,
return;
}
- for (auto& item : subtree)
+ for (const auto& item : subtree)
{
VmMode mode = parseObjectPathAndGetMode(item.first, resName);
if (mode != VmMode::Invalid)
@@ -300,12 +300,12 @@ inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> aResp,
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
}
-inline void afterGetVmData(const std::string& name,
- const std::string& /*service*/,
- const std::string& resName,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- std::pair<sdbusplus::message::object_path,
- dbus::utility::DBusInteracesMap>& item)
+inline void
+ afterGetVmData(const std::string& name, const std::string& /*service*/,
+ const std::string& resName,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::pair<sdbusplus::message::object_path,
+ dbus::utility::DBusInteracesMap>& item)
{
VmMode mode = parseObjectPathAndGetMode(item.first, resName);
if (mode == VmMode::Invalid)
@@ -343,7 +343,7 @@ inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
findAndParseObject(service, resName, aResp,
- std::bind_front(&afterGetVmData, name));
+ std::bind_front(afterGetVmData, name));
}
/**