mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
Notes:
sideshowbarker
2024-07-18 00:33:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cb9cac4e400
@@ -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 {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user