diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2023-05-11 19:23:01 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-05-11 19:23:29 +0300 |
commit | 2bd4ab43be2592ffe0b1321c18d0169f010486ab (patch) | |
tree | cea2a787569ebceeb8f0158163eee7739d0ba7ac | |
parent | 84ea4b10d26cd6ab1e48ebe3a156ca4f16ba3bb4 (diff) | |
download | bmcweb-2bd4ab43be2592ffe0b1321c18d0169f010486ab.tar.xz |
query-param: fix clang-tidy warnings
```
../redfish-core/include/utils/query_param.hpp:287:51: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage]
auto it = std::from_chars(value.data(), value.data() + value.size(),
~~~~~~^~~~~~
../redfish-core/include/utils/query_param.hpp:307:45: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage]
std::from_chars(value.data(), value.data() + value.size(), param);
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic93d3e98e0539f5c7068b93ff7e4505fdd5bbfe1
-rw-r--r-- | redfish-core/include/utils/query_param.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp index e6ca9d313a..d375202408 100644 --- a/redfish-core/include/utils/query_param.hpp +++ b/redfish-core/include/utils/query_param.hpp @@ -284,13 +284,13 @@ inline bool getExpandType(std::string_view value, Query& query) } value.remove_prefix(levels.size()); - auto it = std::from_chars(value.data(), value.data() + value.size(), - query.expandLevel); + auto it = std::from_chars(value.begin(), value.end(), query.expandLevel); if (it.ec != std::errc()) { return false; } - value.remove_prefix(static_cast<size_t>(it.ptr - value.data())); + value.remove_prefix( + static_cast<size_t>(std::distance(value.begin(), it.ptr))); return value == ")"; } @@ -303,8 +303,8 @@ enum class QueryError inline QueryError getNumericParam(std::string_view value, size_t& param) { - std::from_chars_result r = - std::from_chars(value.data(), value.data() + value.size(), param); + std::from_chars_result r = std::from_chars(value.begin(), value.end(), + param); // If the number wasn't representable in the type, it's out of range if (r.ec == std::errc::result_out_of_range) |