Home

Awesome

tinf - tiny inflate library

Version 1.2.1

Copyright (c) 2003-2019 Joergen Ibsen

http://www.ibsensoftware.com/

tinf CI codecov

About

tinf is a small library implementing the decompression algorithm for the deflate compressed data format (called 'inflate'). Deflate compression is used in e.g. zlib, gzip, zip, and png.

I wrote it because I needed a small in-memory zlib decompressor for a self- extracting archive, and the zlib library added 15k to my program. The tinf code added only 2k.

Naturally the size difference is insignificant in most cases. Also, the zlib library has many more features, is well-tested, and mostly faster. But if you have a project that calls for a small and simple deflate decompressor, give it a try :-)

Usage

The include file src/tinf.h contains documentation in the form of doxygen comments.

Wrappers for decompressing zlib and gzip data in memory are supplied.

tgunzip, an example command-line gzip decompressor in C, is included.

tinf uses CMake to generate build systems. To create one for the tools on your platform, and build tinf, use something along the lines of:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release

You can also compile the source files and link them into your project. CMake just provides an easy way to build and test across various platforms and toolsets.

Notes

tinf requires int to be at least 32-bit.

The inflate algorithm and data format are from 'DEFLATE Compressed Data Format Specification version 1.3' (RFC 1951).

The zlib data format is from 'ZLIB Compressed Data Format Specification version 3.3' (RFC 1950).

The gzip data format is from 'GZIP file format specification version 4.3' (RFC 1952).

The original version of tinf assumed it was given valid compressed data, and that there was sufficient space for the decompressed data. If code size is of the utmost importance, and you are absolutely sure you can trust the compressed data, you may want to check out tinf 1.1.0 (last release without security checks).

Ideas for future versions:

Related Projects

License

This projected is licensed under the zlib License (Zlib).