Header Header

Compression handling


Detailed Description

Functions for compression handling.


Functions

static int gx_gzcompress (gxHANDLE handle, void *target, int *tgtlen, const void *source, int srclen, int level)
 Compresses a memory area.
static int gx_gzcompressd (void *target, int *tgtlen, const void *source, int srclen, int level)
 Compresses a memory area.
static int gx_gzuncompress (gxHANDLE handle, void *target, int *tgtlen, const void *source, int srclen)
 Decompresses a compressed data from memory.
static int gx_gzuncompressd (void *target, int *tgtlen, const void *source, int srclen)
 Decompresses a compressed data from memory.
static int gx_creategz (gxHANDLE handle, const wchar_t *filename, int level, int strategy)
 Creates a .gz file (Unicode version).
static int gx_creategza (gxHANDLE handle, const char *filename, int level, int strategy)
 Creates a .gz file (ASCII version).
static int gx_opengz (gxHANDLE handle, const wchar_t *filename)
 Opens the .gz file (Unicode version).
static int gx_opengza (gxHANDLE handle, const char *filename)
 Opens the .gz file (ASCII version).
static int gx_closegz (gxHANDLE handle)
 Closes an opened or created .gz file.
static int gx_readgz (gxHANDLE handle, void *buffer, int *buflen)
 Reads data from an opened .gz file.
static int gx_writegz (gxHANDLE handle, const void *buffer, int buflen)
 Writes data to a created .gz file.
static int gx_createzip (gxHANDLE handle, const wchar_t *filename, int mode)
 Creates a ZIP file (Unicode version).
static int gx_createzipa (gxHANDLE handle, const char *filename, int mode)
 Creates a ZIP file (ASCII version).
static int gx_openzip (gxHANDLE handle, const wchar_t *filename)
 Opens a ZIP file (Unicode version).
static int gx_openzipa (gxHANDLE handle, const char *filename)
 Opens a ZIP file (ASCII version).
static int gx_createzipinmemory (gxHANDLE handle, int mode)
 Creates a ZIP file in memory.
static int gx_getzipinmemory (gxHANDLE handle, void **pbuffer, int *pbuflen)
 Get the created ZIP file in memory.
static int gx_openzipinmemory (gxHANDLE handle, void *buffer, int buflen)
 Opens a ZIP file in memory.
static int gx_closezip (gxHANDLE handle, const wchar_t *comment)
 It closes an opened/created ZIP file (Unicode version).
static int gx_closezipa (gxHANDLE handle, const char *comment)
 It closes an opened/created ZIP file (ASCII version).
static int gx_getzipinfo (gxHANDLE handle, struct GX_PARM_GETZIPINFO *info)
 Gives informations about the opened ZIP file.
static int gx_getzipcomment (gxHANDLE handle, wchar_t *target, int *tlen)
 Reads the comment from the archive (Unicode version).
static int gx_getzipcommenta (gxHANDLE handle, char *target, int *tlen)
 Reads the comment from the archive (ASCII version).
static int gx_createfileinzip (gxHANDLE handle, struct GX_PARM_CREATEFILEINZIPW *cfz)
 Creates a file in the archive (Unicode version).
static int gx_createfileinzipa (gxHANDLE handle, struct GX_PARM_CREATEFILEINZIP *cfz)
 Creates a file in the archive (ASCII version).
static int gx_writetofileinzip (gxHANDLE handle, const void *buffer, int buflen)
 Writes data to the current file in the archive.
static int gx_closefileinzip (gxHANDLE handle)
 Closes the current file in the archive.
static int gx_firstfileinzip (gxHANDLE handle, GX_ZIPFILEDETINFOW *finfo)
 Sets marker to the first file in the archive (Unicode version).
static int gx_firstfileinzipa (gxHANDLE handle, GX_ZIPFILEDETINFO *finfo)
 Sets marker to the first file in the archive.
static int gx_nextfileinzip (gxHANDLE handle, GX_ZIPFILEDETINFOW *finfo)
 Sets marker to the next file in the archive (Unicode version).
static int gx_nextfileinzipa (gxHANDLE handle, GX_ZIPFILEDETINFO *finfo)
 Sets marker to the next file in the archive.
static int gx_locatefileinzip (gxHANDLE handle, GX_ZIPFILEDETINFOW *finfo, const wchar_t *filename, int casesensitivity)
 Sets marker to the specified file in the archive (Unicode version).
static int gx_locatefileinzipa (gxHANDLE handle, GX_ZIPFILEDETINFO *finfo, const char *filename, int casesensitivity)
 Sets marker to the specified file in the archive (ASCII version).
static int gx_fileinfoinzip (gxHANDLE handle, GX_ZIPFILEDETINFOW *finfo)
 Gives information about a marked file in the archive (Unicode version).
static int gx_fileinfoinzipa (gxHANDLE handle, GX_ZIPFILEDETINFO *finfo)
 Gives information about a marked file in the archive (ASCII version).
static int gx_openfileinzip (gxHANDLE handle, int *method, int *level, const wchar_t *password)
 Opens a marked file in the archive (Unicode version).
static int gx_openfileinzipa (gxHANDLE handle, int *method, int *level, const char *password)
 Opens a marked file in the archive.
static int gx_readfromfileinzip (gxHANDLE handle, void *target, int *tlen)
 It reads a content from a marked file in the archive.
static int gx_calculatezipcrc (gxHANDLE handle, unsigned int *crc, const void *buffer, int buflen)
 Calculates CRC-32 value from the specified buffer.
static int gx_calculatezipcrcd (unsigned int *crc, const void *buffer, int buflen)
 Calculates CRC-32 value from the specified buffer.
static int gx_getinitialzipcrc (gxHANDLE handle, unsigned int *crc)
 Returns the initial CRC.
static int gx_getinitialzipcrcd (unsigned int *crc)
 Returns the initial CRC.
static int gx_readlexfieldzip (gxHANDLE handle, void *buffer, int *buflen)
 Reads the local extra field of the marked file in the archive.


Function Documentation

static int gx_gzcompress ( gxHANDLE  handle,
void *  target,
int *  tgtlen,
const void *  source,
int  srclen,
int  level 
) [static]

Compresses a memory area.

Parameters:
handle Handle of an opened ZLIB module.
target Pointer to an allocated area where the function writes the compressed data.
tgtlen Length of the allocated area. The function updates it with the length of the compressed data.
source Pointer to an uncompressed data.
srclen Length of the uncompressed data.
level Compression level 0-9 (see GX_ZLEVELS).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

Referenced by gx_gzcompressd().

static int gx_gzcompressd ( void *  target,
int *  tgtlen,
const void *  source,
int  srclen,
int  level 
) [static]

Compresses a memory area.

Parameters:
target Pointer to an allocated area where the function writes the compressed data.
tgtlen Length of the allocated area. The function updates it with the length of the compressed data.
source Pointer to an uncompressed data.
srclen Length of the uncompressed data.
level Compression level 0-9 (see GX_ZLEVELS).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_direct(), and gx_gzcompress().

static int gx_gzuncompress ( gxHANDLE  handle,
void *  target,
int *  tgtlen,
const void *  source,
int  srclen 
) [static]

Decompresses a compressed data from memory.

Parameters:
handle Handle of an opened ZLIB module.
target Pointer to an allocated area where the function writes the uncompressed data.
tgtlen Length of the allocated area. The function updates it with the length of the uncompressed data.
source Pointer to a compressed data.
srclen Length of the compressed data.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

Referenced by gx_gzuncompressd().

static int gx_gzuncompressd ( void *  target,
int *  tgtlen,
const void *  source,
int  srclen 
) [static]

Decompresses a compressed data from memory.

Parameters:
target Pointer to an allocated area where the function writes the uncompressed data.
tgtlen Length of the allocated area. The function updates it with the length of the uncompressed data.
source Pointer to a compressed data.
srclen Length of the compressed data.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_direct(), and gx_gzuncompress().

static int gx_creategz ( gxHANDLE  handle,
const wchar_t *  filename,
int  level,
int  strategy 
) [static]

Creates a .gz file (Unicode version).

Use it when you can compress data into a single file.

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the .gz file.
level Compression level (see GX_ZLEVELS).
strategy Compression strategy (see GX_ZSTRATEGIES).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_creategza ( gxHANDLE  handle,
const char *  filename,
int  level,
int  strategy 
) [static]

Creates a .gz file (ASCII version).

Use it when you can compress data into a single file.

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the .gz file.
level Compression level (see GX_ZLEVELS).
strategy Compression strategy (see GX_ZSTRATEGIES).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_opengz ( gxHANDLE  handle,
const wchar_t *  filename 
) [static]

Opens the .gz file (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the .gz file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_opengza ( gxHANDLE  handle,
const char *  filename 
) [static]

Opens the .gz file (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the .gz file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_closegz ( gxHANDLE  handle  )  [static]

Closes an opened or created .gz file.

Parameters:
handle Handle of an opened ZLIB module.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_readgz ( gxHANDLE  handle,
void *  buffer,
int *  buflen 
) [static]

Reads data from an opened .gz file.

Parameters:
handle Handle of an opened ZLIB module.
buffer Pointer to an allocated area where the function reads data.
buflen Length of the allocated area, the function updates it with length of unpacked data.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_writegz ( gxHANDLE  handle,
const void *  buffer,
int  buflen 
) [static]

Writes data to a created .gz file.

Parameters:
handle Handle of an opened ZLIB module.
buffer Pointer to an unpacked data.
buflen Length of the unpacked data.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_createzip ( gxHANDLE  handle,
const wchar_t *  filename,
int  mode 
) [static]

Creates a ZIP file (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the ZIP file.
mode Create mode (see GX_CREATEZIPMODES).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_createzipa ( gxHANDLE  handle,
const char *  filename,
int  mode 
) [static]

Creates a ZIP file (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the ZIP file.
mode Create mode (see GX_CREATEZIPMODES).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_openzip ( gxHANDLE  handle,
const wchar_t *  filename 
) [static]

Opens a ZIP file (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the ZIP file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_openzipa ( gxHANDLE  handle,
const char *  filename 
) [static]

Opens a ZIP file (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
filename Path and name of the ZIP file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_createzipinmemory ( gxHANDLE  handle,
int  mode 
) [static]

Creates a ZIP file in memory.

Parameters:
handle Handle of an opened ZLIB module.
mode Create mode (see GX_CREATEZIPMODES).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_getzipinmemory ( gxHANDLE  handle,
void **  pbuffer,
int *  pbuflen 
) [static]

Get the created ZIP file in memory.

Parameters:
handle Handle of an opened ZLIB module.
pbuffer Pointer to the ZIP file in memory.
pbuflen Pointer to the length of the ZIP file in memory.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_openzipinmemory ( gxHANDLE  handle,
void *  buffer,
int  buflen 
) [static]

Opens a ZIP file in memory.

Parameters:
handle Handle of an opened ZLIB module.
buffer The ZIP file in memory.
buflen The length of the ZIP file in memory.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_closezip ( gxHANDLE  handle,
const wchar_t *  comment 
) [static]

It closes an opened/created ZIP file (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
comment Comment string for the ZIP file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_closezipa ( gxHANDLE  handle,
const char *  comment 
) [static]

It closes an opened/created ZIP file (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
comment Comment string for the ZIP file.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_getzipinfo ( gxHANDLE  handle,
struct GX_PARM_GETZIPINFO *  info 
) [static]

Gives informations about the opened ZIP file.

Parameters:
handle Handle of an opened ZLIB module.
info Pointer to an information structure where the function fills it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_getzipcomment ( gxHANDLE  handle,
wchar_t *  target,
int *  tlen 
) [static]

Reads the comment from the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
target Pointer to an allocated area where the function writes the comment string.
tlen Length of the allocated area in characters.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_getzipcommenta ( gxHANDLE  handle,
char *  target,
int *  tlen 
) [static]

Reads the comment from the archive (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
target Pointer to an allocated area where the function writes the comment string.
tlen Length of the allocated area.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_createfileinzip ( gxHANDLE  handle,
struct GX_PARM_CREATEFILEINZIPW *  cfz 
) [static]

Creates a file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
cfz Pointer to the description structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_createfileinzipa ( gxHANDLE  handle,
struct GX_PARM_CREATEFILEINZIP *  cfz 
) [static]

Creates a file in the archive (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
cfz Pointer to the description structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_writetofileinzip ( gxHANDLE  handle,
const void *  buffer,
int  buflen 
) [static]

Writes data to the current file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
buffer Pointer to data.
buflen Length of data in bytes.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_closefileinzip ( gxHANDLE  handle  )  [static]

Closes the current file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_firstfileinzip ( gxHANDLE  handle,
GX_ZIPFILEDETINFOW *  finfo 
) [static]

Sets marker to the first file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_firstfileinzipa ( gxHANDLE  handle,
GX_ZIPFILEDETINFO *  finfo 
) [static]

Sets marker to the first file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_nextfileinzip ( gxHANDLE  handle,
GX_ZIPFILEDETINFOW *  finfo 
) [static]

Sets marker to the next file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_nextfileinzipa ( gxHANDLE  handle,
GX_ZIPFILEDETINFO *  finfo 
) [static]

Sets marker to the next file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_locatefileinzip ( gxHANDLE  handle,
GX_ZIPFILEDETINFOW *  finfo,
const wchar_t *  filename,
int  casesensitivity 
) [static]

Sets marker to the specified file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
filename Name of the file in the archive.
casesensitivity Case sensitivity signification. It can be:
  • 1: comparision is case sensitive (like wcscmp)
  • 2: comparision is not case sensitive (like wcscmpi/wcscasecmp)
  • 0: the default case sensitivity of the operation system (like 1 on Unix, 2 on Windows)
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_locatefileinzipa ( gxHANDLE  handle,
GX_ZIPFILEDETINFO *  finfo,
const char *  filename,
int  casesensitivity 
) [static]

Sets marker to the specified file in the archive (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
filename Name of the file in the archive.
casesensitivity Case sensitivity signification. It can be:
  • 1: comparision is case sensitive (like strcmp)
  • 2: comparision is not case sensitive (like strcmpi/strcasecmp)
  • 0: the default case sensitivity of the operation system (like 1 on Unix, 2 on Windows)
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_fileinfoinzip ( gxHANDLE  handle,
GX_ZIPFILEDETINFOW *  finfo 
) [static]

Gives information about a marked file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_fileinfoinzipa ( gxHANDLE  handle,
GX_ZIPFILEDETINFO *  finfo 
) [static]

Gives information about a marked file in the archive (ASCII version).

Parameters:
handle Handle of an opened ZLIB module.
finfo Pointer to the information structure. The function will fill it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_openfileinzip ( gxHANDLE  handle,
int *  method,
int *  level,
const wchar_t *  password 
) [static]

Opens a marked file in the archive (Unicode version).

Parameters:
handle Handle of an opened ZLIB module.
method Pointer to an integer. The function will update it to the compression method.
level Pointer to an integer. The function will update it to the compression level.
password Password string if the file is encoded. It can be NULL.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_openfileinzipa ( gxHANDLE  handle,
int *  method,
int *  level,
const char *  password 
) [static]

Opens a marked file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
method Pointer to an integer. The function will update it to the compression method.
level Pointer to an integer. The function will update it to the compression level.
password Password string if the file is encoded. It can be NULL.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_readfromfileinzip ( gxHANDLE  handle,
void *  target,
int *  tlen 
) [static]

It reads a content from a marked file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
target Pointer to an allocated area.
tlen Length of the allocated area in bytes.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

static int gx_calculatezipcrc ( gxHANDLE  handle,
unsigned int *  crc,
const void *  buffer,
int  buflen 
) [static]

Calculates CRC-32 value from the specified buffer.

Parameters:
handle Handle of an opened ZLIB module.
crc The initial CRC-32 value (gx_getinitialzipcrc()), the function will be updated it.
buffer Pointer to data.
buflen Length of the data in bytes.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

Referenced by gx_calculatezipcrcd().

static int gx_calculatezipcrcd ( unsigned int *  crc,
const void *  buffer,
int  buflen 
) [static]

Calculates CRC-32 value from the specified buffer.

Parameters:
crc The initial CRC-32 value (gx_getinitialzipcrc()), the function will be updated it.
buffer Pointer to data.
buflen Length of the data in bytes.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_calculatezipcrc(), and gx_direct().

static int gx_getinitialzipcrc ( gxHANDLE  handle,
unsigned int *  crc 
) [static]

Returns the initial CRC.

Parameters:
handle Handle of an opened ZLIB module.
crc Pointer to an area, the function will be updated it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().

Referenced by gx_getinitialzipcrcd().

static int gx_getinitialzipcrcd ( unsigned int *  crc  )  [static]

Returns the initial CRC.

Parameters:
crc Pointer to an area, the function will be updated it.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_direct(), and gx_getinitialzipcrc().

static int gx_readlexfieldzip ( gxHANDLE  handle,
void *  buffer,
int *  buflen 
) [static]

Reads the local extra field of the marked file in the archive.

Parameters:
handle Handle of an opened ZLIB module.
buffer Pointer to data.
buflen Length of the data in bytes.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately ( see gx_geterror() ).

References gx_call().


Generated  for GX
(c) Adaptive Recognition