Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 252719
Collapse All | Expand All

(-)tremulous-1.1.0-src.orig/Makefile (-26 / +47 lines)
Lines 91-96 Link Here
91
USE_OPENAL=1
91
USE_OPENAL=1
92
endif
92
endif
93
93
94
ifndef USE_SYSTEM_JPEG
95
USE_SYSTEM_JPEG=1
96
endif
97
94
ifndef USE_OPENAL_DLOPEN
98
ifndef USE_OPENAL_DLOPEN
95
USE_OPENAL_DLOPEN=0
99
USE_OPENAL_DLOPEN=0
96
endif
100
endif
Lines 193-198 Link Here
193
    endif
197
    endif
194
  endif
198
  endif
195
199
200
  ifeq ($(USE_SYSTEM_JPEG),1)
201
      BASE_CFLAGS += -DUSE_SYSTEM_JPEG=1
202
  endif
203
196
  ifeq ($(USE_CURL),1)
204
  ifeq ($(USE_CURL),1)
197
    BASE_CFLAGS += -DUSE_CURL=1
205
    BASE_CFLAGS += -DUSE_CURL=1
198
    ifeq ($(USE_CURL_DLOPEN),1)
206
    ifeq ($(USE_CURL_DLOPEN),1)
Lines 269-274 Link Here
269
    CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
277
    CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
270
  endif
278
  endif
271
279
280
  ifeq ($(USE_SYSTEM_JPEG),1)
281
    CLIENT_LDFLAGS += -ljpeg
282
  endif
283
272
  ifeq ($(ARCH),x86)
284
  ifeq ($(ARCH),x86)
273
    # linux32 make ...
285
    # linux32 make ...
274
    BASE_CFLAGS += -m32
286
    BASE_CFLAGS += -m32
Lines 928-933 Link Here
928
  $(B)/client/vm.o \
940
  $(B)/client/vm.o \
929
  $(B)/client/vm_interpreted.o \
941
  $(B)/client/vm_interpreted.o \
930
  \
942
  \
943
  $(B)/client/tr_animation.o \
944
  $(B)/client/tr_backend.o \
945
  $(B)/client/tr_bloom.o \
946
  $(B)/client/tr_bsp.o \
947
  $(B)/client/tr_cmds.o \
948
  $(B)/client/tr_curve.o \
949
  $(B)/client/tr_flares.o \
950
  $(B)/client/tr_font.o \
951
  $(B)/client/tr_image.o \
952
  $(B)/client/tr_init.o \
953
  $(B)/client/tr_light.o \
954
  $(B)/client/tr_main.o \
955
  $(B)/client/tr_marks.o \
956
  $(B)/client/tr_mesh.o \
957
  $(B)/client/tr_model.o \
958
  $(B)/client/tr_noise.o \
959
  $(B)/client/tr_scene.o \
960
  $(B)/client/tr_shade.o \
961
  $(B)/client/tr_shade_calc.o \
962
  $(B)/client/tr_shader.o \
963
  $(B)/client/tr_shadows.o \
964
  $(B)/client/tr_sky.o \
965
  $(B)/client/tr_surface.o \
966
  $(B)/client/tr_world.o \
967
968
ifneq ($(USE_SYSTEM_JPEG),1)
969
  Q3OBJ += \
931
  $(B)/client/jcapimin.o \
970
  $(B)/client/jcapimin.o \
932
  $(B)/client/jchuff.o   \
971
  $(B)/client/jchuff.o   \
933
  $(B)/client/jcinit.o \
972
  $(B)/client/jcinit.o \
Lines 961-992 Link Here
961
  $(B)/client/jidctflt.o \
1000
  $(B)/client/jidctflt.o \
962
  $(B)/client/jmemmgr.o \
1001
  $(B)/client/jmemmgr.o \
963
  $(B)/client/jmemnobs.o \
1002
  $(B)/client/jmemnobs.o \
964
  $(B)/client/jutils.o \
1003
  $(B)/client/jutils.o
965
  \
1004
else
966
  $(B)/client/tr_animation.o \
1005
  Q3OBJ += $(B)/client/jpeg_memsrc.o
967
  $(B)/client/tr_backend.o \
1006
endif
968
  $(B)/client/tr_bloom.o \
969
  $(B)/client/tr_bsp.o \
970
  $(B)/client/tr_cmds.o \
971
  $(B)/client/tr_curve.o \
972
  $(B)/client/tr_flares.o \
973
  $(B)/client/tr_font.o \
974
  $(B)/client/tr_image.o \
975
  $(B)/client/tr_init.o \
976
  $(B)/client/tr_light.o \
977
  $(B)/client/tr_main.o \
978
  $(B)/client/tr_marks.o \
979
  $(B)/client/tr_mesh.o \
980
  $(B)/client/tr_model.o \
981
  $(B)/client/tr_noise.o \
982
  $(B)/client/tr_scene.o \
983
  $(B)/client/tr_shade.o \
984
  $(B)/client/tr_shade_calc.o \
985
  $(B)/client/tr_shader.o \
986
  $(B)/client/tr_shadows.o \
987
  $(B)/client/tr_sky.o \
988
  $(B)/client/tr_surface.o \
989
  $(B)/client/tr_world.o \
990
1007
991
ifeq ($(ARCH),x86)
1008
ifeq ($(ARCH),x86)
992
  Q3OBJ += \
1009
  Q3OBJ += \
Lines 1284-1291 Link Here
1284
$(B)/client/%.o: $(BLIBDIR)/%.c
1301
$(B)/client/%.o: $(BLIBDIR)/%.c
1285
	$(DO_BOT_CC)
1302
	$(DO_BOT_CC)
1286
1303
1304
ifneq ($(USE_SYSTEM_JPEG),1)
1287
$(B)/client/%.o: $(JPDIR)/%.c
1305
$(B)/client/%.o: $(JPDIR)/%.c
1288
	$(DO_CC)
1306
	$(DO_CC)
1307
else
1308
$(B)/client/jmemnobs.o : $(JPDIR)/jmemnobs.c; $(DO_CC)  $(GL_CFLAGS) $(MINGW_CFLAGS)
1309
endif
1289
1310
1290
$(B)/client/%.o: $(RDIR)/%.c
1311
$(B)/client/%.o: $(RDIR)/%.c
1291
	$(DO_CC)
1312
	$(DO_CC)
(-)tremulous-1.1.0-src.orig/renderer/jpeg_memsrc.c (+163 lines)
Line 0 Link Here
1
/*
2
* memsrc.c
3
*
4
* Copyright (C) 1994-1996, Thomas G. Lane.
5
* This file is part of the Independent JPEG Group's software.
6
* For conditions of distribution and use, see the accompanying README file.
7
*
8
* This file contains decompression data source routines for the case of
9
* reading JPEG data from a memory buffer that is preloaded with the entire
10
* JPEG file. This would not seem especially useful at first sight, but
11
* a number of people have asked for it.
12
* This is really just a stripped-down version of jdatasrc.c. Comparison
13
* of this code with jdatasrc.c may be helpful in seeing how to make
14
* custom source managers for other purposes.
15
*/
16
17
/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
18
#include <stdio.h>
19
#include <jpeglib.h>
20
#include <jerror.h>
21
22
23
/* Expanded data source object for memory input */
24
25
typedef struct {
26
struct jpeg_source_mgr pub; /* public fields */
27
28
JOCTET eoi_buffer[2]; /* a place to put a dummy EOI */
29
} my_source_mgr;
30
31
typedef my_source_mgr * my_src_ptr;
32
33
34
/*
35
* Initialize source --- called by jpeg_read_header
36
* before any data is actually read.
37
*/
38
39
METHODDEF(void)
40
init_source (j_decompress_ptr cinfo)
41
{
42
/* No work, since jpeg_memory_src set up the buffer pointer and count.
43
* Indeed, if we want to read multiple JPEG images from one buffer,
44
* this *must* not do anything to the pointer.
45
*/
46
}
47
48
49
/*
50
* Fill the input buffer --- called whenever buffer is emptied.
51
*
52
* In this application, this routine should never be called; if it is called,
53
* the decompressor has overrun the end of the input buffer, implying we
54
* supplied an incomplete or corrupt JPEG datastream. A simple error exit
55
* might be the most appropriate response.
56
*
57
* But what we choose to do in this code is to supply dummy EOI markers
58
* in order to force the decompressor to finish processing and supply
59
* some sort of output image, no matter how corrupted.
60
*/
61
62
METHODDEF(boolean)
63
fill_input_buffer (j_decompress_ptr cinfo)
64
{
65
my_src_ptr src = (my_src_ptr) cinfo->src;
66
67
WARNMS(cinfo, JWRN_JPEG_EOF);
68
69
/* Create a fake EOI marker */
70
src->eoi_buffer[0] = (JOCTET) 0xFF;
71
src->eoi_buffer[1] = (JOCTET) JPEG_EOI;
72
src->pub.next_input_byte = src->eoi_buffer;
73
src->pub.bytes_in_buffer = 2;
74
75
return TRUE;
76
}
77
78
79
/*
80
* Skip data --- used to skip over a potentially large amount of
81
* uninteresting data (such as an APPn marker).
82
*
83
* If we overrun the end of the buffer, we let fill_input_buffer deal with
84
* it. An extremely large skip could cause some time-wasting here, but
85
* it really isn't supposed to happen ... and the decompressor will never
86
* skip more than 64K anyway.
87
*/
88
89
METHODDEF(void)
90
skip_input_data (j_decompress_ptr cinfo, long num_bytes)
91
{
92
my_src_ptr src = (my_src_ptr) cinfo->src;
93
94
if (num_bytes > 0) {
95
while (num_bytes > (long) src->pub.bytes_in_buffer) {
96
num_bytes -= (long) src->pub.bytes_in_buffer;
97
(void) fill_input_buffer(cinfo);
98
/* note we assume that fill_input_buffer will never return FALSE,
99
* so suspension need not be handled.
100
*/
101
}
102
src->pub.next_input_byte += (size_t) num_bytes;
103
src->pub.bytes_in_buffer -= (size_t) num_bytes;
104
}
105
}
106
107
108
/*
109
* An additional method that can be provided by data source modules is the
110
* resync_to_restart method for error recovery in the presence of RST markers.
111
* For the moment, this source module just uses the default resync method
112
* provided by the JPEG library. That method assumes that no backtracking
113
* is possible.
114
*/
115
116
117
/*
118
* Terminate source --- called by jpeg_finish_decompress
119
* after all data has been read. Often a no-op.
120
*
121
* NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
122
* application must deal with any cleanup that should happen even
123
* for error exit.
124
*/
125
126
METHODDEF(void)
127
term_source (j_decompress_ptr cinfo)
128
{
129
/* no work necessary here */
130
}
131
132
133
/*
134
* Prepare for input from a memory buffer.
135
*/
136
137
GLOBAL(void)
138
jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer, size_t bufsize)
139
{
140
my_src_ptr src;
141
142
/* The source object is made permanent so that a series of JPEG images
143
* can be read from a single buffer by calling jpeg_memory_src
144
* only before the first one.
145
* This makes it unsafe to use this manager and a different source
146
* manager serially with the same JPEG object. Caveat programmer.
147
*/
148
if (cinfo->src == NULL) { /* first time for this JPEG object? */
149
cinfo->src = (struct jpeg_source_mgr *)
150
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
151
sizeof(my_source_mgr));
152
}
153
154
src = (my_src_ptr) cinfo->src;
155
src->pub.init_source = init_source;
156
src->pub.fill_input_buffer = fill_input_buffer;
157
src->pub.skip_input_data = skip_input_data;
158
src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
159
src->pub.term_source = term_source;
160
161
src->pub.next_input_byte = buffer;
162
src->pub.bytes_in_buffer = bufsize;
163
}
(-)tremulous-1.1.0-src.orig/renderer/jpeg_memsrc.h (+5 lines)
Line 0 Link Here
1
#include <stdio.h>
2
#include <jpeglib.h>
3
4
void jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer,
5
  size_t bufsize);
(-)tremulous-1.1.0-src.orig/src/jpeg-6/jmemnobs.c (-1 / +19 lines)
Lines 16-26 Link Here
16
 */
16
 */
17
17
18
#include "../renderer/tr_local.h"
18
#include "../renderer/tr_local.h"
19
#ifdef USE_SYSTEM_JPEG
20
#include <stdio.h>
21
#include <stdlib.h>
22
#include <jpeglib.h>
23
24
#undef GLOBAL
25
#define GLOBAL
26
#define FAR
19
27
28
typedef void * backing_store_ptr;
29
30
#else
20
#define JPEG_INTERNALS
31
#define JPEG_INTERNALS
21
#include "jinclude.h"
32
#include "jinclude.h"
22
#include "jpeglib.h"
33
#include "jpeglib.h"
23
#include "jmemsys.h"		/* import the system-dependent declarations */
34
#include "jmemsys.h"		/* import the system-dependent declarations */
35
#endif
24
36
25
/*
37
/*
26
 * Memory allocation and ri.Freeing are controlled by the regular library
38
 * Memory allocation and ri.Freeing are controlled by the regular library
Lines 83-89 Link Here
83
jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
95
jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
84
			 long total_bytes_needed)
96
			 long total_bytes_needed)
85
{
97
{
86
  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
98
#ifdef USE_SYSTEM_JPEG
99
  fprintf(stderr,
100
    "jmemnobs.c: jpeg_open_backing_store() call, this should never happen!\n");
101
  exit(1);
102
#else
103
ERREXIT(cinfo, JERR_NO_BACKING_STORE);
104
#endif
87
}
105
}
88
106
89
107
(-)tremulous-1.1.0-src.orig/src/renderer/tr_image.c (-3 / +35 lines)
Lines 31-38 Link Here
31
 * You may also wish to include "jerror.h".
31
 * You may also wish to include "jerror.h".
32
 */
32
 */
33
33
34
#ifdef USE_SYSTEM_JPEG
35
#include <jpeglib.h>
36
#include "jpeg_memsrc.h"
37
#else
34
#define JPEG_INTERNALS
38
#define JPEG_INTERNALS
35
#include "../jpeg-6/jpeglib.h"
39
#include "../jpeg-6/jpeglib.h"
40
#endif
36
41
37
#include "../qcommon/puff.h"
42
#include "../qcommon/puff.h"
38
43
Lines 1409-1414 Link Here
1409
  unsigned char *out;
1414
  unsigned char *out;
1410
  byte	*fbuffer;
1415
  byte	*fbuffer;
1411
  byte  *buf;
1416
  byte  *buf;
1417
  size_t bufsize;
1418
#ifdef USE_SYSTEM_JPEG
1419
  int i,j;
1420
  byte *inptr, *outptr;
1421
#endif
1422
1412
1423
1413
  /* In this example we want to open the input file before doing anything else,
1424
  /* In this example we want to open the input file before doing anything else,
1414
   * so that the setjmp() error recovery below can assume the file is open.
1425
   * so that the setjmp() error recovery below can assume the file is open.
Lines 1416-1422 Link Here
1416
   * requires it in order to read binary files.
1427
   * requires it in order to read binary files.
1417
   */
1428
   */
1418
1429
1419
  ri.FS_ReadFile ( ( char * ) filename, (void **)&fbuffer);
1430
  bufsize = ri.FS_ReadFile ( ( char * ) filename, (void **)&fbuffer);
1420
  if (!fbuffer) {
1431
  if (!fbuffer) {
1421
	return;
1432
	return;
1422
  }
1433
  }
Lines 1434-1441 Link Here
1434
  jpeg_create_decompress(&cinfo);
1445
  jpeg_create_decompress(&cinfo);
1435
1446
1436
  /* Step 2: specify data source (eg, a file) */
1447
  /* Step 2: specify data source (eg, a file) */
1437
1448
#ifdef USE_SYSTEM_JPEG
1449
  jpeg_memory_src(&cinfo, fbuffer, bufsize);
1450
#else
1438
  jpeg_stdio_src(&cinfo, fbuffer);
1451
  jpeg_stdio_src(&cinfo, fbuffer);
1452
#endif
1439
1453
1440
  /* Step 3: read file parameters with jpeg_read_header() */
1454
  /* Step 3: read file parameters with jpeg_read_header() */
1441
1455
Lines 1478-1484 Link Here
1478
  }
1492
  }
1479
1493
1480
  memcount = pixelcount * 4;
1494
  memcount = pixelcount * 4;
1481
  row_stride = cinfo.output_width * cinfo.output_components;
1495
  row_stride = cinfo.output_width * 4;
1482
1496
1483
  out = ri.Malloc(memcount);
1497
  out = ri.Malloc(memcount);
1484
1498
Lines 1499-1504 Link Here
1499
	buf = ((out+(row_stride*cinfo.output_scanline)));
1513
	buf = ((out+(row_stride*cinfo.output_scanline)));
1500
	buffer = &buf;
1514
	buffer = &buf;
1501
    (void) jpeg_read_scanlines(&cinfo, buffer, 1);
1515
    (void) jpeg_read_scanlines(&cinfo, buffer, 1);
1516
#ifdef USE_SYSTEM_JPEG
1517
    /* we have RGB data, we need to expand this out to ARGB */
1518
    inptr = buf + cinfo.output_width * 3 - 1;
1519
    outptr = buf + row_stride - 1;
1520
1521
    for (i = 0; i < cinfo.output_width; i++) {
1522
      /* endian dependent? maybe for big endian this must be done after the
1523
         color/pixel copy? */
1524
      *outptr-- = 255;
1525
      for (j = 0; j < 3; j++) {
1526
        JOCTET color = *inptr--;
1527
        *outptr-- = color;
1528
      }
1529
    }
1530
#endif
1502
  }
1531
  }
1503
  
1532
  
1504
  buf = out;
1533
  buf = out;
Lines 1617-1622 Link Here
1617
  return TRUE;
1646
  return TRUE;
1618
}
1647
}
1619
1648
1649
#ifndef USE_SYSTEM_JPEG
1620
1650
1621
/*
1651
/*
1622
 * Compression initialization.
1652
 * Compression initialization.
Lines 1709-1714 Link Here
1709
  return row_ctr;
1739
  return row_ctr;
1710
}
1740
}
1711
1741
1742
#endif
1743
1712
/*
1744
/*
1713
 * Terminate destination --- called by jpeg_finish_compress
1745
 * Terminate destination --- called by jpeg_finish_compress
1714
 * after all data has been written.  Usually needs to flush buffer.
1746
 * after all data has been written.  Usually needs to flush buffer.

Return to bug 252719