Codechange: refactor DecodeHexText to a generic purpose ConvertHexToBytes (#11866)

DecodeHexText() does more than just decoding hex. ConvertHexToBytes()
now only does pure hex decoding. This required a bit of refactoring
for the code using DecodeHexText().
This commit is contained in:
Patric Stout
2024-01-22 19:42:47 +01:00
committed by GitHub
parent 786cc85e86
commit 75f21065c9
4 changed files with 121 additions and 51 deletions

View File

@@ -39,6 +39,8 @@ void StrTrimInPlace(std::string &str);
[[nodiscard]] bool StrNaturalContains(const std::string_view str, const std::string_view value);
[[nodiscard]] bool StrNaturalContainsIgnoreCase(const std::string_view str, const std::string_view value);
bool ConvertHexToBytes(std::string_view hex, std::span<uint8_t> bytes);
/** Case insensitive comparator for strings, for example for use in std::map. */
struct CaseInsensitiveComparator {
bool operator()(const std::string_view s1, const std::string_view s2) const { return StrCompareIgnoreCase(s1, s2) < 0; }