The ZLib library provides a very thin wrapper around the open source zlib (version 1.2.3) compression utilities. For complete sources of the zlib libraries, please reference the code online at http://www.zlib.net/ or contact Critical Link for a copy of the software used to build the library.
This implementation of Zlib is compiled to support decoding and encoding gzip style headers (see RFC 1952). This unit has been tested to inflate gzip compressed files loaded into memory as well as compressing/uncompressing RAW image data using the methods wrapped in the ZLib namespace.
Example code that could be used to extract a gzip compressed image into memory is shown in the code segment below.
{ void UnCompressGZIP(unsigned char* Addr, int Length, char* out, int OutLength) { unsigned char* Addr = GZIP_IMAGE_ADDR; unsigned int Length = GZIP_IMAGE_LENGTH; unsigned char* out; unsigned int OutLength = INFLATED_LENGTH; // Output length, could be stored, also // can be read from GZIP file (last integer in file) // can also be made "big" and get actual size later, // (this would require cleaning up unused memory...) unsigned int iflength = OutLength; // inflated length int rv; out = new unsigned char[OutLength]; rv = UnCompress(out, &OutLength, (unsigned char*)Addr, Length); if (rv == eeOK) { // iflength is actual uncompressed size // out contains image data } delete [] heap; }