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
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index e6ca9d3..d375202 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -284,13 +284,13 @@
}
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 @@
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)