hapsunday / miniz

Automatically exported from code.google.com/p/miniz
0 stars 0 forks source link

Need another tinfl_decompress_ function #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Is difficult to understand how I should write a tinfl_decompress_ function that 
would decompress a data stream that is coming from a custom fread() function.

The closest clue seems to be by hacking mz_zip_reader_extract_to_mem_no_alloc().

Original issue reported on code.google.com by harris...@gmail.com on 10 Oct 2013 at 7:52

GoogleCodeExporter commented 9 years ago
Ok, I'll see what I can do for the next release.

Original comment by richge...@gmail.com on 13 Oct 2013 at 6:05

GoogleCodeExporter commented 9 years ago
Harris, I don't mean to intrude but I have work with Miniz recently and I can 
share my experience with streaming data in it.

If you don't mind reading a bit of Rust code (similar to C++), take a look at 
https://github.com/williamw520/rustyzip/blob/master/src/rustyzip_lib/deflate.rs.

Look at the following methods in particular,
compress_stream, compresses data from a generic Reader to a Writer.
compress_upcalls, compresses data from input callback and output callback.
decompress_stream, decompresses data from Reader to Writer.
decompress_upcalls, decompresses data with input, output, and rest callbacks.

All these use the low level tdefl_compress and tinfl_decompress functions.  
Hope these help.

Original comment by williamw...@gmail.com on 18 Oct 2013 at 6:27