summaryrefslogtreecommitdiff
path: root/Libraries/LibCompress/Deflate.h
AgeCommit message (Collapse)Author
2020-09-14AK: Lower the requirements for InputStream::eof and rename it.asynts
Consider the following snippet: void foo(InputStream& stream) { if(!stream.eof()) { u8 byte; stream >> byte; } } There is a very subtle bug in this snippet, for some input streams eof() might return false even if no more data can be read. In this case an error flag would be set on the stream. Until now I've always ensured that this is not the case, but this made the implementation of eof() unnecessarily complicated. InputFileStream::eof had to keep a ByteBuffer around just to make this possible. That meant a ton of unnecessary copies just to get a reliable eof(). In most cases it isn't actually necessary to have a reliable eof() implementation. In most other cases a reliable eof() is avaliable anyways because in some cases like InputMemoryStream it is very easy to implement.
2020-09-11LibCompress: Move CanonicalCode out of DeflateDecompressor.asynts
2020-09-11LibCompress: Remove unnecessary InputBitStream.asynts
2020-09-11LibCompress: Return Optional from decompress_all method.asynts
2020-08-31LibCompress: Add support for dynamic deflate blocks.asynts
2020-08-31LibCompress: Deflate: Don't assert that the codes are valid.asynts
2020-08-26LibCompress: Implement DEFLATE properly.asynts
Now we have an actual stream implementation that can read arbitrary (dynamic codes aren't supported yet) deflate encoded data. Even if the blocks are really large. And all of that happens with a single buffer of 32KiB. DEFLATE is amazing!
2020-08-20LibCompress: Turn the DEFLATE implementation into a stream.asynts
Previously, the implementation would produce one Vector<u8> which would contain the whole decompressed data. That can be a lot and even exhaust memory. With these changes it is still necessary to store the whole input data in one piece (I am working on this next,) but the output can be read block by block. (That's not optimal either because blocks can be arbitrarily large, but it's good for now.)
2020-08-04LibCompress: Add LibCompressstelar7
For now this only contains DEFLATE, and a very simple Zlib Eventually GZip, etc. can go here as well.