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

AK: Move Handle from LibCore and name it MaybeOwned

The new name should make it abundantly clear what it does.
This commit is contained in:
Tim Schumacher 2023-01-22 04:24:18 +01:00 committed by Andrew Kaster
parent 5fa590de71
commit 5f2ea31816
16 changed files with 115 additions and 92 deletions

View file

@ -60,7 +60,7 @@ MaybeLoaderError FlacLoaderPlugin::initialize()
// 11.5 STREAM
MaybeLoaderError FlacLoaderPlugin::parse_header()
{
auto bit_input = LOADER_TRY(BigEndianInputBitStream::construct(Core::Stream::Handle<Core::Stream::Stream>(*m_stream)));
auto bit_input = LOADER_TRY(BigEndianInputBitStream::construct(MaybeOwned<Core::Stream::Stream>(*m_stream)));
// A mixture of VERIFY and the non-crashing TRY().
#define FLAC_VERIFY(check, category, msg) \
@ -79,7 +79,7 @@ MaybeLoaderError FlacLoaderPlugin::parse_header()
auto streaminfo = TRY(next_meta_block(*bit_input));
FLAC_VERIFY(streaminfo.type == FlacMetadataBlockType::STREAMINFO, LoaderError::Category::Format, "First block must be STREAMINFO");
auto streaminfo_data_memory = LOADER_TRY(Core::Stream::FixedMemoryStream::construct(streaminfo.data.bytes()));
auto streaminfo_data = LOADER_TRY(BigEndianInputBitStream::construct(Core::Stream::Handle<Core::Stream::Stream>(*streaminfo_data_memory)));
auto streaminfo_data = LOADER_TRY(BigEndianInputBitStream::construct(MaybeOwned<Core::Stream::Stream>(*streaminfo_data_memory)));
// 11.10 METADATA_BLOCK_STREAMINFO
m_min_block_size = LOADER_TRY(streaminfo_data->read_bits<u16>(16));
@ -150,7 +150,7 @@ MaybeLoaderError FlacLoaderPlugin::parse_header()
MaybeLoaderError FlacLoaderPlugin::load_picture(FlacRawMetadataBlock& block)
{
auto memory_stream = LOADER_TRY(Core::Stream::FixedMemoryStream::construct(block.data.bytes()));
auto picture_block_bytes = LOADER_TRY(BigEndianInputBitStream::construct(Core::Stream::Handle<Core::Stream::Stream>(*memory_stream)));
auto picture_block_bytes = LOADER_TRY(BigEndianInputBitStream::construct(MaybeOwned<Core::Stream::Stream>(*memory_stream)));
PictureData picture {};
@ -187,7 +187,7 @@ MaybeLoaderError FlacLoaderPlugin::load_picture(FlacRawMetadataBlock& block)
MaybeLoaderError FlacLoaderPlugin::load_seektable(FlacRawMetadataBlock& block)
{
auto memory_stream = LOADER_TRY(Core::Stream::FixedMemoryStream::construct(block.data.bytes()));
auto seektable_bytes = LOADER_TRY(BigEndianInputBitStream::construct(Core::Stream::Handle<Core::Stream::Stream>(*memory_stream)));
auto seektable_bytes = LOADER_TRY(BigEndianInputBitStream::construct(MaybeOwned<Core::Stream::Stream>(*memory_stream)));
for (size_t i = 0; i < block.length / 18; ++i) {
// 11.14. SEEKPOINT
FlacSeekPoint seekpoint {
@ -333,7 +333,7 @@ MaybeLoaderError FlacLoaderPlugin::next_frame(Span<Sample> target_vector)
} \
} while (0)
auto bit_stream = LOADER_TRY(BigEndianInputBitStream::construct(Core::Stream::Handle<Core::Stream::Stream>(*m_stream)));
auto bit_stream = LOADER_TRY(BigEndianInputBitStream::construct(MaybeOwned<Core::Stream::Stream>(*m_stream)));
// TODO: Check the CRC-16 checksum (and others) by keeping track of read data