1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +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

@ -348,24 +348,15 @@ bool IPC::encode(IPC::Encoder& encoder, const Web::Cookie::ParsedCookie& cookie)
return true;
}
bool IPC::decode(IPC::Decoder& decoder, Web::Cookie::ParsedCookie& cookie)
ErrorOr<void> IPC::decode(IPC::Decoder& decoder, Web::Cookie::ParsedCookie& cookie)
{
if (!decoder.decode(cookie.name))
return false;
if (!decoder.decode(cookie.value))
return false;
if (!decoder.decode(cookie.expiry_time_from_expires_attribute))
return false;
if (!decoder.decode(cookie.expiry_time_from_max_age_attribute))
return false;
if (!decoder.decode(cookie.domain))
return false;
if (!decoder.decode(cookie.path))
return false;
if (!decoder.decode(cookie.secure_attribute_present))
return false;
if (!decoder.decode(cookie.http_only_attribute_present))
return false;
return true;
TRY(decoder.decode(cookie.name));
TRY(decoder.decode(cookie.value));
TRY(decoder.decode(cookie.expiry_time_from_expires_attribute));
TRY(decoder.decode(cookie.expiry_time_from_max_age_attribute));
TRY(decoder.decode(cookie.domain));
TRY(decoder.decode(cookie.path));
TRY(decoder.decode(cookie.secure_attribute_present));
TRY(decoder.decode(cookie.http_only_attribute_present));
return {};
}