mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +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:
parent
8d76eb773f
commit
cb9cac4e40
21 changed files with 207 additions and 296 deletions
|
@ -13,7 +13,6 @@
|
|||
#include <LibIPC/Decoder.h>
|
||||
#include <LibIPC/Encoder.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
@ -343,13 +342,12 @@ bool IPC::encode(IPC::Encoder& encoder, Color const& color)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool IPC::decode(IPC::Decoder& decoder, Color& color)
|
||||
ErrorOr<void> IPC::decode(IPC::Decoder& decoder, Color& color)
|
||||
{
|
||||
u32 rgba = 0;
|
||||
if (!decoder.decode(rgba))
|
||||
return false;
|
||||
u32 rgba;
|
||||
TRY(decoder.decode(rgba));
|
||||
color = Color::from_rgba(rgba);
|
||||
return true;
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color const& value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue