mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +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
|
@ -64,7 +64,7 @@ static ErrorOr<OwnPtr<ImageDecoderPlugin>> probe_and_sniff_for_appropriate_plugi
|
|||
static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin_with_known_mime_type(StringView mime_type, ReadonlyBytes bytes)
|
||||
{
|
||||
struct ImagePluginWithMIMETypeInitializer {
|
||||
ErrorOr<bool> (*validate_before_create)(ReadonlyBytes) = nullptr;
|
||||
bool (*validate_before_create)(ReadonlyBytes) = nullptr;
|
||||
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> (*create)(ReadonlyBytes) = nullptr;
|
||||
StringView mime_type;
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin_with_kn
|
|||
for (auto& plugin : s_initializers_with_mime_type) {
|
||||
if (plugin.mime_type != mime_type)
|
||||
continue;
|
||||
auto validation_result = plugin.validate_before_create(bytes).release_value_but_fixme_should_propagate_errors();
|
||||
auto validation_result = plugin.validate_before_create(bytes);
|
||||
if (!validation_result)
|
||||
continue;
|
||||
auto plugin_decoder = plugin.create(bytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue