Gentoo Archives: gentoo-commits

From: "Michael Sterrett (mr_bones_)" <mr_bones_@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in games-fps/openarena/files: openarena-0.8.5-bots-strcpy-fix.patch openarena-0.8.5-makefile.patch openarena-0.8.5-unbundling.patch
Date: Thu, 09 Sep 2010 07:14:19
Message-Id: 20100909071412.31CA920051@flycatcher.gentoo.org
1 mr_bones_ 10/09/09 07:14:12
2
3 Added: openarena-0.8.5-bots-strcpy-fix.patch
4 openarena-0.8.5-makefile.patch
5 openarena-0.8.5-unbundling.patch
6 Log:
7 version bump with work from Cesar Garcia in bug #306617
8 (Portage version: 2.1.8.3/cvs/Linux i686)
9
10 Revision Changes Path
11 1.1 games-fps/openarena/files/openarena-0.8.5-bots-strcpy-fix.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-bots-strcpy-fix.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-bots-strcpy-fix.patch?rev=1.1&content-type=text/plain
15
16 Index: openarena-0.8.5-bots-strcpy-fix.patch
17 ===================================================================
18 diff -up quake3-1.36/code/botlib/l_precomp.c~ quake3-1.36/code/botlib/l_precomp.c
19 --- quake3-1.36/code/botlib/l_precomp.c~ 2009-04-27 08:42:37.000000000 +0200
20 +++ quake3-1.36/code/botlib/l_precomp.c 2009-11-03 21:03:08.000000000 +0100
21 @@ -948,7 +948,7 @@ void PC_ConvertPath(char *path)
22 if ((*ptr == '\\' || *ptr == '/') &&
23 (*(ptr+1) == '\\' || *(ptr+1) == '/'))
24 {
25 - strcpy(ptr, ptr+1);
26 + memmove(ptr, ptr+1, strlen(ptr));
27 } //end if
28 else
29 {
30 diff -up quake3-1.36/code/botlib/l_script.c~ quake3-1.36/code/botlib/l_script.c
31 --- quake3-1.36/code/botlib/l_script.c~ 2009-04-27 08:42:37.000000000 +0200
32 +++ quake3-1.36/code/botlib/l_script.c 2009-11-03 21:06:11.000000000 +0100
33 @@ -1118,7 +1118,7 @@ void StripDoubleQuotes(char *string)
34 {
35 if (*string == '\"')
36 {
37 - strcpy(string, string+1);
38 + memmove(string, string+1, strlen(string));
39 } //end if
40 if (string[strlen(string)-1] == '\"')
41 {
42 @@ -1135,7 +1135,7 @@ void StripSingleQuotes(char *string)
43 {
44 if (*string == '\'')
45 {
46 - strcpy(string, string+1);
47 + memmove(string, string+1, strlen(string));
48 } //end if
49 if (string[strlen(string)-1] == '\'')
50 {
51
52
53
54 1.1 games-fps/openarena/files/openarena-0.8.5-makefile.patch
55
56 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-makefile.patch?rev=1.1&view=markup
57 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-makefile.patch?rev=1.1&content-type=text/plain
58
59 Index: openarena-0.8.5-makefile.patch
60 ===================================================================
61 --- openarena-engine-0.8.1/Makefile 2008-08-09 22:22:37.000000000 +0200
62 +++ openarena-engine-0.8.1/Makefile.new 2009-01-07 19:33:31.000000000 +0100
63 @@ -67,6 +67,10 @@
64
65 ifndef ARCH
66 ARCH=$(COMPILE_ARCH)
67 +else
68 + ifeq ($(ARCH),amd64)
69 + ARCH=x86_64
70 + endif
71 endif
72 export ARCH
73
74 @@ -231,8 +231,7 @@
75 endif
76 endif
77
78 - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
79 - -pipe -DUSE_ICON $(shell sdl-config --cflags)
80 + BASE_CFLAGS = -fno-strict-aliasing -DUSE_ICON $(shell sdl-config --cflags) -I.
81
82 ifeq ($(USE_OPENAL),1)
83 BASE_CFLAGS += -DUSE_OPENAL
84 @@ -283,29 +283,29 @@
85 SHLIBCFLAGS=-fPIC
86 SHLIBLDFLAGS=-shared $(LDFLAGS)
87
88 - THREAD_LDFLAGS=-lpthread
89 - LDFLAGS=-ldl -lm
90 + THREAD_LIBS=-lpthread
91 + LDLIBS=-ldl -lm -lz
92
93 - CLIENT_LDFLAGS=$(shell sdl-config --libs) -lGL
94 + CLIENT_LIBS=$(shell sdl-config --libs) -lGL -ljpeg
95
96 ifeq ($(USE_OPENAL),1)
97 ifneq ($(USE_OPENAL_DLOPEN),1)
98 - CLIENT_LDFLAGS += -lopenal
99 + CLIENT_LIBS += -lopenal
100 endif
101 endif
102
103 ifeq ($(USE_CURL),1)
104 ifneq ($(USE_CURL_DLOPEN),1)
105 - CLIENT_LDFLAGS += -lcurl
106 + CLIENT_LIBS += -lcurl
107 endif
108 endif
109
110 ifeq ($(USE_CODEC_VORBIS),1)
111 - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
112 + CLIENT_LIBS += -lvorbisfile -lvorbis -logg
113 endif
114
115 ifeq ($(USE_MUMBLE),1)
116 - CLIENT_LDFLAGS += -lrt
117 + CLIENT_LIBS += -lrt
118 endif
119
120 ifeq ($(USE_LOCAL_HEADERS),1)
121 @@ -323,7 +322,7 @@
122 endif
123
124 DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
125 - RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
126 + RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG
127
128 else # ifeq Linux
129
130 @@ -336,7 +336,7 @@
131
132 ifeq ($(PLATFORM),darwin)
133 HAVE_VM_COMPILED=true
134 - CLIENT_LDFLAGS=
135 + CLIENT_LIBS=
136 OPTIMIZE=
137
138 BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes
139 @@ -357,7 +357,7 @@
140 ifeq ($(USE_OPENAL),1)
141 BASE_CFLAGS += -DUSE_OPENAL
142 ifneq ($(USE_OPENAL_DLOPEN),1)
143 - CLIENT_LDFLAGS += -framework OpenAL
144 + CLIENT_LIBS += -framework OpenAL
145 else
146 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
147 endif
148 @@ -366,7 +366,7 @@
149 ifeq ($(USE_CURL),1)
150 BASE_CFLAGS += -DUSE_CURL
151 ifneq ($(USE_CURL_DLOPEN),1)
152 - CLIENT_LDFLAGS += -lcurl
153 + CLIENT_LIBS += -lcurl
154 else
155 BASE_CFLAGS += -DUSE_CURL_DLOPEN
156 endif
157 @@ -374,7 +374,7 @@
158
159 ifeq ($(USE_CODEC_VORBIS),1)
160 BASE_CFLAGS += -DUSE_CODEC_VORBIS
161 - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
162 + CLIENT_LIBS += -lvorbisfile -lvorbis -logg
163 endif
164
165 BASE_CFLAGS += -D_THREAD_SAFE=1
166 @@ -387,7 +387,7 @@
167 # the file has been modified by each build.
168 LIBSDLMAIN=$(B)/libSDLmain.a
169 LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
170 - CLIENT_LDFLAGS += -framework Cocoa -framework IOKit -framework OpenGL \
171 + CLIENT_LIBS += -framework Cocoa -framework IOKit -framework OpenGL \
172 $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
173
174 OPTIMIZE += -ffast-math -falign-loops=16
175 @@ -441,7 +441,7 @@
176 ifeq ($(USE_OPENAL_DLOPEN),1)
177 BASE_CFLAGS += -DUSE_OPENAL_DLOPEN
178 else
179 - CLIENT_LDFLAGS += $(OPENAL_LDFLAGS)
180 + CLIENT_LIBS += $(OPENAL_LDFLAGS)
181 endif
182 endif
183
184 @@ -461,8 +461,8 @@
185
186 BINEXT=.exe
187
188 - LDFLAGS= -lws2_32 -lwinmm
189 - CLIENT_LDFLAGS = -mwindows -lgdi32 -lole32 -lopengl32
190 + LDLIBS= -lws2_32 -lwinmm
191 + CLIENT_LIBS = -mwindows -lgdi32 -lole32 -lopengl32
192
193 ifeq ($(USE_CURL),1)
194 BASE_CFLAGS += -DUSE_CURL
195 @@ -470,9 +470,9 @@
196 ifneq ($(USE_CURL_DLOPEN),1)
197 ifeq ($(USE_LOCAL_HEADERS),1)
198 BASE_CFLAGS += -DCURL_STATICLIB
199 - CLIENT_LDFLAGS += $(LIBSDIR)/win32/libcurl.a
200 + CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a
201 else
202 - CLIENT_LDFLAGS += $(CURL_LIBS)
203 + CLIENT_LIBS += $(CURL_LIBS)
204 endif
205 endif
206 endif
207 @@ -480,9 +480,9 @@
208 ifeq ($(USE_CODEC_VORBIS),1)
209 #Sago: Here I get vorbis to compile in Windows:
210 ifeq ($(PLATFORM),mingw32)
211 - CLIENT_LDFLAGS += $(LIBSDIR)/win32/libvorbisfile.a $(LIBSDIR)/win32/libvorbis.a $(LIBSDIR)/win32/libogg.a
212 + CLIENT_LIBS += $(LIBSDIR)/win32/libvorbisfile.a $(LIBSDIR)/win32/libvorbis.a $(LIBSDIR)/win32/libogg.a
213 else
214 - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
215 + CLIENT_LIBS += -lvorbisfile -lvorbis -logg
216 endif
217 endif
218
219 @@ -496,14 +496,14 @@
220 RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
221
222 # libmingw32 must be linked before libSDLmain
223 - CLIENT_LDFLAGS += -lmingw32
224 + CLIENT_LIBS += -lmingw32
225 ifeq ($(USE_LOCAL_HEADERS),1)
226 BASE_CFLAGS += -I$(SDLHDIR)/include
227 - CLIENT_LDFLAGS += $(LIBSDIR)/win32/libSDLmain.a \
228 + CLIENT_LIBS += $(LIBSDIR)/win32/libSDLmain.a \
229 $(LIBSDIR)/win32/libSDL.dll.a
230 else
231 BASE_CFLAGS += $(SDL_CFLAGS)
232 - CLIENT_LDFLAGS += $(SDL_LIBS)
233 + CLIENT_LIBS += $(SDL_LIBS)
234 endif
235
236
237 @@ -561,22 +561,22 @@
238 SHLIBCFLAGS=-fPIC
239 SHLIBLDFLAGS=-shared $(LDFLAGS)
240
241 - THREAD_LDFLAGS=-lpthread
242 + THREAD_LIBS=-lpthread
243 # don't need -ldl (FreeBSD)
244 - LDFLAGS=-lm
245 + LDLIBS=-lm -lz
246
247 - CLIENT_LDFLAGS =
248 + CLIENT_LIBS =
249
250 - CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL
251 + CLIENT_LIBS += $(shell sdl-config --libs) -lGL
252
253 ifeq ($(USE_OPENAL),1)
254 ifneq ($(USE_OPENAL_DLOPEN),1)
255 - CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal
256 + CLIENT_LIBS += $(THREAD_LIBS) -lopenal
257 endif
258 endif
259
260 ifeq ($(USE_CODEC_VORBIS),1)
261 - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
262 + CLIENT_LIBS += -lvorbisfile -lvorbis -logg
263 endif
264
265 else # ifeq freebsd
266 @@ -618,21 +618,21 @@
267 SHLIBCFLAGS=-fPIC
268 SHLIBLDFLAGS=-shared $(LDFLAGS)
269
270 - THREAD_LDFLAGS=-lpthread
271 - LDFLAGS=-lm
272 + THREAD_LIBS=-lpthread
273 + LDLIBS=-lm -lz
274
275 - CLIENT_LDFLAGS =
276 + CLIENT_LIBS =
277
278 - CLIENT_LDFLAGS += $(shell sdl-config --libs) -lGL
279 + CLIENT_LIBS += $(shell sdl-config --libs) -lGL
280
281 ifeq ($(USE_OPENAL),1)
282 ifneq ($(USE_OPENAL_DLOPEN),1)
283 - CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lossaudio -lopenal
284 + CLIENT_LIBS += $(THREAD_LIBS) -lossaudio -lopenal
285 endif
286 endif
287
288 ifeq ($(USE_CODEC_VORBIS),1)
289 - CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
290 + CLIENT_LIBS += -lvorbisfile -lvorbis -logg
291 endif
292
293 else # ifeq openbsd
294 @@ -647,11 +647,11 @@
295 ARCH=i386
296 endif
297
298 - LDFLAGS=-lm
299 + LDLIBS=-lm -lz
300 SHLIBEXT=so
301 SHLIBCFLAGS=-fPIC
302 SHLIBLDFLAGS=-shared $(LDFLAGS)
303 - THREAD_LDFLAGS=-lpthread
304 + THREAD_LIBS=-lpthread
305
306 BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
307
308 @@ -686,9 +686,9 @@
309 SHLIBCFLAGS=
310 SHLIBLDFLAGS=-shared
311
312 - LDFLAGS=-ldl -lm -lgen
313 + LDLIBS=-ldl -lm -lgen -lz
314 # FIXME: The X libraries probably aren't necessary?
315 - CLIENT_LDFLAGS=-L/usr/X11/$(LIB) $(shell sdl-config --libs) -lGL \
316 + CLIENT_LIBS=-L/usr/X11/$(LIB) $(shell sdl-config --libs) -lGL \
317 - -lX11 -lXext -lm
318 + -lX11 -lXext -lm -ljpeg
319
320 else # ifeq IRIX
321 @@ -736,7 +736,7 @@
322 BASE_CFLAGS += -m32
323 LDFLAGS += -m32
324 BASE_CFLAGS += -I/usr/X11/include/NVIDIA
325 - CLIENT_LDFLAGS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA
326 + CLIENT_LIBS += -L/usr/X11/lib/NVIDIA -R/usr/X11/lib/NVIDIA
327 endif
328 endif
329
330 @@ -752,12 +752,12 @@
331 SHLIBCFLAGS=-fPIC
332 SHLIBLDFLAGS=-shared $(LDFLAGS)
333
334 - THREAD_LDFLAGS=-lpthread
335 - LDFLAGS=-lsocket -lnsl -ldl -lm
336 + THREAD_LIBS=-lpthread
337 + LDLIBS=-lsocket -lnsl -ldl -lm -lz
338
339 BOTCFLAGS=-O0
340
341 - CLIENT_LDFLAGS +=$(shell sdl-config --libs) -lGL
342 + CLIENT_LIBS +=$(shell sdl-config --libs) -lGL -ljpeg
343
344 else # ifeq sunos
345
346 @@ -825,7 +825,7 @@
347 ifeq ($(USE_INTERNAL_SPEEX),1)
348 BASE_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
349 else
350 - CLIENT_LDFLAGS += -lspeex
351 + CLIENT_LIBS += -lspeex -lspeexdsp
352 endif
353 endif
354
355 @@ -1421,13 +1421,13 @@
356
357 $(B)/openarena.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
358 $(echo_cmd) "LD $@"
359 - $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
360 - $(LDFLAGS) $(LIBSDLMAIN)
361 + $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) \
362 + $(LDFLAGS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LDLIBS)
363
364 $(B)/openarena-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
365 $(echo_cmd) "LD $@"
366 - $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \
367 - $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN)
368 + $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) \
369 + $(LDFLAGS) $(THREAD_LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LDLIBS)
370
371 ifneq ($(strip $(LIBSDLMAIN)),)
372 ifneq ($(strip $(LIBSDLMAINSRC)),)
373 @@ -1553,7 +1553,7 @@
374
375 $(B)/oa_ded.$(ARCH)$(BINEXT): $(Q3DOBJ)
376 $(echo_cmd) "LD $@"
377 - $(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
378 + $(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS) $(LDLIBS)
379
380
381
382
383
384
385 1.1 games-fps/openarena/files/openarena-0.8.5-unbundling.patch
386
387 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-unbundling.patch?rev=1.1&view=markup
388 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/games-fps/openarena/files/openarena-0.8.5-unbundling.patch?rev=1.1&content-type=text/plain
389
390 Index: openarena-0.8.5-unbundling.patch
391 ===================================================================
392 --- openarena-engine-0.8.1/Makefile.old 2010-03-06 21:51:19.000000000 +0100
393 +++ openarena-engine-0.8.1/Makefile 2010-03-06 21:58:01.000000000 +0100
394 @@ -1278,41 +1278,7 @@
395 $(B)/client/l_script.o \
396 $(B)/client/l_struct.o \
397 \
398 - $(B)/client/jcapimin.o \
399 - $(B)/client/jcapistd.o \
400 - $(B)/client/jchuff.o \
401 - $(B)/client/jcinit.o \
402 - $(B)/client/jccoefct.o \
403 - $(B)/client/jccolor.o \
404 - $(B)/client/jfdctflt.o \
405 - $(B)/client/jcdctmgr.o \
406 - $(B)/client/jcphuff.o \
407 - $(B)/client/jcmainct.o \
408 - $(B)/client/jcmarker.o \
409 - $(B)/client/jcmaster.o \
410 - $(B)/client/jcomapi.o \
411 - $(B)/client/jcparam.o \
412 - $(B)/client/jcprepct.o \
413 - $(B)/client/jcsample.o \
414 - $(B)/client/jdapimin.o \
415 - $(B)/client/jdapistd.o \
416 $(B)/client/jdatasrc.o \
417 - $(B)/client/jdcoefct.o \
418 - $(B)/client/jdcolor.o \
419 - $(B)/client/jddctmgr.o \
420 - $(B)/client/jdhuff.o \
421 - $(B)/client/jdinput.o \
422 - $(B)/client/jdmainct.o \
423 - $(B)/client/jdmarker.o \
424 - $(B)/client/jdmaster.o \
425 - $(B)/client/jdpostct.o \
426 - $(B)/client/jdsample.o \
427 - $(B)/client/jdtrans.o \
428 - $(B)/client/jerror.o \
429 - $(B)/client/jidctflt.o \
430 - $(B)/client/jmemmgr.o \
431 - $(B)/client/jmemnobs.o \
432 - $(B)/client/jutils.o \
433 \
434 $(B)/client/tr_animation.o \
435 $(B)/client/tr_backend.o \
436 --- openarena-engine-0.8.1/code/qcommon/unzip.h.old 2010-03-06 21:59:46.000000000 +0100
437 +++ openarena-engine-0.8.1/code/qcommon/unzip.h 2010-03-06 22:00:58.000000000 +0100
438 @@ -19,6 +19,8 @@
439 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
440 ===========================================================================
441 */
442 +#include <zconf.h>
443 +#include <zlib.h>
444
445 #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
446 /* like the STRICT of WIN32, we define a pointer that cannot be converted
447 @@ -80,6 +82,7 @@
448 typedef void* (*alloc_func) (void* opaque, unsigned int items, unsigned int size);
449 typedef void (*free_func) (void* opaque, void* address);
450
451 +#if 0
452 struct internal_state;
453
454 typedef struct z_stream_s {
455 @@ -105,6 +108,7 @@
456
457 typedef z_stream *z_streamp;
458
459 +#endif
460
461 /* file_in_zip_read_info_s contain internal information about a file in zipfile,
462 when reading and decompress it */
463 --- openarena-engine-0.8.1/code/qcommon/unzip.c.old 2010-03-06 22:01:40.000000000 +0100
464 +++ openarena-engine-0.8.1/code/qcommon/unzip.c 2010-03-06 22:03:35.000000000 +0100
465 @@ -49,7 +49,7 @@
466 ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
467 PkWare has also a specification at :
468 ftp://ftp.pkware.com/probdesc.zip */
469 -
470 +#if 0
471 /* zlib.h -- interface of the 'zlib' general purpose compression library
472 version 1.1.3, July 9th, 1998
473
474 @@ -955,6 +955,7 @@
475 // static const char * zError OF((int err));
476 // static int inflateSyncPoint OF((z_streamp z));
477 // static const uLong * get_crc_table OF((void));
478 +#endif
479
480 typedef unsigned char uch;
481 typedef unsigned short ush;
482 @@ -2248,6 +2249,8 @@
483 return (int)uReadThis;
484 }
485
486 +#if 0
487 +
488 /* infblock.h -- header to use infblock.c
489 * Copyright (C) 1995-1998 Mark Adler
490 * For conditions of distribution and use, see copyright notice in zlib.h
491 @@ -4295,3 +4298,4 @@
492 }
493
494
495 +#endif
496 --- openarena-engine-0.8.1/code/jpeg-6/jdatasrc.c.old 2010-03-10 09:13:25.000000000 +0100
497 +++ openarena-engine-0.8.1/code/jpeg-6/jdatasrc.c 2010-03-10 09:23:39.000000000 +0100
498 @@ -16,9 +16,15 @@
499
500
501 /* this is not a core library module, so it doesn't define JPEG_INTERNALS */
502 -#include "jinclude.h"
503 -#include "jpeglib.h"
504 -#include "jerror.h"
505 +#include <stdio.h>
506 +#include <string.h>
507 +#include <jpeglib.h>
508 +#include <jerror.h>
509 +#undef METHODDEF
510 +#define METHODDEF static
511 +#undef GLOBAL
512 +#define GLOBAL
513 +#define SIZEOF(object) ((size_t) sizeof(object))
514
515 #ifndef MIN
516 #define MIN(a, b) ((a)<(b)?(a):(b))
517 @@ -189,7 +195,7 @@
518 */
519
520 GLOBAL void
521 -jpeg_mem_src (j_decompress_ptr cinfo, unsigned char *inbuf, size_t size)
522 +jpeg_mem_src (j_decompress_ptr cinfo, unsigned char *inbuf, unsigned long size)
523 {
524 my_src_ptr src;
525
526 --- openarena-engine-0.8.1/code/renderer/tr_image_jpg.c.old 2010-03-10 09:30:30.000000000 +0100
527 +++ openarena-engine-0.8.1/code/renderer/tr_image_jpg.c 2010-03-10 10:17:42.000000000 +0100
528 @@ -31,7 +31,7 @@
529 */
530
531 #define JPEG_INTERNALS
532 -#include "../jpeg-6/jpeglib.h"
533 +#include <jpeglib.h>
534
535 void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *height ) {
536 /* This struct contains the JPEG decompression parameters and pointers to
537 @@ -128,7 +128,10 @@
538 }
539
540 memcount = pixelcount * 4;
541 - row_stride = cinfo.output_width * cinfo.output_components;
542 + if (3 == cinfo.output_components)
543 + row_stride = cinfo.output_width * 4;
544 + else
545 + row_stride = cinfo.output_width * cinfo.output_components;
546
547 out = ri.Malloc(memcount);
548
549 @@ -141,14 +144,26 @@
550 /* Here we use the library's state variable cinfo.output_scanline as the
551 * loop counter, so that we don't have to keep track ourselves.
552 */
553 + buf = out;
554 while (cinfo.output_scanline < cinfo.output_height) {
555 /* jpeg_read_scanlines expects an array of pointers to scanlines.
556 * Here the array is only one element long, but you could ask for
557 * more than one scanline at a time if that's more convenient.
558 */
559 - buf = ((out+(row_stride*cinfo.output_scanline)));
560 buffer = &buf;
561 (void) jpeg_read_scanlines(&cinfo, buffer, 1);
562 + if (3 == cinfo.output_components) {
563 + /* turn RGB into RGBA */
564 + int ioffset = cinfo.output_width * 3 - 1;
565 + int ooffset = cinfo.output_width * 4 - 1;
566 + do {
567 + buf[ooffset--] = 255;
568 + buf[ooffset--] = buf[ioffset--];
569 + buf[ooffset--] = buf[ioffset--];
570 + buf[ooffset--] = buf[ioffset--];
571 + } while (ioffset > 0);
572 + }
573 + buf += row_stride;
574 }
575
576 buf = out;
577 @@ -173,7 +188,7 @@
578 buf[--dindex] = greyshade;
579 } while(sindex);
580 }
581 - else
582 + else if (4 == cinfo.output_components)
583 {
584 // clear all the alphas to 255
585 int i;