diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-10-04 09:55:05 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-10-04 09:46:17 +0200 |
commit | fa9d72a7947d2cff541794e21e0040c3c1d43b32 (patch) | |
tree | 315f11754660c0efecaf1c64123bb7ebcf279308 /src/util | |
parent | fa3cd2853530c86c261ac7266ffe4f1726fe9ce6 (diff) |
Remove unused ParseDouble and ParsePrechecks
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/strencodings.cpp | 25 | ||||
-rw-r--r-- | src/util/strencodings.h | 7 |
2 files changed, 0 insertions, 32 deletions
diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp index 90bf39f010..53989a8d28 100644 --- a/src/util/strencodings.cpp +++ b/src/util/strencodings.cpp @@ -302,17 +302,6 @@ bool ParseIntegral(const std::string& str, T* out) } }; // namespace -[[nodiscard]] static bool ParsePrechecks(const std::string& str) -{ - if (str.empty()) // No empty string allowed - return false; - if (str.size() >= 1 && (IsSpace(str[0]) || IsSpace(str[str.size()-1]))) // No padding allowed - return false; - if (!ValidAsCString(str)) // No embedded NUL characters allowed - return false; - return true; -} - bool ParseInt32(const std::string& str, int32_t* out) { return ParseIntegral<int32_t>(str, out); @@ -343,20 +332,6 @@ bool ParseUInt64(const std::string& str, uint64_t* out) return ParseIntegral<uint64_t>(str, out); } -bool ParseDouble(const std::string& str, double *out) -{ - if (!ParsePrechecks(str)) - return false; - if (str.size() >= 2 && str[0] == '0' && str[1] == 'x') // No hexadecimal floats allowed - return false; - std::istringstream text(str); - text.imbue(std::locale::classic()); - double result; - text >> result; - if(out) *out = result; - return text.eof() && !text.fail(); -} - std::string FormatParagraph(const std::string& in, size_t width, size_t indent) { std::stringstream out; diff --git a/src/util/strencodings.h b/src/util/strencodings.h index 07e1966890..688707d188 100644 --- a/src/util/strencodings.h +++ b/src/util/strencodings.h @@ -159,13 +159,6 @@ std::optional<T> ToIntegral(const std::string& str) [[nodiscard]] bool ParseUInt64(const std::string& str, uint64_t *out); /** - * Convert string to double with strict parse error feedback. - * @returns true if the entire string could be parsed as valid double, - * false if not the entire string could be parsed or when overflow or underflow occurred. - */ -[[nodiscard]] bool ParseDouble(const std::string& str, double *out); - -/** * Convert a span of bytes to a lower-case hexadecimal string. */ std::string HexStr(const Span<const uint8_t> s); |