diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-04-15 14:52:33 +0100 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-04-16 13:27:51 -0400 |
commit | d564cf1e8970275a52a1ef43debe4b1d14b2c063 (patch) | |
tree | dca303a1d92a9cfbe86912edb59fb902b3a74576 /Userland/Applications/FileManager | |
parent | c4134e97944538f34a5881954fb55431ea9da587 (diff) | |
download | serenity-d564cf1e8970275a52a1ef43debe4b1d14b2c063.zip |
LibCore+Everywhere: Make Core::Stream read_line() return StringView
Similar reasoning to making Core::Stream::read() return Bytes, except
that every user of read_line() creates a StringView from the result, so
let's just return one right away.
Diffstat (limited to 'Userland/Applications/FileManager')
-rw-r--r-- | Userland/Applications/FileManager/FileOperationProgressWidget.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 8df185d1dc..51532cad11 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -72,13 +72,13 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation m_notifier = Core::Notifier::construct(helper_pipe_fd, Core::Notifier::Read); m_notifier->on_ready_to_read = [this] { auto line_buffer = ByteBuffer::create_zeroed(1 * KiB).release_value_but_fixme_should_propagate_errors(); - auto line_length_or_error = m_helper_pipe->read_line(line_buffer.bytes()); - if (line_length_or_error.is_error() || line_length_or_error.value() == 0) { + auto line_or_error = m_helper_pipe->read_line(line_buffer.bytes()); + if (line_or_error.is_error() || line_or_error.value().is_empty()) { did_error("Read from pipe returned null."sv); return; } - StringView line { line_buffer.bytes().data(), line_length_or_error.value() }; + auto line = line_or_error.release_value(); auto parts = line.split_view(' '); VERIFY(!parts.is_empty()); |