1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

LibGfx: Minorly simplify BMPLoader's decode_bmp_dib()

header_size is already set to 0 if context.is_included_in_ico is true
and to bmp_header_size else, so we can remove some redundant checks
for context.is_included_in_ico.

No behavior change.
This commit is contained in:
Nico Weber 2023-02-17 15:10:46 -05:00 committed by Andreas Kling
parent 62285e0569
commit 2a1cd84155

View file

@ -828,13 +828,10 @@ static ErrorOr<void> decode_bmp_dib(BMPLoadingContext& context)
u8 header_size = context.is_included_in_ico ? 0 : bmp_header_size;
if (!context.is_included_in_ico && context.file_size < (u8)(header_size + 4))
if (context.file_size < (u8)(header_size + 4))
return Error::from_string_literal("File size too short");
if (context.is_included_in_ico && context.file_size < 4)
return Error::from_string_literal("File size too short");
InputStreamer streamer(context.file_bytes + (context.is_included_in_ico ? 0 : header_size), 4);
InputStreamer streamer(context.file_bytes + header_size, 4);
u32 dib_size = streamer.read_u32();