diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-11-10 23:55:22 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2008-11-10 23:55:22 +0000 |
commit | 8ba546241137c6c1c43751b25e40bbaf610658a1 (patch) | |
tree | a677c3ad74326acc217842a2d927328597cfe3c8 /code/renderer/tr_image_bmp.c | |
parent | b1613ef65246cc89a1e40e35c6e07080c56ea00b (diff) | |
download | ioquake3-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_bmp.c')
-rw-r--r-- | code/renderer/tr_image_bmp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/code/renderer/tr_image_bmp.c b/code/renderer/tr_image_bmp.c index 190b878..0b78abb 100644 --- a/code/renderer/tr_image_bmp.c +++ b/code/renderer/tr_image_bmp.c @@ -50,7 +50,10 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) int row, column; byte *buf_p; byte *end; - byte *buffer = NULL; + union { + byte *b; + void *v; + } buffer; int length; BMPHeader_t bmpHeader; byte *bmpRGBA; @@ -66,8 +69,8 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) // // load the file // - length = ri.FS_ReadFile( ( char * ) name, (void **)&buffer); - if (!buffer || length < 0) { + length = ri.FS_ReadFile( ( char * ) name, &buffer.v); + if (!buffer.b || length < 0) { return; } @@ -76,8 +79,8 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) ri.Error( ERR_DROP, "LoadBMP: header too short (%s)\n", name ); } - buf_p = buffer; - end = buffer + length; + buf_p = buffer.b; + end = buffer.b + length; bmpHeader.id[0] = *buf_p++; bmpHeader.id[1] = *buf_p++; @@ -119,12 +122,12 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) buf_p += sizeof(bmpHeader.palette); } - if (buffer + bmpHeader.bitmapDataOffset > end) + if (buffer.b + bmpHeader.bitmapDataOffset > end) { ri.Error( ERR_DROP, "LoadBMP: invalid offset value in header (%s)\n", name ); } - buf_p = buffer + bmpHeader.bitmapDataOffset; + buf_p = buffer.b + bmpHeader.bitmapDataOffset; if ( bmpHeader.id[0] != 'B' && bmpHeader.id[1] != 'M' ) { @@ -231,6 +234,6 @@ void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) } } - ri.FS_FreeFile( buffer ); + ri.FS_FreeFile( buffer.v ); } |