Commit af46fcc15a1842e851b1f0b873154484d0d9d13c

Werner Lemberg 2022-10-18T19:40:03

[gzip] Update sources to zlib 1.2.13.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
diff --git a/src/gzip/crc32.c b/src/gzip/crc32.c
index 2ddc32d..3a52aa8 100644
--- a/src/gzip/crc32.c
+++ b/src/gzip/crc32.c
@@ -98,13 +98,22 @@
 #  endif
 #endif
 
+/* If available, use the ARM processor CRC32 instruction. */
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
+#  define ARMCRC32
+#endif
+
 /* Local functions. */
 local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
 local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
 
-/* If available, use the ARM processor CRC32 instruction. */
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
-#  define ARMCRC32
+#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
+    local z_word_t byte_swap OF((z_word_t word));
+#endif
+
+#if defined(W) && !defined(ARMCRC32)
+    local z_crc_t crc_word OF((z_word_t data));
+    local z_word_t crc_word_big OF((z_word_t data));
 #endif
 
 #if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
@@ -630,7 +639,7 @@ unsigned long ZEXPORT crc32_z(
 #endif /* DYNAMIC_CRC_TABLE */
 
     /* Pre-condition the CRC */
-    crc ^= 0xffffffff;
+    crc = (~crc) & 0xffffffff;
 
     /* Compute the CRC up to a word boundary. */
     while (len && ((z_size_t)buf & 7) != 0) {
@@ -645,8 +654,8 @@ unsigned long ZEXPORT crc32_z(
     len &= 7;
 
     /* Do three interleaved CRCs to realize the throughput of one crc32x
-       instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three
-       CRCs are combined into a single CRC after each set of batches. */
+       instruction per cycle. Each CRC is calculated on Z_BATCH words. The
+       three CRCs are combined into a single CRC after each set of batches. */
     while (num >= 3 * Z_BATCH) {
         crc1 = 0;
         crc2 = 0;
@@ -749,7 +758,7 @@ unsigned long ZEXPORT crc32_z(
 #endif /* DYNAMIC_CRC_TABLE */
 
     /* Pre-condition the CRC */
-    crc ^= 0xffffffff;
+    crc = (~crc) & 0xffffffff;
 
 #ifdef W
 
@@ -1077,7 +1086,7 @@ uLong ZEXPORT crc32_combine64(
 #ifdef DYNAMIC_CRC_TABLE
     once(&made, make_crc_table);
 #endif /* DYNAMIC_CRC_TABLE */
-    return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
+    return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
 }
 
 /* ========================================================================= */
@@ -1086,7 +1095,7 @@ uLong ZEXPORT crc32_combine(
     uLong crc2,
     z_off_t len2)
 {
-    return crc32_combine64(crc1, crc2, len2);
+    return crc32_combine64(crc1, crc2, (z_off64_t)len2);
 }
 
 /* ========================================================================= */
@@ -1103,14 +1112,14 @@ uLong ZEXPORT crc32_combine_gen64(
 uLong ZEXPORT crc32_combine_gen(
     z_off_t len2)
 {
-    return crc32_combine_gen64(len2);
+    return crc32_combine_gen64((z_off64_t)len2);
 }
 
 /* ========================================================================= */
-uLong crc32_combine_op(
+uLong ZEXPORT crc32_combine_op(
     uLong crc1,
     uLong crc2,
     uLong op)
 {
-    return multmodp(op, crc1) ^ crc2;
+    return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
 }
diff --git a/src/gzip/infback.c b/src/gzip/infback.c
index 5fb8c67..264c14e 100644
--- a/src/gzip/infback.c
+++ b/src/gzip/infback.c
@@ -66,6 +66,7 @@ int ZEXPORT inflateBackInit_(
     state->window = window;
     state->wnext = 0;
     state->whave = 0;
+    state->sane = 1;
     return Z_OK;
 }
 
@@ -605,25 +606,27 @@ int ZEXPORT inflateBack(
             break;
 
         case DONE:
-            /* inflate stream terminated properly -- write leftover output */
+            /* inflate stream terminated properly */
             ret = Z_STREAM_END;
-            if (left < state->wsize) {
-                if (out(out_desc, state->window, state->wsize - left))
-                    ret = Z_BUF_ERROR;
-            }
             goto inf_leave;
 
         case BAD:
             ret = Z_DATA_ERROR;
             goto inf_leave;
 
-        default:                /* can't happen, but makes compilers happy */
+        default:
+            /* can't happen, but makes compilers happy */
             ret = Z_STREAM_ERROR;
             goto inf_leave;
         }
 
-    /* Return unused input */
+    /* Write leftover output and return unused input */
   inf_leave:
+    if (left < state->wsize) {
+        if (out(out_desc, state->window, state->wsize - left) &&
+            ret == Z_STREAM_END)
+            ret = Z_BUF_ERROR;
+    }
     strm->next_in = next;
     strm->avail_in = have;
     return ret;
diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
index 5bf5b81..33c7cf2 100644
--- a/src/gzip/inflate.c
+++ b/src/gzip/inflate.c
@@ -170,6 +170,8 @@ int ZEXPORT inflateReset2(
 
     /* extract wrap request from windowBits parameter */
     if (windowBits < 0) {
+        if (windowBits < -15)
+            return Z_STREAM_ERROR;
         wrap = 0;
         windowBits = -windowBits;
     }
@@ -770,8 +772,9 @@ int ZEXPORT inflate(
                 if (copy > have) copy = have;
                 if (copy) {
                     if (state->head != Z_NULL &&
-                        state->head->extra != Z_NULL) {
-                        len = state->head->extra_len - state->length;
+                        state->head->extra != Z_NULL &&
+                        (len = state->head->extra_len - state->length) <
+                            state->head->extra_max) {
                         zmemcpy(state->head->extra + len, next,
                                 len + copy > state->head->extra_max ?
                                 state->head->extra_max - len : copy);
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index 0b58b29..d8405a2 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.12 Copyright 1995-2022 Mark Adler ";
+   " inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ int ZLIB_INTERNAL inflate_table(
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
index c94eb78..2daa000 100644
--- a/src/gzip/inftrees.h
+++ b/src/gzip/inftrees.h
@@ -41,7 +41,7 @@ typedef struct {
 /* Maximum size of the dynamic table.  The maximum number of code structures is
    1444, which is the sum of 852 for literal/length codes and 592 for distance
    codes.  These values were found by exhaustive searches using the program
-   examples/enough.c found in the zlib distribtution.  The arguments to that
+   examples/enough.c found in the zlib distribution.  The arguments to that
    program are the number of symbols, the initial root table size, and the
    maximum bit length of a code.  "enough 286 9 15" for literal/length codes
    returns returns 852, and "enough 30 6 15" for distance codes returns 592.
diff --git a/src/gzip/patches/freetype-zlib.diff b/src/gzip/patches/freetype-zlib.diff
index 20d8429..42eea19 100644
--- a/src/gzip/patches/freetype-zlib.diff
+++ b/src/gzip/patches/freetype-zlib.diff
@@ -66,7 +66,7 @@ index 57faf3716..4f09a52a7 100644
  
  /* internal gzip file state data structure */
 diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
-index 4375557b4..5bf5b815e 100644
+index c9e566b03..33c7cf2fe 100644
 --- a/src/gzip/inflate.c
 +++ b/src/gzip/inflate.c
 @@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
@@ -80,7 +80,7 @@ index 4375557b4..5bf5b815e 100644
  
  local int inflateStateCheck(
      z_streamp strm)
-@@ -245,6 +247,8 @@ int ZEXPORT inflateInit_(
+@@ -247,6 +249,8 @@ int ZEXPORT inflateInit_(
      return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  }
  
@@ -89,7 +89,7 @@ index 4375557b4..5bf5b815e 100644
  int ZEXPORT inflatePrime(
      z_streamp strm,
      int bits,
-@@ -266,6 +270,8 @@ int ZEXPORT inflatePrime(
+@@ -268,6 +272,8 @@ int ZEXPORT inflatePrime(
      return Z_OK;
  }
  
@@ -98,7 +98,7 @@ index 4375557b4..5bf5b815e 100644
  /*
     Return state with length and distance decoding tables and index sizes set to
     fixed code decoding.  Normally this returns fixed tables from inffixed.h.
-@@ -1312,6 +1318,8 @@ int ZEXPORT inflateEnd(
+@@ -1315,6 +1321,8 @@ int ZEXPORT inflateEnd(
      return Z_OK;
  }
  
@@ -107,7 +107,7 @@ index 4375557b4..5bf5b815e 100644
  int ZEXPORT inflateGetDictionary(
      z_streamp strm,
      Bytef *dictionary,
-@@ -1471,6 +1479,8 @@ int ZEXPORT inflateSync(
+@@ -1474,6 +1482,8 @@ int ZEXPORT inflateSync(
      return Z_OK;
  }
  
@@ -116,7 +116,7 @@ index 4375557b4..5bf5b815e 100644
  /*
     Returns true if inflate is currently at the end of a block generated by
     Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
-@@ -1489,6 +1499,8 @@ int ZEXPORT inflateSyncPoint(
+@@ -1492,6 +1502,8 @@ int ZEXPORT inflateSyncPoint(
      return state->mode == STORED && state->bits == 0;
  }
  
@@ -125,7 +125,7 @@ index 4375557b4..5bf5b815e 100644
  int ZEXPORT inflateCopy(
      z_streamp dest,
      z_streamp source)
-@@ -1536,6 +1548,8 @@ int ZEXPORT inflateCopy(
+@@ -1539,6 +1551,8 @@ int ZEXPORT inflateCopy(
      return Z_OK;
  }
  
@@ -134,7 +134,7 @@ index 4375557b4..5bf5b815e 100644
  int ZEXPORT inflateUndermine(
      z_streamp strm,
      int subvert)
-@@ -1569,6 +1583,8 @@ int ZEXPORT inflateValidate(
+@@ -1572,6 +1586,8 @@ int ZEXPORT inflateValidate(
      return Z_OK;
  }
  
@@ -143,7 +143,7 @@ index 4375557b4..5bf5b815e 100644
  long ZEXPORT inflateMark(
      z_streamp strm)
  {
-@@ -1590,3 +1606,5 @@ unsigned long ZEXPORT inflateCodesUsed(
+@@ -1593,3 +1609,5 @@ unsigned long ZEXPORT inflateCodesUsed(
      state = (struct inflate_state FAR *)strm->state;
      return (unsigned long)(state->next - state->codes);
  }
@@ -170,7 +170,7 @@ index f127b6b1f..c6f5a52e1 100644
 +
 +#endif  /* INFLATE_H */
 diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
-index baa53a0b1..c94eb78b5 100644
+index f53665311..2daa00063 100644
 --- a/src/gzip/inftrees.h
 +++ b/src/gzip/inftrees.h
 @@ -3,6 +3,9 @@
@@ -190,7 +190,7 @@ index baa53a0b1..c94eb78b5 100644
 +
 +#endif  /* INFTREES_H_ */
 diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
-index 4a98e38bf..d760140c2 100644
+index 953cb5012..bbbf75151 100644
 --- a/src/gzip/zlib.h
 +++ b/src/gzip/zlib.h
 @@ -31,7 +31,7 @@
@@ -336,7 +336,7 @@ index 4a98e38bf..d760140c2 100644
  #ifdef __cplusplus
  }
 diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
-index d9a20ae1b..14f0f1a85 100644
+index 0bc7f4ecd..d309bd069 100644
 --- a/src/gzip/zutil.h
 +++ b/src/gzip/zutil.h
 @@ -188,6 +188,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
@@ -348,8 +348,8 @@ index d9a20ae1b..14f0f1a85 100644
  /* provide prototypes for these when building zlib without LFS */
  #if !defined(_WIN32) && \
      (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
-@@ -195,6 +197,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
-     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+@@ -196,6 +198,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+     ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
  #endif
  
 +#endif  /* !Z_FREETYPE */
@@ -357,7 +357,7 @@ index d9a20ae1b..14f0f1a85 100644
          /* common defaults */
  
  #ifndef OS_CODE
-@@ -226,9 +230,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+@@ -227,9 +231,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
  #    define zmemcmp _fmemcmp
  #    define zmemzero(dest, len) _fmemset(dest, 0, len)
  #  else
diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
index d760140..bbbf751 100644
--- a/src/gzip/zlib.h
+++ b/src/gzip/zlib.h
@@ -1,5 +1,5 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.12, March 11th, 2022
+  version 1.2.13, October 13th, 2022
 
   Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
 
@@ -37,11 +37,11 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.12"
-#define ZLIB_VERNUM 0x12c0
+#define ZLIB_VERSION "1.2.13"
+#define ZLIB_VERNUM 0x12d0
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 12
+#define ZLIB_VER_REVISION 13
 #define ZLIB_VER_SUBREVISION 0
 
 /*
@@ -277,7 +277,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
   == 0), or after each call of deflate().  If deflate returns Z_OK and with
   zero avail_out, it must be called again after making room in the output
   buffer because there might be more output pending. See deflatePending(),
-  which can be used if desired to determine whether or not there is more ouput
+  which can be used if desired to determine whether or not there is more output
   in that case.
 
     Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
@@ -664,7 +664,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
    to dictionary.  dictionary must have enough space, where 32768 bytes is
    always enough.  If deflateGetDictionary() is called with dictionary equal to
    Z_NULL, then only the dictionary length is returned, and nothing is copied.
-   Similary, if dictLength is Z_NULL, then it is not set.
+   Similarly, if dictLength is Z_NULL, then it is not set.
 
      deflateGetDictionary() may return a length less than the window size, even
    when more than the window size in input has been provided. It may return up
@@ -919,7 +919,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
    to dictionary.  dictionary must have enough space, where 32768 bytes is
    always enough.  If inflateGetDictionary() is called with dictionary equal to
    Z_NULL, then only the dictionary length is returned, and nothing is copied.
-   Similary, if dictLength is Z_NULL, then it is not set.
+   Similarly, if dictLength is Z_NULL, then it is not set.
 
      inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
    stream state is inconsistent.
@@ -1451,12 +1451,12 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
 
      In the event that the end of file is reached and only a partial item is
    available at the end, i.e. the remaining uncompressed data length is not a
-   multiple of size, then the final partial item is nevetheless read into buf
+   multiple of size, then the final partial item is nevertheless read into buf
    and the end-of-file flag is set.  The length of the partial item read is not
    provided, but could be inferred from the result of gztell().  This behavior
    is the same as the behavior of fread() implementations in common libraries,
    but it prevents the direct use of gzfread() to read a concurrently written
-   file, reseting and retrying on end-of-file, when size is not 1.
+   file, resetting and retrying on end-of-file, when size is not 1.
 */
 
 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
@@ -1945,7 +1945,7 @@ ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));
 ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
 ZEXTERN int            ZEXPORT inflateValidate OF((z_streamp, int));
-ZEXTERN unsigned long  ZEXPORT inflateCodesUsed OF ((z_streamp));
+ZEXTERN unsigned long  ZEXPORT inflateCodesUsed OF((z_streamp));
 ZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));
 ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
 #if defined(_WIN32) && !defined(Z_SOLO)
diff --git a/src/gzip/zutil.c b/src/gzip/zutil.c
index a19ac2b..ef174ca 100644
--- a/src/gzip/zutil.c
+++ b/src/gzip/zutil.c
@@ -61,9 +61,11 @@ uLong ZEXPORT zlibCompileFlags()
 #ifdef ZLIB_DEBUG
     flags += 1 << 8;
 #endif
+    /*
 #if defined(ASMV) || defined(ASMINF)
     flags += 1 << 9;
 #endif
+     */
 #ifdef ZLIB_WINAPI
     flags += 1 << 10;
 #endif
@@ -119,7 +121,7 @@ uLong ZEXPORT zlibCompileFlags()
 #  endif
 int ZLIB_INTERNAL z_verbose = verbose;
 
-void ZLIB_INTERNAL z_error (
+void ZLIB_INTERNAL z_error(
     char *m)
 {
     fprintf(stderr, "%s\n", m);
@@ -214,7 +216,7 @@ local ptr_table table[MAX_PTR];
  * a protected system like OS/2. Use Microsoft C instead.
  */
 
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
 {
     voidpf buf;
     ulg bsize = (ulg)items*size;
@@ -240,7 +242,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
     return buf;
 }
 
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
 {
     int n;
 
@@ -277,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 #  define _hfree   hfree
 #endif
 
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
 {
     (void)opaque;
     return _halloc((long)items, size);
 }
 
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
 {
     (void)opaque;
     _hfree(ptr);
@@ -302,7 +304,7 @@ extern voidp  calloc OF((uInt items, uInt size));
 extern void   free   OF((voidpf ptr));
 #endif
 
-voidpf ZLIB_INTERNAL zcalloc (
+voidpf ZLIB_INTERNAL zcalloc(
     voidpf opaque,
     unsigned items,
     unsigned size)
@@ -312,7 +314,7 @@ voidpf ZLIB_INTERNAL zcalloc (
                               (voidpf)calloc(items, size);
 }
 
-void ZLIB_INTERNAL zcfree (
+void ZLIB_INTERNAL zcfree(
     voidpf opaque,
     voidpf ptr)
 {
diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
index 14f0f1a..d309bd0 100644
--- a/src/gzip/zutil.h
+++ b/src/gzip/zutil.h
@@ -195,6 +195,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
     (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+    ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
 #endif
 
 #endif  /* !Z_FREETYPE */