mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibGfx: Make validate_before_create() create a regular bool
This is for validating that a decoder with a weak or nonexistent sniff() method thinks it can decode an image. This should not be treated as an error. No behavior change.
This commit is contained in:
parent
69e4f924b7
commit
6607757b08
4 changed files with 12 additions and 10 deletions
|
@ -91,11 +91,13 @@ ErrorOr<void> TGAImageDecoderPlugin::decode_tga_header()
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<bool> TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data)
|
||||
bool TGAImageDecoderPlugin::validate_before_create(ReadonlyBytes data)
|
||||
{
|
||||
FixedMemoryStream stream { data };
|
||||
auto header = TRY(stream.read_value<Gfx::TGAHeader>());
|
||||
return !ensure_header_validity(header, data.size()).is_error();
|
||||
auto header_or_err = stream.read_value<Gfx::TGAHeader>();
|
||||
if (header_or_err.is_error())
|
||||
return false;
|
||||
return !ensure_header_validity(header_or_err.release_value(), data.size()).is_error();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> TGAImageDecoderPlugin::create(ReadonlyBytes data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue