summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCompress/Deflate.h
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-01 00:38:05 +0100
committerAndrew Kaster <andrewdkaster@gmail.com>2023-01-13 17:34:45 -0700
commitd23f0a7405ee52a627a1c3c84fbd030834ef259b (patch)
tree633176cb68f2f5753a18c044828977f5fc76dea7 /Userland/Libraries/LibCompress/Deflate.h
parentd717a0800319588e012d778fca61af89ddcf8132 (diff)
downloadserenity-d23f0a7405ee52a627a1c3c84fbd030834ef259b.zip
LibCompress: Switch `DeflateDecompressor` to a fallible constructor
We don't have anything fallible in there yet, but we will soon switch the seekback buffer to the new `CircularBuffer`, which has a fallible constructor. We have to do the same for the internal `GzipDecompressor::Member` class, as it needs to construct a `DeflateCompressor` from its received stream.
Diffstat (limited to 'Userland/Libraries/LibCompress/Deflate.h')
-rw-r--r--Userland/Libraries/LibCompress/Deflate.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCompress/Deflate.h b/Userland/Libraries/LibCompress/Deflate.h
index 22b60730df..5ed55123b8 100644
--- a/Userland/Libraries/LibCompress/Deflate.h
+++ b/Userland/Libraries/LibCompress/Deflate.h
@@ -76,7 +76,7 @@ public:
friend CompressedBlock;
friend UncompressedBlock;
- DeflateDecompressor(Core::Stream::Handle<Core::Stream::Stream> stream);
+ static ErrorOr<NonnullOwnPtr<DeflateDecompressor>> construct(Core::Stream::Handle<Core::Stream::Stream> stream);
~DeflateDecompressor();
virtual ErrorOr<Bytes> read(Bytes) override;
@@ -88,6 +88,8 @@ public:
static ErrorOr<ByteBuffer> decompress_all(ReadonlyBytes);
private:
+ DeflateDecompressor(Core::Stream::Handle<Core::Stream::Stream> stream);
+
ErrorOr<u32> decode_length(u32);
ErrorOr<u32> decode_distance(u32);
ErrorOr<void> decode_codes(CanonicalCode& literal_code, Optional<CanonicalCode>& distance_code);