diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx index bf3c269b99ca..d60bff78ee63 100644 --- a/xmlhelp/source/cxxhelp/provider/db.cxx +++ b/xmlhelp/source/cxxhelp/provider/db.cxx @@ -20,28 +20,23 @@ #include "db.hxx" +#include +#include #include +#include #include #include -#include using namespace com::sun::star::uno; using namespace com::sun::star::io; namespace { -//TODO: Replace with C++17 std::from_chars once available: std::pair readInt32(char const * begin, char const * end) { sal_Int32 n = 0; - for (; begin != end; ++begin) { - auto const w = INetMIME::getHexWeight(static_cast(*begin)); - if (w == -1) { - break; - } - n = 16 * n + w; - } - return {n, begin}; + auto const [ptr, ec] = std::from_chars(begin, end, n, 16); + return {std::max(n, sal_Int32(0)), ec == std::errc{} && n >= 0 ? ptr : begin}; } }