Nilorea Library
C utilities for networking, threading, graphics
ZLIB: shortcuts to easy compress/decompress data

Functions

int CompressData (unsigned char *abSrc, unsigned int nLenSrc, unsigned char *abDst, unsigned int nLenDst)
 Compress a string to another. More...
 
int GetMaxCompressedLen (unsigned int nLenSrc)
 Return the maximum compressed size. More...
 
int UncompressData (unsigned char *abSrc, unsigned int nLenSrc, unsigned char *abDst, unsigned int nLenDst)
 Uncompress a string to another. More...
 
N_STRunzip_nstr (N_STR *src)
 return an uncompressed version of src More...
 
N_STRzip_nstr (N_STR *src)
 return a compressed version of src More...
 

Detailed Description

Function Documentation

◆ CompressData()

int CompressData ( unsigned char *  abSrc,
unsigned int  nLenSrc,
unsigned char *  abDst,
unsigned int  nLenDst 
)

Compress a string to another.

Parameters
abSrcsource string
nLenSrcsize of source string
abDstdestination string
nLenDstdestination length
Returns
-1 or lenght of output

Definition at line 42 of file n_zlib.c.

References __n_assert, LOG_ERR, and n_log.

Referenced by zip_nstr().

+ Here is the caller graph for this function:

◆ GetMaxCompressedLen()

int GetMaxCompressedLen ( unsigned int  nLenSrc)

Return the maximum compressed size.

Parameters
nLenSrc
Returns
The size in bytes

Definition at line 26 of file n_zlib.c.

Referenced by zip_nstr().

+ Here is the caller graph for this function:

◆ UncompressData()

int UncompressData ( unsigned char *  abSrc,
unsigned int  nLenSrc,
unsigned char *  abDst,
unsigned int  nLenDst 
)

Uncompress a string to another.

Parameters
abSrcsource string
nLenSrcsize of source string
abDstdestination string
nLenDstdestination length
Returns
-1 or lenght of output

Definition at line 99 of file n_zlib.c.

References __n_assert, LOG_ERR, and n_log.

Referenced by unzip_nstr().

+ Here is the caller graph for this function:

◆ unzip_nstr()

N_STR * unzip_nstr ( N_STR src)

return an uncompressed version of src

Parameters
srcThe source string
Returns
The uncompressed string or NULL

Definition at line 203 of file n_zlib.c.

References __n_assert, free_nstr, LOG_DEBUG, LOG_ERR, n_log, new_nstr(), and UncompressData().

+ Here is the call graph for this function:

◆ zip_nstr()

N_STR * zip_nstr ( N_STR src)

return a compressed version of src

Parameters
srcThe source string
Returns
The compressed string or NULL

Definition at line 153 of file n_zlib.c.

References __n_assert, CompressData(), free_nstr, GetMaxCompressedLen(), LOG_DEBUG, LOG_ERR, n_log, and new_nstr().

+ Here is the call graph for this function: