From d8aceaea4a90d72961e11709893b5add8c0e2c7f Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Fri, 26 Jul 2024 14:59:18 +0200 Subject: [PATCH] Ignore empty lines in HEX files They are free-form enough that empty lines should probably be supported. --- src/gfx/pal_spec.cpp | 4 ++++ test/gfx/empty_lines.flags | 1 + test/gfx/empty_lines.hex | 7 +++++++ test/gfx/empty_lines.png | Bin 0 -> 712 bytes 4 files changed, 12 insertions(+) create mode 100644 test/gfx/empty_lines.flags create mode 100644 test/gfx/empty_lines.hex create mode 100644 test/gfx/empty_lines.png diff --git a/src/gfx/pal_spec.cpp b/src/gfx/pal_spec.cpp index 35b65af8..2f53a8fe 100644 --- a/src/gfx/pal_spec.cpp +++ b/src/gfx/pal_spec.cpp @@ -401,6 +401,10 @@ static void parseHEXFile(std::filebuf &file) { if (!readLine(file, line)) { break; } + // Ignore empty lines. + if (line.length() == 0) { + continue; + } if (line.length() != 6 || line.find_first_not_of("0123456789ABCDEFabcdef"sv) != std::string::npos) { diff --git a/test/gfx/empty_lines.flags b/test/gfx/empty_lines.flags new file mode 100644 index 00000000..7b577864 --- /dev/null +++ b/test/gfx/empty_lines.flags @@ -0,0 +1 @@ +-c hex:empty_lines.hex diff --git a/test/gfx/empty_lines.hex b/test/gfx/empty_lines.hex new file mode 100644 index 00000000..29d4022e --- /dev/null +++ b/test/gfx/empty_lines.hex @@ -0,0 +1,7 @@ + +5721d9 + +a9d4fe + + +ffffff diff --git a/test/gfx/empty_lines.png b/test/gfx/empty_lines.png new file mode 100644 index 0000000000000000000000000000000000000000..57fdd36f50ceea06ff1b3c6d58a745fd05c30f13 GIT binary patch literal 712 zcmV;(0yq7MP)EX>4Tx04R}tkv&MmKp2MKrk09SMA|{bAwzYtAS&XhRVYG*P%E_RU~=gnG%+M8 zE{=k0!NH%!s)LKOt`4q(Aov5~=;Wm6A|-y86k5c1$8itueecWNcYx5SGR^8512o+> zGpVGQ%dd#xSA-BnKh3zzEMr!Z((oN$_XzO)F2S?>>;4?QYQbVaKqQ`FhG`S86Hjg0 z2Iqa^7%R&v@j3CRNf#u3)BVfh)c3-)I2SpQP8@ zTKov;+XgPK+nTZmT zjFc#Q&F9_SoqhYarq#b6S`%`eYNz2J00009a7bBm001r{001r{0eGc9b^rhX>PbXF zR7l6oRxu94APfX6FR7F+eM^=MRi9XOV98s$G*Z7phDeo*iERvt;w{0tGv_nlV~p-U zUhnkJR@`r1%mFjHG8tT5h#X)pUm4(bjs^t$zPoyYFw6mcKEGGI>ak6gJqW|hCtwaJ z^|gq8w2QhTt*czbmv2MgWeyS-L0fSWbQOUfeVlr#b2Ev?skijN+}jKRow9oL!%tJZ zi6-S|cCd1^LeER2Ir2__qtSun&CZ0U?;;$J%O{JTGzl*y3JU~34rT4Me=