Process the last line of textual palette specs even without a trailing newline

Fixes #1519
This commit is contained in:
ISSOtm
2024-09-30 22:26:00 +02:00
parent e1ac7f389d
commit 86bf289452

View File

@@ -211,11 +211,12 @@ static T readLE(U const *bytes) {
[[gnu::warn_unused_result]] // Ignoring EOF is a bad idea. [[gnu::warn_unused_result]] // Ignoring EOF is a bad idea.
static bool static bool
readLine(std::filebuf &file, std::string &buffer) { readLine(std::filebuf &file, std::string &buffer) {
assume(buffer.empty());
// TODO: maybe this can be optimized to bulk reads? // TODO: maybe this can be optimized to bulk reads?
for (;;) { for (;;) {
auto c = file.sbumpc(); auto c = file.sbumpc();
if (c == std::filebuf::traits_type::eof()) { if (c == std::filebuf::traits_type::eof()) {
return false; return !buffer.empty();
} }
if (c == '\n') { if (c == '\n') {
// Discard a trailing CRLF // Discard a trailing CRLF