ZLib

INT GzClose(
    gzFile zFile)


Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see GzError).


INT GzEof(
    gzFile zFile)


Returns 1 when end-of-file has previously been detected reading the given input stream, otherwise zero.


CHAR * GzError(
    gzFile zFile,
    INT * piError)


Returns the error message for the last error which occurred on the given compressed file. piError is set to the zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO.


INT GzFlush(
    gzFile zFile,
    INT iFlush)


Flushes all pending output into the compressed file. The return value is the zlib error number (see GzError). GzFlush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed.


INT GzGetC(
    gzFile zFile)


Reads one byte from the compressed file. GzGetC returns this byte or -1 in case of end-of-file or error.


CHAR * GzGetS(
    gzFile zFile,
    const CHAR * pcBuffer,
    DWORD dwMaxLen)


Reads bytes from the compressed file until (dwMaxLen - 1) characters are read, or a newline character is read and transferred to pcBuffer, or an end-of-file condition is encountered. The string is then terminated with a NULL character.


gzFile GzOpen(
    const CHAR * pcPath,
    const CHAR * pcMode)


Opens a gzip (.gz) file for reading or writing. The mode parameter is as in FOpen (rb or wb) but can also include a compression level (wb9) or a strategy: f for filtered data as in wb6f, h for Huffman only compression as in wb1h.


INT GzPrintF(
    gzFile zFile,
    const CHAR * pcFormat,
    ...)


Converts, formats, and writes the arguments to the compressed file under control of the format string, just as FPrintF does. GzPrintF returns the number of uncompressed bytes actually written (0 in case of error).


INT GzPutC(
    gzFile zFile,
    INT iChar)


Writes cChar, converted to an unsigned char, into the compressed file. GzPutC returns the value that was written, or -1 in case of error.


INT GzPutS(
    gzFile zFile,
    const CHAR * pcString)


Writes the given NULL-terminated string to the compressed file, excluding the terminating NULL character.


INT GzRead(
    gzFile zFile,
    LPVOID lpvBuffer,
    DWORD dwLength)


Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, GzRead copies the given number of bytes into the buffer.


INT GzRewind(
    gzFile zFile)


Rewinds the given file. This function is supported only for reading.


LONG GzSeek(
    gzFile zFile,
    LONG lOffset,
    INT iMethod)


Sets the starting position for the next GzRead or GzWrite on the given compressed file. iOffset represents a number of bytes in the uncompressed data stream. iMethod is defined as in FSeek; the value SEEK_END is not supported.


INT GzSetParams(
    gzFile zFile,
    INT iLevel,
    INT iStrategy)


Dynamically update the compression level or strategy.


LONG GzTell(
    gzFile zFile)


Returns the starting position for the next GzRead or GzWrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream.


INT GzWrite(
    gzFile zFile,
    LPVOID lpvBuffer,
    DWORD dwLength)


Writes the given number of uncompressed bytes into the compressed file. GzWrite returns the number of uncompressed bytes actually written (0 in case of error).


INT compress(
    PBYTE pbDest,
    PDWORD pdwDestLen,
    PBYTE pbSrc,
    DWORD dwSrcLen)


Compresses the source buffer into the destination buffer. Upon entry, pdwDestLen is the total size of the destination buffer, which must be at least 0.1% larger than dwSrcLen plus 12 bytes.
Upon exit, pdwDestLen is the actual size of the compressed buffer.


INT compress2(
    PBYTE pbDest,
    PDWORD pdwDestLen,
    PBYTE pbSrc,
    DWORD dwSrcLen,
    INT iLevel)


Compresses the source buffer into the destination buffer given a level of compression. Upon entry, pdwDestLen is the total size of the destination buffer, which must be at least 0.1% larger than dwSrcLen plus 12 bytes.
Upon exit, pdwDestLen is the actual size of the compressed buffer.


INT deflate(
    z_streamp pzsStream,
    INT iFlush)


Compresses as much data as possible and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. Z_NO_FLUSH is the typical value for iFlush.


INT deflateEnd(
    z_streamp pzsStream)


Frees all dynamically allocated data structures for this stream. This function discards any unprocessed input and does not flush any pending output.


INT deflateInit(
    z_streamp pzsStream,
    INT iLevel)


Initializes the internal stream state for compression. The fields zalloc, zfree, and opaque are automatically set to Z_NULL and default allocations are always used. iLevel must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time).


INT deflateToFile(
    const PBYTE pbData,
    DWORD dwDataLength,
    const _TCHAR * ptcDest,
    INT iLevel)


Compresses the data in pbData and stores the result into the file indicated by ptcDest. Returns Z_OK if successful, or another Z_* error code otherwise.


INT inflate(
    z_streamp pzsStream,
    INT iFlush)


Decompresses as much data as possible and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. Z_NO_FLUSH is the typical value for iFlush.


INT inflateEnd(
    z_streamp pzsStream)


Frees all dynamically allocated data structures for this stream. This function discards any unprocessed input and does not flush any pending output.


INT inflateFromFile(
    const _TCHAR * ptcSrc,
    PBYTE * ppbDest,
    PDWORD pdwDataLength)


Decompresses a file and stores the data in the memory buffer to which ppbDest points. The size of the buffer is returned in pdwDataLength. When the buffer that receives the decompressed data is no longer needed, it must be freed with a call to Free().


INT inflateInit(
    z_streamp pzsStream)


Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree, and opaque are automatically initialized.


INT uncompress(
    PBYTE pbDest,
    PDWORD pdwDestLen,
    PBYTE pbSrc,
    DWORD dwSrcLen)


Decompresses the source buffer into the destination buffer. Upon entry, pdwDestLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.)
Upon exit, pdwDestLen is the actual size of the compressed buffer.


Copyright © 2006 Shawn (L. Spiro) Wilcoxen