1
1
#![ allow( non_camel_case_types) ]
2
+ #![ allow( non_snake_case) ]
2
3
3
4
use std:: os:: raw:: { c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void} ;
4
5
@@ -56,9 +57,12 @@ pub type z_off_t = libc::off_t;
56
57
) ) ]
57
58
pub type z_off_t = c_long ;
58
59
59
- #[ cfg( zng) ]
60
+ #[ cfg( all ( zng, windows , not ( target_env = "gnu" ) ) ) ]
60
61
pub type z_off_t = i64 ;
61
62
63
+ #[ cfg( all( zng, not( all( windows, not( target_env = "gnu" ) ) ) ) ) ]
64
+ pub type z_off_t = libc:: off_t ;
65
+
62
66
#[ repr( C ) ]
63
67
#[ derive( Copy , Clone ) ]
64
68
pub struct gz_header {
@@ -103,12 +107,16 @@ pub type z_streamp = *mut z_stream;
103
107
// can't parse that.
104
108
#[ cfg( not( zng) ) ]
105
109
macro_rules! zng_prefix {
106
- ( $name: expr) => { stringify!( $name) }
110
+ ( $name: expr) => {
111
+ stringify!( $name)
112
+ } ;
107
113
}
108
114
109
115
#[ cfg( zng) ]
110
116
macro_rules! zng_prefix {
111
- ( $name: expr) => { concat!( "zng_" , stringify!( $name) ) }
117
+ ( $name: expr) => {
118
+ concat!( "zng_" , stringify!( $name) )
119
+ } ;
112
120
}
113
121
114
122
extern "C" {
@@ -124,24 +132,6 @@ extern "C" {
124
132
pub fn deflateCopy ( dest : z_streamp , source : z_streamp ) -> c_int ;
125
133
#[ link_name = zng_prefix ! ( deflateEnd) ]
126
134
pub fn deflateEnd ( strm : z_streamp ) -> c_int ;
127
- #[ link_name = zng_prefix ! ( deflateInit_) ]
128
- pub fn deflateInit_ (
129
- strm : z_streamp ,
130
- level : c_int ,
131
- version : * const c_char ,
132
- stream_size : c_int ,
133
- ) -> c_int ;
134
- #[ link_name = zng_prefix ! ( deflateInit2_) ]
135
- pub fn deflateInit2_ (
136
- strm : z_streamp ,
137
- level : c_int ,
138
- method : c_int ,
139
- windowBits : c_int ,
140
- memLevel : c_int ,
141
- strategy : c_int ,
142
- version : * const c_char ,
143
- stream_size : c_int ,
144
- ) -> c_int ;
145
135
#[ link_name = zng_prefix ! ( deflateParams) ]
146
136
pub fn deflateParams ( strm : z_streamp , level : c_int , strategy : c_int ) -> c_int ;
147
137
#[ link_name = zng_prefix ! ( deflatePrime) ]
@@ -176,29 +166,12 @@ extern "C" {
176
166
) -> c_int ;
177
167
#[ link_name = zng_prefix ! ( inflateBackEnd) ]
178
168
pub fn inflateBackEnd ( strm : z_streamp ) -> c_int ;
179
- #[ link_name = zng_prefix ! ( inflateBackInit_) ]
180
- pub fn inflateBackInit_ (
181
- strm : z_streamp ,
182
- windowBits : c_int ,
183
- window : * mut c_uchar ,
184
- version : * const c_char ,
185
- stream_size : c_int ,
186
- ) -> c_int ;
187
169
#[ link_name = zng_prefix ! ( inflateCopy) ]
188
170
pub fn inflateCopy ( dest : z_streamp , source : z_streamp ) -> c_int ;
189
171
#[ link_name = zng_prefix ! ( inflateEnd) ]
190
172
pub fn inflateEnd ( strm : z_streamp ) -> c_int ;
191
173
#[ link_name = zng_prefix ! ( inflateGetHeader) ]
192
174
pub fn inflateGetHeader ( strm : z_streamp , head : gz_headerp ) -> c_int ;
193
- #[ link_name = zng_prefix ! ( inflateInit_) ]
194
- pub fn inflateInit_ ( strm : z_streamp , version : * const c_char , stream_size : c_int ) -> c_int ;
195
- #[ link_name = zng_prefix ! ( inflateInit2_) ]
196
- pub fn inflateInit2_ (
197
- strm : z_streamp ,
198
- windowBits : c_int ,
199
- version : * const c_char ,
200
- stream_size : c_int ,
201
- ) -> c_int ;
202
175
#[ link_name = zng_prefix ! ( inflateMark) ]
203
176
pub fn inflateMark ( strm : z_streamp ) -> c_long ;
204
177
#[ link_name = zng_prefix ! ( inflatePrime) ]
@@ -245,6 +218,112 @@ extern "C" {
245
218
pub fn zlibVersion ( ) -> * const c_char ;
246
219
}
247
220
221
+ #[ cfg( not( zng) ) ]
222
+ extern "C" {
223
+ pub fn deflateInit_ (
224
+ strm : z_streamp ,
225
+ level : c_int ,
226
+ version : * const c_char ,
227
+ stream_size : c_int ,
228
+ ) -> c_int ;
229
+ pub fn deflateInit2_ (
230
+ strm : z_streamp ,
231
+ level : c_int ,
232
+ method : c_int ,
233
+ windowBits : c_int ,
234
+ memLevel : c_int ,
235
+ strategy : c_int ,
236
+ version : * const c_char ,
237
+ stream_size : c_int ,
238
+ ) -> c_int ;
239
+ pub fn inflateBackInit_ (
240
+ strm : z_streamp ,
241
+ windowBits : c_int ,
242
+ window : * mut c_uchar ,
243
+ version : * const c_char ,
244
+ stream_size : c_int ,
245
+ ) -> c_int ;
246
+ pub fn inflateInit_ ( strm : z_streamp , version : * const c_char , stream_size : c_int ) -> c_int ;
247
+ pub fn inflateInit2_ (
248
+ strm : z_streamp ,
249
+ windowBits : c_int ,
250
+ version : * const c_char ,
251
+ stream_size : c_int ,
252
+ ) -> c_int ;
253
+ }
254
+
255
+ #[ cfg( zng) ]
256
+ extern "C" {
257
+ pub fn zng_deflateInit ( strm : z_streamp , level : c_int ) -> c_int ;
258
+ pub fn zng_deflateInit2 (
259
+ strm : z_streamp ,
260
+ level : c_int ,
261
+ method : c_int ,
262
+ windowBits : c_int ,
263
+ memLevel : c_int ,
264
+ strategy : c_int ,
265
+ ) -> c_int ;
266
+ pub fn zng_inflateBackInit ( strm : z_streamp , windowBits : c_int , window : * mut c_uchar ) -> c_int ;
267
+ pub fn zng_inflateInit ( strm : z_streamp ) -> c_int ;
268
+ pub fn zng_inflateInit2 ( strm : z_streamp , windowBits : c_int ) -> c_int ;
269
+ }
270
+
271
+ // These methods are required to keep BC with original zlib API since zlib-ng 2.1 that changed API
272
+ #[ cfg( zng) ]
273
+ #[ inline( always) ]
274
+ pub unsafe fn inflateInit2_ (
275
+ strm : z_streamp ,
276
+ windowBits : c_int ,
277
+ _version : * const c_char ,
278
+ _stream_size : c_int ,
279
+ ) -> c_int {
280
+ zng_inflateInit2 ( strm, windowBits)
281
+ }
282
+
283
+ #[ cfg( zng) ]
284
+ #[ inline( always) ]
285
+ pub unsafe fn inflateInit_ ( strm : z_streamp , _version : * const c_char , _stream_size : c_int ) -> c_int {
286
+ zng_inflateInit ( strm)
287
+ }
288
+
289
+ #[ cfg( zng) ]
290
+ #[ inline( always) ]
291
+ pub unsafe fn inflateBackInit_ (
292
+ strm : z_streamp ,
293
+ windowBits : c_int ,
294
+ window : * mut c_uchar ,
295
+ _version : * const c_char ,
296
+ _stream_size : c_int ,
297
+ ) -> c_int {
298
+ zng_inflateBackInit ( strm, windowBits, window)
299
+ }
300
+
301
+ #[ cfg( zng) ]
302
+ #[ inline( always) ]
303
+ pub unsafe fn deflateInit2_ (
304
+ strm : z_streamp ,
305
+ level : c_int ,
306
+ method : c_int ,
307
+ windowBits : c_int ,
308
+ memLevel : c_int ,
309
+ strategy : c_int ,
310
+ _version : * const c_char ,
311
+ _stream_size : c_int ,
312
+ ) -> c_int {
313
+ zng_deflateInit2 ( strm, level, method, windowBits, memLevel, strategy)
314
+ }
315
+
316
+ #[ cfg( zng) ]
317
+ #[ inline]
318
+ pub unsafe fn deflateInit_ (
319
+ strm : z_streamp ,
320
+ level : c_int ,
321
+ _version : * const c_char ,
322
+ _stream_size : c_int ,
323
+ ) -> c_int {
324
+ zng_deflateInit ( strm, level)
325
+ }
326
+
248
327
#[ cfg( any( zng, feature = "libc" ) ) ]
249
328
extern "C" {
250
329
#[ link_name = zng_prefix ! ( adler32_combine) ]
0 commit comments