1 |
hasufell 12/07/29 12:00:46 |
2 |
|
3 |
Added: openclonk-5.2.2-zlib-1.2.6.patch |
4 |
Log: |
5 |
fix compilation for zlib-1.2.[67] wrt #428496 |
6 |
|
7 |
(Portage version: 2.2.0_alpha120/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 games-action/openclonk/files/openclonk-5.2.2-zlib-1.2.6.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-action/openclonk/files/openclonk-5.2.2-zlib-1.2.6.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-action/openclonk/files/openclonk-5.2.2-zlib-1.2.6.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: openclonk-5.2.2-zlib-1.2.6.patch |
16 |
=================================================================== |
17 |
From: upstream |
18 |
Date: Tue Feb 21 17:12:00 2012 +0100 |
19 |
Subject: fix compilation for zlib-1.2.[67] |
20 |
|
21 |
backported upstream commits including: |
22 |
http://hg.openclonk.org/openclonk/rev/7a5ee23b58aa |
23 |
|
24 |
bug report: |
25 |
https://bugs.gentoo.org/show_bug.cgi?id=428496 |
26 |
|
27 |
--- src/c4group/CStdFile.h |
28 |
+++ src/c4group/CStdFile.h |
29 |
@@ -26,11 +26,10 @@ |
30 |
#include <stdio.h> |
31 |
#include <StdFile.h> |
32 |
#include <StdBuf.h> |
33 |
+#include <zlib.h> // for gzFile |
34 |
|
35 |
const int CStdFileBufSize = 4096; |
36 |
|
37 |
-typedef void* gzFile; |
38 |
- |
39 |
class CStdStream |
40 |
{ |
41 |
public: |
42 |
From: Julian Ospald <hasufell@g.o> |
43 |
Date: Sun Jul 29 11:29:27 UTC 2012 |
44 |
Subject: |
45 |
|
46 |
--- /dev/null |
47 |
+++ src/zlib/gzio.h |
48 |
@@ -0,0 +1,35 @@ |
49 |
+/* |
50 |
+ * Copyright (C) 2012 Armin Burgmeier |
51 |
+ */ |
52 |
+ |
53 |
+#ifndef C4_GZIO_H |
54 |
+#define C4_GZIO_H |
55 |
+ |
56 |
+#include <zlib.h> |
57 |
+ |
58 |
+extern "C" |
59 |
+{ |
60 |
+ |
61 |
+gzFile ZEXPORT c4_gzopen (const char* path, const char* mode); |
62 |
+gzFile ZEXPORT c4_gzdopen (int fd, const char* mode); |
63 |
+int ZEXPORT c4_gzsetparams (gzFile file, int level, int strategy); |
64 |
+int ZEXPORT c4_gzread (gzFile file, voidp buf, unsigned len); |
65 |
+int ZEXPORT c4_gzgetc(gzFile file); |
66 |
+int ZEXPORT c4_gzungetc(int c, gzFile file); |
67 |
+char * ZEXPORT c4_gzgets(gzFile file, char* buf, int len); |
68 |
+int ZEXPORT c4_gzwrite (gzFile file, voidpc buf, unsigned len); |
69 |
+int ZEXPORTVA c4_gzprintf (gzFile file, const char *format, /* args */ ...); |
70 |
+int ZEXPORT c4_gzputc(gzFile file, int c); |
71 |
+int ZEXPORT c4_gzputs(gzFile file, const char* s); |
72 |
+int ZEXPORT c4_gzflush (gzFile file, int flush); |
73 |
+z_off_t ZEXPORT c4_gzseek (gzFile file, z_off_t offset, int whence); |
74 |
+int ZEXPORT c4_gzrewind (gzFile file); |
75 |
+z_off_t ZEXPORT c4_gztell (gzFile file); |
76 |
+int ZEXPORT c4_gzeof (gzFile file); |
77 |
+int ZEXPORT c4_gzdirect (gzFile file); |
78 |
+int ZEXPORT c4_gzclose (gzFile file); |
79 |
+void ZEXPORT c4_gzclearerr (gzFile file); |
80 |
+ |
81 |
+} |
82 |
+ |
83 |
+#endif // C4_GZIO_H |
84 |
--- src/zlib/gzio.c |
85 |
+++ src/zlib/gzio.c |
86 |
@@ -208,20 +208,13 @@ |
87 |
s->start = ftell(s->file) - s->stream.avail_in; |
88 |
} |
89 |
|
90 |
- /* Reject uncompressed files */ |
91 |
- if (s->transparent) |
92 |
- { |
93 |
- gzclose( (gzFile)s ); |
94 |
- return (gzFile)Z_NULL; |
95 |
- } |
96 |
- |
97 |
return (gzFile)s; |
98 |
} |
99 |
|
100 |
/* =========================================================================== |
101 |
Opens a gzip (.gz) file for reading or writing. |
102 |
*/ |
103 |
-gzFile ZEXPORT gzopen (path, mode) |
104 |
+gzFile ZEXPORT c4_gzopen (path, mode) |
105 |
const char *path; |
106 |
const char *mode; |
107 |
{ |
108 |
@@ -232,7 +225,7 @@ |
109 |
Associate a gzFile with the file descriptor fd. fd is not dup'ed here |
110 |
to mimic the behavio(u)r of fdopen. |
111 |
*/ |
112 |
-gzFile ZEXPORT gzdopen (fd, mode) |
113 |
+gzFile ZEXPORT c4_gzdopen (fd, mode) |
114 |
int fd; |
115 |
const char *mode; |
116 |
{ |
117 |
@@ -247,7 +240,7 @@ |
118 |
/* =========================================================================== |
119 |
* Update the compression level and strategy |
120 |
*/ |
121 |
-int ZEXPORT gzsetparams (file, level, strategy) |
122 |
+int ZEXPORT c4_gzsetparams (file, level, strategy) |
123 |
gzFile file; |
124 |
int level; |
125 |
int strategy; |
126 |
@@ -409,7 +402,7 @@ |
127 |
Reads the given number of uncompressed bytes from the compressed file. |
128 |
gzread returns the number of bytes actually read (0 for end of file). |
129 |
*/ |
130 |
-int ZEXPORT gzread (file, buf, len) |
131 |
+int ZEXPORT c4_gzread (file, buf, len) |
132 |
gzFile file; |
133 |
voidp buf; |
134 |
unsigned len; |
135 |
@@ -518,7 +511,7 @@ |
136 |
Reads one byte from the compressed file. gzgetc returns this byte |
137 |
or -1 in case of end of file or error. |
138 |
*/ |
139 |
-int ZEXPORT gzgetc(file) |
140 |
+int ZEXPORT c4_gzgetc(file) |
141 |
gzFile file; |
142 |
{ |
143 |
unsigned char c; |
144 |
@@ -530,7 +523,7 @@ |
145 |
/* =========================================================================== |
146 |
Push one byte back onto the stream. |
147 |
*/ |
148 |
-int ZEXPORT gzungetc(c, file) |
149 |
+int ZEXPORT c4_gzungetc(c, file) |
150 |
int c; |
151 |
gzFile file; |
152 |
{ |
153 |
@@ -555,7 +548,7 @@ |
154 |
|
155 |
The current implementation is not optimized at all. |
156 |
*/ |
157 |
-char * ZEXPORT gzgets(file, buf, len) |
158 |
+char * ZEXPORT c4_gzgets(file, buf, len) |
159 |
gzFile file; |
160 |
char *buf; |
161 |
int len; |
162 |
@@ -574,7 +567,7 @@ |
163 |
Writes the given number of uncompressed bytes into the compressed file. |
164 |
gzwrite returns the number of bytes actually written (0 in case of error). |
165 |
*/ |
166 |
-int ZEXPORT gzwrite (file, buf, len) |
167 |
+int ZEXPORT c4_gzwrite (file, buf, len) |
168 |
gzFile file; |
169 |
voidpc buf; |
170 |
unsigned len; |
171 |
@@ -618,7 +611,7 @@ |
172 |
#ifdef STDC |
173 |
#include <stdarg.h> |
174 |
|
175 |
-int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) |
176 |
+int ZEXPORTVA c4_gzprintf (gzFile file, const char *format, /* args */ ...) |
177 |
{ |
178 |
char buf[Z_PRINTF_BUFSIZE]; |
179 |
va_list va; |
180 |
@@ -652,7 +645,7 @@ |
181 |
} |
182 |
#else /* not ANSI C */ |
183 |
|
184 |
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, |
185 |
+int ZEXPORTVA c4_gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, |
186 |
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) |
187 |
gzFile file; |
188 |
const char *format; |
189 |
@@ -693,7 +686,7 @@ |
190 |
Writes c, converted to an unsigned char, into the compressed file. |
191 |
gzputc returns the value that was written, or -1 in case of error. |
192 |
*/ |
193 |
-int ZEXPORT gzputc(file, c) |
194 |
+int ZEXPORT c4_gzputc(file, c) |
195 |
gzFile file; |
196 |
int c; |
197 |
{ |
198 |
@@ -708,7 +701,7 @@ |
199 |
the terminating null character. |
200 |
gzputs returns the number of characters written, or -1 in case of error. |
201 |
*/ |
202 |
-int ZEXPORT gzputs(file, s) |
203 |
+int ZEXPORT c4_gzputs(file, s) |
204 |
gzFile file; |
205 |
const char *s; |
206 |
{ |
207 |
@@ -761,7 +754,7 @@ |
208 |
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; |
209 |
} |
210 |
|
211 |
-int ZEXPORT gzflush (file, flush) |
212 |
+int ZEXPORT c4_gzflush (file, flush) |
213 |
gzFile file; |
214 |
int flush; |
215 |
{ |
216 |
@@ -782,7 +775,7 @@ |
217 |
SEEK_END is not implemented, returns error. |
218 |
In this version of the library, gzseek can be extremely slow. |
219 |
*/ |
220 |
-z_off_t ZEXPORT gzseek (file, offset, whence) |
221 |
+z_off_t ZEXPORT c4_gzseek (file, offset, whence) |
222 |
gzFile file; |
223 |
z_off_t offset; |
224 |
int whence; |
225 |
@@ -872,7 +865,7 @@ |
226 |
/* =========================================================================== |
227 |
Rewinds input file. |
228 |
*/ |
229 |
-int ZEXPORT gzrewind (file) |
230 |
+int ZEXPORT c4_gzrewind (file) |
231 |
gzFile file; |
232 |
{ |
233 |
gz_stream *s = (gz_stream*)file; |
234 |
@@ -896,7 +889,7 @@ |
235 |
given compressed file. This position represents a number of bytes in the |
236 |
uncompressed data stream. |
237 |
*/ |
238 |
-z_off_t ZEXPORT gztell (file) |
239 |
+z_off_t ZEXPORT c4_gztell (file) |
240 |
gzFile file; |
241 |
{ |
242 |
return gzseek(file, 0L, SEEK_CUR); |
243 |
@@ -906,7 +899,7 @@ |
244 |
Returns 1 when EOF has previously been detected reading the given |
245 |
input stream, otherwise zero. |
246 |
*/ |
247 |
-int ZEXPORT gzeof (file) |
248 |
+int ZEXPORT c4_gzeof (file) |
249 |
gzFile file; |
250 |
{ |
251 |
gz_stream *s = (gz_stream*)file; |
252 |
@@ -923,7 +916,7 @@ |
253 |
/* =========================================================================== |
254 |
Returns 1 if reading and doing so transparently, otherwise zero. |
255 |
*/ |
256 |
-int ZEXPORT gzdirect (file) |
257 |
+int ZEXPORT c4_gzdirect (file) |
258 |
gzFile file; |
259 |
{ |
260 |
gz_stream *s = (gz_stream*)file; |
261 |
@@ -968,7 +961,7 @@ |
262 |
Flushes all pending output if necessary, closes the compressed file |
263 |
and deallocates all the (de)compression state. |
264 |
*/ |
265 |
-int ZEXPORT gzclose (file) |
266 |
+int ZEXPORT c4_gzclose (file) |
267 |
gzFile file; |
268 |
{ |
269 |
gz_stream *s = (gz_stream*)file; |
270 |
@@ -1003,7 +996,7 @@ |
271 |
to get the exact error code. |
272 |
*/ |
273 |
#if 0 |
274 |
-const char * ZEXPORT gzerror (file, errnum) |
275 |
+const char * ZEXPORT c4_gzerror (file, errnum) |
276 |
gzFile file; |
277 |
int *errnum; |
278 |
{ |
279 |
@@ -1034,7 +1027,7 @@ |
280 |
/* =========================================================================== |
281 |
Clear the error and end-of-file flags, and do the same for the real file. |
282 |
*/ |
283 |
-void ZEXPORT gzclearerr (file) |
284 |
+void ZEXPORT c4_gzclearerr (file) |
285 |
gzFile file; |
286 |
{ |
287 |
gz_stream *s = (gz_stream*)file; |