From 3431c37699cd0bec93b318a3f8df75a7fc25591d Mon Sep 17 00:00:00 2001 From: Jens Alfke Date: Thu, 12 Oct 2023 16:01:35 -0700 Subject: [PATCH] Two small fixes found by static analysis --- include/PubSub.hh | 2 +- include/io/HTTPParser.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/PubSub.hh b/include/PubSub.hh index 281a8e3..09cb500 100644 --- a/include/PubSub.hh +++ b/include/PubSub.hh @@ -198,7 +198,7 @@ namespace crouton::ps { /// ``` template , typename SS = std::remove_reference_t> requires(std::is_same_v,sub_type>) [[nodiscard]] S operator| (P&& pub, S&& sub) { - auto sharedP = std::make_shared(std::move(pub)); + auto sharedP = std::make_shared(std::forward

(pub)); sub.subscribeTo(std::move(sharedP)); return sub; } diff --git a/include/io/HTTPParser.hh b/include/io/HTTPParser.hh index 8e24df5..3060e08 100644 --- a/include/io/HTTPParser.hh +++ b/include/io/HTTPParser.hh @@ -160,7 +160,7 @@ namespace crouton::io::http { ASYNC entireBody(); /// After a call to parseData, returns body bytes that were read by the call. - string latestBodyData() {return std::move(_body);} + string latestBodyData() {string b(std::move(_body)); _body.clear(); return b;} private: Parser(IStream*, Role role);