From 8b01abf9f7cc92e7548e2a0f362aa493a273ef2d Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Tue, 23 Apr 2024 22:20:39 +0100 Subject: [PATCH] AK: Don't move trivially copyable types in BufferedStream methods --- AK/BufferedStream.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AK/BufferedStream.h b/AK/BufferedStream.h index 3c72f45540a..9475b3b23e9 100644 --- a/AK/BufferedStream.h +++ b/AK/BufferedStream.h @@ -317,7 +317,7 @@ public: InputBufferedSeekable(InputBufferedSeekable&& other) = default; InputBufferedSeekable& operator=(InputBufferedSeekable&& other) = default; - virtual ErrorOr read_some(Bytes buffer) override { return m_helper.read(move(buffer)); } + virtual ErrorOr read_some(Bytes buffer) override { return m_helper.read(buffer); } virtual ErrorOr write_some(ReadonlyBytes buffer) override { return m_helper.stream().write_some(buffer); } virtual bool is_eof() const override { return m_helper.is_eof(); } virtual bool is_open() const override { return m_helper.stream().is_open(); } @@ -344,21 +344,21 @@ public: return m_helper.stream().truncate(length); } - ErrorOr read_line(Bytes buffer) { return m_helper.read_line(move(buffer)); } + ErrorOr read_line(Bytes buffer) { return m_helper.read_line(buffer); } ErrorOr can_read_line() { return TRY(m_helper.can_read_up_to_delimiter("\n"sv.bytes())) || m_helper.is_eof_with_data_left_over(); } - ErrorOr read_until(Bytes buffer, StringView candidate) { return m_helper.read_until(move(buffer), move(candidate)); } + ErrorOr read_until(Bytes buffer, StringView candidate) { return m_helper.read_until(buffer, candidate); } template - ErrorOr read_until_any_of(Bytes buffer, Array candidates) { return m_helper.read_until_any_of(move(buffer), move(candidates)); } + ErrorOr read_until_any_of(Bytes buffer, Array candidates) { return m_helper.read_until_any_of(buffer, move(candidates)); } ErrorOr can_read_up_to_delimiter(ReadonlyBytes delimiter) { return m_helper.can_read_up_to_delimiter(delimiter); } // Methods for reading stream into an auto-adjusting buffer ErrorOr read_line_with_resize(ByteBuffer& buffer) { return m_helper.read_line_with_resize(buffer); } - ErrorOr read_until_with_resize(ByteBuffer& buffer, StringView candidate) { return m_helper.read_until_with_resize(move(buffer), move(candidate)); } + ErrorOr read_until_with_resize(ByteBuffer& buffer, StringView candidate) { return m_helper.read_until_with_resize(buffer, candidate); } template - ErrorOr read_until_any_of_with_resize(ByteBuffer& buffer, Array candidates) { return m_helper.read_until_any_of_with_resize(move(buffer), move(candidates)); } + ErrorOr read_until_any_of_with_resize(ByteBuffer& buffer, Array candidates) { return m_helper.read_until_any_of_with_resize(buffer, move(candidates)); } size_t buffer_size() const { return m_helper.buffer_size(); }