cairo 1.15.7-x64-mingw32 → 1.15.8-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +24 -0
  3. data/Rakefile +8 -3
  4. data/ext/cairo/cairo.def +1 -0
  5. data/ext/cairo/extconf.rb +4 -1
  6. data/ext/cairo/rb_cairo.h +2 -1
  7. data/ext/cairo/rb_cairo_font_face.c +172 -0
  8. data/lib/2.2/cairo.so +0 -0
  9. data/lib/2.3/cairo.so +0 -0
  10. data/lib/2.4/cairo.so +0 -0
  11. data/test/cairo-test-utils.rb +4 -0
  12. data/test/test_font_face.rb +46 -0
  13. data/vendor/local/bin/fc-cache.exe +0 -0
  14. data/vendor/local/bin/fc-cat.exe +0 -0
  15. data/vendor/local/bin/fc-list.exe +0 -0
  16. data/vendor/local/bin/fc-match.exe +0 -0
  17. data/vendor/local/bin/fc-pattern.exe +0 -0
  18. data/vendor/local/bin/fc-query.exe +0 -0
  19. data/vendor/local/bin/fc-scan.exe +0 -0
  20. data/vendor/local/bin/fc-validate.exe +0 -0
  21. data/vendor/local/bin/libcairo-2.dll +0 -0
  22. data/vendor/local/bin/libcairo-gobject-2.dll +0 -0
  23. data/vendor/local/bin/libcairo-script-interpreter-2.dll +0 -0
  24. data/vendor/local/bin/libfontconfig-1.dll +0 -0
  25. data/vendor/local/bin/libfreetype-6.dll +0 -0
  26. data/vendor/local/bin/libpixman-1-0.dll +0 -0
  27. data/vendor/local/bin/libpng16-16.dll +0 -0
  28. data/vendor/local/bin/libxml2-2.dll +0 -0
  29. data/vendor/local/bin/png-fix-itxt.exe +0 -0
  30. data/vendor/local/bin/pngfix.exe +0 -0
  31. data/vendor/local/bin/xmlcatalog.exe +0 -0
  32. data/vendor/local/bin/xmllint.exe +0 -0
  33. data/vendor/local/bin/zlib1211.dll +0 -0
  34. data/vendor/local/include/libpng16/pnglibconf.h +1 -1
  35. data/vendor/local/include/pnglibconf.h +1 -1
  36. data/vendor/local/include/zconf.h +32 -9
  37. data/vendor/local/include/zlib.h +298 -154
  38. data/vendor/local/lib/libcairo-gobject.dll.a +0 -0
  39. data/vendor/local/lib/libcairo-script-interpreter.a +0 -0
  40. data/vendor/local/lib/libcairo-script-interpreter.dll.a +0 -0
  41. data/vendor/local/lib/libcairo.a +0 -0
  42. data/vendor/local/lib/libcairo.dll.a +0 -0
  43. data/vendor/local/lib/libfontconfig.dll.a +0 -0
  44. data/vendor/local/lib/libfreetype.a +0 -0
  45. data/vendor/local/lib/libfreetype.dll.a +0 -0
  46. data/vendor/local/lib/libpixman-1.dll.a +0 -0
  47. data/vendor/local/lib/libpng.a +0 -0
  48. data/vendor/local/lib/libpng.dll.a +0 -0
  49. data/vendor/local/lib/libpng16.a +0 -0
  50. data/vendor/local/lib/libpng16.dll.a +0 -0
  51. data/vendor/local/lib/libxml2.a +0 -0
  52. data/vendor/local/lib/libxml2.dll.a +0 -0
  53. data/vendor/local/lib/libz.a +0 -0
  54. data/vendor/local/lib/libz.dll.a +0 -0
  55. data/vendor/local/lib/pkgconfig/zlib.pc +1 -1
  56. data/vendor/local/share/license/zlib/README +3 -3
  57. metadata +7 -7
  58. data/vendor/local/bin/zlib1.dll +0 -0
@@ -205,7 +205,7 @@
205
205
  #define PNG_USER_HEIGHT_MAX 1000000
206
206
  #define PNG_USER_WIDTH_MAX 1000000
207
207
  #define PNG_ZBUF_SIZE 8192
208
- #define PNG_ZLIB_VERNUM 0x1280
208
+ #define PNG_ZLIB_VERNUM 0x12b0
209
209
  #define PNG_Z_DEFAULT_COMPRESSION (-1)
210
210
  #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
211
211
  #define PNG_Z_DEFAULT_STRATEGY 1
@@ -205,7 +205,7 @@
205
205
  #define PNG_USER_HEIGHT_MAX 1000000
206
206
  #define PNG_USER_WIDTH_MAX 1000000
207
207
  #define PNG_ZBUF_SIZE 8192
208
- #define PNG_ZLIB_VERNUM 0x1280
208
+ #define PNG_ZLIB_VERNUM 0x12b0
209
209
  #define PNG_Z_DEFAULT_COMPRESSION (-1)
210
210
  #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
211
211
  #define PNG_Z_DEFAULT_STRATEGY 1
@@ -1,5 +1,5 @@
1
1
  /* zconf.h -- configuration of the zlib compression library
2
- * Copyright (C) 1995-2013 Jean-loup Gailly.
2
+ * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -17,7 +17,7 @@
17
17
  #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
18
18
  # define Z_PREFIX_SET
19
19
 
20
- /* all linked symbols */
20
+ /* all linked symbols and init macros */
21
21
  # define _dist_code z__dist_code
22
22
  # define _length_code z__length_code
23
23
  # define _tr_align z__tr_align
@@ -29,6 +29,7 @@
29
29
  # define adler32 z_adler32
30
30
  # define adler32_combine z_adler32_combine
31
31
  # define adler32_combine64 z_adler32_combine64
32
+ # define adler32_z z_adler32_z
32
33
  # ifndef Z_SOLO
33
34
  # define compress z_compress
34
35
  # define compress2 z_compress2
@@ -37,10 +38,14 @@
37
38
  # define crc32 z_crc32
38
39
  # define crc32_combine z_crc32_combine
39
40
  # define crc32_combine64 z_crc32_combine64
41
+ # define crc32_z z_crc32_z
40
42
  # define deflate z_deflate
41
43
  # define deflateBound z_deflateBound
42
44
  # define deflateCopy z_deflateCopy
43
45
  # define deflateEnd z_deflateEnd
46
+ # define deflateGetDictionary z_deflateGetDictionary
47
+ # define deflateInit z_deflateInit
48
+ # define deflateInit2 z_deflateInit2
44
49
  # define deflateInit2_ z_deflateInit2_
45
50
  # define deflateInit_ z_deflateInit_
46
51
  # define deflateParams z_deflateParams
@@ -67,6 +72,8 @@
67
72
  # define gzeof z_gzeof
68
73
  # define gzerror z_gzerror
69
74
  # define gzflush z_gzflush
75
+ # define gzfread z_gzfread
76
+ # define gzfwrite z_gzfwrite
70
77
  # define gzgetc z_gzgetc
71
78
  # define gzgetc_ z_gzgetc_
72
79
  # define gzgets z_gzgets
@@ -78,7 +85,6 @@
78
85
  # define gzopen_w z_gzopen_w
79
86
  # endif
80
87
  # define gzprintf z_gzprintf
81
- # define gzvprintf z_gzvprintf
82
88
  # define gzputc z_gzputc
83
89
  # define gzputs z_gzputs
84
90
  # define gzread z_gzread
@@ -89,32 +95,39 @@
89
95
  # define gztell z_gztell
90
96
  # define gztell64 z_gztell64
91
97
  # define gzungetc z_gzungetc
98
+ # define gzvprintf z_gzvprintf
92
99
  # define gzwrite z_gzwrite
93
100
  # endif
94
101
  # define inflate z_inflate
95
102
  # define inflateBack z_inflateBack
96
103
  # define inflateBackEnd z_inflateBackEnd
104
+ # define inflateBackInit z_inflateBackInit
97
105
  # define inflateBackInit_ z_inflateBackInit_
106
+ # define inflateCodesUsed z_inflateCodesUsed
98
107
  # define inflateCopy z_inflateCopy
99
108
  # define inflateEnd z_inflateEnd
109
+ # define inflateGetDictionary z_inflateGetDictionary
100
110
  # define inflateGetHeader z_inflateGetHeader
111
+ # define inflateInit z_inflateInit
112
+ # define inflateInit2 z_inflateInit2
101
113
  # define inflateInit2_ z_inflateInit2_
102
114
  # define inflateInit_ z_inflateInit_
103
115
  # define inflateMark z_inflateMark
104
116
  # define inflatePrime z_inflatePrime
105
117
  # define inflateReset z_inflateReset
106
118
  # define inflateReset2 z_inflateReset2
119
+ # define inflateResetKeep z_inflateResetKeep
107
120
  # define inflateSetDictionary z_inflateSetDictionary
108
- # define inflateGetDictionary z_inflateGetDictionary
109
121
  # define inflateSync z_inflateSync
110
122
  # define inflateSyncPoint z_inflateSyncPoint
111
123
  # define inflateUndermine z_inflateUndermine
112
- # define inflateResetKeep z_inflateResetKeep
124
+ # define inflateValidate z_inflateValidate
113
125
  # define inflate_copyright z_inflate_copyright
114
126
  # define inflate_fast z_inflate_fast
115
127
  # define inflate_table z_inflate_table
116
128
  # ifndef Z_SOLO
117
129
  # define uncompress z_uncompress
130
+ # define uncompress2 z_uncompress2
118
131
  # endif
119
132
  # define zError z_zError
120
133
  # ifndef Z_SOLO
@@ -224,9 +237,19 @@
224
237
  # define z_const
225
238
  #endif
226
239
 
227
- /* Some Mac compilers merge all .h files incorrectly: */
228
- #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
229
- # define NO_DUMMY_DECL
240
+ #ifdef Z_SOLO
241
+ typedef unsigned long z_size_t;
242
+ #else
243
+ # define z_longlong long long
244
+ # if defined(NO_SIZE_T)
245
+ typedef unsigned NO_SIZE_T z_size_t;
246
+ # elif defined(STDC)
247
+ # include <stddef.h>
248
+ typedef size_t z_size_t;
249
+ # else
250
+ typedef unsigned long z_size_t;
251
+ # endif
252
+ # undef z_longlong
230
253
  #endif
231
254
 
232
255
  /* Maximum value for memLevel in deflateInit2 */
@@ -256,7 +279,7 @@
256
279
  Of course this will generally degrade compression (there's no free lunch).
257
280
 
258
281
  The memory requirements for inflate are (in bytes) 1 << windowBits
259
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
282
+ that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
260
283
  for small objects.
261
284
  */
262
285
 
@@ -1,7 +1,7 @@
1
1
  /* zlib.h -- interface of the 'zlib' general purpose compression library
2
- version 1.2.8, April 28th, 2013
2
+ version 1.2.11, January 15th, 2017
3
3
 
4
- Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
4
+ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
5
5
 
6
6
  This software is provided 'as-is', without any express or implied
7
7
  warranty. In no event will the authors be held liable for any damages
@@ -37,11 +37,11 @@
37
37
  extern "C" {
38
38
  #endif
39
39
 
40
- #define ZLIB_VERSION "1.2.8"
41
- #define ZLIB_VERNUM 0x1280
40
+ #define ZLIB_VERSION "1.2.11"
41
+ #define ZLIB_VERNUM 0x12b0
42
42
  #define ZLIB_VER_MAJOR 1
43
43
  #define ZLIB_VER_MINOR 2
44
- #define ZLIB_VER_REVISION 8
44
+ #define ZLIB_VER_REVISION 11
45
45
  #define ZLIB_VER_SUBREVISION 0
46
46
 
47
47
  /*
@@ -65,7 +65,8 @@ extern "C" {
65
65
  with "gz". The gzip format is different from the zlib format. gzip is a
66
66
  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
67
67
 
68
- This library can optionally read and write gzip streams in memory as well.
68
+ This library can optionally read and write gzip and raw deflate streams in
69
+ memory as well.
69
70
 
70
71
  The zlib format was designed to be compact and fast for use in memory
71
72
  and on communications channels. The gzip format was designed for single-
@@ -74,7 +75,7 @@ extern "C" {
74
75
 
75
76
  The library does not install any signal handler. The decoder checks
76
77
  the consistency of the compressed data, so the library should never crash
77
- even in case of corrupted input.
78
+ even in the case of corrupted input.
78
79
  */
79
80
 
80
81
  typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
@@ -87,7 +88,7 @@ typedef struct z_stream_s {
87
88
  uInt avail_in; /* number of bytes available at next_in */
88
89
  uLong total_in; /* total number of input bytes read so far */
89
90
 
90
- Bytef *next_out; /* next output byte should be put there */
91
+ Bytef *next_out; /* next output byte will go here */
91
92
  uInt avail_out; /* remaining free space at next_out */
92
93
  uLong total_out; /* total number of bytes output so far */
93
94
 
@@ -98,8 +99,9 @@ typedef struct z_stream_s {
98
99
  free_func zfree; /* used to free the internal state */
99
100
  voidpf opaque; /* private data object passed to zalloc and zfree */
100
101
 
101
- int data_type; /* best guess about the data type: binary or text */
102
- uLong adler; /* adler32 value of the uncompressed data */
102
+ int data_type; /* best guess about the data type: binary or text
103
+ for deflate, or the decoding state for inflate */
104
+ uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */
103
105
  uLong reserved; /* reserved for future use */
104
106
  } z_stream;
105
107
 
@@ -142,7 +144,9 @@ typedef gz_header FAR *gz_headerp;
142
144
 
143
145
  zalloc must return Z_NULL if there is not enough memory for the object.
144
146
  If zlib is used in a multi-threaded application, zalloc and zfree must be
145
- thread safe.
147
+ thread safe. In that case, zlib is thread-safe. When zalloc and zfree are
148
+ Z_NULL on entry to the initialization function, they are set to internal
149
+ routines that use the standard library functions malloc() and free().
146
150
 
147
151
  On 16-bit systems, the functions zalloc and zfree must be able to allocate
148
152
  exactly 65536 bytes, but will not be required to allocate more than this if
@@ -155,7 +159,7 @@ typedef gz_header FAR *gz_headerp;
155
159
 
156
160
  The fields total_in and total_out can be used for statistics or progress
157
161
  reports. After compression, total_in holds the total size of the
158
- uncompressed data and may be saved for use in the decompressor (particularly
162
+ uncompressed data and may be saved for use by the decompressor (particularly
159
163
  if the decompressor wants to decompress everything in a single step).
160
164
  */
161
165
 
@@ -200,7 +204,7 @@ typedef gz_header FAR *gz_headerp;
200
204
  #define Z_TEXT 1
201
205
  #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
202
206
  #define Z_UNKNOWN 2
203
- /* Possible values of the data_type field (though see inflate()) */
207
+ /* Possible values of the data_type field for deflate() */
204
208
 
205
209
  #define Z_DEFLATED 8
206
210
  /* The deflate compression method (the only one supported in this version) */
@@ -258,11 +262,11 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
258
262
  enough room in the output buffer), next_in and avail_in are updated and
259
263
  processing will resume at this point for the next call of deflate().
260
264
 
261
- - Provide more output starting at next_out and update next_out and avail_out
265
+ - Generate more output starting at next_out and update next_out and avail_out
262
266
  accordingly. This action is forced if the parameter flush is non zero.
263
267
  Forcing flush frequently degrades the compression ratio, so this parameter
264
- should be set only when necessary (in interactive applications). Some
265
- output may be provided even if flush is not set.
268
+ should be set only when necessary. Some output may be provided even if
269
+ flush is zero.
266
270
 
267
271
  Before the call of deflate(), the application should ensure that at least
268
272
  one of the actions is possible, by providing more input and/or consuming more
@@ -271,7 +275,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
271
275
  output when it wants, for example when the output buffer is full (avail_out
272
276
  == 0), or after each call of deflate(). If deflate returns Z_OK and with
273
277
  zero avail_out, it must be called again after making room in the output
274
- buffer because there might be more output pending.
278
+ buffer because there might be more output pending. See deflatePending(),
279
+ which can be used if desired to determine whether or not there is more ouput
280
+ in that case.
275
281
 
276
282
  Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
277
283
  decide how much data to accumulate before producing output, in order to
@@ -292,8 +298,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
292
298
  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
293
299
  This completes the current deflate block and follows it with an empty fixed
294
300
  codes block that is 10 bits long. This assures that enough bytes are output
295
- in order for the decompressor to finish the block before the empty fixed code
296
- block.
301
+ in order for the decompressor to finish the block before the empty fixed
302
+ codes block.
297
303
 
298
304
  If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
299
305
  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
@@ -319,34 +325,38 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
319
325
 
320
326
  If the parameter flush is set to Z_FINISH, pending input is processed,
321
327
  pending output is flushed and deflate returns with Z_STREAM_END if there was
322
- enough output space; if deflate returns with Z_OK, this function must be
323
- called again with Z_FINISH and more output space (updated avail_out) but no
324
- more input data, until it returns with Z_STREAM_END or an error. After
325
- deflate has returned Z_STREAM_END, the only possible operations on the stream
326
- are deflateReset or deflateEnd.
327
-
328
- Z_FINISH can be used immediately after deflateInit if all the compression
329
- is to be done in a single step. In this case, avail_out must be at least the
330
- value returned by deflateBound (see below). Then deflate is guaranteed to
331
- return Z_STREAM_END. If not enough output space is provided, deflate will
332
- not return Z_STREAM_END, and it must be called again as described above.
333
-
334
- deflate() sets strm->adler to the adler32 checksum of all input read
335
- so far (that is, total_in bytes).
328
+ enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this
329
+ function must be called again with Z_FINISH and more output space (updated
330
+ avail_out) but no more input data, until it returns with Z_STREAM_END or an
331
+ error. After deflate has returned Z_STREAM_END, the only possible operations
332
+ on the stream are deflateReset or deflateEnd.
333
+
334
+ Z_FINISH can be used in the first deflate call after deflateInit if all the
335
+ compression is to be done in a single step. In order to complete in one
336
+ call, avail_out must be at least the value returned by deflateBound (see
337
+ below). Then deflate is guaranteed to return Z_STREAM_END. If not enough
338
+ output space is provided, deflate will not return Z_STREAM_END, and it must
339
+ be called again as described above.
340
+
341
+ deflate() sets strm->adler to the Adler-32 checksum of all input read
342
+ so far (that is, total_in bytes). If a gzip stream is being generated, then
343
+ strm->adler will be the CRC-32 checksum of the input read so far. (See
344
+ deflateInit2 below.)
336
345
 
337
346
  deflate() may update strm->data_type if it can make a good guess about
338
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
339
- binary. This field is only for information purposes and does not affect the
340
- compression algorithm in any manner.
347
+ the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is
348
+ considered binary. This field is only for information purposes and does not
349
+ affect the compression algorithm in any manner.
341
350
 
342
351
  deflate() returns Z_OK if some progress has been made (more input
343
352
  processed or more output produced), Z_STREAM_END if all input has been
344
353
  consumed and all output has been produced (only when flush is set to
345
354
  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
346
- if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
347
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
348
- fatal, and deflate() can be called again with more input and more output
349
- space to continue compressing.
355
+ if next_in or next_out was Z_NULL or the state was inadvertently written over
356
+ by the application), or Z_BUF_ERROR if no progress is possible (for example
357
+ avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and
358
+ deflate() can be called again with more input and more output space to
359
+ continue compressing.
350
360
  */
351
361
 
352
362
 
@@ -369,23 +379,21 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
369
379
 
370
380
  Initializes the internal stream state for decompression. The fields
371
381
  next_in, avail_in, zalloc, zfree and opaque must be initialized before by
372
- the caller. If next_in is not Z_NULL and avail_in is large enough (the
373
- exact value depends on the compression method), inflateInit determines the
374
- compression method from the zlib header and allocates all data structures
375
- accordingly; otherwise the allocation will be deferred to the first call of
376
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
377
- use default allocation functions.
382
+ the caller. In the current version of inflate, the provided input is not
383
+ read or consumed. The allocation of a sliding window will be deferred to
384
+ the first call of inflate (if the decompression does not complete on the
385
+ first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
386
+ them to use default allocation functions.
378
387
 
379
388
  inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
380
389
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
381
390
  version assumed by the caller, or Z_STREAM_ERROR if the parameters are
382
391
  invalid, such as a null pointer to the structure. msg is set to null if
383
- there is no error message. inflateInit does not perform any decompression
384
- apart from possibly reading the zlib header if present: actual decompression
385
- will be done by inflate(). (So next_in and avail_in may be modified, but
386
- next_out and avail_out are unused and unchanged.) The current implementation
387
- of inflateInit() does not process any header information -- that is deferred
388
- until inflate() is called.
392
+ there is no error message. inflateInit does not perform any decompression.
393
+ Actual decompression will be done by inflate(). So next_in, and avail_in,
394
+ next_out, and avail_out are unused and unchanged. The current
395
+ implementation of inflateInit() does not process any header information --
396
+ that is deferred until inflate() is called.
389
397
  */
390
398
 
391
399
 
@@ -401,17 +409,20 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
401
409
 
402
410
  - Decompress more input starting at next_in and update next_in and avail_in
403
411
  accordingly. If not all input can be processed (because there is not
404
- enough room in the output buffer), next_in is updated and processing will
405
- resume at this point for the next call of inflate().
412
+ enough room in the output buffer), then next_in and avail_in are updated
413
+ accordingly, and processing will resume at this point for the next call of
414
+ inflate().
406
415
 
407
- - Provide more output starting at next_out and update next_out and avail_out
416
+ - Generate more output starting at next_out and update next_out and avail_out
408
417
  accordingly. inflate() provides as much output as possible, until there is
409
418
  no more input data or no more space in the output buffer (see below about
410
419
  the flush parameter).
411
420
 
412
421
  Before the call of inflate(), the application should ensure that at least
413
422
  one of the actions is possible, by providing more input and/or consuming more
414
- output, and updating the next_* and avail_* values accordingly. The
423
+ output, and updating the next_* and avail_* values accordingly. If the
424
+ caller of inflate() does not provide both available input and available
425
+ output space, it is possible that there will be no progress made. The
415
426
  application can consume the uncompressed output when it wants, for example
416
427
  when the output buffer is full (avail_out == 0), or after each call of
417
428
  inflate(). If inflate returns Z_OK and with zero avail_out, it must be
@@ -428,7 +439,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
428
439
  gets to the end of that block, or when it runs out of data.
429
440
 
430
441
  The Z_BLOCK option assists in appending to or combining deflate streams.
431
- Also to assist in this, on return inflate() will set strm->data_type to the
442
+ To assist in this, on return inflate() always sets strm->data_type to the
432
443
  number of unused bits in the last byte taken from strm->next_in, plus 64 if
433
444
  inflate() is currently decoding the last block in the deflate stream, plus
434
445
  128 if inflate() returned immediately after decoding an end-of-block code or
@@ -454,7 +465,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
454
465
  this case all pending input is processed and all pending output is flushed;
455
466
  avail_out must be large enough to hold all of the uncompressed data for the
456
467
  operation to complete. (The size of the uncompressed data may have been
457
- saved by the compressor for this purpose.) The use of Z_FINISH is not
468
+ saved by the compressor for this purpose.) The use of Z_FINISH is not
458
469
  required to perform an inflation in one step. However it may be used to
459
470
  inform inflate that a faster approach can be used for the single inflate()
460
471
  call. Z_FINISH also informs inflate to not maintain a sliding window if the
@@ -476,32 +487,33 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
476
487
  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
477
488
  strm->adler to the Adler-32 checksum of all output produced so far (that is,
478
489
  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
479
- below. At the end of the stream, inflate() checks that its computed adler32
490
+ below. At the end of the stream, inflate() checks that its computed Adler-32
480
491
  checksum is equal to that saved by the compressor and returns Z_STREAM_END
481
492
  only if the checksum is correct.
482
493
 
483
494
  inflate() can decompress and check either zlib-wrapped or gzip-wrapped
484
495
  deflate data. The header type is detected automatically, if requested when
485
496
  initializing with inflateInit2(). Any information contained in the gzip
486
- header is not retained, so applications that need that information should
487
- instead use raw inflate, see inflateInit2() below, or inflateBack() and
488
- perform their own processing of the gzip header and trailer. When processing
497
+ header is not retained unless inflateGetHeader() is used. When processing
489
498
  gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
490
- producted so far. The CRC-32 is checked against the gzip trailer.
499
+ produced so far. The CRC-32 is checked against the gzip trailer, as is the
500
+ uncompressed length, modulo 2^32.
491
501
 
492
502
  inflate() returns Z_OK if some progress has been made (more input processed
493
503
  or more output produced), Z_STREAM_END if the end of the compressed data has
494
504
  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
495
505
  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
496
506
  corrupted (input stream not conforming to the zlib format or incorrect check
497
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
498
- next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
499
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
500
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
507
+ value, in which case strm->msg points to a string with a more specific
508
+ error), Z_STREAM_ERROR if the stream structure was inconsistent (for example
509
+ next_in or next_out was Z_NULL, or the state was inadvertently written over
510
+ by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR
511
+ if no progress was possible or if there was not enough room in the output
512
+ buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
501
513
  inflate() can be called again with more input and more output space to
502
514
  continue decompressing. If Z_DATA_ERROR is returned, the application may
503
515
  then call inflateSync() to look for a good compression block if a partial
504
- recovery of the data is desired.
516
+ recovery of the data is to be attempted.
505
517
  */
506
518
 
507
519
 
@@ -511,9 +523,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
511
523
  This function discards any unprocessed input and does not flush any pending
512
524
  output.
513
525
 
514
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
515
- was inconsistent. In the error case, msg may be set but then points to a
516
- static string (which must not be deallocated).
526
+ inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state
527
+ was inconsistent.
517
528
  */
518
529
 
519
530
 
@@ -544,16 +555,29 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
544
555
  compression at the expense of memory usage. The default value is 15 if
545
556
  deflateInit is used instead.
546
557
 
558
+ For the current implementation of deflate(), a windowBits value of 8 (a
559
+ window size of 256 bytes) is not supported. As a result, a request for 8
560
+ will result in 9 (a 512-byte window). In that case, providing 8 to
561
+ inflateInit2() will result in an error when the zlib header with 9 is
562
+ checked against the initialization of inflate(). The remedy is to not use 8
563
+ with deflateInit2() with this initialization, or at least in that case use 9
564
+ with inflateInit2().
565
+
547
566
  windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
548
567
  determines the window size. deflate() will then generate raw deflate data
549
- with no zlib header or trailer, and will not compute an adler32 check value.
568
+ with no zlib header or trailer, and will not compute a check value.
550
569
 
551
570
  windowBits can also be greater than 15 for optional gzip encoding. Add
552
571
  16 to windowBits to write a simple gzip header and trailer around the
553
572
  compressed data instead of a zlib wrapper. The gzip header will have no
554
573
  file name, no extra data, no comment, no modification time (set to zero), no
555
- header crc, and the operating system will be set to 255 (unknown). If a
556
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
574
+ header crc, and the operating system will be set to the appropriate value,
575
+ if the operating system was determined at compile time. If a gzip stream is
576
+ being written, strm->adler is a CRC-32 instead of an Adler-32.
577
+
578
+ For raw deflate or gzip encoding, a request for a 256-byte window is
579
+ rejected as invalid, since only the zlib header provides a means of
580
+ transmitting the window size to the decompressor.
557
581
 
558
582
  The memLevel parameter specifies how much memory should be allocated
559
583
  for the internal compression state. memLevel=1 uses minimum memory but is
@@ -614,12 +638,12 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
614
638
  addition, the current implementation of deflate will use at most the window
615
639
  size minus 262 bytes of the provided dictionary.
616
640
 
617
- Upon return of this function, strm->adler is set to the adler32 value
641
+ Upon return of this function, strm->adler is set to the Adler-32 value
618
642
  of the dictionary; the decompressor may later use this value to determine
619
- which dictionary has been used by the compressor. (The adler32 value
643
+ which dictionary has been used by the compressor. (The Adler-32 value
620
644
  applies to the whole dictionary even if only a subset of the dictionary is
621
645
  actually used by the compressor.) If a raw deflate was requested, then the
622
- adler32 value is not computed and strm->adler is not set.
646
+ Adler-32 value is not computed and strm->adler is not set.
623
647
 
624
648
  deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
625
649
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
@@ -628,6 +652,28 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
628
652
  not perform any compression: this will be done by deflate().
629
653
  */
630
654
 
655
+ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
656
+ Bytef *dictionary,
657
+ uInt *dictLength));
658
+ /*
659
+ Returns the sliding dictionary being maintained by deflate. dictLength is
660
+ set to the number of bytes in the dictionary, and that many bytes are copied
661
+ to dictionary. dictionary must have enough space, where 32768 bytes is
662
+ always enough. If deflateGetDictionary() is called with dictionary equal to
663
+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
664
+ Similary, if dictLength is Z_NULL, then it is not set.
665
+
666
+ deflateGetDictionary() may return a length less than the window size, even
667
+ when more than the window size in input has been provided. It may return up
668
+ to 258 bytes less in that case, due to how zlib's implementation of deflate
669
+ manages the sliding window and lookahead for matches, where matches can be
670
+ up to 258 bytes long. If the application needs the last window-size bytes of
671
+ input, then that would need to be saved by the application outside of zlib.
672
+
673
+ deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
674
+ stream state is inconsistent.
675
+ */
676
+
631
677
  ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
632
678
  z_streamp source));
633
679
  /*
@@ -648,10 +694,10 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
648
694
 
649
695
  ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
650
696
  /*
651
- This function is equivalent to deflateEnd followed by deflateInit,
652
- but does not free and reallocate all the internal compression state. The
653
- stream will keep the same compression level and any other attributes that
654
- may have been set by deflateInit2.
697
+ This function is equivalent to deflateEnd followed by deflateInit, but
698
+ does not free and reallocate the internal compression state. The stream
699
+ will leave the compression level and any other attributes that may have been
700
+ set unchanged.
655
701
 
656
702
  deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
657
703
  stream state was inconsistent (such as zalloc or state being Z_NULL).
@@ -662,20 +708,36 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
662
708
  int strategy));
663
709
  /*
664
710
  Dynamically update the compression level and compression strategy. The
665
- interpretation of level and strategy is as in deflateInit2. This can be
711
+ interpretation of level and strategy is as in deflateInit2(). This can be
666
712
  used to switch between compression and straight copy of the input data, or
667
713
  to switch to a different kind of input data requiring a different strategy.
668
- If the compression level is changed, the input available so far is
669
- compressed with the old level (and may be flushed); the new level will take
670
- effect only at the next call of deflate().
671
-
672
- Before the call of deflateParams, the stream state must be set as for
673
- a call of deflate(), since the currently available input may have to be
674
- compressed and flushed. In particular, strm->avail_out must be non-zero.
675
-
676
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
677
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
678
- strm->avail_out was zero.
714
+ If the compression approach (which is a function of the level) or the
715
+ strategy is changed, and if any input has been consumed in a previous
716
+ deflate() call, then the input available so far is compressed with the old
717
+ level and strategy using deflate(strm, Z_BLOCK). There are three approaches
718
+ for the compression levels 0, 1..3, and 4..9 respectively. The new level
719
+ and strategy will take effect at the next call of deflate().
720
+
721
+ If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
722
+ not have enough output space to complete, then the parameter change will not
723
+ take effect. In this case, deflateParams() can be called again with the
724
+ same parameters and more output space to try again.
725
+
726
+ In order to assure a change in the parameters on the first try, the
727
+ deflate stream should be flushed using deflate() with Z_BLOCK or other flush
728
+ request until strm.avail_out is not zero, before calling deflateParams().
729
+ Then no more input data should be provided before the deflateParams() call.
730
+ If this is done, the old level and strategy will be applied to the data
731
+ compressed before deflateParams(), and the new level and strategy will be
732
+ applied to the the data compressed after deflateParams().
733
+
734
+ deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
735
+ state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
736
+ there was not enough output space to complete the compression of the
737
+ available input data before a change in the strategy or approach. Note that
738
+ in the case of a Z_BUF_ERROR, the parameters are not changed. A return
739
+ value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
740
+ retried with more output space.
679
741
  */
680
742
 
681
743
  ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
@@ -793,7 +855,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
793
855
  is for use with other formats that use the deflate compressed data format
794
856
  such as zip. Those formats provide their own check values. If a custom
795
857
  format is developed using the raw deflate format for compressed data, it is
796
- recommended that a check value such as an adler32 or a crc32 be applied to
858
+ recommended that a check value such as an Adler-32 or a CRC-32 be applied to
797
859
  the uncompressed data as is done in the zlib, gzip, and zip formats. For
798
860
  most applications, the zlib format should be used as is. Note that comments
799
861
  above on the use in deflateInit2() applies to the magnitude of windowBits.
@@ -802,7 +864,10 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
802
864
  32 to windowBits to enable zlib and gzip decoding with automatic header
803
865
  detection, or add 16 to decode only the gzip format (the zlib format will
804
866
  return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
805
- crc32 instead of an adler32.
867
+ CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
868
+ below), inflate() will not automatically decode concatenated gzip streams.
869
+ inflate() will return Z_STREAM_END at the end of the gzip stream. The state
870
+ would need to be reset to continue decoding a subsequent gzip stream.
806
871
 
807
872
  inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
808
873
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -823,7 +888,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
823
888
  Initializes the decompression dictionary from the given uncompressed byte
824
889
  sequence. This function must be called immediately after a call of inflate,
825
890
  if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
826
- can be determined from the adler32 value returned by that call of inflate.
891
+ can be determined from the Adler-32 value returned by that call of inflate.
827
892
  The compressor and decompressor must use exactly the same dictionary (see
828
893
  deflateSetDictionary). For raw inflate, this function can be called at any
829
894
  time to set the dictionary. If the provided dictionary is smaller than the
@@ -834,7 +899,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
834
899
  inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
835
900
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
836
901
  inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
837
- expected one (incorrect adler32 value). inflateSetDictionary does not
902
+ expected one (incorrect Adler-32 value). inflateSetDictionary does not
838
903
  perform any decompression: this will be done by subsequent calls of
839
904
  inflate().
840
905
  */
@@ -892,7 +957,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
892
957
  ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
893
958
  /*
894
959
  This function is equivalent to inflateEnd followed by inflateInit,
895
- but does not free and reallocate all the internal decompression state. The
960
+ but does not free and reallocate the internal decompression state. The
896
961
  stream will keep attributes that may have been set by inflateInit2.
897
962
 
898
963
  inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -904,7 +969,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
904
969
  /*
905
970
  This function is the same as inflateReset, but it also permits changing
906
971
  the wrap and window size requests. The windowBits parameter is interpreted
907
- the same as it is for inflateInit2.
972
+ the same as it is for inflateInit2. If the window size is changed, then the
973
+ memory allocated for the window is freed, and the window will be reallocated
974
+ by inflate() if needed.
908
975
 
909
976
  inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
910
977
  stream state was inconsistent (such as zalloc or state being Z_NULL), or if
@@ -956,7 +1023,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
956
1023
  location in the input stream can be determined from avail_in and data_type
957
1024
  as noted in the description for the Z_BLOCK flush parameter for inflate.
958
1025
 
959
- inflateMark returns the value noted above or -1 << 16 if the provided
1026
+ inflateMark returns the value noted above, or -65536 if the provided
960
1027
  source stream state was inconsistent.
961
1028
  */
962
1029
 
@@ -1048,9 +1115,9 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1048
1115
  This routine would normally be used in a utility that reads zip or gzip
1049
1116
  files and writes out uncompressed files. The utility would decode the
1050
1117
  header and process the trailer on its own, hence this routine expects only
1051
- the raw deflate stream to decompress. This is different from the normal
1052
- behavior of inflate(), which expects either a zlib or gzip header and
1053
- trailer around the deflate stream.
1118
+ the raw deflate stream to decompress. This is different from the default
1119
+ behavior of inflate(), which expects a zlib header and trailer around the
1120
+ deflate stream.
1054
1121
 
1055
1122
  inflateBack() uses two subroutines supplied by the caller that are then
1056
1123
  called by inflateBack() for input and output. inflateBack() calls those
@@ -1059,12 +1126,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1059
1126
  parameters and return types are defined above in the in_func and out_func
1060
1127
  typedefs. inflateBack() will call in(in_desc, &buf) which should return the
1061
1128
  number of bytes of provided input, and a pointer to that input in buf. If
1062
- there is no input available, in() must return zero--buf is ignored in that
1063
- case--and inflateBack() will return a buffer error. inflateBack() will call
1064
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
1065
- should return zero on success, or non-zero on failure. If out() returns
1066
- non-zero, inflateBack() will return with an error. Neither in() nor out()
1067
- are permitted to change the contents of the window provided to
1129
+ there is no input available, in() must return zero -- buf is ignored in that
1130
+ case -- and inflateBack() will return a buffer error. inflateBack() will
1131
+ call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
1132
+ out() should return zero on success, or non-zero on failure. If out()
1133
+ returns non-zero, inflateBack() will return with an error. Neither in() nor
1134
+ out() are permitted to change the contents of the window provided to
1068
1135
  inflateBackInit(), which is also the buffer that out() uses to write from.
1069
1136
  The length written by out() will be at most the window size. Any non-zero
1070
1137
  amount of input may be provided by in().
@@ -1092,7 +1159,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1092
1159
  using strm->next_in which will be Z_NULL only if in() returned an error. If
1093
1160
  strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
1094
1161
  non-zero. (in() will always be called before out(), so strm->next_in is
1095
- assured to be defined if out() returns non-zero.) Note that inflateBack()
1162
+ assured to be defined if out() returns non-zero.) Note that inflateBack()
1096
1163
  cannot return Z_OK.
1097
1164
  */
1098
1165
 
@@ -1114,7 +1181,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1114
1181
  7.6: size of z_off_t
1115
1182
 
1116
1183
  Compiler, assembler, and debug options:
1117
- 8: DEBUG
1184
+ 8: ZLIB_DEBUG
1118
1185
  9: ASMV or ASMINF -- use ASM code
1119
1186
  10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
1120
1187
  11: 0 (reserved)
@@ -1164,7 +1231,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
1164
1231
  the byte length of the source buffer. Upon entry, destLen is the total size
1165
1232
  of the destination buffer, which must be at least the value returned by
1166
1233
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1167
- compressed buffer.
1234
+ compressed data. compress() is equivalent to compress2() with a level
1235
+ parameter of Z_DEFAULT_COMPRESSION.
1168
1236
 
1169
1237
  compress returns Z_OK if success, Z_MEM_ERROR if there was not
1170
1238
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1180,7 +1248,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
1180
1248
  length of the source buffer. Upon entry, destLen is the total size of the
1181
1249
  destination buffer, which must be at least the value returned by
1182
1250
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1183
- compressed buffer.
1251
+ compressed data.
1184
1252
 
1185
1253
  compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1186
1254
  memory, Z_BUF_ERROR if there was not enough room in the output buffer,
@@ -1203,7 +1271,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1203
1271
  uncompressed data. (The size of the uncompressed data must have been saved
1204
1272
  previously by the compressor and transmitted to the decompressor by some
1205
1273
  mechanism outside the scope of this compression library.) Upon exit, destLen
1206
- is the actual size of the uncompressed buffer.
1274
+ is the actual size of the uncompressed data.
1207
1275
 
1208
1276
  uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
1209
1277
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1212,6 +1280,14 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1212
1280
  buffer with the uncompressed data up to that point.
1213
1281
  */
1214
1282
 
1283
+ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
1284
+ const Bytef *source, uLong *sourceLen));
1285
+ /*
1286
+ Same as uncompress, except that sourceLen is a pointer, where the
1287
+ length of the source is *sourceLen. On return, *sourceLen is the number of
1288
+ source bytes consumed.
1289
+ */
1290
+
1215
1291
  /* gzip file access functions */
1216
1292
 
1217
1293
  /*
@@ -1290,10 +1366,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1290
1366
  default buffer size is 8192 bytes. This function must be called after
1291
1367
  gzopen() or gzdopen(), and before any other calls that read or write the
1292
1368
  file. The buffer memory allocation is always deferred to the first read or
1293
- write. Two buffers are allocated, either both of the specified size when
1294
- writing, or one of the specified size and the other twice that size when
1295
- reading. A larger buffer size of, for example, 64K or 128K bytes will
1296
- noticeably increase the speed of decompression (reading).
1369
+ write. Three times that size in buffer space is allocated. A larger buffer
1370
+ size of, for example, 64K or 128K bytes will noticeably increase the speed
1371
+ of decompression (reading).
1297
1372
 
1298
1373
  The new buffer size also affects the maximum length for gzprintf().
1299
1374
 
@@ -1304,10 +1379,12 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1304
1379
  ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
1305
1380
  /*
1306
1381
  Dynamically update the compression level or strategy. See the description
1307
- of deflateInit2 for the meaning of these parameters.
1382
+ of deflateInit2 for the meaning of these parameters. Previously provided
1383
+ data is flushed before the parameter change.
1308
1384
 
1309
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
1310
- opened for writing.
1385
+ gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
1386
+ opened for writing, Z_ERRNO if there is an error writing the flushed data,
1387
+ or Z_MEM_ERROR if there is a memory allocation error.
1311
1388
  */
1312
1389
 
1313
1390
  ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
@@ -1335,7 +1412,35 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
1335
1412
  case.
1336
1413
 
1337
1414
  gzread returns the number of uncompressed bytes actually read, less than
1338
- len for end of file, or -1 for error.
1415
+ len for end of file, or -1 for error. If len is too large to fit in an int,
1416
+ then nothing is read, -1 is returned, and the error state is set to
1417
+ Z_STREAM_ERROR.
1418
+ */
1419
+
1420
+ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
1421
+ gzFile file));
1422
+ /*
1423
+ Read up to nitems items of size size from file to buf, otherwise operating
1424
+ as gzread() does. This duplicates the interface of stdio's fread(), with
1425
+ size_t request and return types. If the library defines size_t, then
1426
+ z_size_t is identical to size_t. If not, then z_size_t is an unsigned
1427
+ integer type that can contain a pointer.
1428
+
1429
+ gzfread() returns the number of full items read of size size, or zero if
1430
+ the end of the file was reached and a full item could not be read, or if
1431
+ there was an error. gzerror() must be consulted if zero is returned in
1432
+ order to determine if there was an error. If the multiplication of size and
1433
+ nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1434
+ is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1435
+
1436
+ In the event that the end of file is reached and only a partial item is
1437
+ available at the end, i.e. the remaining uncompressed data length is not a
1438
+ multiple of size, then the final partial item is nevetheless read into buf
1439
+ and the end-of-file flag is set. The length of the partial item read is not
1440
+ provided, but could be inferred from the result of gztell(). This behavior
1441
+ is the same as the behavior of fread() implementations in common libraries,
1442
+ but it prevents the direct use of gzfread() to read a concurrently written
1443
+ file, reseting and retrying on end-of-file, when size is not 1.
1339
1444
  */
1340
1445
 
1341
1446
  ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
@@ -1346,19 +1451,33 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
1346
1451
  error.
1347
1452
  */
1348
1453
 
1454
+ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
1455
+ z_size_t nitems, gzFile file));
1456
+ /*
1457
+ gzfwrite() writes nitems items of size size from buf to file, duplicating
1458
+ the interface of stdio's fwrite(), with size_t request and return types. If
1459
+ the library defines size_t, then z_size_t is identical to size_t. If not,
1460
+ then z_size_t is an unsigned integer type that can contain a pointer.
1461
+
1462
+ gzfwrite() returns the number of full items written of size size, or zero
1463
+ if there was an error. If the multiplication of size and nitems overflows,
1464
+ i.e. the product does not fit in a z_size_t, then nothing is written, zero
1465
+ is returned, and the error state is set to Z_STREAM_ERROR.
1466
+ */
1467
+
1349
1468
  ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
1350
1469
  /*
1351
1470
  Converts, formats, and writes the arguments to the compressed file under
1352
1471
  control of the format string, as in fprintf. gzprintf returns the number of
1353
- uncompressed bytes actually written, or 0 in case of error. The number of
1354
- uncompressed bytes written is limited to 8191, or one less than the buffer
1355
- size given to gzbuffer(). The caller should assure that this limit is not
1356
- exceeded. If it is exceeded, then gzprintf() will return an error (0) with
1357
- nothing written. In this case, there may also be a buffer overflow with
1358
- unpredictable consequences, which is possible only if zlib was compiled with
1359
- the insecure functions sprintf() or vsprintf() because the secure snprintf()
1360
- or vsnprintf() functions were not available. This can be determined using
1361
- zlibCompileFlags().
1472
+ uncompressed bytes actually written, or a negative zlib error code in case
1473
+ of error. The number of uncompressed bytes written is limited to 8191, or
1474
+ one less than the buffer size given to gzbuffer(). The caller should assure
1475
+ that this limit is not exceeded. If it is exceeded, then gzprintf() will
1476
+ return an error (0) with nothing written. In this case, there may also be a
1477
+ buffer overflow with unpredictable consequences, which is possible only if
1478
+ zlib was compiled with the insecure functions sprintf() or vsprintf()
1479
+ because the secure snprintf() or vsnprintf() functions were not available.
1480
+ This can be determined using zlibCompileFlags().
1362
1481
  */
1363
1482
 
1364
1483
  ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
@@ -1418,7 +1537,7 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
1418
1537
  If the flush parameter is Z_FINISH, the remaining data is written and the
1419
1538
  gzip stream is completed in the output. If gzwrite() is called again, a new
1420
1539
  gzip stream will be started in the output. gzread() is able to read such
1421
- concatented gzip streams.
1540
+ concatenated gzip streams.
1422
1541
 
1423
1542
  gzflush should be called only when strictly necessary because it will
1424
1543
  degrade compression if called too often.
@@ -1572,7 +1691,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1572
1691
  return the updated checksum. If buf is Z_NULL, this function returns the
1573
1692
  required initial value for the checksum.
1574
1693
 
1575
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
1694
+ An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
1576
1695
  much faster.
1577
1696
 
1578
1697
  Usage example:
@@ -1585,6 +1704,12 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1585
1704
  if (adler != original_adler) error();
1586
1705
  */
1587
1706
 
1707
+ ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
1708
+ z_size_t len));
1709
+ /*
1710
+ Same as adler32(), but with a size_t length.
1711
+ */
1712
+
1588
1713
  /*
1589
1714
  ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1590
1715
  z_off_t len2));
@@ -1614,6 +1739,12 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1614
1739
  if (crc != original_crc) error();
1615
1740
  */
1616
1741
 
1742
+ ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
1743
+ z_size_t len));
1744
+ /*
1745
+ Same as crc32(), but with a size_t length.
1746
+ */
1747
+
1617
1748
  /*
1618
1749
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
1619
1750
 
@@ -1644,19 +1775,35 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1644
1775
  unsigned char FAR *window,
1645
1776
  const char *version,
1646
1777
  int stream_size));
1647
- #define deflateInit(strm, level) \
1648
- deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1649
- #define inflateInit(strm) \
1650
- inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1651
- #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1652
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1653
- (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1654
- #define inflateInit2(strm, windowBits) \
1655
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1656
- (int)sizeof(z_stream))
1657
- #define inflateBackInit(strm, windowBits, window) \
1658
- inflateBackInit_((strm), (windowBits), (window), \
1659
- ZLIB_VERSION, (int)sizeof(z_stream))
1778
+ #ifdef Z_PREFIX_SET
1779
+ # define z_deflateInit(strm, level) \
1780
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1781
+ # define z_inflateInit(strm) \
1782
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1783
+ # define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1784
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1785
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1786
+ # define z_inflateInit2(strm, windowBits) \
1787
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1788
+ (int)sizeof(z_stream))
1789
+ # define z_inflateBackInit(strm, windowBits, window) \
1790
+ inflateBackInit_((strm), (windowBits), (window), \
1791
+ ZLIB_VERSION, (int)sizeof(z_stream))
1792
+ #else
1793
+ # define deflateInit(strm, level) \
1794
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1795
+ # define inflateInit(strm) \
1796
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1797
+ # define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1798
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1799
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1800
+ # define inflateInit2(strm, windowBits) \
1801
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1802
+ (int)sizeof(z_stream))
1803
+ # define inflateBackInit(strm, windowBits, window) \
1804
+ inflateBackInit_((strm), (windowBits), (window), \
1805
+ ZLIB_VERSION, (int)sizeof(z_stream))
1806
+ #endif
1660
1807
 
1661
1808
  #ifndef Z_SOLO
1662
1809
 
@@ -1676,10 +1823,10 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1676
1823
  #ifdef Z_PREFIX_SET
1677
1824
  # undef z_gzgetc
1678
1825
  # define z_gzgetc(g) \
1679
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
1826
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1680
1827
  #else
1681
1828
  # define gzgetc(g) \
1682
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
1829
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1683
1830
  #endif
1684
1831
 
1685
1832
  /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
@@ -1737,19 +1884,16 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1737
1884
 
1738
1885
  #endif /* !Z_SOLO */
1739
1886
 
1740
- /* hack for buggy compilers */
1741
- #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1742
- struct internal_state {int dummy;};
1743
- #endif
1744
-
1745
1887
  /* undocumented functions */
1746
1888
  ZEXTERN const char * ZEXPORT zError OF((int));
1747
1889
  ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
1748
1890
  ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
1749
1891
  ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
1892
+ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
1893
+ ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
1750
1894
  ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
1751
1895
  ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
1752
- #if defined(_WIN32) && !defined(Z_SOLO)
1896
+ #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
1753
1897
  ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
1754
1898
  const char *mode));
1755
1899
  #endif