Leptonica 1.54
Файл src/zlibmem.c
#include "allheaders.h"
#include "zlib.h"

Функции

l_uint8zlibCompress (l_uint8 *datain, size_t nin, size_t *pnout)
l_uint8zlibUncompress (l_uint8 *datain, size_t nin, size_t *pnout)

Переменные

static const l_int32 L_BUF_SIZE = 32768
static const l_int32 ZLIB_COMPRESSION_LEVEL = 6

Функции

l_uint8* zlibCompress ( l_uint8 datain,
size_t  nin,
size_t *  pnout 
)

zlibCompress()

Input: datain (byte buffer with input data) nin (number of bytes of input data) &nout (<return> number of bytes of output data) Return: dataout (compressed data), or null on error

Notes: (1) We repeatedly read in and fill up an input buffer, compress the data, and read it back out. zlib uses two byte buffers internally in the z_stream data structure. We use the bbuffers to feed data into the fixed bufferin, and feed it out of bufferout, in the same way that a pair of streams would normally be used if the data were being read from one file and written to another. This is done iteratively, compressing L_BUF_SIZE bytes of input data at a time.

l_uint8* zlibUncompress ( l_uint8 datain,
size_t  nin,
size_t *  pnout 
)

zlibUncompress()

Input: datain (byte buffer with compressed input data) nin (number of bytes of input data) &nout (<return> number of bytes of output data) Return: dataout (uncompressed data), or null on error

Notes: (1) See zlibCompress().


Переменные

const l_int32 L_BUF_SIZE = 32768 [static]
const l_int32 ZLIB_COMPRESSION_LEVEL = 6 [static]