mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Process the last line of textual palette specs even without a trailing newline
Fixes #1519
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user