StringUtil: Fix incorrect end_ptr computation

This commit is contained in:
Stenzek 2024-10-07 01:42:19 +10:00
parent 3fb5fb4c72
commit 9ff4fbd21c
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -94,7 +94,7 @@ inline std::optional<T> FromChars(const std::string_view str, int base, std::str
if (endptr)
{
const size_t remaining_len = end - ptr - 1;
const size_t remaining_len = end - result.ptr;
*endptr = (remaining_len > 0) ? std::string_view(result.ptr, remaining_len) : std::string_view();
}
@ -125,7 +125,7 @@ inline std::optional<T> FromChars(const std::string_view str, std::string_view*
if (endptr)
{
const size_t remaining_len = end - ptr - 1;
const size_t remaining_len = end - result.ptr;
*endptr = (remaining_len > 0) ? std::string_view(result.ptr, remaining_len) : std::string_view();
}