• Stars
    star
    161
  • Rank 226,167 (Top 5 %)
  • Language
    C
  • License
    zlib License
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tiny inflate library (inflate, gzip, zlib)

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:

  • Memory for the tinf_data object should be passed, to avoid using more than 1k of stack space
  • Wrappers for unpacking zip archives and png images
  • Blocking of some sort, so everything does not have to be in memory
  • Optional table-based Huffman decoder
  • Small compressor using fixed Huffman trees

Related Projects

License

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

More Repositories

1

parg

Parser for argv that works similarly to getopt
C
176
star
2

brieflz

Small fast Lempel-Ziv compression library
C
100
star
3

scv

ANSI C implementation of dynamic array, with interface similar to C++ std::vector
C
38
star
4

blz4

Example of LZ4 compression with optimal parsing using BriefLZ algorithms
C
27
star
5

lzdatagen

LZ data generator
C
21
star
6

bcrush

Example of CRUSH compression with optimal parsing using BriefLZ algorithms
C
14
star
7

galib

Copy of GAlib (http://lancet.mit.edu/ga/) for use in pngwolf-zopfli
C
12
star
8

spooky

SpookyHash in C
C
10
star
9

tmcolorconv

Convert tmTheme to sRGB color space
Python
9
star
10

pngquant-winbuild

Setup for building pngquant on Windows
Makefile
7
star
11

bdftools

Command line tools modified for converting the Dina programming font between FON and BDF format
C
7
star
12

yamltotm

YAML to tmTheme
Python
7
star
13

vscode-solarized-minimal

Solarized Minimal color theme for Visual Studio Code
6
star
14

ExportSnapshot

Lightroom plug-in to create snapshot on export
Lua
6
star
15

wideint

C++ implementation of wide exact-width integer types
C++
4
star
16

blog

Basic logging
C
3
star
17

oksolar-minimal

OKSolar Minimal color scheme generator
Python
3
star
18

BackupHelper

Lightroom plug-in to add menu item for catalog backup
Lua
2
star
19

ulz

An ultra-fast LZ77 compressor/data compression library
C++
2
star
20

aocpp2019

Advent of Code 2019 solutions in C++17
C++
2
star
21

aocpp2018

Advent of Code 2018 solutions in C++17
C++
2
star
22

com2text

MS-DOS COM to Text Converters
Assembly
2
star
23

hardtoc

Hard to C blog
HTML
1
star
24

citest

Test repository for playing around with GitHub Actions
Meson
1
star
25

atom-solarized-minimal-dark

Solarized Minimal Dark color theme for Atom
CSS
1
star
26

solarized_minimal

Solarized Minimal color scheme for Sublime Text
XML
1
star
27

solarized-minimal

Website for Solarized Minimal
HTML
1
star
28

lzeg

1
star