diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-12-22 20:40:33 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-26 09:36:16 +0100 |
commit | 9b483625e653d2ea89533c99b501a2e296c4d366 (patch) | |
tree | a84ddbd6a8bae04104dd9617e3b99e5e1f8e9c4a /Userland/Libraries/LibCore/DateTime.h | |
parent | 765c5b416f61f08dd68ea4b77a39e9380f2c8f9d (diff) | |
download | serenity-9b483625e653d2ea89533c99b501a2e296c4d366.zip |
LibIPC+Everywhere: Change IPC decoders to construct values in-place
Currently, the generated IPC decoders will default-construct the type to
be decoded, then pass that value by reference to the concrete decoder.
This, of course, requires that the type is default-constructible. This
was an issue for decoding Variants, which had to require the first type
in the Variant list is Empty, to ensure it is default constructible.
Further, this made it possible for values to become uninitialized in
user-defined decoders.
This patch makes the decoder interface such that the concrete decoders
themselves contruct the decoded type upon return from the decoder. To do
so, the default decoders in IPC::Decoder had to be moved to the IPC
namespace scope, as these decoders are now specializations instead of
overloaded methods (C++ requires specializations to be in a namespace
scope).
Diffstat (limited to 'Userland/Libraries/LibCore/DateTime.h')
-rw-r--r-- | Userland/Libraries/LibCore/DateTime.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCore/DateTime.h b/Userland/Libraries/LibCore/DateTime.h index fe050a2df3..e605d1f1d9 100644 --- a/Userland/Libraries/LibCore/DateTime.h +++ b/Userland/Libraries/LibCore/DateTime.h @@ -58,6 +58,6 @@ template<> bool encode(Encoder&, Core::DateTime const&); template<> -ErrorOr<void> decode(Decoder&, Core::DateTime&); +ErrorOr<Core::DateTime> decode(Decoder&); } |