|
1
|
|
|
2
|
Overview |
|
3
|
======== |
|
4
|
|
|
5
|
This directory contains an update to the ZLib interface unit, |
|
6
|
distributed by Borland as a Delphi supplemental component. |
|
7
|
|
|
8
|
The original ZLib unit is Copyright (c) 1997,99 Borland Corp., |
|
9
|
and is based on zlib version 1.0.4. There are a series of bugs |
|
10
|
and security problems associated with that old zlib version, and |
|
11
|
we recommend the users to update their ZLib unit. |
|
12
|
|
|
13
|
|
|
14
|
Summary of modifications |
|
15
|
======================== |
|
16
|
|
|
17
|
- Improved makefile, adapted to zlib version 1.2.1. |
|
18
|
|
|
19
|
- Some field types from TZStreamRec are changed from Integer to |
|
20
|
Longint, for consistency with the zlib.h header, and for 64-bit |
|
21
|
readiness. |
|
22
|
|
|
23
|
- The zlib_version constant is updated. |
|
24
|
|
|
25
|
- The new Z_RLE strategy has its corresponding symbolic constant. |
|
26
|
|
|
27
|
- The allocation and deallocation functions and function types |
|
28
|
(TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl, |
|
29
|
and _malloc and _free are added as C RTL stubs. As a result, |
|
30
|
the original C sources of zlib can be compiled out of the box, |
|
31
|
and linked to the ZLib unit. |
|
32
|
|
|
33
|
|
|
34
|
Suggestions for improvements |
|
35
|
============================ |
|
36
|
|
|
37
|
Currently, the ZLib unit provides only a limited wrapper around |
|
38
|
the zlib library, and much of the original zlib functionality is |
|
39
|
missing. Handling compressed file formats like ZIP/GZIP or PNG |
|
40
|
cannot be implemented without having this functionality. |
|
41
|
Applications that handle these formats are either using their own, |
|
42
|
duplicated code, or not using the ZLib unit at all. |
|
43
|
|
|
44
|
Here are a few suggestions: |
|
45
|
|
|
46
|
- Checksum class wrappers around adler32() and crc32(), similar |
|
47
|
to the Java classes that implement the java.util.zip.Checksum |
|
48
|
interface. |
|
49
|
|
|
50
|
- The ability to read and write raw deflate streams, without the |
|
51
|
zlib stream header and trailer. Raw deflate streams are used |
|
52
|
in the ZIP file format. |
|
53
|
|
|
54
|
- The ability to read and write gzip streams, used in the GZIP |
|
55
|
file format, and normally produced by the gzip program. |
|
56
|
|
|
57
|
- The ability to select a different compression strategy, useful |
|
58
|
to PNG and MNG image compression, and to multimedia compression |
|
59
|
in general. Besides the compression level |
|
60
|
|
|
61
|
TCompressionLevel = (clNone, clFastest, clDefault, clMax); |
|
62
|
|
|
63
|
which, in fact, could have used the 'z' prefix and avoided |
|
64
|
TColor-like symbols |
|
65
|
|
|
66
|
TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax); |
|
67
|
|
|
68
|
there could be a compression strategy |
|
69
|
|
|
70
|
TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle); |
|
71
|
|
|
72
|
- ZIP and GZIP stream handling via TStreams. |
|
73
|
|
|
74
|
|
|
75
|
-- |
|
76
|
Cosmin Truta <[email protected]> |
|
77
|
|