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

AK: Rename Stream::read_entire_buffer to Stream::read_until_filled

No functional changes.
This commit is contained in:
Tim Schumacher 2023-03-01 15:27:35 +01:00 committed by Linus Groh
parent d5871f5717
commit a3f73e7d85
31 changed files with 58 additions and 58 deletions

View file

@ -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." };

View file

@ -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;