mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix parsing of textual colours
`n`'s input value was not honored, and its updating logic incorrect
This commit is contained in:
@@ -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};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
error: GPL palette file appears to be truncated
|
||||
Conversion aborted after 1 error
|
||||
@@ -1 +0,0 @@
|
||||
-c gpl:truncated_gpl.gpl
|
||||
@@ -1 +0,0 @@
|
||||
GIMP Palette
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 712 B |
Reference in New Issue
Block a user