Ignore empty lines in HEX files

They are free-form enough that empty lines should probably be supported.
This commit is contained in:
ISSOtm
2024-07-26 14:59:18 +02:00
committed by Sylvie
parent a23b4732e3
commit d8aceaea4a
4 changed files with 12 additions and 0 deletions

View File

@@ -401,6 +401,10 @@ static void parseHEXFile(std::filebuf &file) {
if (!readLine(file, line)) { if (!readLine(file, line)) {
break; break;
} }
// Ignore empty lines.
if (line.length() == 0) {
continue;
}
if (line.length() != 6 if (line.length() != 6
|| line.find_first_not_of("0123456789ABCDEFabcdef"sv) != std::string::npos) { || line.find_first_not_of("0123456789ABCDEFabcdef"sv) != std::string::npos) {

View File

@@ -0,0 +1 @@
-c hex:empty_lines.hex

7
test/gfx/empty_lines.hex Normal file
View File

@@ -0,0 +1,7 @@
5721d9
a9d4fe
ffffff

BIN
test/gfx/empty_lines.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B