summaryrefslogtreecommitdiff
path: root/include/openbmc_dbus_rest.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-12-20 20:53:40 +0300
committerEd Tanous <ed@tanous.net>2022-12-29 02:58:33 +0300
commit7f57f19593fc87da79caa9d7da77976622c933ae (patch)
treeb326b99c1139e22134a7b25dd8165d5830ae75c1 /include/openbmc_dbus_rest.hpp
parente3eb3d6333030675b3b8585b713a80dcf7cce81c (diff)
downloadbmcweb-7f57f19593fc87da79caa9d7da77976622c933ae.tar.xz
cppcheck: Fix Ineffective call of function 'substr'
This likely has no performance implications in practice, but getting a clean cppcheck run is good. Suggestion was implemented per cppcheck. Tested: This is in the deprecated rest API. Not sure how much testing we need to do. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1658697730ac07c7cdefd2b73c80ee65fba4dedb
Diffstat (limited to 'include/openbmc_dbus_rest.hpp')
-rw-r--r--include/openbmc_dbus_rest.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 0e3e070ccd..2cb2bc335e 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2040,7 +2040,7 @@ inline void handleDBusUrl(const crow::Request& req,
{
destProperty = objectPath.substr(attrPosition + strlen(attrSeperator),
objectPath.length());
- objectPath = objectPath.substr(0, attrPosition);
+ objectPath.resize(attrPosition);
}
if (req.method() == boost::beast::http::verb::post)
@@ -2052,7 +2052,7 @@ inline void handleDBusUrl(const crow::Request& req,
std::string postProperty =
objectPath.substr((actionPosition + strlen(actionSeperator)),
objectPath.length());
- objectPath = objectPath.substr(0, actionPosition);
+ objectPath.resize(actionPosition);
handleAction(req, asyncResp, objectPath, postProperty);
return;
}