aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer/tr_image_pcx.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-11-10 23:55:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-11-10 23:55:22 +0000
commit8ba546241137c6c1c43751b25e40bbaf610658a1 (patch)
treea677c3ad74326acc217842a2d927328597cfe3c8 /code/renderer/tr_image_pcx.c
parentb1613ef65246cc89a1e40e35c6e07080c56ea00b (diff)
downloadioquake3-aero-8ba546241137c6c1c43751b25e40bbaf610658a1.tar.gz
ioquake3-aero-8ba546241137c6c1c43751b25e40bbaf610658a1.zip
* Fix some new GCC 4.3 warnings
* Fix many many strict aliasing warnings, now that it's re-enabled git-svn-id: svn://svn.icculus.org/quake3/trunk@1487 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer/tr_image_pcx.c')
-rw-r--r--code/renderer/tr_image_pcx.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/code/renderer/tr_image_pcx.c b/code/renderer/tr_image_pcx.c
index db407de..d1b1a5e 100644
--- a/code/renderer/tr_image_pcx.c
+++ b/code/renderer/tr_image_pcx.c
@@ -50,7 +50,10 @@ typedef struct {
void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
{
- byte *raw;
+ union {
+ byte *b;
+ void *v;
+ } raw;
byte *end;
pcx_t *pcx;
int len;
@@ -71,23 +74,23 @@ void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
//
// load the file
//
- len = ri.FS_ReadFile( ( char * ) filename, (void **)&raw);
- if (!raw || len < 0) {
+ len = ri.FS_ReadFile( ( char * ) filename, &raw.v);
+ if (!raw.b || len < 0) {
return;
}
if((unsigned)len < sizeof(pcx_t))
{
ri.Printf (PRINT_ALL, "PCX truncated: %s\n", filename);
- ri.FS_FreeFile (raw);
+ ri.FS_FreeFile (raw.v);
return;
}
//
// parse the PCX file
//
- pcx = (pcx_t *)raw;
- end = raw+len;
+ pcx = (pcx_t *)raw.b;
+ end = raw.b+len;
w = LittleShort(pcx->xmax)+1;
h = LittleShort(pcx->ymax)+1;
@@ -107,7 +110,7 @@ void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
pix = pic8 = ri.Malloc ( size );
- raw = pcx->data;
+ raw.b = pcx->data;
// FIXME: should use bytes_per_line but original q3 didn't do that either
while(pix < pic8+size)
{
@@ -117,16 +120,16 @@ void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
continue;
}
- if(raw+1 > end)
+ if(raw.b+1 > end)
break;
- dataByte = *raw++;
+ dataByte = *raw.b++;
if((dataByte & 0xC0) == 0xC0)
{
- if(raw+1 > end)
+ if(raw.b+1 > end)
break;
runLength = dataByte & 0x3F;
- dataByte = *raw++;
+ dataByte = *raw.b++;
}
else
runLength = 1;
@@ -139,7 +142,7 @@ void R_LoadPCX ( const char *filename, byte **pic, int *width, int *height)
ri.Free (pic8);
}
- if (raw-(byte*)pcx >= end - (byte*)769 || end[-769] != 0x0c)
+ if (raw.b-(byte*)pcx >= end - (byte*)769 || end[-769] != 0x0c)
{
ri.Printf (PRINT_ALL, "PCX missing palette: %s\n", filename);
ri.FS_FreeFile (pcx);