summaryrefslogtreecommitdiff
path: root/src/renderer/tr_image_jpg.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2009-10-03 12:31:59 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:03 +0000
commit304d4258d3a49488f570b8ad71931faa7e5d40ba (patch)
treebf9ec15bd9154305ff9fab2943b3daf25024f8a5 /src/renderer/tr_image_jpg.c
parent6e90e4e7861f5cb354487d1fe0f1fd06c385308e (diff)
* Merge ioq3-r1498, by popular demand
Diffstat (limited to 'src/renderer/tr_image_jpg.c')
-rw-r--r--src/renderer/tr_image_jpg.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/renderer/tr_image_jpg.c b/src/renderer/tr_image_jpg.c
index fb4f2121..2e1a52a7 100644
--- a/src/renderer/tr_image_jpg.c
+++ b/src/renderer/tr_image_jpg.c
@@ -57,7 +57,10 @@ void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *heig
unsigned pixelcount, memcount;
unsigned char *out;
int len;
- byte *fbuffer;
+ union {
+ byte *b;
+ void *v;
+ } fbuffer;
byte *buf;
/* In this example we want to open the input file before doing anything else,
@@ -66,8 +69,8 @@ void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *heig
* requires it in order to read binary files.
*/
- len = ri.FS_ReadFile ( ( char * ) filename, (void **)&fbuffer);
- if (!fbuffer || len < 0) {
+ len = ri.FS_ReadFile ( ( char * ) filename, &fbuffer.v);
+ if (!fbuffer.b || len < 0) {
return;
}
@@ -85,7 +88,7 @@ void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *heig
/* Step 2: specify data source (eg, a file) */
- jpeg_mem_src(&cinfo, fbuffer, len);
+ jpeg_mem_src(&cinfo, fbuffer.b, len);
/* Step 3: read file parameters with jpeg_read_header() */
@@ -203,7 +206,7 @@ void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *heig
* so as to simplify the setjmp error logic above. (Actually, I don't
* think that jpeg_destroy can do an error exit, but why assume anything...)
*/
- ri.FS_FreeFile (fbuffer);
+ ri.FS_FreeFile (fbuffer.v);
/* At this point you may want to check to see whether any corrupt-data
* warnings occurred (test whether jerr.pub.num_warnings is nonzero).