Fix parsing of textual colours

`n`'s input value was not honored, and its updating logic incorrect
This commit is contained in:
ISSOtm
2024-07-26 19:36:26 +02:00
committed by Sylvie
parent 8e60d1f0b8
commit 1f8f28cac8
5 changed files with 3 additions and 7 deletions

View File

@@ -240,11 +240,11 @@ static bool readLine(std::filebuf &file, std::string &buffer) {
template<typename U> // Should be uint*_t
static std::optional<U> parseDec(std::string const &str, std::string::size_type &n) {
uintmax_t value = 0;
auto result = std::from_chars(str.data(), str.data() + str.size(), value);
if ((bool)result.ec) {
auto result = std::from_chars(str.data() + n, str.data() + str.size(), value);
if (static_cast<bool>(result.ec)) {
return std::nullopt;
}
n += result.ptr - str.data();
n = result.ptr - str.data();
return std::optional<U>{value};
}

View File

@@ -1,2 +0,0 @@
error: GPL palette file appears to be truncated
Conversion aborted after 1 error

View File

@@ -1 +0,0 @@
-c gpl:truncated_gpl.gpl

View File

@@ -1 +0,0 @@
GIMP Palette

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B