1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:27:35 +00:00

LibGfx/PortableFormat: Don't accept comments that don't start with #

This commit is contained in:
Lucas CHOLLET 2023-03-12 20:58:55 -04:00 committed by Andreas Kling
parent 9052a6febf
commit 964172754e

View file

@ -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>