1
|
|
-From 2977ff0df909f939517e9857943938ff84201a26 Mon Sep 17 00:00:00 2001
|
2
|
|
-From: David Turner <david@freetype.org>
|
3
|
|
-Date: Wed, 18 Aug 2021 00:17:35 +0200
|
4
|
|
-Subject: [zlib] Fix zlib sources to compile for FreeType
|
|
1
|
+[zlib] Fix zlib sources for compilation with FreeType
|
5
|
2
|
|
6
|
|
-Fix misc zlib sources to ensure that they do not issue compiler
|
7
|
|
-warnings when they are compiled as part of src/gzip/ftgzip.c.
|
|
3
|
+We must ensure that they do not issue compiler errors or warnings when they
|
|
4
|
+are compiled as part of `src/gzip/ftgzip.c`.
|
8
|
5
|
|
9
|
|
-* src/gzip/adler32.c: Do not define unused functions when Z_FREETYPE
|
10
|
|
- is set.
|
|
6
|
+* src/gzip/adler32.c: Do not define unused functions when `Z_FREETYPE`
|
|
7
|
+is set.
|
11
|
8
|
|
12
|
|
-* src/gzip/crc32.c: Undefined DO1 and DO8 macros that are already
|
13
|
|
- defined in adler32.c.
|
|
9
|
+* src/gzip/crc32.c (DO1, DO8): Undefine. Already defined in `adler32.c`.
|
14
|
10
|
|
15
|
|
-* src/gzip/gzguts.h: Rename COPY macro to COPY__ since COPY and
|
16
|
|
- COPY_ conflict with enum values with the same name in
|
17
|
|
- zlib.h.
|
|
11
|
+* src/gzip/gzguts.h (COPY): Rename to...
|
|
12
|
+(COPY__): ... this since `COPY` and `COPY_` conflict with enum values,
|
|
13
|
+which have the same name in `zlib.h`.
|
18
|
14
|
|
19
|
15
|
* src/gzip/inflate.c, src/gzip/adler32.c: Omit unused function
|
20
|
|
- declarations when Z_FREETYPE is defined.
|
|
16
|
+declarations when `Z_FREETYPE` is defined.
|
21
|
17
|
|
22
|
|
-* src/gzip/zlib.h: Include "ftzconf.h" instead of "zconf.h" to
|
23
|
|
- avoid conflicts with system-installed headers. Omit unused
|
24
|
|
- function declarations when Z_FREETYPE is defined.
|
|
18
|
+* src/gzip/zlib.h: Include `ftzconf.h` instead of `zconf.h` to avoid
|
|
19
|
+conflicts with system-installed headers.
|
|
20
|
+Omit unused function declarations when `Z_FREETYPE` is defined.
|
25
|
21
|
|
26
|
|
-* src/gzip/zutil.h: Use ft_memxxx() functions instead of memxxx().
|
27
|
|
- Omit unused function declarations when Z_FREETYPE is defined.
|
|
22
|
+* src/gzip/zutil.h: Use `ft_memxxx` functions instead of `memxxx`.
|
|
23
|
+Omit unused function declarations when `Z_FREETYPE` is defined.
|
28
|
24
|
|
29
|
|
-* src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros
|
30
|
|
- to prevent compiler errors.
|
31
|
|
----
|
32
|
|
- src/gzip/adler32.c | 6 ++++++
|
33
|
|
- src/gzip/crc32.c | 2 ++
|
34
|
|
- src/gzip/gzguts.h | 2 +-
|
35
|
|
- src/gzip/inflate.c | 18 ++++++++++++++++++
|
36
|
|
- src/gzip/inflate.h | 5 +++++
|
37
|
|
- src/gzip/inftrees.h | 5 +++++
|
38
|
|
- src/gzip/zlib.h | 39 ++++++++++++++++++++++++++++++++++++---
|
39
|
|
- src/gzip/zutil.h | 10 +++++++---
|
40
|
|
- 8 files changed, 80 insertions(+), 7 deletions(-)
|
|
25
|
+* src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros to
|
|
26
|
+prevent compiler errors.
|
41
|
27
|
|
42
|
|
-diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c
|
43
|
|
-index d0be4380a..a8242ba13 100644
|
44
|
|
---- a/src/gzip/adler32.c
|
45
|
|
-+++ b/src/gzip/adler32.c
|
|
28
|
+diff --git b/src/gzip/adler32.c a/src/gzip/adler32.c
|
|
29
|
+index be5e8a247..aa032e1dd 100644
|
|
30
|
+--- b/src/gzip/adler32.c
|
|
31
|
++++ a/src/gzip/adler32.c
|
46
|
32
|
@@ -7,7 +7,9 @@
|
47
|
33
|
|
48
|
34
|
#include "zutil.h"
|
... |
... |
@@ -53,25 +39,25 @@ index d0be4380a..a8242ba13 100644 |
53
|
39
|
|
54
|
40
|
#define BASE 65521U /* largest prime smaller than 65536 */
|
55
|
41
|
#define NMAX 5552
|
56
|
|
-@@ -139,6 +141,8 @@ uLong ZEXPORT adler32(adler, buf, len)
|
|
42
|
+@@ -139,6 +141,8 @@ uLong ZEXPORT adler32(
|
57
|
43
|
return adler32_z(adler, buf, len);
|
58
|
44
|
}
|
59
|
45
|
|
60
|
46
|
+#ifndef Z_FREETYPE
|
61
|
47
|
+
|
62
|
48
|
/* ========================================================================= */
|
63
|
|
- local uLong adler32_combine_(adler1, adler2, len2)
|
64
|
|
- uLong adler1;
|
65
|
|
-@@ -184,3 +188,5 @@ uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
|
49
|
+ local uLong adler32_combine_(
|
|
50
|
+ uLong adler1,
|
|
51
|
+@@ -184,3 +188,5 @@ uLong ZEXPORT adler32_combine64(
|
66
|
52
|
{
|
67
|
53
|
return adler32_combine_(adler1, adler2, len2);
|
68
|
54
|
}
|
69
|
55
|
+
|
70
|
56
|
+#endif /* !Z_FREETYPE */
|
71
|
|
-diff --git a/src/gzip/crc32.c b/src/gzip/crc32.c
|
72
|
|
-index 9580440c0..d67663a4e 100644
|
73
|
|
---- a/src/gzip/crc32.c
|
74
|
|
-+++ b/src/gzip/crc32.c
|
|
57
|
+diff --git b/src/gzip/crc32.c a/src/gzip/crc32.c
|
|
58
|
+index 3e3eb1794..ffced1ea7 100644
|
|
59
|
+--- b/src/gzip/crc32.c
|
|
60
|
++++ a/src/gzip/crc32.c
|
75
|
61
|
@@ -195,6 +195,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
76
|
62
|
}
|
77
|
63
|
|
... |
... |
@@ -81,23 +67,23 @@ index 9580440c0..d67663a4e 100644 |
81
|
67
|
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
|
82
|
68
|
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
|
83
|
69
|
|
84
|
|
-diff --git a/src/gzip/gzguts.h b/src/gzip/gzguts.h
|
85
|
|
-index 990a4d251..a27f38998 100644
|
86
|
|
---- a/src/gzip/gzguts.h
|
87
|
|
-+++ b/src/gzip/gzguts.h
|
|
70
|
+diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h
|
|
71
|
+index 990a4d251..c81f8f392 100644
|
|
72
|
+--- b/src/gzip/gzguts.h
|
|
73
|
++++ a/src/gzip/gzguts.h
|
88
|
74
|
@@ -163,7 +163,7 @@
|
89
|
75
|
|
90
|
76
|
/* values for gz_state how */
|
91
|
77
|
#define LOOK 0 /* look for a gzip header */
|
92
|
78
|
-#define COPY 1 /* copy input directly */
|
93
|
|
-+#define COPY__ 1 /* copy input directly */
|
|
79
|
++#define COPY__ 1 /* copy input directly */
|
94
|
80
|
#define GZIP 2 /* decompress a gzip stream */
|
95
|
81
|
|
96
|
82
|
/* internal gzip file state data structure */
|
97
|
|
-diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
|
98
|
|
-index ac333e8c2..fa61003ce 100644
|
99
|
|
---- a/src/gzip/inflate.c
|
100
|
|
-+++ b/src/gzip/inflate.c
|
|
83
|
+diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c
|
|
84
|
+index 3f7ea647b..7387e6f57 100644
|
|
85
|
+--- b/src/gzip/inflate.c
|
|
86
|
++++ a/src/gzip/inflate.c
|
101
|
87
|
@@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
102
|
88
|
#ifdef BUILDFIXED
|
103
|
89
|
void makefixed OF((void));
|
... |
... |
@@ -107,18 +93,18 @@ index ac333e8c2..fa61003ce 100644 |
107
|
93
|
unsigned len));
|
108
|
94
|
+#endif
|
109
|
95
|
|
110
|
|
- local int inflateStateCheck(strm)
|
111
|
|
- z_streamp strm;
|
112
|
|
-@@ -244,6 +246,8 @@ int stream_size;
|
|
96
|
+ local int inflateStateCheck(
|
|
97
|
+ z_streamp strm)
|
|
98
|
+@@ -244,6 +246,8 @@ int ZEXPORT inflateInit_(
|
113
|
99
|
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
114
|
100
|
}
|
115
|
101
|
|
116
|
102
|
+#ifndef Z_FREETYPE
|
117
|
103
|
+
|
118
|
|
- int ZEXPORT inflatePrime(strm, bits, value)
|
119
|
|
- z_streamp strm;
|
120
|
|
- int bits;
|
121
|
|
-@@ -265,6 +269,8 @@ int value;
|
|
104
|
+ int ZEXPORT inflatePrime(
|
|
105
|
+ z_streamp strm,
|
|
106
|
+ int bits,
|
|
107
|
+@@ -265,6 +269,8 @@ int ZEXPORT inflatePrime(
|
122
|
108
|
return Z_OK;
|
123
|
109
|
}
|
124
|
110
|
|
... |
... |
@@ -127,16 +113,16 @@ index ac333e8c2..fa61003ce 100644 |
127
|
113
|
/*
|
128
|
114
|
Return state with length and distance decoding tables and index sizes set to
|
129
|
115
|
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
130
|
|
-@@ -1288,6 +1294,8 @@ z_streamp strm;
|
|
116
|
+@@ -1288,6 +1294,8 @@ int ZEXPORT inflateEnd(
|
131
|
117
|
return Z_OK;
|
132
|
118
|
}
|
133
|
119
|
|
134
|
120
|
+#ifndef Z_FREETYPE
|
135
|
121
|
+
|
136
|
|
- int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
|
137
|
|
- z_streamp strm;
|
138
|
|
- Bytef *dictionary;
|
139
|
|
-@@ -1440,6 +1448,8 @@ z_streamp strm;
|
|
122
|
+ int ZEXPORT inflateGetDictionary(
|
|
123
|
+ z_streamp strm,
|
|
124
|
+ Bytef *dictionary,
|
|
125
|
+@@ -1440,6 +1448,8 @@ int ZEXPORT inflateSync(
|
140
|
126
|
return Z_OK;
|
141
|
127
|
}
|
142
|
128
|
|
... |
... |
@@ -145,43 +131,43 @@ index ac333e8c2..fa61003ce 100644 |
145
|
131
|
/*
|
146
|
132
|
Returns true if inflate is currently at the end of a block generated by
|
147
|
133
|
Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
|
148
|
|
-@@ -1458,6 +1468,8 @@ z_streamp strm;
|
|
134
|
+@@ -1458,6 +1468,8 @@ int ZEXPORT inflateSyncPoint(
|
149
|
135
|
return state->mode == STORED && state->bits == 0;
|
150
|
136
|
}
|
151
|
137
|
|
152
|
138
|
+#if !Z_FREETYPE
|
153
|
139
|
+
|
154
|
|
- int ZEXPORT inflateCopy(dest, source)
|
155
|
|
- z_streamp dest;
|
156
|
|
- z_streamp source;
|
157
|
|
-@@ -1505,6 +1517,8 @@ z_streamp source;
|
|
140
|
+ int ZEXPORT inflateCopy(
|
|
141
|
+ z_streamp dest,
|
|
142
|
+ z_streamp source)
|
|
143
|
+@@ -1505,6 +1517,8 @@ int ZEXPORT inflateCopy(
|
158
|
144
|
return Z_OK;
|
159
|
145
|
}
|
160
|
146
|
|
161
|
147
|
+#endif /* !Z_FREETYPE */
|
162
|
148
|
+
|
163
|
|
- int ZEXPORT inflateUndermine(strm, subvert)
|
164
|
|
- z_streamp strm;
|
165
|
|
- int subvert;
|
166
|
|
-@@ -1538,6 +1552,8 @@ int check;
|
|
149
|
+ int ZEXPORT inflateUndermine(
|
|
150
|
+ z_streamp strm,
|
|
151
|
+ int subvert)
|
|
152
|
+@@ -1538,6 +1552,8 @@ int ZEXPORT inflateValidate(
|
167
|
153
|
return Z_OK;
|
168
|
154
|
}
|
169
|
155
|
|
170
|
156
|
+#ifndef Z_FREETYPE
|
171
|
157
|
+
|
172
|
|
- long ZEXPORT inflateMark(strm)
|
173
|
|
- z_streamp strm;
|
|
158
|
+ long ZEXPORT inflateMark(
|
|
159
|
+ z_streamp strm)
|
174
|
160
|
{
|
175
|
|
-@@ -1559,3 +1575,5 @@ z_streamp strm;
|
|
161
|
+@@ -1559,3 +1575,5 @@ unsigned long ZEXPORT inflateCodesUsed(
|
176
|
162
|
state = (struct inflate_state FAR *)strm->state;
|
177
|
163
|
return (unsigned long)(state->next - state->codes);
|
178
|
164
|
}
|
179
|
165
|
+
|
180
|
166
|
+#endif /* !Z_FREETYPE */
|
181
|
|
-diff --git a/src/gzip/inflate.h b/src/gzip/inflate.h
|
|
167
|
+diff --git b/src/gzip/inflate.h a/src/gzip/inflate.h
|
182
|
168
|
index a46cce6b6..92ea758e2 100644
|
183
|
|
---- a/src/gzip/inflate.h
|
184
|
|
-+++ b/src/gzip/inflate.h
|
|
169
|
+--- b/src/gzip/inflate.h
|
|
170
|
++++ a/src/gzip/inflate.h
|
185
|
171
|
@@ -3,6 +3,9 @@
|
186
|
172
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
187
|
173
|
*/
|
... |
... |
@@ -198,10 +184,10 @@ index a46cce6b6..92ea758e2 100644 |
198
|
184
|
};
|
199
|
185
|
+
|
200
|
186
|
+#endif /* INFLATE_H */
|
201
|
|
-diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h
|
|
187
|
+diff --git b/src/gzip/inftrees.h a/src/gzip/inftrees.h
|
202
|
188
|
index baa53a0b1..c94eb78b5 100644
|
203
|
|
---- a/src/gzip/inftrees.h
|
204
|
|
-+++ b/src/gzip/inftrees.h
|
|
189
|
+--- b/src/gzip/inftrees.h
|
|
190
|
++++ a/src/gzip/inftrees.h
|
205
|
191
|
@@ -3,6 +3,9 @@
|
206
|
192
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
207
|
193
|
*/
|
... |
... |
@@ -218,10 +204,10 @@ index baa53a0b1..c94eb78b5 100644 |
218
|
204
|
unsigned FAR *bits, unsigned short FAR *work));
|
219
|
205
|
+
|
220
|
206
|
+#endif /* INFTREES_H_ */
|
221
|
|
-diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
|
222
|
|
-index f09cdaf1e..ff5ae736d 100644
|
223
|
|
---- a/src/gzip/zlib.h
|
224
|
|
-+++ b/src/gzip/zlib.h
|
|
207
|
+diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h
|
|
208
|
+index f09cdaf1e..1807c0645 100644
|
|
209
|
+--- b/src/gzip/zlib.h
|
|
210
|
++++ a/src/gzip/zlib.h
|
225
|
211
|
@@ -31,7 +31,7 @@
|
226
|
212
|
#ifndef ZLIB_H
|
227
|
213
|
#define ZLIB_H
|
... |
... |
@@ -319,22 +305,6 @@ index f09cdaf1e..ff5ae736d 100644 |
319
|
305
|
ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
|
320
|
306
|
z_size_t len));
|
321
|
307
|
/*
|
322
|
|
-@@ -1755,7 +1771,6 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
|
323
|
|
- len2.
|
324
|
|
- */
|
325
|
|
-
|
326
|
|
--
|
327
|
|
- /* various hacks, don't look :) */
|
328
|
|
-
|
329
|
|
- /* deflateInit and inflateInit are macros to allow checking the zlib version
|
330
|
|
-@@ -1763,6 +1778,7 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
|
331
|
|
- */
|
332
|
|
- ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
333
|
|
- const char *version, int stream_size));
|
334
|
|
-+
|
335
|
|
- ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
|
336
|
|
- const char *version, int stream_size));
|
337
|
|
- ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
338
|
308
|
@@ -1805,6 +1821,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
339
|
309
|
ZLIB_VERSION, (int)sizeof(z_stream))
|
340
|
310
|
#endif
|
... |
... |
@@ -379,11 +349,21 @@ index f09cdaf1e..ff5ae736d 100644 |
379
|
349
|
|
380
|
350
|
#ifdef __cplusplus
|
381
|
351
|
}
|
382
|
|
-diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h
|
383
|
|
-index b079ea6a8..a38573878 100644
|
384
|
|
---- a/src/gzip/zutil.h
|
385
|
|
-+++ b/src/gzip/zutil.h
|
386
|
|
-@@ -185,6 +185,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
352
|
+diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h
|
|
353
|
+index b079ea6a8..2d734a835 100644
|
|
354
|
+--- b/src/gzip/zutil.h
|
|
355
|
++++ a/src/gzip/zutil.h
|
|
356
|
+@@ -30,7 +30,9 @@
|
|
357
|
+ #endif
|
|
358
|
+
|
|
359
|
+ #ifdef Z_SOLO
|
|
360
|
++# ifndef Z_FREETYPE
|
|
361
|
+ typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
|
|
362
|
++# endif
|
|
363
|
+ #endif
|
|
364
|
+
|
|
365
|
+ #ifndef local
|
|
366
|
+@@ -185,6 +187,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
387
|
367
|
#pragma warn -8066
|
388
|
368
|
#endif
|
389
|
369
|
|
... |
... |
@@ -392,7 +372,7 @@ index b079ea6a8..a38573878 100644 |
392
|
372
|
/* provide prototypes for these when building zlib without LFS */
|
393
|
373
|
#if !defined(_WIN32) && \
|
394
|
374
|
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
395
|
|
-@@ -192,6 +194,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
375
|
+@@ -192,6 +196,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
396
|
376
|
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
397
|
377
|
#endif
|
398
|
378
|
|
... |
... |
@@ -401,7 +381,7 @@ index b079ea6a8..a38573878 100644 |
401
|
381
|
/* common defaults */
|
402
|
382
|
|
403
|
383
|
#ifndef OS_CODE
|
404
|
|
-@@ -223,9 +227,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
384
|
+@@ -223,9 +229,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
405
|
385
|
# define zmemcmp _fmemcmp
|
406
|
386
|
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
407
|
387
|
# else
|
... |
... |
@@ -414,6 +394,3 @@ index b079ea6a8..a38573878 100644 |
414
|
394
|
# endif
|
415
|
395
|
#else
|
416
|
396
|
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
417
|
|
---
|
418
|
|
-2.30.2
|
419
|
|
-
|