cannam@128: cannam@128: Overview cannam@128: ======== cannam@128: cannam@128: This directory contains an update to the ZLib interface unit, cannam@128: distributed by Borland as a Delphi supplemental component. cannam@128: cannam@128: The original ZLib unit is Copyright (c) 1997,99 Borland Corp., cannam@128: and is based on zlib version 1.0.4. There are a series of bugs cannam@128: and security problems associated with that old zlib version, and cannam@128: we recommend the users to update their ZLib unit. cannam@128: cannam@128: cannam@128: Summary of modifications cannam@128: ======================== cannam@128: cannam@128: - Improved makefile, adapted to zlib version 1.2.1. cannam@128: cannam@128: - Some field types from TZStreamRec are changed from Integer to cannam@128: Longint, for consistency with the zlib.h header, and for 64-bit cannam@128: readiness. cannam@128: cannam@128: - The zlib_version constant is updated. cannam@128: cannam@128: - The new Z_RLE strategy has its corresponding symbolic constant. cannam@128: cannam@128: - The allocation and deallocation functions and function types cannam@128: (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl, cannam@128: and _malloc and _free are added as C RTL stubs. As a result, cannam@128: the original C sources of zlib can be compiled out of the box, cannam@128: and linked to the ZLib unit. cannam@128: cannam@128: cannam@128: Suggestions for improvements cannam@128: ============================ cannam@128: cannam@128: Currently, the ZLib unit provides only a limited wrapper around cannam@128: the zlib library, and much of the original zlib functionality is cannam@128: missing. Handling compressed file formats like ZIP/GZIP or PNG cannam@128: cannot be implemented without having this functionality. cannam@128: Applications that handle these formats are either using their own, cannam@128: duplicated code, or not using the ZLib unit at all. cannam@128: cannam@128: Here are a few suggestions: cannam@128: cannam@128: - Checksum class wrappers around adler32() and crc32(), similar cannam@128: to the Java classes that implement the java.util.zip.Checksum cannam@128: interface. cannam@128: cannam@128: - The ability to read and write raw deflate streams, without the cannam@128: zlib stream header and trailer. Raw deflate streams are used cannam@128: in the ZIP file format. cannam@128: cannam@128: - The ability to read and write gzip streams, used in the GZIP cannam@128: file format, and normally produced by the gzip program. cannam@128: cannam@128: - The ability to select a different compression strategy, useful cannam@128: to PNG and MNG image compression, and to multimedia compression cannam@128: in general. Besides the compression level cannam@128: cannam@128: TCompressionLevel = (clNone, clFastest, clDefault, clMax); cannam@128: cannam@128: which, in fact, could have used the 'z' prefix and avoided cannam@128: TColor-like symbols cannam@128: cannam@128: TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax); cannam@128: cannam@128: there could be a compression strategy cannam@128: cannam@128: TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle); cannam@128: cannam@128: - ZIP and GZIP stream handling via TStreams. cannam@128: cannam@128: cannam@128: -- cannam@128: Cosmin Truta