1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:07:44 +00:00

AK: Rename Stream::write_entire_buffer to Stream::write_until_depleted

No functional changes.
This commit is contained in:
Tim Schumacher 2023-03-01 15:37:45 +01:00 committed by Linus Groh
parent a3f73e7d85
commit ecd1862859
46 changed files with 141 additions and 141 deletions

View file

@ -29,7 +29,7 @@ TEST_CASE(allocating_memory_stream_empty)
TEST_CASE(allocating_memory_stream_offset_of)
{
AllocatingMemoryStream stream;
MUST(stream.write_entire_buffer("Well Hello Friends! :^)"sv.bytes()));
MUST(stream.write_until_depleted("Well Hello Friends! :^)"sv.bytes()));
{
auto offset = MUST(stream.offset_of(" "sv.bytes()));
@ -79,12 +79,12 @@ TEST_CASE(allocating_memory_stream_offset_of_oob)
// First, fill exactly one chunk.
for (size_t i = 0; i < 256; ++i)
MUST(stream.write_entire_buffer("AAAAAAAAAAAAAAAA"sv.bytes()));
MUST(stream.write_until_depleted("AAAAAAAAAAAAAAAA"sv.bytes()));
// Then discard it all.
MUST(stream.discard(4096));
// Now we can write into this chunk again, knowing that it's initialized to all 'A's.
MUST(stream.write_entire_buffer("Well Hello Friends! :^)"sv.bytes()));
MUST(stream.write_until_depleted("Well Hello Friends! :^)"sv.bytes()));
{
auto offset = MUST(stream.offset_of("A"sv.bytes()));

View file

@ -221,7 +221,7 @@ TEST_CASE(tcp_socket_write)
auto server_socket = maybe_server_socket.release_value();
EXPECT(!server_socket->set_blocking(true).is_error());
EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
EXPECT(!client_socket->write_until_depleted({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
client_socket->close();
auto maybe_receive_buffer = ByteBuffer::create_uninitialized(64);
@ -285,7 +285,7 @@ TEST_CASE(udp_socket_read_write)
auto client_socket = maybe_client_socket.release_value();
EXPECT(client_socket->is_open());
EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
EXPECT(!client_socket->write_until_depleted({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
// FIXME: UDPServer::receive sadly doesn't give us a way to block on it,
// currently.
@ -405,7 +405,7 @@ TEST_CASE(local_socket_write)
EXPECT(!maybe_client_socket.is_error());
auto client_socket = maybe_client_socket.release_value();
EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
EXPECT(!client_socket->write_until_depleted({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error());
client_socket->close();
return 0;

View file

@ -37,7 +37,7 @@ static void expect_bitmap_equals_reference(Gfx::Bitmap const& bitmap, StringView
auto target_path = LexicalPath("/home/anon").append(reference_filename);
auto qoi_buffer = MUST(Gfx::QOIWriter::encode(bitmap));
auto qoi_output_stream = MUST(Core::File::open(target_path.string(), Core::File::OpenMode::Write));
MUST(qoi_output_stream->write_entire_buffer(qoi_buffer));
MUST(qoi_output_stream->write_until_depleted(qoi_buffer));
}
auto reference_image_path = DeprecatedString::formatted(REFERENCE_IMAGE_DIR "/{}", reference_filename);

View file

@ -161,7 +161,7 @@ public:
}
for (DeprecatedString const& line : lines) {
if (m_output->write_entire_buffer(DeprecatedString::formatted("{}\n", line).bytes()).is_error())
if (m_output->write_until_depleted(DeprecatedString::formatted("{}\n", line).bytes()).is_error())
break;
}
@ -427,7 +427,7 @@ void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<Deprec
complete_results.set("duration", time_taken_in_ms / 1000.);
complete_results.set("results", result_object);
if (file->write_entire_buffer(complete_results.to_deprecated_string().bytes()).is_error())
if (file->write_until_depleted(complete_results.to_deprecated_string().bytes()).is_error())
warnln("Failed to write per-file");
file->close();
}

View file

@ -96,17 +96,17 @@ TEST_CASE(test_TLS_hello_handshake)
loop.quit(0);
};
if (tls->write_entire_buffer("GET / HTTP/1.1\r\nHost: "_b).is_error()) {
if (tls->write_until_depleted("GET / HTTP/1.1\r\nHost: "_b).is_error()) {
FAIL("write(0) failed");
return;
}
auto the_server = DEFAULT_SERVER;
if (tls->write_entire_buffer(the_server.bytes()).is_error()) {
if (tls->write_until_depleted(the_server.bytes()).is_error()) {
FAIL("write(1) failed");
return;
}
if (tls->write_entire_buffer("\r\nConnection : close\r\n\r\n"_b).is_error()) {
if (tls->write_until_depleted("\r\nConnection : close\r\n\r\n"_b).is_error()) {
FAIL("write(2) failed");
return;
}