diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-22 04:24:18 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-01-29 19:16:44 -0700 |
commit | 5f2ea31816612dead5bc7ac59d27da0bc4b45736 (patch) | |
tree | de38924f38690ac2e440744f51712422c50aedb9 /Userland/Libraries/LibCompress/Zlib.cpp | |
parent | 5fa590de71b10ab020cb63065d2aa37da65f5371 (diff) | |
download | serenity-5f2ea31816612dead5bc7ac59d27da0bc4b45736.zip |
AK: Move `Handle` from `LibCore` and name it `MaybeOwned`
The new name should make it abundantly clear what it does.
Diffstat (limited to 'Userland/Libraries/LibCompress/Zlib.cpp')
-rw-r--r-- | Userland/Libraries/LibCompress/Zlib.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index db1f5558e5..ff2d78aa9c 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -69,13 +69,13 @@ u32 ZlibDecompressor::checksum() return m_checksum; } -ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(Core::Stream::Handle<Core::Stream::Stream> stream, ZlibCompressionLevel compression_level) +ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(MaybeOwned<Core::Stream::Stream> stream, ZlibCompressionLevel compression_level) { // Zlib only defines Deflate as a compression method. auto compression_method = ZlibCompressionMethod::Deflate; // FIXME: Find a way to compress with Deflate's "Best" compression level. - auto compressor_stream = TRY(DeflateCompressor::construct(Core::Stream::Handle(*stream), static_cast<DeflateCompressor::CompressionLevel>(compression_level))); + auto compressor_stream = TRY(DeflateCompressor::construct(MaybeOwned(*stream), static_cast<DeflateCompressor::CompressionLevel>(compression_level))); auto zlib_compressor = TRY(adopt_nonnull_own_or_enomem(new (nothrow) ZlibCompressor(move(stream), move(compressor_stream)))); TRY(zlib_compressor->write_header(compression_method, compression_level)); @@ -83,7 +83,7 @@ ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(Core::Stream::H return zlib_compressor; } -ZlibCompressor::ZlibCompressor(Core::Stream::Handle<Core::Stream::Stream> stream, NonnullOwnPtr<Core::Stream::Stream> compressor_stream) +ZlibCompressor::ZlibCompressor(MaybeOwned<Core::Stream::Stream> stream, NonnullOwnPtr<Core::Stream::Stream> compressor_stream) : m_output_stream(move(stream)) , m_compressor(move(compressor_stream)) { @@ -164,7 +164,7 @@ ErrorOr<void> ZlibCompressor::finish() ErrorOr<ByteBuffer> ZlibCompressor::compress_all(ReadonlyBytes bytes, ZlibCompressionLevel compression_level) { auto output_stream = TRY(try_make<Core::Stream::AllocatingMemoryStream>()); - auto zlib_stream = TRY(ZlibCompressor::construct(Core::Stream::Handle<Core::Stream::Stream>(*output_stream), compression_level)); + auto zlib_stream = TRY(ZlibCompressor::construct(MaybeOwned<Core::Stream::Stream>(*output_stream), compression_level)); TRY(zlib_stream->write_entire_buffer(bytes)); |