diff options
-rw-r--r-- | http/http_client.hpp | 32 | ||||
-rw-r--r-- | http/http_connection.hpp | 6 | ||||
-rw-r--r-- | http/http_server.hpp | 12 | ||||
-rw-r--r-- | http/websocket.hpp | 16 | ||||
-rw-r--r-- | include/ibm/locks.hpp | 14 | ||||
-rw-r--r-- | include/multipart_parser.hpp | 6 | ||||
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 6 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | redfish-core/include/query.hpp | 4 | ||||
-rw-r--r-- | redfish-core/include/utils/query_param.hpp | 4 | ||||
-rw-r--r-- | redfish-core/lib/chassis.hpp | 10 | ||||
-rw-r--r-- | redfish-core/lib/managers.hpp | 14 | ||||
-rw-r--r-- | redfish-core/lib/metric_report.hpp | 6 | ||||
-rw-r--r-- | redfish-core/lib/metric_report_definition.hpp | 9 | ||||
-rw-r--r-- | redfish-core/lib/network_protocol.hpp | 8 | ||||
-rw-r--r-- | redfish-core/lib/processor.hpp | 27 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 26 | ||||
-rw-r--r-- | redfish-core/lib/storage.hpp | 8 | ||||
-rw-r--r-- | redfish-core/lib/systems.hpp | 68 | ||||
-rw-r--r-- | redfish-core/lib/update_service.hpp | 8 | ||||
-rw-r--r-- | redfish-core/lib/virtual_media.hpp | 18 |
21 files changed, 151 insertions, 152 deletions
diff --git a/http/http_client.hpp b/http/http_client.hpp index 571b5a9465..ae077ef07b 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -93,11 +93,11 @@ struct PendingRequest std::function<void(bool, uint32_t, Response&)> callback; RetryPolicyData retryPolicy; PendingRequest( - boost::beast::http::request<boost::beast::http::string_body>&& req, - const std::function<void(bool, uint32_t, Response&)>& callback, - const RetryPolicyData& retryPolicy) : - req(std::move(req)), - callback(callback), retryPolicy(retryPolicy) + boost::beast::http::request<boost::beast::http::string_body>&& reqIn, + const std::function<void(bool, uint32_t, Response&)>& callbackIn, + const RetryPolicyData& retryPolicyIn) : + req(std::move(reqIn)), + callback(callbackIn), retryPolicy(retryPolicyIn) {} }; @@ -394,11 +394,12 @@ class ConnectionInfo : public std::enable_shared_from_this<ConnectionInfo> } public: - explicit ConnectionInfo(boost::asio::io_context& ioc, const std::string& id, - const std::string& destIP, const uint16_t destPort, - const unsigned int connId) : - subId(id), - host(destIP), port(destPort), connId(connId), conn(ioc), timer(ioc) + explicit ConnectionInfo(boost::asio::io_context& ioc, + const std::string& idIn, const std::string& destIP, + const uint16_t destPort, + const unsigned int connIdIn) : + subId(idIn), + host(destIP), port(destPort), connId(connIdIn), conn(ioc), timer(ioc) {} }; @@ -598,11 +599,12 @@ class ConnectionPool : public std::enable_shared_from_this<ConnectionPool> } public: - explicit ConnectionPool(boost::asio::io_context& ioc, const std::string& id, - const std::string& destIP, - const uint16_t destPort) : - ioc(ioc), - id(id), destIP(destIP), destPort(destPort) + explicit ConnectionPool(boost::asio::io_context& iocIn, + const std::string& idIn, + const std::string& destIPIn, + const uint16_t destPortIn) : + ioc(iocIn), + id(idIn), destIP(destIPIn), destPort(destPortIn) { std::string clientKey = destIP + ":" + std::to_string(destPort); BMCWEB_LOG_DEBUG << "Initializing connection pool for " << destIP << ":" diff --git a/http/http_connection.hpp b/http/http_connection.hpp index 55ea84707c..d20fd250c4 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -151,10 +151,10 @@ class Connection : } // Check if certificate is OK - int error = X509_STORE_CTX_get_error(cts); - if (error != X509_V_OK) + int ctxError = X509_STORE_CTX_get_error(cts); + if (ctxError != X509_V_OK) { - BMCWEB_LOG_INFO << this << " Last TLS error is: " << error; + BMCWEB_LOG_INFO << this << " Last TLS error is: " << ctxError; return true; } // Check that we have reached final certificate in chain diff --git a/http/http_server.hpp b/http/http_server.hpp index a0ccc09c5a..050a3f000e 100644 --- a/http/http_server.hpp +++ b/http/http_server.hpp @@ -30,34 +30,34 @@ class Server public: Server(Handler* handlerIn, std::unique_ptr<boost::asio::ip::tcp::acceptor>&& acceptorIn, - std::shared_ptr<boost::asio::ssl::context> adaptorCtx, + std::shared_ptr<boost::asio::ssl::context> adaptorCtxIn, std::shared_ptr<boost::asio::io_context> io = std::make_shared<boost::asio::io_context>()) : ioService(std::move(io)), acceptor(std::move(acceptorIn)), signals(*ioService, SIGINT, SIGTERM, SIGHUP), handler(handlerIn), - adaptorCtx(std::move(adaptorCtx)) + adaptorCtx(std::move(adaptorCtxIn)) {} Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port, - const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx, + const std::shared_ptr<boost::asio::ssl::context>& adaptorCtxIn, const std::shared_ptr<boost::asio::io_context>& io = std::make_shared<boost::asio::io_context>()) : Server(handlerIn, std::make_unique<boost::asio::ip::tcp::acceptor>( *io, boost::asio::ip::tcp::endpoint( boost::asio::ip::make_address(bindaddr), port)), - adaptorCtx, io) + adaptorCtxIn, io) {} Server(Handler* handlerIn, int existingSocket, - const std::shared_ptr<boost::asio::ssl::context>& adaptorCtx, + const std::shared_ptr<boost::asio::ssl::context>& adaptorCtxIn, const std::shared_ptr<boost::asio::io_context>& io = std::make_shared<boost::asio::io_context>()) : Server(handlerIn, std::make_unique<boost::asio::ip::tcp::acceptor>( *io, boost::asio::ip::tcp::v6(), existingSocket), - adaptorCtx, io) + adaptorCtxIn, io) {} void updateDateStr() diff --git a/http/websocket.hpp b/http/websocket.hpp index 9a735fdabf..3aa8554e1c 100644 --- a/http/websocket.hpp +++ b/http/websocket.hpp @@ -70,18 +70,18 @@ class ConnectionImpl : public Connection public: ConnectionImpl( const crow::Request& reqIn, Adaptor adaptorIn, - std::function<void(Connection&)> openHandler, + std::function<void(Connection&)> openHandlerIn, std::function<void(Connection&, const std::string&, bool)> - messageHandler, - std::function<void(Connection&, const std::string&)> closeHandler, - std::function<void(Connection&)> errorHandler) : + messageHandlerIn, + std::function<void(Connection&, const std::string&)> closeHandlerIn, + std::function<void(Connection&)> errorHandlerIn) : Connection(reqIn, reqIn.session == nullptr ? std::string{} : reqIn.session->username), ws(std::move(adaptorIn)), inBuffer(inString, 131088), - openHandler(std::move(openHandler)), - messageHandler(std::move(messageHandler)), - closeHandler(std::move(closeHandler)), - errorHandler(std::move(errorHandler)), session(reqIn.session) + openHandler(std::move(openHandlerIn)), + messageHandler(std::move(messageHandlerIn)), + closeHandler(std::move(closeHandlerIn)), + errorHandler(std::move(errorHandlerIn)), session(reqIn.session) { /* Turn on the timeouts on websocket stream to server role */ ws.set_option(boost::beast::websocket::stream_base::timeout::suggested( diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp index 7dccbd8e20..2c6668c9a6 100644 --- a/include/ibm/locks.hpp +++ b/include/ibm/locks.hpp @@ -439,19 +439,19 @@ inline bool Lock::isValidLockRequest(const LockRequest& refLockRecord) inline Rc Lock::isConflictWithTable(const LockRequests& refLockRequestStructure) { - uint32_t transactionId = 0; + uint32_t thisTransactionId = 0; if (lockTable.empty()) { - transactionId = generateTransactionId(); - BMCWEB_LOG_DEBUG << transactionId; + thisTransactionId = generateTransactionId(); + BMCWEB_LOG_DEBUG << thisTransactionId; // Lock table is empty, so we are safe to add the lockrecords // as there will be no conflict BMCWEB_LOG_DEBUG << "Lock table is empty, so adding the lockrecords"; lockTable.emplace(std::pair<uint32_t, LockRequests>( - transactionId, refLockRequestStructure)); + thisTransactionId, refLockRequestStructure)); - return std::make_pair(false, transactionId); + return std::make_pair(false, thisTransactionId); } BMCWEB_LOG_DEBUG << "Lock table is not empty, check for conflict with lock table"; @@ -597,7 +597,7 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, // compare segment data - for (uint32_t i = 0; i < p.second; i++) + for (uint32_t j = 0; j < p.second; j++) { // if the segment data is different, then the locks is on a // different resource so no conflict between the lock @@ -610,7 +610,7 @@ inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, if (!(checkByte( boost::endian::endian_reverse(std::get<3>(refLockRecord1)), boost::endian::endian_reverse(std::get<3>(refLockRecord2)), - i))) + j))) { return false; } diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp index 945ebf900e..9d801da979 100644 --- a/include/multipart_parser.hpp +++ b/include/multipart_parser.hpp @@ -198,7 +198,7 @@ class MultipartParser // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) c = buffer[i]; } - processPartData(prevIndex, index, buffer, i, c, state); + processPartData(prevIndex, buffer, i, c); break; case State::END: break; @@ -244,8 +244,8 @@ class MultipartParser } } - void processPartData(size_t& prevIndex, size_t& index, const char* buffer, - size_t& i, char c, State& state) + void processPartData(size_t& prevIndex, const char* buffer, size_t& i, + char c) { prevIndex = index; diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 1ed695ac19..76410237bc 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -2168,9 +2168,9 @@ inline void const char* ifaceName = interface->Attribute("name"); if (ifaceName != nullptr) { - nlohmann::json::object_t interface; - interface["name"] = ifaceName; - interfacesArray.push_back(std::move(interface)); + nlohmann::json::object_t interfaceObj; + interfaceObj["name"] = ifaceName; + interfacesArray.push_back(std::move(interfaceObj)); } interface = interface->NextSiblingElement("interface"); diff --git a/meson.build b/meson.build index aa0fb3b2c9..2ba0fc2bca 100644 --- a/meson.build +++ b/meson.build @@ -165,6 +165,7 @@ if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0')) '-Wunused-parameter', '-Wnull-dereference', '-Wdouble-promotion', + '-Wshadow', '-Wno-psabi', ]), language:'cpp') diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp index 4c7e2f4651..df61aefc98 100644 --- a/redfish-core/include/query.hpp +++ b/redfish-core/include/query.hpp @@ -50,8 +50,8 @@ namespace redfish asyncResp->res.releaseCompleteRequestHandler(); asyncResp->res.setCompleteRequestHandler( [&app, handler(std::move(handler)), - query{*queryOpt}](crow::Response& res) mutable { - processAllParams(app, query, handler, res); + query{*queryOpt}](crow::Response& resIn) mutable { + processAllParams(app, query, handler, resIn); }); return true; } diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp index 7282413fc5..e221a865ac 100644 --- a/redfish-core/include/utils/query_param.hpp +++ b/redfish-core/include/utils/query_param.hpp @@ -470,9 +470,9 @@ class MultiAsyncResp : public std::enable_shared_from_this<MultiAsyncResp> // allows callers to attach sub-responses within the json tree that need // to be executed and filled into their appropriate locations. This // class manages the final "merge" of the json resources. - MultiAsyncResp(crow::App& app, + MultiAsyncResp(crow::App& appIn, std::shared_ptr<bmcweb::AsyncResp> finalResIn) : - app(app), + app(appIn), finalRes(std::move(finalResIn)) {} diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 724d5f344c..cfa1832d8c 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -319,9 +319,9 @@ inline void requestRoutesChassis(App& app) *crow::connections::systemBus, connectionName, path, assetTagInterface, "AssetTag", [asyncResp, chassisId(std::string(chassisId))]( - const boost::system::error_code ec, + const boost::system::error_code ec2, const std::string& property) { - if (ec) + if (ec2) { BMCWEB_LOG_DEBUG << "DBus response error for AssetTag"; @@ -615,11 +615,11 @@ inline void } crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec) { + [asyncResp](const boost::system::error_code ec2) { // Use "Set" method to set the property value. - if (ec) + if (ec2) { - BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec; + BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec2; messages::internalError(asyncResp->res); return; } diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 7b1d1da358..f15fb0b10d 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -1871,8 +1871,8 @@ inline void // An addition could be a Redfish Setting like // ActiveSoftwareImageApplyTime and support OnReset crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { BMCWEB_LOG_DEBUG << "D-Bus response error setting."; messages::internalError(aResp->res); @@ -2061,9 +2061,9 @@ inline void requestRoutesManager(App& app) const std::shared_ptr<bmcweb::AsyncResp>& aRsp) { aRsp->res.jsonValue["Links"]["ManagerForChassis@odata.count"] = 1; nlohmann::json::array_t managerForChassis; - nlohmann::json::object_t manager; - manager["@odata.id"] = "/redfish/v1/Chassis/" + chassisId; - managerForChassis.push_back(std::move(manager)); + nlohmann::json::object_t managerObj; + managerObj["@odata.id"] = "/redfish/v1/Chassis/" + chassisId; + managerForChassis.push_back(std::move(managerObj)); aRsp->res.jsonValue["Links"]["ManagerForChassis"] = std::move(managerForChassis); aRsp->res.jsonValue["Links"]["ManagerInChassis"]["@odata.id"] = @@ -2133,10 +2133,10 @@ inline void requestRoutesManager(App& app) "xyz.openbmc_project.Inventory.Decorator.Asset") { crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec, + [asyncResp](const boost::system::error_code ec2, const dbus::utility::DBusPropertiesMap& propertiesList) { - if (ec) + if (ec2) { BMCWEB_LOG_DEBUG << "Can't get bmc asset!"; return; diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp index 74636dda31..b93483c4bf 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -115,11 +115,11 @@ inline void requestRoutesMetricReport(App& app) sdbusplus::asio::getProperty<telemetry::TimestampReadings>( *crow::connections::systemBus, telemetry::service, reportPath, telemetry::reportInterface, "Readings", - [asyncResp, id](const boost::system::error_code ec, + [asyncResp, id](const boost::system::error_code ec2, const telemetry::TimestampReadings& ret) { - if (ec) + if (ec2) { - BMCWEB_LOG_ERROR << "respHandler DBus error " << ec; + BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2; messages::internalError(asyncResp->res); return; } diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp index 8f45fca785..88333fc0ff 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp @@ -96,10 +96,11 @@ inline void } nlohmann::json metrics = nlohmann::json::array(); - for (const auto& [sensorPath, operationType, id, metadata] : *readingParams) + for (const auto& [sensorPath, operationType, metricId, metadata] : + *readingParams) { metrics.push_back({ - {"MetricId", id}, + {"MetricId", metricId}, {"MetricProperties", {metadata}}, }); } @@ -254,8 +255,8 @@ class AddReport { public: AddReport(AddReportArgs argsIn, - const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) : - asyncResp(asyncResp), + const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) : + asyncResp(asyncRespIn), args{std::move(argsIn)} {} ~AddReport() diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 8e921d74b6..89f0334076 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -194,9 +194,9 @@ inline void getNetworkData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, asyncResp->res.jsonValue[protocolName]["ProtocolEnabled"] = isProtocolEnabled; getPortNumber(socketPath, [asyncResp, protocolName]( - const boost::system::error_code ec, + const boost::system::error_code ec2, int portNumber) { - if (ec) + if (ec2) { messages::internalError(asyncResp->res); return; @@ -272,8 +272,8 @@ inline void } crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec) { - if (ec) + [asyncResp](const boost::system::error_code ec2) { + if (ec2) { messages::internalError(asyncResp->res); return; diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index 1e04393e24..a8cfb68d47 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -581,13 +581,13 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "xyz.openbmc_project.Inventory.Item.Cpu." "OperatingConfig", "BaseSpeedPrioritySettings", - [aResp](const boost::system::error_code ec, + [aResp](const boost::system::error_code ec2, const BaseSpeedPrioritySettingsProperty& baseSpeedList) { - if (ec) + if (ec2) { BMCWEB_LOG_WARNING << "D-Bus Property Get error: " - << ec; + << ec2; messages::internalError(aResp->res); return; } @@ -731,7 +731,7 @@ inline void getProcessorObject(const std::shared_ptr<bmcweb::AsyncResp>& resp, // matching objects. Assume all interfaces we want to process // must be on the same object path. - handler(resp, processorId, objectPath, serviceMap); + handler(objectPath, serviceMap); return; } messages::resourceNotFound(resp->res, "Processor", processorId); @@ -1218,7 +1218,9 @@ inline void requestRoutesProcessor(App& app) asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Processors/" + processorId; - getProcessorObject(asyncResp, processorId, getProcessorData); + getProcessorObject( + asyncResp, processorId, + std::bind_front(getProcessorData, asyncResp, processorId)); }); BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/<str>/") @@ -1249,17 +1251,10 @@ inline void requestRoutesProcessor(App& app) } // Check for 404 and find matching D-Bus object, then run // property patch handlers if that all succeeds. - getProcessorObject( - asyncResp, processorId, - [appliedConfigUri = std::move(appliedConfigUri)]( - const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, - const std::string& processorId, - const std::string& objectPath, - const dbus::utility::MapperServiceMap& serviceMap) { - patchAppliedOperatingConfig(asyncResp, processorId, - appliedConfigUri, objectPath, - serviceMap); - }); + getProcessorObject(asyncResp, processorId, + std::bind_front(patchAppliedOperatingConfig, + asyncResp, processorId, + appliedConfigUri)); } }); } diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 09e21e8117..ca842d913d 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -192,35 +192,35 @@ class SensorsAsyncResp const std::string dbusPath; }; - SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn, const std::string& chassisIdIn, std::span<std::string_view> typesIn, std::string_view subNode) : - asyncResp(asyncResp), + asyncResp(asyncRespIn), chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode), efficientExpand(false) {} // Store extra data about sensor mapping and return it in callback - SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn, const std::string& chassisIdIn, std::span<std::string_view> typesIn, std::string_view subNode, DataCompleteCb&& creationComplete) : - asyncResp(asyncResp), + asyncResp(asyncRespIn), chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode), efficientExpand(false), metadata{std::vector<SensorData>()}, dataComplete{std::move(creationComplete)} {} // sensor collections expand - SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + SensorsAsyncResp(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn, const std::string& chassisIdIn, const std::span<std::string_view> typesIn, - const std::string_view& subNode, bool efficientExpand) : - asyncResp(asyncResp), + const std::string_view& subNode, bool efficientExpandIn) : + asyncResp(asyncRespIn), chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode), - efficientExpand(efficientExpand) + efficientExpand(efficientExpandIn) {} ~SensorsAsyncResp() @@ -1249,8 +1249,8 @@ inline void populateFanRedundancy( sensorsAsyncResp->asyncResp->res.jsonValue["Fans"]; for (const std::string& item : *collection) { - sdbusplus::message::object_path path(item); - std::string itemName = path.filename(); + sdbusplus::message::object_path itemPath(item); + std::string itemName = itemPath.filename(); if (itemName.empty()) { continue; @@ -1266,11 +1266,11 @@ inline void populateFanRedundancy( }); if (schemaItem != fanRedfish.end()) { - nlohmann::json::object_t collection; - collection["@odata.id"] = + nlohmann::json::object_t collectionId; + collectionId["@odata.id"] = (*schemaItem)["@odata.id"]; redfishCollection.emplace_back( - std::move(collection)); + std::move(collectionId)); } else { diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index ecdf8b2158..cab23a230d 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -184,7 +184,7 @@ inline void // Redfish properties with same name and a // string value const std::string& propertyName = property.first; - nlohmann::json& object = + nlohmann::json& controller = asyncResp->res.jsonValue["StorageControllers"][index]; if ((propertyName == "PartNumber") || (propertyName == "SerialNumber") || @@ -199,7 +199,7 @@ inline void messages::internalError(asyncResp->res); return; } - object[propertyName] = *value; + controller[propertyName] = *value; } } }, @@ -650,8 +650,8 @@ inline void chassisDriveCollectionGet( std::vector<std::string> leafNames; for (const auto& drive : resp) { - sdbusplus::message::object_path path(drive); - leafNames.push_back(path.filename()); + sdbusplus::message::object_path drivePath(drive); + leafNames.push_back(drivePath.filename()); } std::sort(leafNames.begin(), leafNames.end(), diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index 0e00341188..7180b0917d 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -1246,11 +1246,11 @@ inline void getTrustedModuleRequiredToBoot( sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, serv, path, "xyz.openbmc_project.Control.TPM.Policy", "TPMEnable", - [aResp](const boost::system::error_code ec, bool tpmRequired) { - if (ec) + [aResp](const boost::system::error_code ec2, bool tpmRequired) { + if (ec2) { BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get" - << ec; + << ec2; messages::internalError(aResp->res); return; } @@ -1336,12 +1336,12 @@ inline void setTrustedModuleRequiredToBoot( // Valid TPM Enable object found, now setting the value crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error: Set TrustedModuleRequiredToBoot" - << ec; + << ec2; messages::internalError(aResp->res); return; } @@ -1468,10 +1468,10 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -1942,12 +1942,12 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Control.Power.Mode", "PowerMode", - [aResp](const boost::system::error_code ec, + [aResp](const boost::system::error_code ec2, const std::string& pmode) { - if (ec) + if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: " - << ec; + << ec2; messages::internalError(aResp->res); return; } @@ -2069,8 +2069,8 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Set the Power Mode property crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { messages::internalError(aResp->res); return; @@ -2419,12 +2419,12 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) // Valid IdlePowerSaver object found, now read the current values crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec, + [aResp](const boost::system::error_code ec2, ipsPropertiesType& properties) { - if (ec) + if (ec2) { BMCWEB_LOG_ERROR - << "DBUS response error on IdlePowerSaver GetAll: " << ec; + << "DBUS response error on IdlePowerSaver GetAll: " << ec2; messages::internalError(aResp->res); return; } @@ -2522,10 +2522,10 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsEnable) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -2537,10 +2537,10 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsEnterUtil) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -2555,10 +2555,10 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Convert from seconds into milliseconds for DBus const uint64_t timeMilliseconds = *ipsEnterTime * 1000; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -2571,10 +2571,10 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsExitUtil) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -2589,10 +2589,10 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Convert from seconds into milliseconds for DBus const uint64_t timeMilliseconds = *ipsExitTime * 1000; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code ec) { - if (ec) + [aResp](const boost::system::error_code ec2) { + if (ec2) { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; messages::internalError(aResp->res); return; } @@ -2636,7 +2636,7 @@ inline void requestRoutesSystemsCollection(App& app) *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/network/hypervisor", "xyz.openbmc_project.Network.SystemConfiguration", "HostName", - [asyncResp](const boost::system::error_code ec, + [asyncResp](const boost::system::error_code ec2, const std::string& /*hostName*/) { nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"]; ifaceArray = nlohmann::json::array(); @@ -2646,7 +2646,7 @@ inline void requestRoutesSystemsCollection(App& app) system["@odata.id"] = "/redfish/v1/Systems/system"; ifaceArray.push_back(std::move(system)); count = ifaceArray.size(); - if (!ec) + if (!ec2) { BMCWEB_LOG_DEBUG << "Hypervisor is available"; nlohmann::json::object_t hypervisor; diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 33769a0354..c9fb4a12ad 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -141,10 +141,10 @@ static void { if (property.first == "Activation") { - const std::string* state = + const std::string* activationState = std::get_if<std::string>( &property.second); - if (state == nullptr) + if (activationState == nullptr) { taskData->messages.emplace_back( messages::internalError()); @@ -201,10 +201,10 @@ static void { if (property.first == "Progress") { - const std::string* progress = + const std::string* progressStr = std::get_if<std::string>( &property.second); - if (progress == nullptr) + if (progressStr == nullptr) { taskData->messages.emplace_back( messages::internalError()); diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index aba98e9547..4f6fad9b46 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -54,10 +54,10 @@ inline std::string getTransferProtocolTypeFromUri(const std::string& imageUri) * @brief Read all known properties from VM object interfaces */ inline void - vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interface, + vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interfaces, const std::shared_ptr<bmcweb::AsyncResp>& aResp) { - for (const auto& [interface, values] : interface) + for (const auto& [interface, values] : interfaces) { if (interface == "xyz.openbmc_project.VirtualMedia.MountPoint") { @@ -595,8 +595,8 @@ class Pipe public: using unix_fd = sdbusplus::message::unix_fd; - Pipe(boost::asio::io_context& io, Buffer&& buffer) : - impl(io), buffer{std::move(buffer)} + Pipe(boost::asio::io_context& io, Buffer&& bufferIn) : + impl(io), buffer{std::move(bufferIn)} {} ~Pipe() @@ -830,9 +830,9 @@ inline void handleManagersVirtualMediaActionInsertPost( crow::connections::systemBus->async_method_call( [service, resName, actionParams, - asyncResp](const boost::system::error_code ec, + asyncResp](const boost::system::error_code ec2, dbus::utility::ManagedObjectType& subtree) mutable { - if (ec) + if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error"; @@ -915,11 +915,11 @@ inline void handleManagersVirtualMediaActionEject( crow::connections::systemBus->async_method_call( [asyncResp, - resName](const boost::system::error_code ec, + resName](const boost::system::error_code ec2, const dbus::utility::MapperGetObject& getObjectType) { - if (ec) + if (ec2) { - BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec; + BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec2; messages::internalError(asyncResp->res); return; |