diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-01 23:37:35 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-04 11:49:15 +0100 |
commit | ab99ed5fba8bf954cdd60bbc90dafbe47b29b18f (patch) | |
tree | 472d897714faecc41f6d4a6f9cabb4b9c7ce7b26 /Userland/Services | |
parent | d0f3f3d5ff1f783dcad5b6d8d0ceb38bbc397688 (diff) | |
download | serenity-ab99ed5fba8bf954cdd60bbc90dafbe47b29b18f.zip |
LibIPC+Everywhere: Change IPC::encode's return type to ErrorOr
In doing so, this removes all uses of the Encoder's stream operator,
except for where it is currently still used in the generated IPC code.
So the stream operator currently discards any errors, which is the
existing behavior. A subsequent commit will propagate the errors.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WindowServer/ScreenLayout.h | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/ScreenLayout.ipp | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/Userland/Services/WindowServer/ScreenLayout.h b/Userland/Services/WindowServer/ScreenLayout.h index 6a5c5b0571..4ff2d5bcf8 100644 --- a/Userland/Services/WindowServer/ScreenLayout.h +++ b/Userland/Services/WindowServer/ScreenLayout.h @@ -74,13 +74,13 @@ public: namespace IPC { template<> -bool encode(Encoder&, WindowServer::ScreenLayout::Screen const&); +ErrorOr<void> encode(Encoder&, WindowServer::ScreenLayout::Screen const&); template<> ErrorOr<WindowServer::ScreenLayout::Screen> decode(Decoder&); template<> -bool encode(Encoder&, WindowServer::ScreenLayout const&); +ErrorOr<void> encode(Encoder&, WindowServer::ScreenLayout const&); template<> ErrorOr<WindowServer::ScreenLayout> decode(Decoder&); diff --git a/Userland/Services/WindowServer/ScreenLayout.ipp b/Userland/Services/WindowServer/ScreenLayout.ipp index 77b4b04497..f9fc1d7573 100644 --- a/Userland/Services/WindowServer/ScreenLayout.ipp +++ b/Userland/Services/WindowServer/ScreenLayout.ipp @@ -393,10 +393,15 @@ bool ScreenLayout::try_auto_add_display_connector(DeprecatedString const& device namespace IPC { template<> -bool encode(Encoder& encoder, WindowServer::ScreenLayout::Screen const& screen) +ErrorOr<void> encode(Encoder& encoder, WindowServer::ScreenLayout::Screen const& screen) { - encoder << screen.mode << screen.device << screen.location << screen.resolution << screen.scale_factor; - return true; + TRY(encoder.encode(screen.mode)); + TRY(encoder.encode(screen.device)); + TRY(encoder.encode(screen.location)); + TRY(encoder.encode(screen.resolution)); + TRY(encoder.encode(screen.scale_factor)); + + return {}; } template<> @@ -412,10 +417,12 @@ ErrorOr<WindowServer::ScreenLayout::Screen> decode(Decoder& decoder) } template<> -bool encode(Encoder& encoder, WindowServer::ScreenLayout const& screen_layout) +ErrorOr<void> encode(Encoder& encoder, WindowServer::ScreenLayout const& screen_layout) { - encoder << screen_layout.screens << screen_layout.main_screen_index; - return true; + TRY(encoder.encode(screen_layout.screens)); + TRY(encoder.encode(screen_layout.main_screen_index)); + + return {}; } template<> |