mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
LibGfx: Use StringView for header constants in the GIF decoder
This commit is contained in:
parent
2482966db9
commit
b6359b211d
1 changed files with 4 additions and 4 deletions
|
@ -87,8 +87,8 @@ enum class GIFFormat {
|
||||||
|
|
||||||
static Optional<GIFFormat> decode_gif_header(InputMemoryStream& stream)
|
static Optional<GIFFormat> decode_gif_header(InputMemoryStream& stream)
|
||||||
{
|
{
|
||||||
static const char valid_header_87[] = "GIF87a";
|
static auto valid_header_87 = "GIF87a"sv;
|
||||||
static const char valid_header_89[] = "GIF89a";
|
static auto valid_header_89 = "GIF89a"sv;
|
||||||
|
|
||||||
Array<u8, 6> header;
|
Array<u8, 6> header;
|
||||||
stream >> header;
|
stream >> header;
|
||||||
|
@ -96,9 +96,9 @@ static Optional<GIFFormat> decode_gif_header(InputMemoryStream& stream)
|
||||||
if (stream.handle_any_error())
|
if (stream.handle_any_error())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (header.span() == ReadonlyBytes { valid_header_87, 6 })
|
if (header.span() == valid_header_87.bytes())
|
||||||
return GIFFormat::GIF87a;
|
return GIFFormat::GIF87a;
|
||||||
if (header.span() == ReadonlyBytes { valid_header_89, 6 })
|
if (header.span() == valid_header_89.bytes())
|
||||||
return GIFFormat::GIF89a;
|
return GIFFormat::GIF89a;
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue