1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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.
This commit is contained in:
Andreas Kling 2021-11-28 11:56:31 +01:00
parent 8d76eb773f
commit cb9cac4e40
21 changed files with 207 additions and 296 deletions

View file

@ -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 {};
}
}