diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-03-01 17:24:50 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-13 15:16:20 +0000 |
commit | ae51c1821c0d32ba40b866d8e5561f6de3359b17 (patch) | |
tree | 6bd2d0964841bf5bd56797ad4a887e8e4e3ac63c /Userland | |
parent | 26516ee1601b0662bb1753f834a179bf1a20082d (diff) | |
download | serenity-ae51c1821c0d32ba40b866d8e5561f6de3359b17.zip |
Everywhere: Remove unintentional partial stream reads and writes
Diffstat (limited to 'Userland')
41 files changed, 104 insertions, 182 deletions
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index d88d593742..ab39e65f9e 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -775,8 +775,7 @@ ErrorOr<void> BrowserWindow::take_screenshot(ScreenshotType type) auto encoded = TRY(Gfx::PNGWriter::encode(*bitmap.bitmap())); auto screenshot_file = TRY(Core::File::open(path.string(), Core::File::OpenMode::Write)); - // FIXME: This should write the entire span. - TRY(screenshot_file->write_some(encoded)); + TRY(screenshot_file->write_until_depleted(encoded)); return {}; } diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp index 551fa6b81d..435db8e5cf 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp @@ -50,8 +50,7 @@ ErrorOr<void> DomainListModel::save() TRY(builder.try_appendff("{}\n", domain)); auto file = TRY(Core::File::open(filter_list_file_path(), Core::File::OpenMode::Write)); - // FIXME: This should write the entire span. - TRY(file->write_some(TRY(builder.to_byte_buffer()).bytes())); + TRY(file->write_until_depleted(TRY(builder.to_byte_buffer()).bytes())); return {}; } diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index bf3c17b0b1..b6d7a5beaa 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -284,8 +284,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } auto byte_buffer = byte_buffer_or_error.release_value(); - // FIXME: This should write the entire span. - if (auto result = file->write_some(byte_buffer); result.is_error()) + if (auto result = file->write_until_depleted(byte_buffer); result.is_error()) GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", result.release_error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error); }; save_backtrace_button.set_enabled(false); diff --git a/Userland/Applications/HexEditor/HexDocument.cpp b/Userland/Applications/HexEditor/HexDocument.cpp index eddcc409f5..a350fd284a 100644 --- a/Userland/Applications/HexEditor/HexDocument.cpp +++ b/Userland/Applications/HexEditor/HexDocument.cpp @@ -62,12 +62,10 @@ void HexDocumentMemory::clear_changes() ErrorOr<void> HexDocumentMemory::write_to_file(Core::File& file) { TRY(file.seek(0, SeekMode::SetPosition)); - // FIXME: This should write the entire span. - TRY(file.write_some(m_buffer)); + TRY(file.write_until_depleted(m_buffer)); for (auto& change : m_changes) { TRY(file.seek(change.key, SeekMode::SetPosition)); - // FIXME: This should write the entire span. - TRY(file.write_some({ &change.value, 1 })); + TRY(file.write_until_depleted({ &change.value, 1 })); } return {}; } @@ -89,8 +87,7 @@ ErrorOr<void> HexDocumentFile::write_to_file() { for (auto& change : m_changes) { TRY(m_file->seek(change.key, SeekMode::SetPosition)); - // FIXME: This should write the entire span. - TRY(m_file->write_some({ &change.value, 1 })); + TRY(m_file->write_until_depleted({ &change.value, 1 })); } clear_changes(); // make sure the next get operation triggers a read @@ -110,14 +107,12 @@ ErrorOr<void> HexDocumentFile::write_to_file(Core::File& file) auto copy_buffer = TRY(m_file->read_some(buffer)); if (copy_buffer.size() == 0) break; - // FIXME: This should write the entire span. - TRY(file.write_some(copy_buffer)); + TRY(file.write_until_depleted(copy_buffer)); } for (auto& change : m_changes) { TRY(file.seek(change.key, SeekMode::SetPosition)); - // FIXME: This should write the entire span. - TRY(file.write_some({ &change.value, 1 })); + TRY(file.write_until_depleted({ &change.value, 1 })); } return {}; diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 3695aadfc8..849494b414 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -191,8 +191,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename) // Write to file. DeprecatedString file_content = map_json.to_deprecated_string(); auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Write)); - // FIXME: This should write the entire span. - TRY(file->write_some(file_content.bytes())); + TRY(file->write_until_depleted(file_content.bytes())); file->close(); window()->set_modified(false); diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index bd4664d13d..7f8273546f 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -73,8 +73,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) filename = path.basename(); auto encoded = TRY(dump_bitmap(magnifier->current_bitmap(), path.extension())); - // FIXME: This should write the entire span. - TRY(file->write_some(encoded)); + TRY(file->write_until_depleted(encoded)); return {}; }; diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index 252c2a6a1a..f97f90dae2 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -187,8 +187,7 @@ ErrorOr<void> RunWindow::save_history() // Write the first 25 items of history for (int i = 0; i < min(static_cast<int>(m_path_history.size()), 25); i++) - // FIXME: This should write the entire span. - TRY(file->write_some(DeprecatedString::formatted("{}\n", m_path_history[i]).bytes())); + TRY(file->write_until_depleted(DeprecatedString::formatted("{}\n", m_path_history[i]).bytes())); return {}; } diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index 2c5ecc5409..753bb91f66 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -632,25 +632,24 @@ ErrorOr<void> ChessWidget::import_pgn(Core::File& file) ErrorOr<void> ChessWidget::export_pgn(Core::File& file) const { // Tag Pair Section - // FIXME: This should write the entire span. - TRY(file.write_some("[Event \"Casual Game\"]\n"sv.bytes())); - TRY(file.write_some("[Site \"SerenityOS Chess\"]\n"sv.bytes())); - TRY(file.write_some(DeprecatedString::formatted("[Date \"{}\"]\n", Core::DateTime::now().to_deprecated_string("%Y.%m.%d"sv)).bytes())); - TRY(file.write_some("[Round \"1\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[Event \"Casual Game\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[Site \"SerenityOS Chess\"]\n"sv.bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("[Date \"{}\"]\n", Core::DateTime::now().to_deprecated_string("%Y.%m.%d"sv)).bytes())); + TRY(file.write_until_depleted("[Round \"1\"]\n"sv.bytes())); DeprecatedString username(getlogin()); auto const player1 = (!username.is_empty() ? username.view() : "?"sv.bytes()); auto const player2 = (!m_engine.is_null() ? "SerenityOS ChessEngine"sv.bytes() : "?"sv.bytes()); - TRY(file.write_some(DeprecatedString::formatted("[White \"{}\"]\n", m_side == Chess::Color::White ? player1 : player2).bytes())); - TRY(file.write_some(DeprecatedString::formatted("[Black \"{}\"]\n", m_side == Chess::Color::Black ? player1 : player2).bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("[White \"{}\"]\n", m_side == Chess::Color::White ? player1 : player2).bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("[Black \"{}\"]\n", m_side == Chess::Color::Black ? player1 : player2).bytes())); - TRY(file.write_some(DeprecatedString::formatted("[Result \"{}\"]\n", Chess::Board::result_to_points_string(m_board.game_result(), m_board.turn())).bytes())); - TRY(file.write_some("[WhiteElo \"?\"]\n"sv.bytes())); - TRY(file.write_some("[BlackElo \"?\"]\n"sv.bytes())); - TRY(file.write_some("[Variant \"Standard\"]\n"sv.bytes())); - TRY(file.write_some("[TimeControl \"-\"]\n"sv.bytes())); - TRY(file.write_some("[Annotator \"SerenityOS Chess\"]\n"sv.bytes())); - TRY(file.write_some("\n"sv.bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("[Result \"{}\"]\n", Chess::Board::result_to_points_string(m_board.game_result(), m_board.turn())).bytes())); + TRY(file.write_until_depleted("[WhiteElo \"?\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[BlackElo \"?\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[Variant \"Standard\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[TimeControl \"-\"]\n"sv.bytes())); + TRY(file.write_until_depleted("[Annotator \"SerenityOS Chess\"]\n"sv.bytes())); + TRY(file.write_until_depleted("\n"sv.bytes())); // Movetext Section for (size_t i = 0, move_no = 1; i < m_board.moves().size(); i += 2, move_no++) { @@ -658,17 +657,17 @@ ErrorOr<void> ChessWidget::export_pgn(Core::File& file) const if (i + 1 < m_board.moves().size()) { const DeprecatedString black = m_board.moves().at(i + 1).to_algebraic(); - TRY(file.write_some(DeprecatedString::formatted("{}. {} {} ", move_no, white, black).bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("{}. {} {} ", move_no, white, black).bytes())); } else { - TRY(file.write_some(DeprecatedString::formatted("{}. {} ", move_no, white).bytes())); + TRY(file.write_until_depleted(DeprecatedString::formatted("{}. {} ", move_no, white).bytes())); } } - TRY(file.write_some("{ "sv.bytes())); - TRY(file.write_some(Chess::Board::result_to_string(m_board.game_result(), m_board.turn()).bytes())); - TRY(file.write_some(" } "sv.bytes())); - TRY(file.write_some(Chess::Board::result_to_points_string(m_board.game_result(), m_board.turn()).bytes())); - TRY(file.write_some("\n"sv.bytes())); + TRY(file.write_until_depleted("{ "sv.bytes())); + TRY(file.write_until_depleted(Chess::Board::result_to_string(m_board.game_result(), m_board.turn()).bytes())); + TRY(file.write_until_depleted(" } "sv.bytes())); + TRY(file.write_until_depleted(Chess::Board::result_to_points_string(m_board.game_result(), m_board.turn()).bytes())); + TRY(file.write_until_depleted("\n"sv.bytes())); return {}; } diff --git a/Userland/Libraries/LibAudio/MP3Loader.cpp b/Userland/Libraries/LibAudio/MP3Loader.cpp index 3a5274f649..ffdb8e5508 100644 --- a/Userland/Libraries/LibAudio/MP3Loader.cpp +++ b/Userland/Libraries/LibAudio/MP3Loader.cpp @@ -233,9 +233,7 @@ ErrorOr<MP3::MP3Frame, LoaderError> MP3LoaderPlugin::read_frame_data(MP3::Header size_t old_reservoir_size = m_bit_reservoir.used_buffer_size(); LOADER_TRY(m_bitstream->read_until_filled(buffer)); - // FIXME: This should write the entire span. - if (LOADER_TRY(m_bit_reservoir.write_some(buffer)) != header.slot_count) - return LoaderError { LoaderError::Category::IO, m_loaded_samples, "Could not write frame into bit reservoir." }; + LOADER_TRY(m_bit_reservoir.write_until_depleted(buffer)); // If we don't have enough data in the reservoir to process this frame, skip it (but keep the data). if (old_reservoir_size < static_cast<size_t>(frame.main_data_begin)) diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp index e7a8494305..8660163951 100644 --- a/Userland/Libraries/LibCompress/Deflate.cpp +++ b/Userland/Libraries/LibCompress/Deflate.cpp @@ -225,10 +225,8 @@ ErrorOr<Bytes> DeflateDecompressor::read_some(Bytes bytes) if (block_type == 0b00) { m_input_stream->align_to_byte_boundary(); - // FIXME: This should read the entire span. - LittleEndian<u16> length, negated_length; - TRY(m_input_stream->read_some(length.bytes())); - TRY(m_input_stream->read_some(negated_length.bytes())); + u16 length = TRY(m_input_stream->read_value<LittleEndian<u16>>()); + u16 negated_length = TRY(m_input_stream->read_value<LittleEndian<u16>>()); if ((length ^ 0xffff) != negated_length) return Error::from_string_literal("Calculated negated length does not equal stored negated length"); diff --git a/Userland/Libraries/LibCompress/Gzip.cpp b/Userland/Libraries/LibCompress/Gzip.cpp index c5abab5657..fce7a5fc09 100644 --- a/Userland/Libraries/LibCompress/Gzip.cpp +++ b/Userland/Libraries/LibCompress/Gzip.cpp @@ -75,10 +75,8 @@ ErrorOr<Bytes> GzipDecompressor::read_some(Bytes bytes) current_member().m_nread += current_slice.size(); if (current_slice.size() < slice.size()) { - // FIXME: This should read the entire span. - LittleEndian<u32> crc32, input_size; - TRY(m_input_stream->read_some(crc32.bytes())); - TRY(m_input_stream->read_some(input_size.bytes())); + u32 crc32 = TRY(m_input_stream->read_value<LittleEndian<u32>>()); + u32 input_size = TRY(m_input_stream->read_value<LittleEndian<u32>>()); if (crc32 != current_member().m_checksum.digest()) return Error::from_string_literal("Stored CRC32 does not match the calculated CRC32 of the current member"); @@ -116,18 +114,16 @@ ErrorOr<Bytes> GzipDecompressor::read_some(Bytes bytes) return Error::from_string_literal("Header is not supported by implementation"); if (header.flags & Flags::FEXTRA) { - // FIXME: This should read the entire span. - LittleEndian<u16> subfield_id, length; - TRY(m_input_stream->read_some(subfield_id.bytes())); - TRY(m_input_stream->read_some(length.bytes())); + u16 subfield_id = TRY(m_input_stream->read_value<LittleEndian<u16>>()); + u16 length = TRY(m_input_stream->read_value<LittleEndian<u16>>()); TRY(m_input_stream->discard(length)); + (void)subfield_id; } auto discard_string = [&]() -> ErrorOr<void> { char next_char; do { - // FIXME: This should read the entire span. - TRY(m_input_stream->read_some({ &next_char, sizeof(next_char) })); + next_char = TRY(m_input_stream->read_value<char>()); } while (next_char); return {}; @@ -140,10 +136,9 @@ ErrorOr<Bytes> GzipDecompressor::read_some(Bytes bytes) TRY(discard_string()); if (header.flags & Flags::FHCRC) { - // FIXME: This should read the entire span. - LittleEndian<u16> crc16; - TRY(m_input_stream->read_some(crc16.bytes())); + u16 crc = TRY(m_input_stream->read_value<LittleEndian<u16>>()); // FIXME: we should probably verify this instead of just assuming it matches + (void)crc; } m_current_member = TRY(Member::construct(header, *m_input_stream)); diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index ccf30ec89a..91f8413460 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -113,8 +113,7 @@ ErrorOr<void> ZlibCompressor::write_header(ZlibCompressionMethod compression_met // FIXME: Support pre-defined dictionaries. - // FIXME: This should write the entire span. - TRY(m_output_stream->write_some(header.as_u16.bytes())); + TRY(m_output_stream->write_until_depleted(header.as_u16.bytes())); return {}; } @@ -155,8 +154,7 @@ ErrorOr<void> ZlibCompressor::finish() TRY(static_cast<DeflateCompressor*>(m_compressor.ptr())->final_flush()); NetworkOrdered<u32> adler_sum = m_adler32_checksum.digest(); - // FIXME: This should write the entire span. - TRY(m_output_stream->write_some(adler_sum.bytes())); + TRY(m_output_stream->write_value(adler_sum)); m_finished = true; diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index faa333a225..a302fd9b46 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -179,11 +179,10 @@ ErrorOr<void> ConfigFile::sync() TRY(m_file->seek(0, SeekMode::SetPosition)); for (auto& it : m_groups) { - // FIXME: This should write the entire span. - TRY(m_file->write_some(DeprecatedString::formatted("[{}]\n", it.key).bytes())); + TRY(m_file->write_until_depleted(DeprecatedString::formatted("[{}]\n", it.key).bytes())); for (auto& jt : it.value) - TRY(m_file->write_some(DeprecatedString::formatted("{}={}\n", jt.key, jt.value).bytes())); - TRY(m_file->write_some("\n"sv.bytes())); + TRY(m_file->write_until_depleted(DeprecatedString::formatted("{}={}\n", jt.key, jt.value).bytes())); + TRY(m_file->write_until_depleted("\n"sv.bytes())); } m_dirty = false; diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index b5a0c98521..149360e181 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -221,9 +221,7 @@ public: auto bytes_to_send = serialized.bytes(); u32 length = bytes_to_send.size(); // FIXME: Propagate errors - // FIXME: This should write the entire span. - auto sent = MUST(m_socket->write_some({ (u8 const*)&length, sizeof(length) })); - VERIFY(sent == sizeof(length)); + MUST(m_socket->write_value(length)); while (!bytes_to_send.is_empty()) { size_t bytes_sent = MUST(m_socket->write_some(bytes_to_send)); bytes_to_send = bytes_to_send.slice(bytes_sent); diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 74482ed7bb..8a9cf9ee86 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -1593,9 +1593,8 @@ ErrorOr<void> TextEditor::write_to_file(Core::File& file) // A size 0 file doesn't need a data copy. } else { for (size_t i = 0; i < line_count(); ++i) { - // FIXME: This should write the entire span. - TRY(file.write_some(line(i).to_utf8().bytes())); - TRY(file.write_some("\n"sv.bytes())); + TRY(file.write_until_depleted(line(i).to_utf8().bytes())); + TRY(file.write_until_depleted("\n"sv.bytes())); } } document().set_unmodified(); diff --git a/Userland/Libraries/LibIMAP/Client.cpp b/Userland/Libraries/LibIMAP/Client.cpp index e952e73ca9..753af26ad9 100644 --- a/Userland/Libraries/LibIMAP/Client.cpp +++ b/Userland/Libraries/LibIMAP/Client.cpp @@ -60,8 +60,7 @@ ErrorOr<void> Client::on_ready_to_receive() auto pending_bytes = TRY(m_socket->pending_bytes()); auto receive_buffer = TRY(m_buffer.get_bytes_for_writing(pending_bytes)); - // FIXME: This should read the entire span. - TRY(m_socket->read_some(receive_buffer)); + TRY(m_socket->read_until_filled(receive_buffer)); // Once we get server hello we can start sending. if (m_connect_pending) { @@ -146,9 +145,8 @@ static ReadonlyBytes command_byte_buffer(CommandType command) ErrorOr<void> Client::send_raw(StringView data) { - // FIXME: This should write the entire span. - TRY(m_socket->write_some(data.bytes())); - TRY(m_socket->write_some("\r\n"sv.bytes())); + TRY(m_socket->write_until_depleted(data.bytes())); + TRY(m_socket->write_until_depleted("\r\n"sv.bytes())); return {}; } diff --git a/Userland/Libraries/LibJS/Console.cpp b/Userland/Libraries/LibJS/Console.cpp index cc3af07d97..c977452cc2 100644 --- a/Userland/Libraries/LibJS/Console.cpp +++ b/Userland/Libraries/LibJS/Console.cpp @@ -680,8 +680,7 @@ ThrowCompletionOr<String> ConsoleClient::generically_format_values(MarkedVector< bool first = true; for (auto const& value : values) { if (!first) - // FIXME: This should write the entire span. - TRY_OR_THROW_OOM(vm, stream.write_some(" "sv.bytes())); + TRY_OR_THROW_OOM(vm, stream.write_until_depleted(" "sv.bytes())); TRY_OR_THROW_OOM(vm, JS::print(value, ctx)); first = false; } diff --git a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp index 98833292f0..fbb8a552ff 100644 --- a/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp +++ b/Userland/Libraries/LibLine/XtermSuggestionDisplay.cpp @@ -51,8 +51,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager) // the suggestion list to fit in the prompt line. auto start = max_line_count - m_prompt_lines_at_suggestion_initiation; for (size_t i = start; i < max_line_count; ++i) - // FIXME: This should write the entire span. - TRY(stderr_stream->write_some("\n"sv.bytes())); + TRY(stderr_stream->write_until_depleted("\n"sv.bytes())); lines_used += max_line_count; longest_suggestion_length = 0; } @@ -100,8 +99,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager) if (next_column > m_num_columns) { auto lines = (suggestion.text_view.length() + m_num_columns - 1) / m_num_columns; lines_used += lines; - // FIXME: This should write the entire span. - TRY(stderr_stream->write_some("\n"sv.bytes())); + TRY(stderr_stream->write_until_depleted("\n"sv.bytes())); num_printed = 0; } @@ -117,13 +115,11 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager) if (spans_entire_line) { num_printed += m_num_columns; - // FIXME: This should write the entire span. - TRY(stderr_stream->write_some(suggestion.text_string.bytes())); - TRY(stderr_stream->write_some(suggestion.display_trivia_string.bytes())); + TRY(stderr_stream->write_until_depleted(suggestion.text_string.bytes())); + TRY(stderr_stream->write_until_depleted(suggestion.display_trivia_string.bytes())); } else { auto field = DeprecatedString::formatted("{: <{}} {}", suggestion.text_string, longest_suggestion_byte_length_without_trivia, suggestion.display_trivia_string); - // FIXME: This should write the entire span. - TRY(stderr_stream->write_some(DeprecatedString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes())); + TRY(stderr_stream->write_until_depleted(DeprecatedString::formatted("{: <{}}", field, longest_suggestion_byte_length + 2).bytes())); num_printed += longest_suggestion_length + 2; } @@ -154,8 +150,7 @@ ErrorOr<void> XtermSuggestionDisplay::display(SuggestionManager const& manager) TRY(VT::move_absolute(m_origin_row + lines_used, m_num_columns - string.length() - 1, *stderr_stream)); TRY(VT::apply_style({ Style::Background(Style::XtermColor::Green) }, *stderr_stream)); - // FIXME: This should write the entire span. - TRY(stderr_stream->write_some(string.bytes())); + TRY(stderr_stream->write_until_depleted(string.bytes())); TRY(VT::apply_style(Style::reset_style(), *stderr_stream)); } diff --git a/Userland/Libraries/LibSQL/SQLClient.cpp b/Userland/Libraries/LibSQL/SQLClient.cpp index 44e11cdd90..db9455b83e 100644 --- a/Userland/Libraries/LibSQL/SQLClient.cpp +++ b/Userland/Libraries/LibSQL/SQLClient.cpp @@ -67,8 +67,7 @@ static ErrorOr<void> launch_server(DeprecatedString const& socket_path, Deprecat if (server_pid != 0) { auto server_pid_file = TRY(Core::File::open(pid_path, Core::File::OpenMode::Write)); - // FIXME: This should write the entire span. - TRY(server_pid_file->write_some(DeprecatedString::number(server_pid).bytes())); + TRY(server_pid_file->write_until_depleted(DeprecatedString::number(server_pid).bytes())); TRY(Core::System::kill(getpid(), SIGTERM)); } diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index fd944a90c9..738172ef54 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -220,8 +220,7 @@ inline ByteBuffer load_entire_file(StringView path) auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read)); auto file_size = TRY(file->size()); auto content = TRY(ByteBuffer::create_uninitialized(file_size)); - // FIXME: This should read the entire span. - TRY(file->read_some(content.bytes())); + TRY(file->read_until_filled(content.bytes())); return content; }; diff --git a/Userland/Libraries/LibWeb/WebDriver/Client.cpp b/Userland/Libraries/LibWeb/WebDriver/Client.cpp index 99b645bb65..6161e8b61f 100644 --- a/Userland/Libraries/LibWeb/WebDriver/Client.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/Client.cpp @@ -279,8 +279,7 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue resu builder.append("\r\n"sv); auto builder_contents = TRY(builder.to_byte_buffer()); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(builder_contents)); + TRY(m_socket->write_until_depleted(builder_contents)); while (!content.is_empty()) { auto bytes_sent = TRY(m_socket->write_some(content.bytes())); @@ -320,9 +319,8 @@ ErrorOr<void, Client::WrappedError> Client::send_error_response(Error const& err header_builder.appendff("Content-Length: {}\r\n", content_builder.length()); header_builder.append("\r\n"sv); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(TRY(header_builder.to_byte_buffer()))); - TRY(m_socket->write_some(TRY(content_builder.to_byte_buffer()))); + TRY(m_socket->write_until_depleted(TRY(header_builder.to_byte_buffer()))); + TRY(m_socket->write_until_depleted(TRY(content_builder.to_byte_buffer()))); log_response(error.http_status); return {}; diff --git a/Userland/Services/EchoServer/Client.cpp b/Userland/Services/EchoServer/Client.cpp index ba382cedbd..4b028e2e6e 100644 --- a/Userland/Services/EchoServer/Client.cpp +++ b/Userland/Services/EchoServer/Client.cpp @@ -40,8 +40,7 @@ ErrorOr<void> Client::drain_socket() break; } - // FIXME: This should write the entire span. - TRY(m_socket->write_some(bytes_read)); + TRY(m_socket->write_until_depleted(bytes_read)); } return {}; diff --git a/Userland/Services/FileOperation/main.cpp b/Userland/Services/FileOperation/main.cpp index 69dbbfa3c7..a8d5f61d2d 100644 --- a/Userland/Services/FileOperation/main.cpp +++ b/Userland/Services/FileOperation/main.cpp @@ -240,8 +240,7 @@ ErrorOr<int> execute_work_items(Vector<WorkItem> const& items) auto bytes_read = TRY(source_file->read_some(buffer.bytes())); if (bytes_read.is_empty()) break; - // FIXME: This should write the entire span. - if (auto result = destination_file->write_some(bytes_read); result.is_error()) { + if (auto result = destination_file->write_until_depleted(bytes_read); result.is_error()) { // FIXME: Return the formatted string directly. There is no way to do this right now without the temporary going out of scope and being destroyed. report_warning(DeprecatedString::formatted("Failed to write to destination file: {}", result.error())); return result.release_error(); diff --git a/Userland/Services/InspectorServer/InspectableProcess.cpp b/Userland/Services/InspectorServer/InspectableProcess.cpp index dececc1e0c..89e8b66755 100644 --- a/Userland/Services/InspectorServer/InspectableProcess.cpp +++ b/Userland/Services/InspectorServer/InspectableProcess.cpp @@ -26,9 +26,8 @@ InspectableProcess::InspectableProcess(pid_t pid, NonnullOwnPtr<Core::LocalSocke MUST(m_socket->set_blocking(true)); m_socket->on_ready_to_read = [this] { - char c; - // FIXME: This should read the entire span. - [[maybe_unused]] auto buffer = m_socket->read_some({ &c, 1 }); + [[maybe_unused]] auto c = m_socket->read_value<char>().release_value_but_fixme_should_propagate_errors(); + if (m_socket->is_eof()) { Core::deferred_invoke([pid = this->m_pid] { g_processes.remove(pid); }); return; @@ -44,14 +43,7 @@ DeprecatedString InspectableProcess::wait_for_response() return {}; } - u32 length {}; - // FIXME: This should read the entire span. - auto length_bytes_read = m_socket->read_some({ (u8*)&length, sizeof(length) }).release_value_but_fixme_should_propagate_errors(); - if (length_bytes_read.size() != sizeof(length)) { - dbgln("InspectableProcess got malformed data: PID {}", m_pid); - m_socket->close(); - return {}; - } + auto length = m_socket->read_value<u32>().release_value_but_fixme_should_propagate_errors(); auto data_buffer = ByteBuffer::create_uninitialized(length).release_value_but_fixme_should_propagate_errors(); auto remaining_data_buffer = data_buffer.bytes(); @@ -82,9 +74,8 @@ void InspectableProcess::send_request(JsonObject const& request) u32 length = serialized.length(); // FIXME: Propagate errors - // FIXME: This should write the entire span. - MUST(m_socket->write_some({ (u8 const*)&length, sizeof(length) })); - MUST(m_socket->write_some(serialized.bytes())); + MUST(m_socket->write_value(length)); + MUST(m_socket->write_until_depleted(serialized.bytes())); } } diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index c93f6b4992..17dfc2ed45 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -239,8 +239,7 @@ ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, DeprecatedString auto udp_socket = TRY(Core::UDPSocket::connect(nameserver, 53, Time::from_seconds(1))); TRY(udp_socket->set_blocking(true)); - // FIXME: This should write the entire span. - TRY(udp_socket->write_some(buffer)); + TRY(udp_socket->write_until_depleted(buffer)); u8 response_buffer[4096]; int nrecv = TRY(udp_socket->read_some({ response_buffer, sizeof(response_buffer) })).size(); diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index 4f0db9fc1a..f4d5d0e28b 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -161,8 +161,7 @@ ErrorOr<void> Client::send_data(StringView data) } if (fast) { - // FIXME: This should write the entire span. - TRY(m_socket->write_some({ data.characters_without_null_termination(), data.length() })); + TRY(m_socket->write_until_depleted({ data.characters_without_null_termination(), data.length() })); return {}; } @@ -184,8 +183,7 @@ ErrorOr<void> Client::send_data(StringView data) } auto builder_contents = TRY(builder.to_byte_buffer()); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(builder_contents)); + TRY(m_socket->write_until_depleted(builder_contents)); return {}; } @@ -206,8 +204,7 @@ ErrorOr<void> Client::send_commands(Vector<Command> commands) } VERIFY(TRY(stream.tell()) == buffer.size()); - // FIXME: This should write the entire span. - TRY(m_socket->write_some({ buffer.data(), buffer.size() })); + TRY(m_socket->write_until_depleted({ buffer.data(), buffer.size() })); return {}; } diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index 571b09da0b..43b40da3e0 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -192,8 +192,7 @@ ErrorOr<void> Client::send_response(Stream& response, HTTP::HttpRequest const& r builder.append("\r\n"sv); auto builder_contents = TRY(builder.to_byte_buffer()); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(builder_contents)); + TRY(m_socket->write_until_depleted(builder_contents)); log_response(200, request); char buffer[PAGE_SIZE]; @@ -235,8 +234,7 @@ ErrorOr<void> Client::send_redirect(StringView redirect_path, HTTP::HttpRequest builder.append("\r\n"sv); auto builder_contents = TRY(builder.to_byte_buffer()); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(builder_contents)); + TRY(m_socket->write_until_depleted(builder_contents)); log_response(301, request); return {}; @@ -365,9 +363,8 @@ ErrorOr<void> Client::send_error_response(unsigned code, HTTP::HttpRequest const header_builder.append("Content-Type: text/html; charset=UTF-8\r\n"sv); header_builder.appendff("Content-Length: {}\r\n", content_builder.length()); header_builder.append("\r\n"sv); - // FIXME: This should write the entire span. - TRY(m_socket->write_some(TRY(header_builder.to_byte_buffer()))); - TRY(m_socket->write_some(TRY(content_builder.to_byte_buffer()))); + TRY(m_socket->write_until_depleted(TRY(header_builder.to_byte_buffer()))); + TRY(m_socket->write_until_depleted(TRY(content_builder.to_byte_buffer()))); log_response(code, request); return {}; diff --git a/Userland/Utilities/gml-format.cpp b/Userland/Utilities/gml-format.cpp index 465573d722..49ef4a4898 100644 --- a/Userland/Utilities/gml-format.cpp +++ b/Userland/Utilities/gml-format.cpp @@ -28,8 +28,7 @@ static ErrorOr<bool> format_file(StringView path, bool inplace) return true; TRY(file->seek(0, SeekMode::SetPosition)); TRY(file->truncate(0)); - // FIXME: This should write the entire span. - TRY(file->write_some(formatted_gml.bytes())); + TRY(file->write_until_depleted(formatted_gml.bytes())); } else { out("{}", formatted_gml); } diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 7453120887..0eb070c1fb 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -174,8 +174,7 @@ static ErrorOr<NonnullRefPtr<Core::Timer>> load_page_for_screenshot_and_exit(Cor auto output_file = MUST(Core::File::open(output_file_path, Core::File::OpenMode::Write)); auto image_buffer = MUST(Gfx::PNGWriter::encode(*screenshot)); - // FIXME: This should write the entire buffer. - MUST(output_file->write_some(image_buffer.bytes())); + MUST(output_file->write_until_depleted(image_buffer.bytes())); } else { warnln("No screenshot available"); } diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index db9fae8d59..48a446965b 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -188,8 +188,7 @@ static ErrorOr<void> write_to_file(String const& path) for (size_t i = 0; i < g_repl_statements.size(); i++) { auto line = g_repl_statements[i].bytes(); if (line.size() > 0 && i != g_repl_statements.size() - 1) { - // FIXME: This should write the entire span. - TRY(file->write_some(line)); + TRY(file->write_until_depleted(line)); } if (i != g_repl_statements.size() - 1) { TRY(file->write_value('\n')); diff --git a/Userland/Utilities/nc.cpp b/Userland/Utilities/nc.cpp index 858bbed77d..7ea01aeccd 100644 --- a/Userland/Utilities/nc.cpp +++ b/Userland/Utilities/nc.cpp @@ -82,8 +82,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto nread = TRY(Core::System::read(STDIN_FILENO, buffer_span)); buffer_span = buffer_span.trim(nread); - // FIXME: This should write the entire span. - TRY(socket->write_some({ buffer_span.data(), static_cast<size_t>(nread) })); + TRY(socket->write_until_depleted({ buffer_span.data(), static_cast<size_t>(nread) })); } } diff --git a/Userland/Utilities/reboot.cpp b/Userland/Utilities/reboot.cpp index 462e2e0111..3210d556b5 100644 --- a/Userland/Utilities/reboot.cpp +++ b/Userland/Utilities/reboot.cpp @@ -14,8 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments) auto file = TRY(Core::File::open("/sys/kernel/power_state"sv, Core::File::OpenMode::Write)); const DeprecatedString file_contents = "1"; - // FIXME: This should write the entire span. - TRY(file->write_some(file_contents.bytes())); + TRY(file->write_until_depleted(file_contents.bytes())); file->close(); return 0; diff --git a/Userland/Utilities/sed.cpp b/Userland/Utilities/sed.cpp index a978896bc7..8ecf6540aa 100644 --- a/Userland/Utilities/sed.cpp +++ b/Userland/Utilities/sed.cpp @@ -141,9 +141,8 @@ ErrorOr<int> serenity_main(Main::Arguments args) if (maybe_output_file.has_value()) { auto const& output_file = maybe_output_file.value(); - // FIXME: This should write the entire span. - TRY(output_file->write_some(result.bytes())); - TRY(output_file->write_some("\n"sv.bytes())); + TRY(output_file->write_until_depleted(result.bytes())); + TRY(output_file->write_until_depleted("\n"sv.bytes())); } } } diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 78e3c4db83..c168f9d583 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -167,8 +167,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } auto& file = *file_or_error.value(); - // FIXME: This should write the entire span. - TRY(file.write_some(encoded_bitmap.bytes())); + TRY(file.write_until_depleted(encoded_bitmap.bytes())); if (edit_image) TRY(Core::Process::spawn("/bin/PixelPaint"sv, Array { output_path })); diff --git a/Userland/Utilities/shutdown.cpp b/Userland/Utilities/shutdown.cpp index 2547de06a5..c4cbfdfbcf 100644 --- a/Userland/Utilities/shutdown.cpp +++ b/Userland/Utilities/shutdown.cpp @@ -18,8 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments) auto file = TRY(Core::File::open("/sys/kernel/power_state"sv, Core::File::OpenMode::Write)); const DeprecatedString file_contents = "2"; - // FIXME: This should write the entire span. - TRY(file->write_some(file_contents.bytes())); + TRY(file->write_until_depleted(file_contents.bytes())); file->close(); return 0; diff --git a/Userland/Utilities/strace.cpp b/Userland/Utilities/strace.cpp index e1afa0e22b..b026cac11b 100644 --- a/Userland/Utilities/strace.cpp +++ b/Userland/Utilities/strace.cpp @@ -932,7 +932,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) FormattedSyscallBuilder builder(syscall_name); TRY(format_syscall(builder, syscall_function, arg1, arg2, arg3, res)); - // FIXME: This should write the entire span. - TRY(trace_file->write_some(builder.string_view().bytes())); + TRY(trace_file->write_until_depleted(builder.string_view().bytes())); } } diff --git a/Userland/Utilities/sysctl.cpp b/Userland/Utilities/sysctl.cpp index 90d587ed6c..33883dc187 100644 --- a/Userland/Utilities/sysctl.cpp +++ b/Userland/Utilities/sysctl.cpp @@ -48,8 +48,7 @@ static bool write_variable(StringView name, StringView value) warnln("Failed to open {}: {}", path, file.error()); return false; } - // FIXME: This should write the entire span. - if (auto result = file.value()->write_some(value.bytes()); result.is_error()) { + if (auto result = file.value()->write_until_depleted(value.bytes()); result.is_error()) { warnln("Failed to write {}: {}", path, result.error()); return false; } diff --git a/Userland/Utilities/tail.cpp b/Userland/Utilities/tail.cpp index 3e73b69cd4..6f89a84ed3 100644 --- a/Userland/Utilities/tail.cpp +++ b/Userland/Utilities/tail.cpp @@ -34,10 +34,8 @@ static ErrorOr<off_t> find_seek_pos(Core::File& file, int wanted_lines) if (file.is_eof()) break; - Array<u8, 1> buffer; - // FIXME: This should read the entire span. - auto ch = TRY(file.read_some(buffer)); - if (*ch.data() == '\n' && (end - pos) > 1) { + auto ch = TRY(file.read_value<u8>()); + if (ch == '\n' && (end - pos) > 1) { lines++; if (lines == wanted_lines) break; diff --git a/Userland/Utilities/uniq.cpp b/Userland/Utilities/uniq.cpp index 7253c5924d..f7609da2ca 100644 --- a/Userland/Utilities/uniq.cpp +++ b/Userland/Utilities/uniq.cpp @@ -17,11 +17,10 @@ static ErrorOr<void> write_line_content(StringView line, size_t count, bool dupl if (duplicates_only && count <= 1) return {}; - // FIXME: This should write the entire span. if (print_count) - TRY(outfile.write_some(DeprecatedString::formatted("{} {}\n", count, line).bytes())); + TRY(outfile.write_until_depleted(DeprecatedString::formatted("{} {}\n", count, line).bytes())); else - TRY(outfile.write_some(DeprecatedString::formatted("{}\n", line).bytes())); + TRY(outfile.write_until_depleted(DeprecatedString::formatted("{}\n", line).bytes())); return {}; } diff --git a/Userland/Utilities/utmpupdate.cpp b/Userland/Utilities/utmpupdate.cpp index be2ec0334d..77d98b1f16 100644 --- a/Userland/Utilities/utmpupdate.cpp +++ b/Userland/Utilities/utmpupdate.cpp @@ -72,8 +72,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(file->seek(0, SeekMode::SetPosition)); TRY(file->truncate(0)); - // FIXME: This should write the entire span. - TRY(file->write_some(json.to_deprecated_string().bytes())); + TRY(file->write_until_depleted(json.to_deprecated_string().bytes())); return 0; } diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp index 1fb1f33066..2443fe4e07 100644 --- a/Userland/Utilities/wasm.cpp +++ b/Userland/Utilities/wasm.cpp @@ -53,14 +53,12 @@ static bool pre_interpret_hook(Wasm::Configuration& config, Wasm::InstructionPoi if (always_print_stack) config.dump_stack(); if (always_print_instruction) { - // FIXME: This should write the entire span. - g_stdout->write_some(DeprecatedString::formatted("{:0>4} ", ip.value()).bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(DeprecatedString::formatted("{:0>4} ", ip.value()).bytes()).release_value_but_fixme_should_propagate_errors(); g_printer->print(instr); } if (g_continue) return true; - // FIXME: This should write the entire span. - g_stdout->write_some(DeprecatedString::formatted("{:0>4} ", ip.value()).bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(DeprecatedString::formatted("{:0>4} ", ip.value()).bytes()).release_value_but_fixme_should_propagate_errors(); g_printer->print(instr); DeprecatedString last_command = ""; for (;;) { @@ -216,8 +214,7 @@ static bool pre_interpret_hook(Wasm::Configuration& config, Wasm::InstructionPoi if (!result.values().is_empty()) warnln("Returned:"); for (auto& value : result.values()) { - // FIXME: This should write the entire span. - g_stdout->write_some(" -> "sv.bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(" -> "sv.bytes()).release_value_but_fixme_should_propagate_errors(); g_printer->print(value); } } @@ -457,18 +454,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto print_func = [&](auto const& address) { Wasm::FunctionInstance* fn = machine.store().get(address); - // FIXME: This should write the entire span. - g_stdout->write_some(DeprecatedString::formatted("- Function with address {}, ptr = {}\n", address.value(), fn).bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(DeprecatedString::formatted("- Function with address {}, ptr = {}\n", address.value(), fn).bytes()).release_value_but_fixme_should_propagate_errors(); if (fn) { - // FIXME: This should write the entire span. - g_stdout->write_some(DeprecatedString::formatted(" wasm function? {}\n", fn->has<Wasm::WasmFunction>()).bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(DeprecatedString::formatted(" wasm function? {}\n", fn->has<Wasm::WasmFunction>()).bytes()).release_value_but_fixme_should_propagate_errors(); fn->visit( [&](Wasm::WasmFunction const& func) { Wasm::Printer printer { *g_stdout, 3 }; - // FIXME: This should write the entire span. - g_stdout->write_some(" type:\n"sv.bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(" type:\n"sv.bytes()).release_value_but_fixme_should_propagate_errors(); printer.print(func.type()); - g_stdout->write_some(" code:\n"sv.bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(" code:\n"sv.bytes()).release_value_but_fixme_should_propagate_errors(); printer.print(func.code()); }, [](Wasm::HostFunction const&) {}); @@ -532,8 +526,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (!result.values().is_empty()) warnln("Returned:"); for (auto& value : result.values()) { - // FIXME: This should write the entire span. - g_stdout->write_some(" -> "sv.bytes()).release_value_but_fixme_should_propagate_errors(); + g_stdout->write_until_depleted(" -> "sv.bytes()).release_value_but_fixme_should_propagate_errors(); g_printer->print(value); } } |