mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibGfx/PortableFormat: Simplify read_number signature
The function signature goes from: `bool read_number(Streamer& streamer, TValue* value)` to `ErrorOr<u16> read_number(Streamer& streamer)` It allows us to, on one hand use `ErrorOr` for error propagation, removing an out parameter in the meantime, and on the other hand remove the useless template.
This commit is contained in:
committed by
Andreas Kling
parent
387894cdf2
commit
9052a6febf
Notes:
sideshowbarker
2024-07-17 00:16:31 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/9052a6febf Pull-request: https://github.com/SerenityOS/serenity/pull/17831 Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/nico
@@ -33,11 +33,11 @@ bool read_image_data(PGMLoadingContext& context, Streamer& streamer)
|
||||
Vector<Gfx::Color> color_data;
|
||||
|
||||
if (context.type == PGMLoadingContext::Type::ASCII) {
|
||||
u16 value;
|
||||
|
||||
while (true) {
|
||||
if (!read_number(streamer, &value))
|
||||
auto number_or_error = read_number(streamer);
|
||||
if (number_or_error.is_error())
|
||||
break;
|
||||
auto value = number_or_error.value();
|
||||
|
||||
if (!read_whitespace(context, streamer))
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user