Файл src/zlibmem.c

#include <stdio.h>
#include <stdlib.h>
#include "allheaders.h"
#include "zlib.h"

Функции

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

Переменные

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

Функции

l_uint8* zlibCompress ( l_uint8 datain,
l_int32  nin,
l_int32 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,
l_int32  nin,
l_int32 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]


Документация по Leptonica. Последние изменения: Fri Aug 7 20:31:38 2009. Создано системой  doxygen 1.5.9