Public Types | Static Public Member Functions

Celartem::Zlib Struct Reference

#include <cel_compress.h>

List of all members.

Public Types

enum  { levelDefault = -1 }

Static Public Member Functions

static void compress (SimpleArray< u8 > &outBuffer, const u8 *CEL_RESTRICT inData, size_t inSize, int compLevel=levelDefault)
static void compress (u8 *CEL_RESTRICT outBuffer, size_t *CEL_RESTRICT ioSize, const u8 *CEL_RESTRICT inData, size_t inSize, int compLevel=levelDefault)
static void decompress (SimpleArray< u8 > &outBuffer, const u8 *CEL_RESTRICT inData, size_t inSize)
static void decompress (u8 *CEL_RESTRICT outBuffer, size_t *ioSize, const u8 *CEL_RESTRICT inData, size_t inSize)
static u32 adler32 (u32 inCurrentAdler, const u8 *CEL_RESTRICT inData, size_t inSize)
static u32 crc32 (u32 inCurrentCRC, const u8 *CEL_RESTRICT inData, size_t inSize)

Detailed Description

Compression/Decompression using zlib.


Member Enumeration Documentation

anonymous enum
Enumerator:
levelDefault 

compression level default; used with compress function.


Member Function Documentation

static u32 Celartem::Zlib::adler32 ( u32  inCurrentAdler,
const u8 *CEL_RESTRICT  inData,
size_t  inSize 
) [static]

This function updates zlib origin Adler-32 checksum.
If inData is NULL, this funcion returnes the initial value for the checksum.

Parameters:
inCurrentCRC Current checksum value.
inData 
inData Pointer that points the data to be verified.
inSize The size of the data specified by inData.

The following code is a sample usage of this function:

u32 crc = Zlib::adler32(0, NULL, 0);
while(...)
{
    crc = Zlib::adler32(crc, buffer, length);
}
if(crc != original_crc) error();
static void Celartem::Zlib::compress ( SimpleArray< u8 > &  outBuffer,
const u8 *CEL_RESTRICT  inData,
size_t  inSize,
int  compLevel = levelDefault 
) [static]

This function compresses the specified data using zlib.

Parameters:
outBuffer A buffer to receive the compressed result.
inData Pointer that points the data to be compressed.
inSize The size of the data specified by inData.
compLevel Compression level in 1-9. Smaller number means faster but low-compression ratio. levelDefault currently stands for 6.
static void Celartem::Zlib::compress ( u8 *CEL_RESTRICT  outBuffer,
size_t *CEL_RESTRICT  ioSize,
const u8 *CEL_RESTRICT  inData,
size_t  inSize,
int  compLevel = levelDefault 
) [static]

This function compresses the specified data using zlib.

Parameters:
outBuffer A buffer to receive the compressed result.
ioSize [IN] The size of the buffer specified by outBuffer.
[OUT] The bytes written on the outBuffer.
inData Pointer that points the data to be compressed.
inSize The size of the data specified by inData.
compLevel Compression level in 1-9. Smaller number means faster but low-compression ratio. levelDefault currently stands for 6.
static u32 Celartem::Zlib::crc32 ( u32  inCurrentCRC,
const u8 *CEL_RESTRICT  inData,
size_t  inSize 
) [static]

This function updates CRC32 checksum.
If inData is NULL, this funcion returnes the initial value for the checksum.

Parameters:
inCurrentCRC Current checksum value.
inData 
inData Pointer that points the data to be verified.
inSize The size of the data specified by inData.

The following code is a sample usage of this function:

u32 crc = Zlib::crc32(0, NULL, 0);
while(...)
{
    crc = Zlib::crc32(crc, buffer, length);
}
if(crc != original_crc) error();
static void Celartem::Zlib::decompress ( u8 *CEL_RESTRICT  outBuffer,
size_t *  ioSize,
const u8 *CEL_RESTRICT  inData,
size_t  inSize 
) [static]

This function decompresses the specified data using zlib.

Parameters:
outBuffer The buffer to receive the decompressed result.
ioSize [IN] The size of the buffer specified by outBuffer. [OUT] The bytes written on the outBuffer.
inData Pointer that points the data to be decompressed.
inSize The size of the data specified by inData.
static void Celartem::Zlib::decompress ( SimpleArray< u8 > &  outBuffer,
const u8 *CEL_RESTRICT  inData,
size_t  inSize 
) [static]

This function decompresses the specified data using zlib.

Parameters:
outBuffer A buffer to receive the decompressed result. This buffer must be large enough to receive the decompressed result.
inData Pointer that points the data to be decompressed.
inSize The size of the data specified by inData.

The documentation for this struct was generated from the following file:

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:17.
Caminova Logo