summaryrefslogtreecommitdiff
path: root/src/qcommon/cm_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/cm_load.c')
-rw-r--r--src/qcommon/cm_load.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/qcommon/cm_load.c b/src/qcommon/cm_load.c
index 06a037aa..6291f4d7 100644
--- a/src/qcommon/cm_load.c
+++ b/src/qcommon/cm_load.c
@@ -714,7 +714,10 @@ Loads in the map and all submodels
==================
*/
void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
- int *buf;
+ union {
+ int *i;
+ void *v;
+ } buf;
int i;
dheader_t header;
int length;
@@ -753,19 +756,19 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
// load the file
//
#ifndef BSPC
- length = FS_ReadFile( name, (void **)&buf );
+ length = FS_ReadFile( name, &buf.v );
#else
- length = LoadQuakeFile((quakefile_t *) name, (void **)&buf);
+ length = LoadQuakeFile((quakefile_t *) name, &buf.v);
#endif
- if ( !buf ) {
+ if ( !buf.i ) {
Com_Error (ERR_DROP, "Couldn't load %s", name);
}
- last_checksum = LittleLong (Com_BlockChecksum (buf, length));
+ last_checksum = LittleLong (Com_BlockChecksum (buf.i, length));
*checksum = last_checksum;
- header = *(dheader_t *)buf;
+ header = *(dheader_t *)buf.i;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++) {
((int *)&header)[i] = LittleLong ( ((int *)&header)[i]);
}
@@ -775,7 +778,7 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
, name, header.version, BSP_VERSION );
}
- cmod_base = (byte *)buf;
+ cmod_base = (byte *)buf.i;
// load into heap
CMod_LoadShaders( &header.lumps[LUMP_SHADERS] );
@@ -794,7 +797,7 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
CMod_CreateBrushSideWindings( );
// we are NOT freeing the file, because it is cached for the ref
- FS_FreeFile (buf);
+ FS_FreeFile (buf.v);
CM_InitBoxHull ();