Commit graph

44 commits

Author SHA1 Message Date
Paul Sokolovsky
27176508e1 tinflate: When using sliding dictionary, check that offset lies within it. 2016-10-11 07:09:47 +03:00
Paul Sokolovsky
3fb1f4f7d8 tinfgzip: Fixes for pedantic compiler warnings. 2016-09-24 16:06:09 +03:00
Paul Sokolovsky
d83f7d4f16 adler32, crc32: Consistently use stdint types. 2016-08-17 14:46:11 +03:00
Paul Sokolovsky
7abf5a82d2 tinflate: Fixes for pedantic compiler warnings. 2016-08-17 06:23:15 +03:00
Paul Sokolovsky
79d5870ea2 Rename tinf_read_src_byte() to uzlib_get_byte(). 2016-08-15 00:15:46 +03:00
Paul Sokolovsky
9dd4fe3a9b genlz77: Update API to uzlib_ prefix. 2016-08-15 00:10:19 +03:00
Paul Sokolovsky
6e9f13e9d9 tinf: Rename remaining uncompress API functions to uzlib_ prefix. 2016-08-14 00:43:36 +03:00
Paul Sokolovsky
82812eac6e tinf: tinf_*_parse_header: Rename to uzlib_*. 2016-08-14 00:09:51 +03:00
Paul Sokolovsky
6600f29a95 tinf.h: Reorder API declarations for clarity. 2016-08-12 17:13:32 +03:00
Paul Sokolovsky
0d7290e8cf tgunzip: Update for tinf_uncompress_dyn_chksum(). 2016-08-11 01:06:58 +03:00
Paul Sokolovsky
05ee017a06 tinf: Add tinf_uncompress_dyn_chksum() handling zlib/gzip chksum calc.
If tinf_zlib_parse_header()/tinf_gzip_parse_header() were called,
tinf_uncompress_dyn_chksum() will calculate corresponding checksum
(adler32/crc32) incrementally, and at EOF check it (separate error
code return for checksum mismatch).
2016-08-10 02:01:55 +03:00
Paul Sokolovsky
61d9cd644f tinfzlib: Refactor to support stream interface. 2016-08-06 00:18:52 +03:00
Paul Sokolovsky
e200028869 tinf_adler32(): Allow to work in incremental manner.
By letting passing in previously calculated partial checksum.
2016-08-06 00:14:09 +03:00
Paul Sokolovsky
f99e297389 tinflate.c: Allow to read source in stream mode using d->readSource(). 2016-08-05 02:19:13 +03:00
Paul Sokolovsky
7e817c502a tinf: destGrow() callback no longer needed/used.
tinf_uncompress_dyn() now will uncompress amount of data specified by the
caller, so caller can grow buffer itself.
2016-08-05 02:16:57 +03:00
Paul Sokolovsky
7ede9ec449 tinf_uncompress(): Remove dangling function.
Client code now should call tinf_uncompress_dyn() directly.
2016-08-03 02:57:13 +03:00
Paul Sokolovsky
fbf79b5188 tinfgzip: Rewrite in terms of (new) tinf_uncompress_dyn().
tinf_gzip_uncompress() is gone, and replaced with 2 functions to parse
gzip header/trailer. The core decompression routine is tinf_uncompress_dyn,
and client code is expected to call it itself.
2016-08-03 02:03:00 +03:00
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