mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibGfx/PortableFormat: Don't accept comments that don't start with #
This commit is contained in:
parent
9052a6febf
commit
964172754e
1 changed files with 7 additions and 5 deletions
|
@ -55,18 +55,20 @@ static inline ErrorOr<u16> read_number(Streamer& streamer)
|
|||
template<typename TContext>
|
||||
static bool read_comment([[maybe_unused]] TContext& context, Streamer& streamer)
|
||||
{
|
||||
bool exist = false;
|
||||
bool is_first_char = true;
|
||||
u8 byte {};
|
||||
|
||||
while (streamer.read(byte)) {
|
||||
if (byte == '#') {
|
||||
exist = true;
|
||||
if (is_first_char) {
|
||||
if (byte != '#')
|
||||
return false;
|
||||
is_first_char = false;
|
||||
} else if (byte == '\t' || byte == '\n') {
|
||||
return exist;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return exist;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename TContext>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue