summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-03-01 15:27:35 +0100
committerLinus Groh <mail@linusgroh.de>2023-03-13 15:16:20 +0000
commita3f73e7d85584412e2774870bc6538faaaf71001 (patch)
tree0e16f061a39e5006ff311bcd93011fdd0a3816ba
parentd5871f5717579fab3c093537c44e3cd467560cdd (diff)
downloadserenity-a3f73e7d85584412e2774870bc6538faaaf71001.zip
AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
No functional changes.
-rw-r--r--AK/Stream.cpp2
-rw-r--r--AK/Stream.h6
-rw-r--r--AK/String.cpp2
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibGL/GenerateGLAPIWrapper.cpp2
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h2
-rw-r--r--Tests/LibCore/TestLibCoreStream.cpp8
-rw-r--r--Tests/LibCpp/test-cpp-parser.cpp2
-rw-r--r--Tests/LibCpp/test-cpp-preprocessor.cpp2
-rw-r--r--Tests/LibMarkdown/TestCommonmark.cpp2
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp2
-rw-r--r--Userland/Libraries/LibArchive/TarStream.h2
-rw-r--r--Userland/Libraries/LibAudio/MP3Loader.cpp2
-rw-r--r--Userland/Libraries/LibAudio/WavLoader.cpp4
-rw-r--r--Userland/Libraries/LibCompress/Deflate.cpp4
-rw-r--r--Userland/Libraries/LibCompress/Gzip.cpp4
-rw-r--r--Userland/Libraries/LibCompress/Zlib.cpp2
-rw-r--r--Userland/Libraries/LibCore/SOCKSProxyClient.cpp4
-rw-r--r--Userland/Libraries/LibDNS/Packet.cpp2
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfTypes.h6
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/LineProgram.h8
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp6
-rw-r--r--Userland/Libraries/LibGfx/JPEGLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/QOILoader.cpp6
-rw-r--r--Userland/Libraries/LibIPC/Decoder.h2
-rw-r--r--Userland/Libraries/LibLine/Editor.cpp2
-rw-r--r--Userland/Libraries/LibProtocol/Request.cpp2
-rw-r--r--Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp10
-rw-r--r--Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp2
-rw-r--r--Userland/Libraries/LibWasm/Parser/Parser.cpp10
-rw-r--r--Userland/Shell/AST.cpp4
-rw-r--r--Userland/Utilities/wasm.cpp2
31 files changed, 58 insertions, 58 deletions
diff --git a/AK/Stream.cpp b/AK/Stream.cpp
index ab0c572391..bf627c3762 100644
--- a/AK/Stream.cpp
+++ b/AK/Stream.cpp
@@ -11,7 +11,7 @@
namespace AK {
-ErrorOr<void> Stream::read_entire_buffer(Bytes buffer)
+ErrorOr<void> Stream::read_until_filled(Bytes buffer)
{
size_t nread = 0;
while (nread < buffer.size()) {
diff --git a/AK/Stream.h b/AK/Stream.h
index 8211cf8687..53fd681dab 100644
--- a/AK/Stream.h
+++ b/AK/Stream.h
@@ -26,13 +26,13 @@ public:
virtual ErrorOr<Bytes> read_some(Bytes) = 0;
/// Tries to fill the entire buffer through reading. Returns whether the
/// buffer was filled without an error.
- virtual ErrorOr<void> read_entire_buffer(Bytes);
+ virtual ErrorOr<void> read_until_filled(Bytes);
/// Reads the stream until EOF, storing the contents into a ByteBuffer which
/// is returned once EOF is encountered. The block size determines the size
/// of newly allocated chunks while reading.
virtual ErrorOr<ByteBuffer> read_until_eof(size_t block_size = 4096);
/// Discards the given number of bytes from the stream. As this is usually used
- /// as an efficient version of `read_entire_buffer`, it returns an error
+ /// as an efficient version of `read_until_filled`, it returns an error
/// if reading failed or if not all bytes could be discarded.
/// Unless specifically overwritten, this just uses read() to read into an
/// internal stack-based buffer.
@@ -58,7 +58,7 @@ public:
ErrorOr<T> read_value()
{
alignas(T) u8 buffer[sizeof(T)] = {};
- TRY(read_entire_buffer({ &buffer, sizeof(buffer) }));
+ TRY(read_until_filled({ &buffer, sizeof(buffer) }));
return bit_cast<T>(buffer);
}
diff --git a/AK/String.cpp b/AK/String.cpp
index 32d88547c7..ae7328cca0 100644
--- a/AK/String.cpp
+++ b/AK/String.cpp
@@ -140,7 +140,7 @@ ErrorOr<NonnullRefPtr<StringData>> StringData::from_utf8(char const* utf8_data,
static ErrorOr<void> read_stream_into_buffer(Stream& stream, Bytes buffer)
{
- TRY(stream.read_entire_buffer(buffer));
+ TRY(stream.read_until_filled(buffer));
if (!Utf8View { StringView { buffer } }.validate())
return Error::from_string_literal("String::from_stream: Input was not valid UTF-8");
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibGL/GenerateGLAPIWrapper.cpp b/Meta/Lagom/Tools/CodeGenerators/LibGL/GenerateGLAPIWrapper.cpp
index 6232391bcf..f7a81af8f8 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibGL/GenerateGLAPIWrapper.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibGL/GenerateGLAPIWrapper.cpp
@@ -540,7 +540,7 @@ ErrorOr<JsonValue> read_entire_file_as_json(StringView filename)
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Read));
auto json_size = TRY(file->size());
auto json_data = TRY(ByteBuffer::create_uninitialized(json_size));
- TRY(file->read_entire_buffer(json_data.bytes()));
+ TRY(file->read_until_filled(json_data.bytes()));
return JsonValue::from_string(json_data);
}
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h
index a4d3ead5a4..fa22fdc8ae 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h
@@ -59,6 +59,6 @@ ErrorOr<JsonValue> read_entire_file_as_json(StringView filename)
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Read));
auto json_size = TRY(file->size());
auto json_data = TRY(ByteBuffer::create_uninitialized(json_size));
- TRY(file->read_entire_buffer(json_data.bytes()));
+ TRY(file->read_until_filled(json_data.bytes()));
return JsonValue::from_string(json_data);
}
diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp
index e9bc16a02f..cc835b2a50 100644
--- a/Tests/LibCore/TestLibCoreStream.cpp
+++ b/Tests/LibCore/TestLibCoreStream.cpp
@@ -90,17 +90,17 @@ TEST_CASE(file_seeking_around)
EXPECT(!file->seek(500, SeekMode::SetPosition).is_error());
EXPECT_EQ(file->tell().release_value(), 500ul);
- EXPECT(!file->read_entire_buffer(buffer).is_error());
+ EXPECT(!file->read_until_filled(buffer).is_error());
EXPECT_EQ(buffer_contents, expected_seek_contents1);
EXPECT(!file->seek(234, SeekMode::FromCurrentPosition).is_error());
EXPECT_EQ(file->tell().release_value(), 750ul);
- EXPECT(!file->read_entire_buffer(buffer).is_error());
+ EXPECT(!file->read_until_filled(buffer).is_error());
EXPECT_EQ(buffer_contents, expected_seek_contents2);
EXPECT(!file->seek(-105, SeekMode::FromEndPosition).is_error());
EXPECT_EQ(file->tell().release_value(), 8597ul);
- EXPECT(!file->read_entire_buffer(buffer).is_error());
+ EXPECT(!file->read_until_filled(buffer).is_error());
EXPECT_EQ(buffer_contents, expected_seek_contents3);
}
@@ -123,7 +123,7 @@ TEST_CASE(file_adopt_fd)
EXPECT(!file->seek(500, SeekMode::SetPosition).is_error());
EXPECT_EQ(file->tell().release_value(), 500ul);
- EXPECT(!file->read_entire_buffer(buffer).is_error());
+ EXPECT(!file->read_until_filled(buffer).is_error());
EXPECT_EQ(buffer_contents, expected_seek_contents1);
// A single seek & read test should be fine for now.
diff --git a/Tests/LibCpp/test-cpp-parser.cpp b/Tests/LibCpp/test-cpp-parser.cpp
index 5bcc7dabc1..fda7cf827e 100644
--- a/Tests/LibCpp/test-cpp-parser.cpp
+++ b/Tests/LibCpp/test-cpp-parser.cpp
@@ -18,7 +18,7 @@ static DeprecatedString read_all(DeprecatedString const& path)
auto file = MUST(Core::File::open(path, Core::File::OpenMode::Read));
auto file_size = MUST(file->size());
auto content = MUST(ByteBuffer::create_uninitialized(file_size));
- MUST(file->read_entire_buffer(content.bytes()));
+ MUST(file->read_until_filled(content.bytes()));
return DeprecatedString { content.bytes() };
}
diff --git a/Tests/LibCpp/test-cpp-preprocessor.cpp b/Tests/LibCpp/test-cpp-preprocessor.cpp
index 39a50d3f59..89685aff74 100644
--- a/Tests/LibCpp/test-cpp-preprocessor.cpp
+++ b/Tests/LibCpp/test-cpp-preprocessor.cpp
@@ -17,7 +17,7 @@ static DeprecatedString read_all(DeprecatedString const& path)
auto file = MUST(Core::File::open(path, Core::File::OpenMode::Read));
auto file_size = MUST(file->size());
auto content = MUST(ByteBuffer::create_uninitialized(file_size));
- MUST(file->read_entire_buffer(content.bytes()));
+ MUST(file->read_until_filled(content.bytes()));
return DeprecatedString { content.bytes() };
}
diff --git a/Tests/LibMarkdown/TestCommonmark.cpp b/Tests/LibMarkdown/TestCommonmark.cpp
index b3f685c905..9c748197dc 100644
--- a/Tests/LibMarkdown/TestCommonmark.cpp
+++ b/Tests/LibMarkdown/TestCommonmark.cpp
@@ -22,7 +22,7 @@ TEST_SETUP
auto file = file_or_error.release_value();
auto file_size = MUST(file->size());
auto content = MUST(ByteBuffer::create_uninitialized(file_size));
- MUST(file->read_entire_buffer(content.bytes()));
+ MUST(file->read_until_filled(content.bytes()));
DeprecatedString test_data { content.bytes() };
auto tests = JsonParser(test_data).parse().value().as_array();
diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index ebd4544af9..d88d593742 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -490,7 +490,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
auto search_engines_file = TRY(Core::File::open(Browser::search_engines_file_path(), Core::File::OpenMode::Read));
auto file_size = TRY(search_engines_file->size());
auto buffer = TRY(ByteBuffer::create_uninitialized(file_size));
- if (!search_engines_file->read_entire_buffer(buffer).is_error()) {
+ if (!search_engines_file->read_until_filled(buffer).is_error()) {
StringView buffer_contents { buffer.bytes() };
if (auto json = TRY(JsonValue::from_string(buffer_contents)); json.is_array()) {
auto json_array = json.as_array();
diff --git a/Userland/Libraries/LibArchive/TarStream.h b/Userland/Libraries/LibArchive/TarStream.h
index 45cc1eb111..070d067cda 100644
--- a/Userland/Libraries/LibArchive/TarStream.h
+++ b/Userland/Libraries/LibArchive/TarStream.h
@@ -81,7 +81,7 @@ inline ErrorOr<void> TarInputStream::for_each_extended_header(F func)
auto header_size = TRY(header().size());
ByteBuffer file_contents_buffer = TRY(ByteBuffer::create_zeroed(header_size));
- TRY(file_stream.read_entire_buffer(file_contents_buffer));
+ TRY(file_stream.read_until_filled(file_contents_buffer));
StringView file_contents { file_contents_buffer };
diff --git a/Userland/Libraries/LibAudio/MP3Loader.cpp b/Userland/Libraries/LibAudio/MP3Loader.cpp
index 674f398ae2..3a5274f649 100644
--- a/Userland/Libraries/LibAudio/MP3Loader.cpp
+++ b/Userland/Libraries/LibAudio/MP3Loader.cpp
@@ -232,7 +232,7 @@ ErrorOr<MP3::MP3Frame, LoaderError> MP3LoaderPlugin::read_frame_data(MP3::Header
auto& buffer = maybe_buffer.value();
size_t old_reservoir_size = m_bit_reservoir.used_buffer_size();
- LOADER_TRY(m_bitstream->read_entire_buffer(buffer));
+ 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." };
diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp
index 116193ed2f..8abb2cb8fa 100644
--- a/Userland/Libraries/LibAudio/WavLoader.cpp
+++ b/Userland/Libraries/LibAudio/WavLoader.cpp
@@ -93,7 +93,7 @@ template<typename T>
static ErrorOr<double> read_sample(Stream& stream)
{
T sample { 0 };
- TRY(stream.read_entire_buffer(Bytes { &sample, sizeof(T) }));
+ TRY(stream.read_until_filled(Bytes { &sample, sizeof(T) }));
// Remap integer samples to normalized floating-point range of -1 to 1.
if constexpr (IsIntegral<T>) {
if constexpr (NumericLimits<T>::is_signed()) {
@@ -157,7 +157,7 @@ ErrorOr<Vector<FixedArray<Sample>>, LoaderError> WavLoaderPlugin::load_chunks(si
pcm_bits_per_sample(m_sample_format), sample_format_name(m_sample_format));
auto sample_data = LOADER_TRY(ByteBuffer::create_zeroed(bytes_to_read));
- LOADER_TRY(m_stream->read_entire_buffer(sample_data.bytes()));
+ LOADER_TRY(m_stream->read_until_filled(sample_data.bytes()));
// m_loaded_samples should contain the amount of actually loaded samples
m_loaded_samples += samples_to_read;
diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp
index b790d317f4..66fc163a6c 100644
--- a/Userland/Libraries/LibCompress/Deflate.cpp
+++ b/Userland/Libraries/LibCompress/Deflate.cpp
@@ -329,7 +329,7 @@ ErrorOr<ByteBuffer> DeflateDecompressor::decompress_all(ReadonlyBytes bytes)
}
auto output_buffer = TRY(ByteBuffer::create_uninitialized(output_stream.used_buffer_size()));
- TRY(output_stream.read_entire_buffer(output_buffer));
+ TRY(output_stream.read_until_filled(output_buffer));
return output_buffer;
}
@@ -1027,7 +1027,7 @@ ErrorOr<ByteBuffer> DeflateCompressor::compress_all(ReadonlyBytes bytes, Compres
TRY(deflate_stream->final_flush());
auto buffer = TRY(ByteBuffer::create_uninitialized(output_stream->used_buffer_size()));
- TRY(output_stream->read_entire_buffer(buffer));
+ TRY(output_stream->read_until_filled(buffer));
return buffer;
}
diff --git a/Userland/Libraries/LibCompress/Gzip.cpp b/Userland/Libraries/LibCompress/Gzip.cpp
index 56f6daa535..b7b2c12860 100644
--- a/Userland/Libraries/LibCompress/Gzip.cpp
+++ b/Userland/Libraries/LibCompress/Gzip.cpp
@@ -179,7 +179,7 @@ ErrorOr<ByteBuffer> GzipDecompressor::decompress_all(ReadonlyBytes bytes)
}
auto output_buffer = TRY(ByteBuffer::create_uninitialized(output_stream.used_buffer_size()));
- TRY(output_stream.read_entire_buffer(output_buffer));
+ TRY(output_stream.read_until_filled(output_buffer));
return output_buffer;
}
@@ -245,7 +245,7 @@ ErrorOr<ByteBuffer> GzipCompressor::compress_all(ReadonlyBytes bytes)
TRY(gzip_stream.write_entire_buffer(bytes));
auto buffer = TRY(ByteBuffer::create_uninitialized(output_stream->used_buffer_size()));
- TRY(output_stream->read_entire_buffer(buffer.bytes()));
+ TRY(output_stream->read_until_filled(buffer.bytes()));
return buffer;
}
diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp
index 39df8779b6..3b3f4af219 100644
--- a/Userland/Libraries/LibCompress/Zlib.cpp
+++ b/Userland/Libraries/LibCompress/Zlib.cpp
@@ -173,7 +173,7 @@ ErrorOr<ByteBuffer> ZlibCompressor::compress_all(ReadonlyBytes bytes, ZlibCompre
TRY(zlib_stream->finish());
auto buffer = TRY(ByteBuffer::create_uninitialized(output_stream->used_buffer_size()));
- TRY(output_stream->read_entire_buffer(buffer.bytes()));
+ TRY(output_stream->read_until_filled(buffer.bytes()));
return buffer;
}
diff --git a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp
index 532d12604f..9817998072 100644
--- a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp
+++ b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp
@@ -171,7 +171,7 @@ ErrorOr<Reply> send_connect_request_message(Core::Socket& socket, Core::SOCKSPro
return Error::from_string_literal("SOCKS negotiation failed: Failed to send connect request trailer");
auto buffer = TRY(ByteBuffer::create_uninitialized(stream.used_buffer_size()));
- TRY(stream.read_entire_buffer(buffer.bytes()));
+ TRY(stream.read_until_filled(buffer.bytes()));
// FIXME: This should write the entire span.
size = TRY(socket.write_some({ buffer.data(), buffer.size() }));
@@ -263,7 +263,7 @@ ErrorOr<u8> send_username_password_authentication_message(Core::Socket& socket,
return Error::from_string_literal("SOCKS negotiation failed: Failed to send username/password authentication message");
auto buffer = TRY(ByteBuffer::create_uninitialized(stream.used_buffer_size()));
- TRY(stream.read_entire_buffer(buffer.bytes()));
+ TRY(stream.read_until_filled(buffer.bytes()));
// FIXME: This should write the entire span.
size = TRY(socket.write_some(buffer));
diff --git a/Userland/Libraries/LibDNS/Packet.cpp b/Userland/Libraries/LibDNS/Packet.cpp
index d3b39538c6..b0d323f43e 100644
--- a/Userland/Libraries/LibDNS/Packet.cpp
+++ b/Userland/Libraries/LibDNS/Packet.cpp
@@ -72,7 +72,7 @@ ErrorOr<ByteBuffer> Packet::to_byte_buffer() const
}
auto buffer = TRY(ByteBuffer::create_uninitialized(stream.used_buffer_size()));
- TRY(stream.read_entire_buffer(buffer));
+ TRY(stream.read_until_filled(buffer));
return buffer;
}
diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfTypes.h b/Userland/Libraries/LibDebug/Dwarf/DwarfTypes.h
index f429fd7229..bfdefaa39f 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DwarfTypes.h
+++ b/Userland/Libraries/LibDebug/Dwarf/DwarfTypes.h
@@ -58,11 +58,11 @@ struct [[gnu::packed]] CompilationUnitHeader {
static ErrorOr<CompilationUnitHeader> read_from_stream(Stream& stream)
{
CompilationUnitHeader header;
- TRY(stream.read_entire_buffer(Bytes { &header.common, sizeof(header.common) }));
+ TRY(stream.read_until_filled(Bytes { &header.common, sizeof(header.common) }));
if (header.common.version <= 4)
- TRY(stream.read_entire_buffer(Bytes { &header.v4, sizeof(header.v4) }));
+ TRY(stream.read_until_filled(Bytes { &header.v4, sizeof(header.v4) }));
else
- TRY(stream.read_entire_buffer(Bytes { &header.v5, sizeof(header.v5) }));
+ TRY(stream.read_until_filled(Bytes { &header.v5, sizeof(header.v5) }));
return header;
}
};
diff --git a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
index bbf9f877ef..6d39799448 100644
--- a/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
+++ b/Userland/Libraries/LibDebug/Dwarf/LineProgram.h
@@ -68,12 +68,12 @@ struct [[gnu::packed]] LineProgramUnitHeader32 {
static ErrorOr<LineProgramUnitHeader32> read_from_stream(Stream& stream)
{
LineProgramUnitHeader32 header;
- TRY(stream.read_entire_buffer(Bytes { &header.common, sizeof(header.common) }));
+ TRY(stream.read_until_filled(Bytes { &header.common, sizeof(header.common) }));
if (header.common.version <= 4)
- TRY(stream.read_entire_buffer(Bytes { &header.v4, sizeof(header.v4) }));
+ TRY(stream.read_until_filled(Bytes { &header.v4, sizeof(header.v4) }));
else
- TRY(stream.read_entire_buffer(Bytes { &header.v5, sizeof(header.v5) }));
- TRY(stream.read_entire_buffer(Bytes { &header.std_opcode_lengths, min(sizeof(header.std_opcode_lengths), (header.opcode_base() - 1) * sizeof(header.std_opcode_lengths[0])) }));
+ TRY(stream.read_until_filled(Bytes { &header.v5, sizeof(header.v5) }));
+ TRY(stream.read_until_filled(Bytes { &header.std_opcode_lengths, min(sizeof(header.std_opcode_lengths), (header.opcode_base() - 1) * sizeof(header.std_opcode_lengths[0])) }));
return header;
}
};
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 33aec6c5de..1809b21feb 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -94,7 +94,7 @@ static ErrorOr<GIFFormat> decode_gif_header(Stream& stream)
static auto valid_header_89 = "GIF89a"sv;
Array<u8, 6> header;
- TRY(stream.read_entire_buffer(header));
+ TRY(stream.read_until_filled(header));
if (header.span() == valid_header_87.bytes())
return GIFFormat::GIF87a;
@@ -424,7 +424,7 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
break;
TRY(sub_block.try_resize(sub_block.size() + sub_block_length));
- TRY(stream.read_entire_buffer(sub_block.span().slice_from_end(sub_block_length)));
+ TRY(stream.read_until_filled(sub_block.span().slice_from_end(sub_block_length)));
}
if (extension_type == 0xF9) {
@@ -501,7 +501,7 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
break;
Array<u8, 256> buffer;
- TRY(stream.read_entire_buffer(buffer.span().trim(lzw_encoded_bytes_expected)));
+ TRY(stream.read_until_filled(buffer.span().trim(lzw_encoded_bytes_expected)));
for (int i = 0; i < lzw_encoded_bytes_expected; ++i) {
image->lzw_encoded_bytes.append(buffer[i]);
diff --git a/Userland/Libraries/LibGfx/JPEGLoader.cpp b/Userland/Libraries/LibGfx/JPEGLoader.cpp
index 491a66ded9..5c93041a36 100644
--- a/Userland/Libraries/LibGfx/JPEGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPEGLoader.cpp
@@ -769,7 +769,7 @@ static ErrorOr<void> read_icc_profile(SeekableStream& stream, JPEGLoadingContext
return Error::from_string_literal("Duplicate ICC chunk at sequence number");
chunk_state->chunks[index] = TRY(ByteBuffer::create_zeroed(bytes_to_read));
- TRY(stream.read_entire_buffer(chunk_state->chunks[index]));
+ TRY(stream.read_until_filled(chunk_state->chunks[index]));
chunk_state->seen_number_of_icc_chunks++;
diff --git a/Userland/Libraries/LibGfx/QOILoader.cpp b/Userland/Libraries/LibGfx/QOILoader.cpp
index ad6a20c78b..b6392ff65a 100644
--- a/Userland/Libraries/LibGfx/QOILoader.cpp
+++ b/Userland/Libraries/LibGfx/QOILoader.cpp
@@ -35,7 +35,7 @@ static ErrorOr<Color> decode_qoi_op_rgb(Stream& stream, u8 first_byte, Color pix
{
VERIFY(first_byte == QOI_OP_RGB);
u8 bytes[3];
- TRY(stream.read_entire_buffer({ &bytes, array_size(bytes) }));
+ TRY(stream.read_until_filled({ &bytes, array_size(bytes) }));
// The alpha value remains unchanged from the previous pixel.
return Color { bytes[0], bytes[1], bytes[2], pixel.alpha() };
@@ -45,7 +45,7 @@ static ErrorOr<Color> decode_qoi_op_rgba(Stream& stream, u8 first_byte)
{
VERIFY(first_byte == QOI_OP_RGBA);
u8 bytes[4];
- TRY(stream.read_entire_buffer({ &bytes, array_size(bytes) }));
+ TRY(stream.read_until_filled({ &bytes, array_size(bytes) }));
return Color { bytes[0], bytes[1], bytes[2], bytes[3] };
}
@@ -110,7 +110,7 @@ static ErrorOr<u8> decode_qoi_op_run(Stream&, u8 first_byte)
static ErrorOr<void> decode_qoi_end_marker(Stream& stream)
{
u8 bytes[array_size(END_MARKER)];
- TRY(stream.read_entire_buffer({ &bytes, array_size(bytes) }));
+ TRY(stream.read_until_filled({ &bytes, array_size(bytes) }));
if (!stream.is_eof())
return Error::from_string_literal("Invalid QOI image: expected end of stream but more bytes are available");
if (memcmp(&END_MARKER, &bytes, array_size(bytes)) != 0)
diff --git a/Userland/Libraries/LibIPC/Decoder.h b/Userland/Libraries/LibIPC/Decoder.h
index 6a5f62438c..512a1bf2b7 100644
--- a/Userland/Libraries/LibIPC/Decoder.h
+++ b/Userland/Libraries/LibIPC/Decoder.h
@@ -52,7 +52,7 @@ public:
ErrorOr<void> decode_into(Bytes bytes)
{
- TRY(m_stream.read_entire_buffer(bytes));
+ TRY(m_stream.read_until_filled(bytes));
return {};
}
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
index 7e4f14c68f..476ef66706 100644
--- a/Userland/Libraries/LibLine/Editor.cpp
+++ b/Userland/Libraries/LibLine/Editor.cpp
@@ -1346,7 +1346,7 @@ ErrorOr<void> Editor::refresh_display()
return;
auto buffer = ByteBuffer::create_uninitialized(output_stream.used_buffer_size()).release_value_but_fixme_should_propagate_errors();
- output_stream.read_entire_buffer(buffer).release_value_but_fixme_should_propagate_errors();
+ output_stream.read_until_filled(buffer).release_value_but_fixme_should_propagate_errors();
fwrite(buffer.data(), sizeof(char), buffer.size(), stderr);
}
};
diff --git a/Userland/Libraries/LibProtocol/Request.cpp b/Userland/Libraries/LibProtocol/Request.cpp
index c10b260978..44bcd7bdc2 100644
--- a/Userland/Libraries/LibProtocol/Request.cpp
+++ b/Userland/Libraries/LibProtocol/Request.cpp
@@ -90,7 +90,7 @@ void Request::set_should_buffer_all_input(bool value)
on_finish = [this](auto success, u32 total_size) {
auto output_buffer = ByteBuffer::create_uninitialized(m_internal_buffered_data->payload_stream.used_buffer_size()).release_value_but_fixme_should_propagate_errors();
- m_internal_buffered_data->payload_stream.read_entire_buffer(output_buffer).release_value_but_fixme_should_propagate_errors();
+ m_internal_buffered_data->payload_stream.read_until_filled(output_buffer).release_value_but_fixme_should_propagate_errors();
on_buffered_request_finish(
success,
total_size,
diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp
index ee5baaaf17..088b2a8079 100644
--- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp
+++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp
@@ -210,7 +210,7 @@ struct ConvertToRaw<float> {
LittleEndian<u32> res;
ReadonlyBytes bytes { &value, sizeof(float) };
FixedMemoryStream stream { bytes };
- stream.read_entire_buffer(res.bytes()).release_value_but_fixme_should_propagate_errors();
+ stream.read_until_filled(res.bytes()).release_value_but_fixme_should_propagate_errors();
return static_cast<u32>(res);
}
};
@@ -222,7 +222,7 @@ struct ConvertToRaw<double> {
LittleEndian<u64> res;
ReadonlyBytes bytes { &value, sizeof(double) };
FixedMemoryStream stream { bytes };
- stream.read_entire_buffer(res.bytes()).release_value_but_fixme_should_propagate_errors();
+ stream.read_until_filled(res.bytes()).release_value_but_fixme_should_propagate_errors();
return static_cast<u64>(res);
}
};
@@ -260,7 +260,7 @@ T BytecodeInterpreter::read_value(ReadonlyBytes data)
{
LittleEndian<T> value;
FixedMemoryStream stream { data };
- auto maybe_error = stream.read_entire_buffer(value.bytes());
+ auto maybe_error = stream.read_until_filled(value.bytes());
if (maybe_error.is_error()) {
dbgln("Read from {} failed", data.data());
m_trap = Trap { "Read from memory failed" };
@@ -273,7 +273,7 @@ float BytecodeInterpreter::read_value<float>(ReadonlyBytes data)
{
LittleEndian<u32> raw_value;
FixedMemoryStream stream { data };
- auto maybe_error = stream.read_entire_buffer(raw_value.bytes());
+ auto maybe_error = stream.read_until_filled(raw_value.bytes());
if (maybe_error.is_error())
m_trap = Trap { "Read from memory failed" };
return bit_cast<float>(static_cast<u32>(raw_value));
@@ -284,7 +284,7 @@ double BytecodeInterpreter::read_value<double>(ReadonlyBytes data)
{
LittleEndian<u64> raw_value;
FixedMemoryStream stream { data };
- auto maybe_error = stream.read_entire_buffer(raw_value.bytes());
+ auto maybe_error = stream.read_until_filled(raw_value.bytes());
if (maybe_error.is_error())
m_trap = Trap { "Read from memory failed" };
return bit_cast<double>(static_cast<u64>(raw_value));
diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp b/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp
index 74f54587c9..79b513ddad 100644
--- a/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp
+++ b/Userland/Libraries/LibWasm/AbstractMachine/Configuration.cpp
@@ -89,7 +89,7 @@ void Configuration::dump_stack()
AllocatingMemoryStream memory_stream;
Printer { memory_stream }.print(vs...);
auto buffer = ByteBuffer::create_uninitialized(memory_stream.used_buffer_size()).release_value_but_fixme_should_propagate_errors();
- memory_stream.read_entire_buffer(buffer).release_value_but_fixme_should_propagate_errors();
+ memory_stream.read_until_filled(buffer).release_value_but_fixme_should_propagate_errors();
dbgln(format.view(), StringView(buffer).trim_whitespace());
};
for (auto const& entry : stack().entries()) {
diff --git a/Userland/Libraries/LibWasm/Parser/Parser.cpp b/Userland/Libraries/LibWasm/Parser/Parser.cpp
index 35c53be67f..c2582ddfa8 100644
--- a/Userland/Libraries/LibWasm/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWasm/Parser/Parser.cpp
@@ -64,7 +64,7 @@ static auto parse_vector(Stream& stream)
if (count > Constants::max_allowed_vector_size)
return ParseResult<Vector<T>> { ParseError::HugeAllocationRequested };
entries.resize(count);
- if (stream.read_entire_buffer({ entries.data(), entries.size() }).is_error())
+ if (stream.read_until_filled({ entries.data(), entries.size() }).is_error())
return ParseResult<Vector<T>> { with_eof_check(stream, ParseError::InvalidInput) };
break; // Note: We read this all in one go!
}
@@ -486,7 +486,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(Stream& stream, InstructionP
case Instructions::f32_const.value(): {
// op literal
LittleEndian<u32> value;
- if (stream.read_entire_buffer(value.bytes()).is_error())
+ if (stream.read_until_filled(value.bytes()).is_error())
return with_eof_check(stream, ParseError::ExpectedFloatingImmediate);
auto floating = bit_cast<float>(static_cast<u32>(value));
@@ -496,7 +496,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(Stream& stream, InstructionP
case Instructions::f64_const.value(): {
// op literal
LittleEndian<u64> value;
- if (stream.read_entire_buffer(value.bytes()).is_error())
+ if (stream.read_until_filled(value.bytes()).is_error())
return with_eof_check(stream, ParseError::ExpectedFloatingImmediate);
auto floating = bit_cast<double>(static_cast<u64>(value));
@@ -1276,12 +1276,12 @@ ParseResult<Module> Module::parse(Stream& stream)
{
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Module"sv);
u8 buf[4];
- if (stream.read_entire_buffer({ buf, 4 }).is_error())
+ if (stream.read_until_filled({ buf, 4 }).is_error())
return with_eof_check(stream, ParseError::InvalidInput);
if (Bytes { buf, 4 } != wasm_magic.span())
return with_eof_check(stream, ParseError::InvalidModuleMagic);
- if (stream.read_entire_buffer({ buf, 4 }).is_error())
+ if (stream.read_until_filled({ buf, 4 }).is_error())
return with_eof_check(stream, ParseError::InvalidInput);
if (Bytes { buf, 4 } != wasm_version.span())
return with_eof_check(stream, ParseError::InvalidModuleVersion);
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp
index e675ca2fee..f5082c7de0 100644
--- a/Userland/Shell/AST.cpp
+++ b/Userland/Shell/AST.cpp
@@ -1772,7 +1772,7 @@ ErrorOr<void> Execute::for_each_entry(RefPtr<Shell> shell, Function<ErrorOr<Iter
return Break;
}
auto entry = entry_result.release_value();
- TRY(stream.read_entire_buffer(entry));
+ TRY(stream.read_until_filled(entry));
auto str = TRY(String::from_utf8(StringView(entry.data(), entry.size() - ifs.length())));
if (TRY(callback(make_ref_counted<StringValue>(move(str)))) == IterationDecision::Break) {
@@ -1862,7 +1862,7 @@ ErrorOr<void> Execute::for_each_entry(RefPtr<Shell> shell, Function<ErrorOr<Iter
return {};
}
auto entry = entry_result.release_value();
- TRY(stream.read_entire_buffer(entry));
+ TRY(stream.read_until_filled(entry));
TRY(callback(make_ref_counted<StringValue>(TRY(String::from_utf8(entry)))));
}
}
diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp
index b4f6f0c046..1fb1f33066 100644
--- a/Userland/Utilities/wasm.cpp
+++ b/Userland/Utilities/wasm.cpp
@@ -410,7 +410,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
else
argument_builder.append(", "sv);
auto buffer = ByteBuffer::create_uninitialized(stream.used_buffer_size()).release_value_but_fixme_should_propagate_errors();
- stream.read_entire_buffer(buffer).release_value_but_fixme_should_propagate_errors();
+ stream.read_until_filled(buffer).release_value_but_fixme_should_propagate_errors();
argument_builder.append(StringView(buffer).trim_whitespace());
}
dbgln("[wasm runtime] Stub function {} was called with the following arguments: {}", name, argument_builder.to_deprecated_string());