-
Notifications
You must be signed in to change notification settings - Fork 5
/
ZLibDelphi.pas
153 lines (110 loc) · 2.74 KB
/
ZLibDelphi.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
unit ZLibDelphi;
{$IFOPT D+}
{$DEFINE ZLIB_DEBUG}
{$ENDIF}
interface
uses
Windows, SysUtils;
const
ZLIB_VERSION = '1.2.1';
Z_NO_FLUSH = 0;
Z_FINISH = 4;
Z_OK = 0;
Z_STREAM_END = 1;
type
PRZStream = ^RZStream;
RZStream = record
NextIn: PByte;
AvailIn: Cardinal;
TotalIn: Cardinal;
NextOut: PByte;
AvailOut: Cardinal;
TotalOut: Cardinal;
Msg: PChar;
State: Pointer;
AllocFunc: Pointer;
FreeFunc: Pointer;
Opaque: Cardinal;
DataType: Integer;
Adler: Cardinal;
Reserved: Cardinal;
end;
function inflateInit_(strm: Pointer; version: Pointer; stream_size: Integer): Integer; cdecl; external;
function inflateReset(strm: Pointer): Integer; cdecl; external;
function inflate(strm: Pointer; flush: Integer): Integer; cdecl; external;
function inflateSync(strm: Pointer): Integer; cdecl; external;
function deflateInit(strm: Pointer; level: Integer): Integer;
function deflateInit_(strm: Pointer; level: Integer; version: Pointer; stream_size: Integer): Integer; cdecl; external;
function deflateReset(strm: Pointer): Integer; cdecl; external;
function deflate(strm: Pointer; flush: Integer): Integer; cdecl; external;
function deflateEnd(strm: Pointer): Integer; cdecl; external;
function inflateEnd(strm: Pointer): Integer; cdecl; external;
function deflateParams(strm: Pointer; level: Integer; strategy: Integer): Integer; cdecl; external;
implementation
uses
LibDelphi;
function deflateInit(strm: Pointer; level: Integer): Integer;
begin
Result:=deflateInit_(strm,level,PChar(ZLIB_VERSION),SizeOf(RZStream));
end;
{inflate}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\inflate.obj}
{$ELSE}
{$L ZLibDelphi\release\inflate.obj}
{$ENDIF}
{crc32}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\crc32.obj}
{$ELSE}
{$L ZLibDelphi\release\crc32.obj}
{$ENDIF}
{adler32}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\adler32.obj}
{$ELSE}
{$L ZLibDelphi\release\adler32.obj}
{$ENDIF}
{inftrees}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\inftrees.obj}
{$ELSE}
{$L ZLibDelphi\release\inftrees.obj}
{$ENDIF}
{inffast}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\inffast.obj}
{$ELSE}
{$L ZLibDelphi\release\inffast.obj}
{$ENDIF}
{deflate}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\deflate.obj}
{$ELSE}
{$L ZLibDelphi\release\deflate.obj}
{$ENDIF}
{zutil}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\zutil.obj}
{$ELSE}
{$L ZLibDelphi\release\zutil.obj}
{$ENDIF}
{trees}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\trees.obj}
{$ELSE}
{$L ZLibDelphi\release\trees.obj}
{$ENDIF}
{compress}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\compress.obj}
{$ELSE}
{$L ZLibDelphi\release\compress.obj}
{$ENDIF}
{decompress}
{$IFDEF ZLIB_DEBUG}
{$L ZLibDelphi\debug\uncompr.obj}
{$ELSE}
{$L ZLibDelphi\release\uncompr.obj}
{$ENDIF}
end.