Commit graph

27 commits

Author SHA1 Message Date
Paul Sokolovsky
dd802431ad tinflate: Support either stream or inplace uncompress mode.
If tinf_uncompress_dyn_init() called with NULL dictionary, inplace mode will
be active. Output will still be produced in chunks of .destSize, but any
data written to .dest pointer should remain there (and the pointer itself
should not be touched after initialization).
2016-08-03 01:49:52 +03:00
Paul Sokolovsky
9daa35b843 tinflate: Refactor to support stream mode.
Now calling tinf_uncompress_dyn() will produce d.destSize uncompressed bytes
in d->dest (autoincremented). Before using tinf_uncompress_dyn(),
tinf_uncompress_dyn_init() should be called, with a buffer for sliding
dictionary.
2016-08-03 01:38:11 +03:00
Paul Sokolovsky
b4082097c7 tinflate: Read source stream byte by byte using tinf_read_src_byte(). 2016-08-03 01:34:58 +03:00
jwhitelock
347295ece3 tinf_zlib_uncompress(): Set d.destSize, not d.destRemaining.
destRemaining was set instead of destSize, this caused the destRemaining
to be re-initialized in follow-up call to tinf_uncompress_dyn() function
with destSize which was uninitialized.
2016-07-04 22:02:16 +03:00
Dave Hylands
ee2f58d04c tinf_uncompress: Initialize TINF_DATA::destSize.
Without destSize being explicitly set, you get random failures
with TINF_DEST_OVERFLOW being returned (since destSize winds up
being initialized with a random value from the stack).
2016-02-01 23:01:22 +02:00
Paul Sokolovsky
ae4ca4a039 tinf_inflate_block_data(): Be more strict about type signedness.
Patch by Damien George from
https://github.com/micropython/micropython/pull/1082.patch
2015-03-19 00:01:26 +02:00
Paul Sokolovsky
f649d0d33a tinf_uncompress(): Mark unused argument.
Patch by Damien George from
https://github.com/micropython/micropython/pull/1082.patch
2015-03-19 00:01:26 +02:00
Paul Sokolovsky
e42b0fc4c4 tinf_init(): Use proper prototype for zero arguments.
Patch by Damien George from
https://github.com/micropython/micropython/pull/1082.patch
2015-03-19 00:01:26 +02:00
Paul Sokolovsky
821f3bc252 tinflate: Actually count remaining bytes in output buffer. 2015-01-25 02:48:11 +02:00
Paul Sokolovsky
537eaa95ff Add .gitignore. 2014-10-12 23:53:12 +03:00
Paul Sokolovsky
75b914f3c8 Merge genlz77.h into tinf.h. 2014-10-12 23:31:55 +03:00
Paul Sokolovsky
099af064aa Update file headers and add my copyrights where applicable. 2014-10-12 21:15:30 +03:00
Paul Sokolovsky
72607c654a Update README for uzlib. 2014-10-12 21:15:30 +03:00
Paul Sokolovsky
6bc0c21a1f tinflate, tinfzlib: Provide API taking TINF_DATA* and incremental alloc.
The new API takes a pointer to TINF_DATA (which thus can be allocated by
caller the way it sees fit) and provides callback to incrementally increase
size of decompression buffer.
2014-10-12 21:15:30 +03:00
Paul Sokolovsky
4a54b86313 tinf.h: TINF_DATA is now part of external API.
Users need to have freedom where and how to allocate it.
2014-10-12 21:15:30 +03:00
Paul Sokolovsky
73cd6a2dec Add "tgzip" example. 2014-10-12 21:15:30 +03:00
Paul Sokolovsky
fefb7bbcb5 tgunzip: Produce link map file. 2014-10-12 21:15:30 +03:00
Paul Sokolovsky
807ce9884d makefile.elf: Add defl_static and genlz77. 2014-10-12 21:15:29 +03:00
Paul Sokolovsky
9d639d6dcc genlz77: Generic LZ77 hash compressor. 2014-10-12 21:15:29 +03:00
Paul Sokolovsky
2eb3c5275d defl_static: Add DEFLATE static Huffman encoding, ported from PuTTY. 2014-10-12 21:09:39 +03:00
Paul Sokolovsky
81ae6225de Provide option to have predefined static extra bits tables.
Having a neat algo to create them at runtime is neat, but on embedded
systems, RAM is precious, ROM is less so.
2014-10-12 21:09:39 +03:00
Paul Sokolovsky
29957f12a0 Make executable depend on library. 2014-09-15 23:11:08 -07:00
Paul Sokolovsky
8611ea758c Don't spend runtime memory on static huffman tables.
Build them dynamically as needed, just for blocks needing them, using the
same objects as dymanic trees. Given how most deflated files structured,
this won't need to be done too often.
2014-09-15 23:11:08 -07:00
Paul Sokolovsky
9723624454 Get rid of a separate codelength huffman tree, reuse length tree for this.
Codelengths are used to decode length, based on which length tree is built.
That means that codelength and length trees' lifetimes are serialized,
advantage of which we take to save bunch of runtime memory.
2014-09-15 23:10:34 -07:00
Paul Sokolovsky
7d06d511a6 Fix line-endings CRLF -> LF. 2014-08-20 03:52:43 +03:00
Joergen Ibsen
c2eaa885d0 Changed readme to markdown. 2012-11-13 23:55:14 +01:00
Joergen Ibsen
93352fca2a Initial commit of tinf v1.00 source. 2012-11-13 23:14:45 +01:00