@@ -12,15 +12,16 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" +#import "OFHuffmanTree.h" #import "OFKernelEventObserver.h" OF_ASSUME_NONNULL_BEGIN -#define OF_INFLATE64_STREAM_BUFFER_SIZE 4096 +#define OFInflate64StreamBufferSize 4096 /** * @class OFInflate64Stream OFInflate64Stream.h ObjFW/OFInflate64Stream.h * * @note This class only conforms to OFReadyForReadingObserving if the @@ -31,11 +32,11 @@ */ OF_SUBCLASSING_RESTRICTED @interface OFInflate64Stream: OFStream { OFStream *_stream; - unsigned char _buffer[OF_INFLATE64_STREAM_BUFFER_SIZE]; + unsigned char _buffer[OFInflate64StreamBufferSize]; uint16_t _bufferIndex, _bufferLength; uint8_t _byte; uint8_t _bitIndex, _savedBitsLength; uint16_t _savedBits; unsigned char *_Nullable _slidingWindow; @@ -48,23 +49,23 @@ } uncompressedHeader; struct { uint16_t position, length; } uncompressed; struct { - struct of_huffman_tree *_Nullable litLenTree; - struct of_huffman_tree *_Nullable distTree; - struct of_huffman_tree *_Nullable codeLenTree; - struct of_huffman_tree *_Nullable treeIter; + OFHuffmanTree _Nullable litLenTree; + OFHuffmanTree _Nullable distTree; + OFHuffmanTree _Nullable codeLenTree; + OFHuffmanTree _Nullable treeIter; uint8_t *_Nullable lengths; uint16_t receivedCount; uint8_t value, litLenCodesCount, distCodesCount; uint8_t codeLenCodesCount; } huffmanTree; struct { - struct of_huffman_tree *_Nullable litLenTree; - struct of_huffman_tree *_Nullable distTree; - struct of_huffman_tree *_Nullable treeIter; + OFHuffmanTree _Nullable litLenTree; + OFHuffmanTree _Nullable distTree; + OFHuffmanTree _Nullable treeIter; int state; uint16_t value, length, distance, extraBits; } huffman; } _context; bool _inLastBlock, _atEndOfStream;