cairo 1.15.4-x86-mingw32 → 1.15.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +10 -0
  3. data/Rakefile +5 -4
  4. data/ext/cairo/rb_cairo.h +1 -1
  5. data/lib/2.2/cairo.so +0 -0
  6. data/lib/2.3/cairo.so +0 -0
  7. data/lib/2.4/cairo.so +0 -0
  8. data/vendor/local/bin/fc-cache.exe +0 -0
  9. data/vendor/local/bin/fc-cat.exe +0 -0
  10. data/vendor/local/bin/fc-list.exe +0 -0
  11. data/vendor/local/bin/fc-match.exe +0 -0
  12. data/vendor/local/bin/fc-pattern.exe +0 -0
  13. data/vendor/local/bin/fc-query.exe +0 -0
  14. data/vendor/local/bin/fc-scan.exe +0 -0
  15. data/vendor/local/bin/fc-validate.exe +0 -0
  16. data/vendor/local/bin/libcairo-2.dll +0 -0
  17. data/vendor/local/bin/libcairo-gobject-2.dll +0 -0
  18. data/vendor/local/bin/libcairo-script-interpreter-2.dll +0 -0
  19. data/vendor/local/bin/libfontconfig-1.dll +0 -0
  20. data/vendor/local/bin/libfreetype-6.dll +0 -0
  21. data/vendor/local/bin/libpixman-1-0.dll +0 -0
  22. data/vendor/local/bin/libpng16-16.dll +0 -0
  23. data/vendor/local/bin/libxml2-2.dll +0 -0
  24. data/vendor/local/bin/png-fix-itxt.exe +0 -0
  25. data/vendor/local/bin/pngfix.exe +0 -0
  26. data/vendor/local/bin/xmlcatalog.exe +0 -0
  27. data/vendor/local/bin/xmllint.exe +0 -0
  28. data/vendor/local/bin/zlib1.dll +0 -0
  29. data/vendor/local/include/libpng16/pnglibconf.h +1 -1
  30. data/vendor/local/include/pnglibconf.h +1 -1
  31. data/vendor/local/include/zconf.h +32 -9
  32. data/vendor/local/include/zlib.h +297 -154
  33. data/vendor/local/lib/libcairo-gobject.dll.a +0 -0
  34. data/vendor/local/lib/libcairo-script-interpreter.a +0 -0
  35. data/vendor/local/lib/libcairo-script-interpreter.dll.a +0 -0
  36. data/vendor/local/lib/libcairo.a +0 -0
  37. data/vendor/local/lib/libcairo.dll.a +0 -0
  38. data/vendor/local/lib/libfontconfig.dll.a +0 -0
  39. data/vendor/local/lib/libfreetype.a +0 -0
  40. data/vendor/local/lib/libfreetype.dll.a +0 -0
  41. data/vendor/local/lib/libpixman-1.dll.a +0 -0
  42. data/vendor/local/lib/libpng.a +0 -0
  43. data/vendor/local/lib/libpng.dll.a +0 -0
  44. data/vendor/local/lib/libpng16.a +0 -0
  45. data/vendor/local/lib/libpng16.dll.a +0 -0
  46. data/vendor/local/lib/libxml2.a +0 -0
  47. data/vendor/local/lib/libxml2.dll.a +0 -0
  48. data/vendor/local/lib/libz.a +0 -0
  49. data/vendor/local/lib/libz.dll.a +0 -0
  50. data/vendor/local/lib/pkgconfig/zlib.pc +1 -1
  51. data/vendor/local/share/license/zlib/README +3 -3
  52. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e7f0e449fafb91c273782dd8e08bc861611579a
4
- data.tar.gz: 3173e412c067e96014bc3f7429cc248ac07713a8
3
+ metadata.gz: d1965568af18766d0fe016b0c8aa53ead4d87cbc
4
+ data.tar.gz: 06debc4548479d32ef51e88933ad091ada0f56e5
5
5
  SHA512:
6
- metadata.gz: bdbe95aaa9965fd846017f303ba8e52aed204dcc4f48f9351a8ead39331d9f3076cbdf8a1cacc363196cd8c438e9f6652a85183ec983aebdb26dcb60b9065475
7
- data.tar.gz: 418ad66f5f1b6128deba1c883abc9fcfe525c8b91839403f4806afe9c8620fab6400f950f0a70e5f04aa4af919be7562e5f6d35853b9b9fa547ce961201c8a16
6
+ metadata.gz: 4176557f14b7838b01f3fbe130cc6c2b8358a42c117f72746731236f955e5cae7d481082152a6ae3f088f357605cbe4515a7be521c63b42bffbff83675631287
7
+ data.tar.gz: 711ac48b2424f1c0077275348e7d16374a20a1cc6da3f028f23b56ef3af08e5863c7ac6f6a055516e533d6473bc6cad81c10a15fed0c83535feeb4643cf29a68
data/NEWS CHANGED
@@ -1,3 +1,13 @@
1
+ Release 1.15.5 (2017-01-14) Kouhei Sutou <kou@cozmixng.org>
2
+ ===========================================================
3
+
4
+ Improvements
5
+ ------------
6
+
7
+ * Windows: Applied the patch at
8
+ https://bugs.freedesktop.org/show_bug.cgi?id=99054 that fixes
9
+ unexpected assertion failure in win32 surface.
10
+
1
11
  Release 1.15.4 (2017-01-07) Kouhei Sutou <kou@cozmixng.org>
2
12
  ===========================================================
3
13
 
data/Rakefile CHANGED
@@ -442,8 +442,8 @@ windows_task = WindowsTask.new(spec) do |task|
442
442
  task.packages = [
443
443
  {
444
444
  :name => "zlib",
445
- :version => "1.2.8",
446
- :download_base_url => "http://downloads.sourceforge.net/project/libpng/zlib/1.2.8",
445
+ :version => "1.2.10",
446
+ :download_base_url => "https://downloads.sourceforge.net/project/libpng/zlib/1.2.10",
447
447
  :compression_method => "gz",
448
448
  :windows => {
449
449
  :builder => ZlibBuilder.new,
@@ -453,7 +453,7 @@ windows_task = WindowsTask.new(spec) do |task|
453
453
  {
454
454
  :name => "libpng",
455
455
  :version => "1.6.27",
456
- :download_base_url => "http://downloads.sourceforge.net/project/libpng/libpng16/1.6.27",
456
+ :download_base_url => "https://downloads.sourceforge.net/project/libpng/libpng16/1.6.27",
457
457
  :windows => {
458
458
  :built_file => "bin/libpng16-16.dll",
459
459
  },
@@ -461,7 +461,7 @@ windows_task = WindowsTask.new(spec) do |task|
461
461
  {
462
462
  :name => "freetype",
463
463
  :version => "2.7",
464
- :download_base_url => "http://downloads.sourceforge.net/project/freetype/freetype2/2.7",
464
+ :download_base_url => "https://downloads.sourceforge.net/project/freetype/freetype2/2.7",
465
465
  :compression_method => "bz2",
466
466
  :windows => {
467
467
  :built_file => "bin/libfreetype-7.dll",
@@ -511,6 +511,7 @@ windows_task = WindowsTask.new(spec) do |task|
511
511
  "--enable-gobject",
512
512
  ],
513
513
  :patches => [
514
+ "cairo-1.15.4-99054-fix-win32-backend-assertion-failure.diff"
514
515
  ],
515
516
  :need_autoreconf => true,
516
517
  },
data/ext/cairo/rb_cairo.h CHANGED
@@ -73,7 +73,7 @@ RB_CAIRO_BEGIN_DECLS
73
73
 
74
74
  #define RB_CAIRO_VERSION_MAJOR 1
75
75
  #define RB_CAIRO_VERSION_MINOR 15
76
- #define RB_CAIRO_VERSION_MICRO 4
76
+ #define RB_CAIRO_VERSION_MICRO 5
77
77
 
78
78
  RB_CAIRO_VAR VALUE rb_mCairo;
79
79
  RB_CAIRO_VAR VALUE rb_cCairo_Context;
data/lib/2.2/cairo.so CHANGED
Binary file
data/lib/2.3/cairo.so CHANGED
Binary file
data/lib/2.4/cairo.so CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -203,7 +203,7 @@
203
203
  #define PNG_USER_HEIGHT_MAX 1000000
204
204
  #define PNG_USER_WIDTH_MAX 1000000
205
205
  #define PNG_ZBUF_SIZE 8192
206
- #define PNG_ZLIB_VERNUM 0x1280
206
+ #define PNG_ZLIB_VERNUM 0x12a0
207
207
  #define PNG_Z_DEFAULT_COMPRESSION (-1)
208
208
  #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
209
209
  #define PNG_Z_DEFAULT_STRATEGY 1
@@ -203,7 +203,7 @@
203
203
  #define PNG_USER_HEIGHT_MAX 1000000
204
204
  #define PNG_USER_WIDTH_MAX 1000000
205
205
  #define PNG_ZBUF_SIZE 8192
206
- #define PNG_ZLIB_VERNUM 0x1280
206
+ #define PNG_ZLIB_VERNUM 0x12a0
207
207
  #define PNG_Z_DEFAULT_COMPRESSION (-1)
208
208
  #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
209
209
  #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.10, January 2nd, 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.10"
41
+ #define ZLIB_VERNUM 0x12a0
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 10
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,35 @@ 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, then the input available so far is compressed with the
716
+ old level and strategy using deflate(strm, Z_BLOCK). There are three
717
+ approaches for the compression levels 0, 1..3, and 4..9 respectively. The
718
+ new level and strategy will take effect at the next call of deflate().
719
+
720
+ If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
721
+ not have enough output space to complete, then the parameter change will not
722
+ take effect. In this case, deflateParams() can be called again with the
723
+ same parameters and more output space to try again.
724
+
725
+ In order to assure a change in the parameters on the first try, the
726
+ deflate stream should be flushed using deflate() with Z_BLOCK or other flush
727
+ request until strm.avail_out is not zero, before calling deflateParams().
728
+ Then no more input data should be provided before the deflateParams() call.
729
+ If this is done, the old level and strategy will be applied to the data
730
+ compressed before deflateParams(), and the new level and strategy will be
731
+ applied to the the data compressed after deflateParams().
732
+
733
+ deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
734
+ state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
735
+ there was not enough output space to complete the compression of the
736
+ available input data before a change in the strategy or approach. Note that
737
+ in the case of a Z_BUF_ERROR, the parameters are not changed. A return
738
+ value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
739
+ retried with more output space.
679
740
  */
680
741
 
681
742
  ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
@@ -793,7 +854,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
793
854
  is for use with other formats that use the deflate compressed data format
794
855
  such as zip. Those formats provide their own check values. If a custom
795
856
  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
857
+ recommended that a check value such as an Adler-32 or a CRC-32 be applied to
797
858
  the uncompressed data as is done in the zlib, gzip, and zip formats. For
798
859
  most applications, the zlib format should be used as is. Note that comments
799
860
  above on the use in deflateInit2() applies to the magnitude of windowBits.
@@ -802,7 +863,10 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
802
863
  32 to windowBits to enable zlib and gzip decoding with automatic header
803
864
  detection, or add 16 to decode only the gzip format (the zlib format will
804
865
  return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
805
- crc32 instead of an adler32.
866
+ CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
867
+ below), inflate() will not automatically decode concatenated gzip streams.
868
+ inflate() will return Z_STREAM_END at the end of the gzip stream. The state
869
+ would need to be reset to continue decoding a subsequent gzip stream.
806
870
 
807
871
  inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
808
872
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -823,7 +887,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
823
887
  Initializes the decompression dictionary from the given uncompressed byte
824
888
  sequence. This function must be called immediately after a call of inflate,
825
889
  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.
890
+ can be determined from the Adler-32 value returned by that call of inflate.
827
891
  The compressor and decompressor must use exactly the same dictionary (see
828
892
  deflateSetDictionary). For raw inflate, this function can be called at any
829
893
  time to set the dictionary. If the provided dictionary is smaller than the
@@ -834,7 +898,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
834
898
  inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
835
899
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
836
900
  inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
837
- expected one (incorrect adler32 value). inflateSetDictionary does not
901
+ expected one (incorrect Adler-32 value). inflateSetDictionary does not
838
902
  perform any decompression: this will be done by subsequent calls of
839
903
  inflate().
840
904
  */
@@ -892,7 +956,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
892
956
  ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
893
957
  /*
894
958
  This function is equivalent to inflateEnd followed by inflateInit,
895
- but does not free and reallocate all the internal decompression state. The
959
+ but does not free and reallocate the internal decompression state. The
896
960
  stream will keep attributes that may have been set by inflateInit2.
897
961
 
898
962
  inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -904,7 +968,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
904
968
  /*
905
969
  This function is the same as inflateReset, but it also permits changing
906
970
  the wrap and window size requests. The windowBits parameter is interpreted
907
- the same as it is for inflateInit2.
971
+ the same as it is for inflateInit2. If the window size is changed, then the
972
+ memory allocated for the window is freed, and the window will be reallocated
973
+ by inflate() if needed.
908
974
 
909
975
  inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
910
976
  stream state was inconsistent (such as zalloc or state being Z_NULL), or if
@@ -956,7 +1022,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
956
1022
  location in the input stream can be determined from avail_in and data_type
957
1023
  as noted in the description for the Z_BLOCK flush parameter for inflate.
958
1024
 
959
- inflateMark returns the value noted above or -1 << 16 if the provided
1025
+ inflateMark returns the value noted above, or -65536 if the provided
960
1026
  source stream state was inconsistent.
961
1027
  */
962
1028
 
@@ -1048,9 +1114,9 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1048
1114
  This routine would normally be used in a utility that reads zip or gzip
1049
1115
  files and writes out uncompressed files. The utility would decode the
1050
1116
  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.
1117
+ the raw deflate stream to decompress. This is different from the default
1118
+ behavior of inflate(), which expects a zlib header and trailer around the
1119
+ deflate stream.
1054
1120
 
1055
1121
  inflateBack() uses two subroutines supplied by the caller that are then
1056
1122
  called by inflateBack() for input and output. inflateBack() calls those
@@ -1059,12 +1125,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1059
1125
  parameters and return types are defined above in the in_func and out_func
1060
1126
  typedefs. inflateBack() will call in(in_desc, &buf) which should return the
1061
1127
  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
1128
+ there is no input available, in() must return zero -- buf is ignored in that
1129
+ case -- and inflateBack() will return a buffer error. inflateBack() will
1130
+ call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
1131
+ out() should return zero on success, or non-zero on failure. If out()
1132
+ returns non-zero, inflateBack() will return with an error. Neither in() nor
1133
+ out() are permitted to change the contents of the window provided to
1068
1134
  inflateBackInit(), which is also the buffer that out() uses to write from.
1069
1135
  The length written by out() will be at most the window size. Any non-zero
1070
1136
  amount of input may be provided by in().
@@ -1092,7 +1158,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1092
1158
  using strm->next_in which will be Z_NULL only if in() returned an error. If
1093
1159
  strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
1094
1160
  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()
1161
+ assured to be defined if out() returns non-zero.) Note that inflateBack()
1096
1162
  cannot return Z_OK.
1097
1163
  */
1098
1164
 
@@ -1114,7 +1180,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1114
1180
  7.6: size of z_off_t
1115
1181
 
1116
1182
  Compiler, assembler, and debug options:
1117
- 8: DEBUG
1183
+ 8: ZLIB_DEBUG
1118
1184
  9: ASMV or ASMINF -- use ASM code
1119
1185
  10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
1120
1186
  11: 0 (reserved)
@@ -1164,7 +1230,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
1164
1230
  the byte length of the source buffer. Upon entry, destLen is the total size
1165
1231
  of the destination buffer, which must be at least the value returned by
1166
1232
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1167
- compressed buffer.
1233
+ compressed data. compress() is equivalent to compress2() with a level
1234
+ parameter of Z_DEFAULT_COMPRESSION.
1168
1235
 
1169
1236
  compress returns Z_OK if success, Z_MEM_ERROR if there was not
1170
1237
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1180,7 +1247,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
1180
1247
  length of the source buffer. Upon entry, destLen is the total size of the
1181
1248
  destination buffer, which must be at least the value returned by
1182
1249
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1183
- compressed buffer.
1250
+ compressed data.
1184
1251
 
1185
1252
  compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1186
1253
  memory, Z_BUF_ERROR if there was not enough room in the output buffer,
@@ -1203,7 +1270,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1203
1270
  uncompressed data. (The size of the uncompressed data must have been saved
1204
1271
  previously by the compressor and transmitted to the decompressor by some
1205
1272
  mechanism outside the scope of this compression library.) Upon exit, destLen
1206
- is the actual size of the uncompressed buffer.
1273
+ is the actual size of the uncompressed data.
1207
1274
 
1208
1275
  uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
1209
1276
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1212,6 +1279,14 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1212
1279
  buffer with the uncompressed data up to that point.
1213
1280
  */
1214
1281
 
1282
+ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
1283
+ const Bytef *source, uLong *sourceLen));
1284
+ /*
1285
+ Same as uncompress, except that sourceLen is a pointer, where the
1286
+ length of the source is *sourceLen. On return, *sourceLen is the number of
1287
+ source bytes consumed.
1288
+ */
1289
+
1215
1290
  /* gzip file access functions */
1216
1291
 
1217
1292
  /*
@@ -1290,10 +1365,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1290
1365
  default buffer size is 8192 bytes. This function must be called after
1291
1366
  gzopen() or gzdopen(), and before any other calls that read or write the
1292
1367
  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).
1368
+ write. Three times that size in buffer space is allocated. A larger buffer
1369
+ size of, for example, 64K or 128K bytes will noticeably increase the speed
1370
+ of decompression (reading).
1297
1371
 
1298
1372
  The new buffer size also affects the maximum length for gzprintf().
1299
1373
 
@@ -1304,10 +1378,12 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1304
1378
  ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
1305
1379
  /*
1306
1380
  Dynamically update the compression level or strategy. See the description
1307
- of deflateInit2 for the meaning of these parameters.
1381
+ of deflateInit2 for the meaning of these parameters. Previously provided
1382
+ data is flushed before the parameter change.
1308
1383
 
1309
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
1310
- opened for writing.
1384
+ gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
1385
+ opened for writing, Z_ERRNO if there is an error writing the flushed data,
1386
+ or Z_MEM_ERROR if there is a memory allocation error.
1311
1387
  */
1312
1388
 
1313
1389
  ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
@@ -1335,7 +1411,35 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
1335
1411
  case.
1336
1412
 
1337
1413
  gzread returns the number of uncompressed bytes actually read, less than
1338
- len for end of file, or -1 for error.
1414
+ len for end of file, or -1 for error. If len is too large to fit in an int,
1415
+ then nothing is read, -1 is returned, and the error state is set to
1416
+ Z_STREAM_ERROR.
1417
+ */
1418
+
1419
+ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
1420
+ gzFile file));
1421
+ /*
1422
+ Read up to nitems items of size size from file to buf, otherwise operating
1423
+ as gzread() does. This duplicates the interface of stdio's fread(), with
1424
+ size_t request and return types. If the library defines size_t, then
1425
+ z_size_t is identical to size_t. If not, then z_size_t is an unsigned
1426
+ integer type that can contain a pointer.
1427
+
1428
+ gzfread() returns the number of full items read of size size, or zero if
1429
+ the end of the file was reached and a full item could not be read, or if
1430
+ there was an error. gzerror() must be consulted if zero is returned in
1431
+ order to determine if there was an error. If the multiplication of size and
1432
+ nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1433
+ is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1434
+
1435
+ In the event that the end of file is reached and only a partial item is
1436
+ available at the end, i.e. the remaining uncompressed data length is not a
1437
+ multiple of size, then the final partial item is nevetheless read into buf
1438
+ and the end-of-file flag is set. The length of the partial item read is not
1439
+ provided, but could be inferred from the result of gztell(). This behavior
1440
+ is the same as the behavior of fread() implementations in common libraries,
1441
+ but it prevents the direct use of gzfread() to read a concurrently written
1442
+ file, reseting and retrying on end-of-file, when size is not 1.
1339
1443
  */
1340
1444
 
1341
1445
  ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
@@ -1346,19 +1450,33 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
1346
1450
  error.
1347
1451
  */
1348
1452
 
1453
+ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
1454
+ z_size_t nitems, gzFile file));
1455
+ /*
1456
+ gzfwrite() writes nitems items of size size from buf to file, duplicating
1457
+ the interface of stdio's fwrite(), with size_t request and return types. If
1458
+ the library defines size_t, then z_size_t is identical to size_t. If not,
1459
+ then z_size_t is an unsigned integer type that can contain a pointer.
1460
+
1461
+ gzfwrite() returns the number of full items written of size size, or zero
1462
+ if there was an error. If the multiplication of size and nitems overflows,
1463
+ i.e. the product does not fit in a z_size_t, then nothing is written, zero
1464
+ is returned, and the error state is set to Z_STREAM_ERROR.
1465
+ */
1466
+
1349
1467
  ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
1350
1468
  /*
1351
1469
  Converts, formats, and writes the arguments to the compressed file under
1352
1470
  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().
1471
+ uncompressed bytes actually written, or a negative zlib error code in case
1472
+ of error. The number of uncompressed bytes written is limited to 8191, or
1473
+ one less than the buffer size given to gzbuffer(). The caller should assure
1474
+ that this limit is not exceeded. If it is exceeded, then gzprintf() will
1475
+ return an error (0) with nothing written. In this case, there may also be a
1476
+ buffer overflow with unpredictable consequences, which is possible only if
1477
+ zlib was compiled with the insecure functions sprintf() or vsprintf()
1478
+ because the secure snprintf() or vsnprintf() functions were not available.
1479
+ This can be determined using zlibCompileFlags().
1362
1480
  */
1363
1481
 
1364
1482
  ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
@@ -1418,7 +1536,7 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
1418
1536
  If the flush parameter is Z_FINISH, the remaining data is written and the
1419
1537
  gzip stream is completed in the output. If gzwrite() is called again, a new
1420
1538
  gzip stream will be started in the output. gzread() is able to read such
1421
- concatented gzip streams.
1539
+ concatenated gzip streams.
1422
1540
 
1423
1541
  gzflush should be called only when strictly necessary because it will
1424
1542
  degrade compression if called too often.
@@ -1572,7 +1690,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1572
1690
  return the updated checksum. If buf is Z_NULL, this function returns the
1573
1691
  required initial value for the checksum.
1574
1692
 
1575
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
1693
+ An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
1576
1694
  much faster.
1577
1695
 
1578
1696
  Usage example:
@@ -1585,6 +1703,12 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1585
1703
  if (adler != original_adler) error();
1586
1704
  */
1587
1705
 
1706
+ ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
1707
+ z_size_t len));
1708
+ /*
1709
+ Same as adler32(), but with a size_t length.
1710
+ */
1711
+
1588
1712
  /*
1589
1713
  ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1590
1714
  z_off_t len2));
@@ -1614,6 +1738,12 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1614
1738
  if (crc != original_crc) error();
1615
1739
  */
1616
1740
 
1741
+ ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
1742
+ z_size_t len));
1743
+ /*
1744
+ Same as crc32(), but with a size_t length.
1745
+ */
1746
+
1617
1747
  /*
1618
1748
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
1619
1749
 
@@ -1644,19 +1774,35 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1644
1774
  unsigned char FAR *window,
1645
1775
  const char *version,
1646
1776
  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))
1777
+ #ifdef Z_PREFIX_SET
1778
+ # define z_deflateInit(strm, level) \
1779
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1780
+ # define z_inflateInit(strm) \
1781
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1782
+ # define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1783
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1784
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1785
+ # define z_inflateInit2(strm, windowBits) \
1786
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1787
+ (int)sizeof(z_stream))
1788
+ # define z_inflateBackInit(strm, windowBits, window) \
1789
+ inflateBackInit_((strm), (windowBits), (window), \
1790
+ ZLIB_VERSION, (int)sizeof(z_stream))
1791
+ #else
1792
+ # define deflateInit(strm, level) \
1793
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1794
+ # define inflateInit(strm) \
1795
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1796
+ # define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1797
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1798
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1799
+ # define inflateInit2(strm, windowBits) \
1800
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1801
+ (int)sizeof(z_stream))
1802
+ # define inflateBackInit(strm, windowBits, window) \
1803
+ inflateBackInit_((strm), (windowBits), (window), \
1804
+ ZLIB_VERSION, (int)sizeof(z_stream))
1805
+ #endif
1660
1806
 
1661
1807
  #ifndef Z_SOLO
1662
1808
 
@@ -1676,10 +1822,10 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1676
1822
  #ifdef Z_PREFIX_SET
1677
1823
  # undef z_gzgetc
1678
1824
  # define z_gzgetc(g) \
1679
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
1825
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1680
1826
  #else
1681
1827
  # define gzgetc(g) \
1682
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
1828
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1683
1829
  #endif
1684
1830
 
1685
1831
  /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
@@ -1737,19 +1883,16 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1737
1883
 
1738
1884
  #endif /* !Z_SOLO */
1739
1885
 
1740
- /* hack for buggy compilers */
1741
- #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1742
- struct internal_state {int dummy;};
1743
- #endif
1744
-
1745
1886
  /* undocumented functions */
1746
1887
  ZEXTERN const char * ZEXPORT zError OF((int));
1747
1888
  ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
1748
1889
  ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
1749
1890
  ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
1891
+ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
1892
+ ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
1750
1893
  ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
1751
1894
  ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
1752
- #if defined(_WIN32) && !defined(Z_SOLO)
1895
+ #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
1753
1896
  ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
1754
1897
  const char *mode));
1755
1898
  #endif