summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/Size.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-28 11:56:31 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-28 23:14:19 +0100
commitcb9cac4e4002d6f2d5a16c7344dfb5393cec2b56 (patch)
treedaa183f9f73c17d0e72e0d0bd7b89ecbf0f6fdbe /Userland/Libraries/LibGfx/Size.cpp
parent8d76eb773f25b1e51ef923734cd355692f014ce5 (diff)
downloadserenity-cb9cac4e4002d6f2d5a16c7344dfb5393cec2b56.zip
LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice reduction in line count.
Diffstat (limited to 'Userland/Libraries/LibGfx/Size.cpp')
-rw-r--r--Userland/Libraries/LibGfx/Size.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGfx/Size.cpp b/Userland/Libraries/LibGfx/Size.cpp
index 28be84125a..dc122d13bc 100644
--- a/Userland/Libraries/LibGfx/Size.cpp
+++ b/Userland/Libraries/LibGfx/Size.cpp
@@ -33,16 +33,14 @@ bool encode(Encoder& encoder, Gfx::IntSize const& size)
return true;
}
-bool decode(Decoder& decoder, Gfx::IntSize& size)
+ErrorOr<void> decode(Decoder& decoder, Gfx::IntSize& size)
{
int width = 0;
int height = 0;
- if (!decoder.decode(width))
- return false;
- if (!decoder.decode(height))
- return false;
+ TRY(decoder.decode(width));
+ TRY(decoder.decode(height));
size = { width, height };
- return true;
+ return {};
}
}