mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 13:05:12 +00:00
LibAudio: Use read_until_filled
to fill a buffer from a Stream
This has the advantage of recognizing when the Stream reaches EOF and avoids an endless loop.
This commit is contained in:
parent
4098335600
commit
708387b850
Notes:
sideshowbarker
2024-07-17 16:23:55 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/708387b850 Pull-request: https://github.com/SerenityOS/serenity/pull/18327 Issue: https://github.com/SerenityOS/serenity/issues/18315
1 changed files with 1 additions and 6 deletions
|
@ -250,12 +250,7 @@ ErrorOr<FlacRawMetadataBlock, LoaderError> FlacLoaderPlugin::next_meta_block(Big
|
|||
FLAC_VERIFY(!block_data_result.is_error(), LoaderError::Category::IO, "Out of memory");
|
||||
auto block_data = block_data_result.release_value();
|
||||
|
||||
// Blocks might exceed our buffer size.
|
||||
auto bytes_left_to_read = block_data.bytes();
|
||||
while (bytes_left_to_read.size()) {
|
||||
auto read_bytes = LOADER_TRY(bit_input.read_some(bytes_left_to_read));
|
||||
bytes_left_to_read = bytes_left_to_read.slice(read_bytes.size());
|
||||
}
|
||||
LOADER_TRY(bit_input.read_until_filled(block_data));
|
||||
|
||||
m_data_start_location += block_length;
|
||||
return FlacRawMetadataBlock {
|
||||
|
|
Loading…
Add table
Reference in a new issue