mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:17:34 +00:00
AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
No functional changes.
This commit is contained in:
parent
d5871f5717
commit
a3f73e7d85
31 changed files with 58 additions and 58 deletions
|
@ -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]);
|
||||
|
|
|
@ -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++;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue