Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ZLIB: shortcuts to easy compress/decompress data

Functions

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

Detailed Description

Function Documentation

◆ CompressData()

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

Definition at line 37 of file n_zlib.c.

◆ GetMaxCompressedLen()

size_t GetMaxCompressedLen ( size_t  nLenSrc)

Return the maximum compressed size.

Parameters
nLenSrc
Returns
The size in bytes

Definition at line 24 of file n_zlib.c.

Referenced by zip_nstr().

+ Here is the caller graph for this function:

◆ UncompressData()

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

Uncompress a string to another.

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

Definition at line 94 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 199 of file n_zlib.c.

References __n_assert, N_STR::data, free_nstr, N_STR::length, LOG_DEBUG, LOG_ERR, n_log, new_nstr(), UncompressData(), and N_STR::written.

+ 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 148 of file n_zlib.c.

References __n_assert, N_STR::data, free_nstr, GetMaxCompressedLen(), N_STR::length, LOG_DEBUG, LOG_ERR, n_log, new_nstr(), and N_STR::written.

+ Here is the call graph for this function: