diff options
author | Ed Tanous <edtanous@google.com> | 2022-01-25 22:04:33 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-02-15 04:13:25 +0300 |
commit | 71d5d8dbf54dace8a559e593a2bc6011b7261af5 (patch) | |
tree | 2aac5ddb2a5761c62df9e01d1fe92db929a556f8 | |
parent | e662eae819f545ef07193f216b42e161b7ff7a46 (diff) | |
download | bmcweb-71d5d8dbf54dace8a559e593a2bc6011b7261af5.tar.xz |
readability-static-accessed-through-instance
We access std::string::npos through member variables in a couple places.
Fix it.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I587f89e1580661aa311dfe4e06591ab38806e241
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 4 | ||||
-rw-r--r-- | redfish-core/lib/log_services.hpp | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/.clang-tidy b/.clang-tidy index 9958891b15..b4e75eea4e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -285,6 +285,7 @@ readability-redundant-preprocessor, readability-redundant-smartptr-get, readability-redundant-string-cstr, readability-redundant-string-init, +readability-static-accessed-through-instance, readability-identifier-naming' WarningsAsErrors: '*' diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index b457935e84..cb5d727a25 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -2049,7 +2049,7 @@ inline void handleDBusUrl(const crow::Request& req, std::string destProperty; const char* attrSeperator = "/attr/"; size_t attrPosition = objectPath.find(attrSeperator); - if (attrPosition != objectPath.npos) + if (attrPosition != std::string::npos) { destProperty = objectPath.substr(attrPosition + strlen(attrSeperator), objectPath.length()); @@ -2060,7 +2060,7 @@ inline void handleDBusUrl(const crow::Request& req, { constexpr const char* actionSeperator = "/action/"; size_t actionPosition = objectPath.find(actionSeperator); - if (actionPosition != objectPath.npos) + if (actionPosition != std::string::npos) { std::string postProperty = objectPath.substr((actionPosition + strlen(actionSeperator)), diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index b2c5d4ca67..e72e81d375 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -318,7 +318,7 @@ inline static bool std::string_view tsStr(entryID); auto underscorePos = tsStr.find('_'); - if (underscorePos != tsStr.npos) + if (underscorePos != std::string_view::npos) { // Timestamp has an index tsStr.remove_suffix(tsStr.size() - underscorePos); |