mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +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:
parent
5fa590de71
commit
5f2ea31816
16 changed files with 115 additions and 92 deletions
|
@ -188,13 +188,13 @@ ErrorOr<bool> DeflateDecompressor::UncompressedBlock::try_read_more()
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<DeflateDecompressor>> DeflateDecompressor::construct(Core::Stream::Handle<Core::Stream::Stream> stream)
|
||||
ErrorOr<NonnullOwnPtr<DeflateDecompressor>> DeflateDecompressor::construct(MaybeOwned<Core::Stream::Stream> stream)
|
||||
{
|
||||
auto output_buffer = TRY(CircularBuffer::create_empty(32 * KiB));
|
||||
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) DeflateDecompressor(move(stream), move(output_buffer))));
|
||||
}
|
||||
|
||||
DeflateDecompressor::DeflateDecompressor(Core::Stream::Handle<Core::Stream::Stream> stream, CircularBuffer output_buffer)
|
||||
DeflateDecompressor::DeflateDecompressor(MaybeOwned<Core::Stream::Stream> stream, CircularBuffer output_buffer)
|
||||
: m_input_stream(make<Core::Stream::LittleEndianInputBitStream>(move(stream)))
|
||||
, m_output_buffer(move(output_buffer))
|
||||
{
|
||||
|
@ -446,7 +446,7 @@ ErrorOr<void> DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Opt
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<DeflateCompressor>> DeflateCompressor::construct(Core::Stream::Handle<Core::Stream::Stream> stream, CompressionLevel compression_level)
|
||||
ErrorOr<NonnullOwnPtr<DeflateCompressor>> DeflateCompressor::construct(MaybeOwned<Core::Stream::Stream> stream, CompressionLevel compression_level)
|
||||
{
|
||||
auto bit_stream = TRY(Core::Stream::LittleEndianOutputBitStream::construct(move(stream)));
|
||||
auto deflate_compressor = TRY(adopt_nonnull_own_or_enomem(new (nothrow) DeflateCompressor(move(bit_stream), compression_level)));
|
||||
|
@ -1017,7 +1017,7 @@ ErrorOr<void> DeflateCompressor::final_flush()
|
|||
ErrorOr<ByteBuffer> DeflateCompressor::compress_all(ReadonlyBytes bytes, CompressionLevel compression_level)
|
||||
{
|
||||
auto output_stream = TRY(try_make<Core::Stream::AllocatingMemoryStream>());
|
||||
auto deflate_stream = TRY(DeflateCompressor::construct(Core::Stream::Handle<Core::Stream::Stream>(*output_stream), compression_level));
|
||||
auto deflate_stream = TRY(DeflateCompressor::construct(MaybeOwned<Core::Stream::Stream>(*output_stream), compression_level));
|
||||
|
||||
TRY(deflate_stream->write_entire_buffer(bytes));
|
||||
TRY(deflate_stream->final_flush());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue