diff options
Diffstat (limited to 'src/renderer/tr_image_tga.c')
-rw-r--r-- | src/renderer/tr_image_tga.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/renderer/tr_image_tga.c b/src/renderer/tr_image_tga.c index 2147acdc..e66e60de 100644 --- a/src/renderer/tr_image_tga.c +++ b/src/renderer/tr_image_tga.c @@ -45,7 +45,10 @@ void R_LoadTGA ( 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; TargaHeader targa_header; byte *targa_rgba; int length; @@ -60,8 +63,8 @@ void R_LoadTGA ( 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; } @@ -70,8 +73,8 @@ void R_LoadTGA ( const char *name, byte **pic, int *width, int *height) ri.Error( ERR_DROP, "LoadTGA: header too short (%s)\n", name ); } - buf_p = buffer; - end = buffer + length; + buf_p = buffer.b; + end = buffer.b + length; targa_header.id_length = buf_p[0]; targa_header.colormap_type = buf_p[1]; @@ -313,5 +316,5 @@ void R_LoadTGA ( const char *name, byte **pic, int *width, int *height) *pic = targa_rgba; - ri.FS_FreeFile (buffer); + ri.FS_FreeFile (buffer.v); } |