mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibGfx: Return bool not ErrorOr<bool> from ImageDecoderPlugin::sniff()
Nobody made use of the ErrorOr return value and it just added more chance of confusion, since it was not clear if failing to sniff an image should return an error or false. The answer was false, if you returned Error you'd crash the ImageDecoder.
This commit is contained in:
parent
8d9cb538d6
commit
6cf8eeb7a4
22 changed files with 40 additions and 40 deletions
|
@ -22,7 +22,7 @@
|
|||
namespace Gfx {
|
||||
|
||||
struct ImagePluginInitializer {
|
||||
ErrorOr<bool> (*sniff)(ReadonlyBytes) = nullptr;
|
||||
bool (*sniff)(ReadonlyBytes) = nullptr;
|
||||
ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> (*create)(ReadonlyBytes) = nullptr;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ static constexpr ImagePluginWithMIMETypeInitializer s_initializers_with_mime_typ
|
|||
static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin(ReadonlyBytes bytes)
|
||||
{
|
||||
for (auto& plugin : s_initializers) {
|
||||
auto sniff_result = plugin.sniff(bytes).release_value_but_fixme_should_propagate_errors();
|
||||
auto sniff_result = plugin.sniff(bytes);
|
||||
if (!sniff_result)
|
||||
continue;
|
||||
auto plugin_decoder = plugin.create(bytes).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue