#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | tinfl_huff_table |
struct | tinfl_decompressor_tag |
Macros | |
#define | TINFL_HEADER_INCLUDED |
#define | MZ_MACRO_END while (0) |
#define | TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) |
#define | TINFL_LZ_DICT_SIZE 32768 |
#define | tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END |
#define | tinfl_get_adler32(r) (r)->m_check_adler32 |
#define | TINFL_BITBUF_SIZE (32) |
#define | MZ_MALLOC(x) malloc(x) |
#define | MZ_FREE(x) free(x) |
#define | MZ_REALLOC(p, x) realloc(p, x) |
#define | MZ_MAX(a, b) (((a)>(b))?(a):(b)) |
#define | MZ_MIN(a, b) (((a)<(b))?(a):(b)) |
#define | MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj)) |
#define | MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) |
#define | MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) |
#define | TINFL_MEMCPY(d, s, l) memcpy(d, s, l) |
#define | TINFL_MEMSET(p, c, l) memset(p, c, l) |
#define | TINFL_CR_BEGIN switch(r->m_state) { case 0: |
#define | TINFL_CR_RETURN(state_index, result) do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END |
#define | TINFL_CR_RETURN_FOREVER(state_index, result) do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END |
#define | TINFL_CR_FINISH } |
#define | TINFL_GET_BYTE(state_index, c) |
#define | TINFL_NEED_BITS(state_index, n) do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n)) |
#define | TINFL_SKIP_BITS(state_index, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END |
#define | TINFL_GET_BITS(state_index, b, n) do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END |
#define | TINFL_HUFF_BITBUF_FILL(state_index, pHuff) |
#define | TINFL_HUFF_DECODE(state_index, sym, pHuff) |
Typedefs | |
typedef unsigned char | mz_uint8 |
typedef signed short | mz_int16 |
typedef unsigned short | mz_uint16 |
typedef unsigned int | mz_uint32 |
typedef unsigned int | mz_uint |
typedef unsigned long long | mz_uint64 |
typedef int(* | tinfl_put_buf_func_ptr )(const void *pBuf, int len, void *pUser) |
typedef struct tinfl_decompressor_tag | tinfl_decompressor |
typedef mz_uint32 | tinfl_bit_buf_t |
Enumerations | |
enum | { TINFL_FLAG_PARSE_ZLIB_HEADER = 1, TINFL_FLAG_HAS_MORE_INPUT = 2, TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, TINFL_FLAG_COMPUTE_ADLER32 = 8 } |
enum | tinfl_status { TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS = -4, TINFL_STATUS_BAD_PARAM = -3, TINFL_STATUS_ADLER32_MISMATCH = -2, TINFL_STATUS_FAILED = -1, TINFL_STATUS_DONE = 0, TINFL_STATUS_NEEDS_MORE_INPUT = 1, TINFL_STATUS_HAS_MORE_OUTPUT = 2 } |
enum | { TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS } |
Functions | |
void * | tinfl_decompress_mem_to_heap (const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags) |
size_t | tinfl_decompress_mem_to_mem (void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) |
int | tinfl_decompress_mem_to_callback (const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags) |
tinfl_status | tinfl_decompress (tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags) |
#define MZ_CLEAR_OBJ | ( | obj | ) | memset(&(obj), 0, sizeof(obj)) |
#define MZ_FREE | ( | x | ) | free(x) |
#define MZ_MACRO_END while (0) |
#define MZ_MALLOC | ( | x | ) | malloc(x) |
#define MZ_MAX | ( | a, | |
b | |||
) | (((a)>(b))?(a):(b)) |
#define MZ_MIN | ( | a, | |
b | |||
) | (((a)<(b))?(a):(b)) |
#define MZ_READ_LE16 | ( | p | ) | ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U)) |
#define MZ_READ_LE32 | ( | p | ) | ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U)) |
#define MZ_REALLOC | ( | p, | |
x | |||
) | realloc(p, x) |
#define TINFL_BITBUF_SIZE (32) |
#define TINFL_CR_BEGIN switch(r->m_state) { case 0: |
#define TINFL_CR_FINISH } |
#define TINFL_CR_RETURN | ( | state_index, | |
result | |||
) | do { status = result; r->m_state = state_index; goto common_exit; case state_index:; } MZ_MACRO_END |
#define TINFL_CR_RETURN_FOREVER | ( | state_index, | |
result | |||
) | do { for ( ; ; ) { TINFL_CR_RETURN(state_index, result); } } MZ_MACRO_END |
#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) |
#define tinfl_get_adler32 | ( | r | ) | (r)->m_check_adler32 |
#define TINFL_GET_BITS | ( | state_index, | |
b, | |||
n | |||
) | do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } b = bit_buf & ((1 << (n)) - 1); bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END |
#define TINFL_GET_BYTE | ( | state_index, | |
c | |||
) |
#define TINFL_HEADER_INCLUDED |
#define TINFL_HUFF_BITBUF_FILL | ( | state_index, | |
pHuff | |||
) |
#define TINFL_HUFF_DECODE | ( | state_index, | |
sym, | |||
pHuff | |||
) |
#define tinfl_init | ( | r | ) | do { (r)->m_state = 0; } MZ_MACRO_END |
#define TINFL_LZ_DICT_SIZE 32768 |
#define TINFL_MEMCPY | ( | d, | |
s, | |||
l | |||
) | memcpy(d, s, l) |
#define TINFL_MEMSET | ( | p, | |
c, | |||
l | |||
) | memset(p, c, l) |
#define TINFL_NEED_BITS | ( | state_index, | |
n | |||
) | do { mz_uint c; TINFL_GET_BYTE(state_index, c); bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); num_bits += 8; } while (num_bits < (mz_uint)(n)) |
#define TINFL_SKIP_BITS | ( | state_index, | |
n | |||
) | do { if (num_bits < (mz_uint)(n)) { TINFL_NEED_BITS(state_index, n); } bit_buf >>= (n); num_bits -= (n); } MZ_MACRO_END |
typedef signed short mz_int16 |
typedef unsigned int mz_uint |
typedef unsigned short mz_uint16 |
typedef unsigned int mz_uint32 |
typedef unsigned long long mz_uint64 |
typedef unsigned char mz_uint8 |
typedef mz_uint32 tinfl_bit_buf_t |
typedef struct tinfl_decompressor_tag tinfl_decompressor |
typedef int(* tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser) |
anonymous enum |
anonymous enum |
enum tinfl_status |
tinfl_status tinfl_decompress | ( | tinfl_decompressor * | r, |
const mz_uint8 * | pIn_buf_next, | ||
size_t * | pIn_buf_size, | ||
mz_uint8 * | pOut_buf_start, | ||
mz_uint8 * | pOut_buf_next, | ||
size_t * | pOut_buf_size, | ||
const mz_uint32 | decomp_flags | ||
) |
int tinfl_decompress_mem_to_callback | ( | const void * | pIn_buf, |
size_t * | pIn_buf_size, | ||
tinfl_put_buf_func_ptr | pPut_buf_func, | ||
void * | pPut_buf_user, | ||
int | flags | ||
) |
void * tinfl_decompress_mem_to_heap | ( | const void * | pSrc_buf, |
size_t | src_buf_len, | ||
size_t * | pOut_len, | ||
int | flags | ||
) |
size_t tinfl_decompress_mem_to_mem | ( | void * | pOut_buf, |
size_t | out_buf_len, | ||
const void * | pSrc_buf, | ||
size_t | src_buf_len, | ||
int | flags | ||
) |