fix(radio): Fix handling of blank lines in YAML files (#3762)

* Fix handling of blank lines in YAML files.

* Added some basic EOL / blank line unit tests

---------

Co-authored-by: raphaelcoeffic <raphael.coeffic@frafos.com>
This commit is contained in:
philmoz
2023-09-07 21:25:09 +10:00
committed by GitHub
co-authored by raphaelcoeffic
parent fec64a964d
commit 65ee80f159
2 changed files with 76 additions and 8 deletions
+6 -8
View File
@@ -302,15 +302,13 @@ YamlParser::parse(const char* buffer, unsigned int size)
break;
case ps_CRLF:
if (*c == '\n') {
// Skip blank lines
while (c < end && (*c == '\r' || *c == '\n'))
c += 1;
// reset state at EOL
// Skip blank lines
while (c < end && (*c == '\r' || *c == '\n'))
c += 1;
// reset state at EOL (unless we have run out of buffer, in case EOL continues in next buffer)
if (c < end)
reset();
continue;
}
break;
continue;
}
c++;