diff options
author | Andrey Nazarov <skuller@skuller.net> | 2008-04-02 23:03:09 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2008-04-02 23:03:09 +0000 |
commit | 7ec50f12252b4dfb97f3249ccf05a771b98785c1 (patch) | |
tree | 279e4e8bd7b940368331a43869c165de9637ae99 /source/sw_image.c | |
parent | 80e48417564f1ce50a39a7c552ad95e651362c1f (diff) |
Use size_t instead of int where possible.
Added initial support for Win64 port.
Diffstat (limited to 'source/sw_image.c')
-rw-r--r-- | source/sw_image.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/sw_image.c b/source/sw_image.c index 13abf48..5e03868 100644 --- a/source/sw_image.c +++ b/source/sw_image.c @@ -115,9 +115,8 @@ R_LoadWal */ image_t *R_LoadWal( const char *name ) { miptex_t *mt; - uint32_t ofs, w, h; image_t *image; - unsigned size, length; + size_t size, length, ofs, endpos, w, h; byte *source[4]; length = fs.LoadFile( name, ( void ** )&mt ); @@ -131,7 +130,8 @@ image_t *R_LoadWal( const char *name ) { size = w * h * ( 256 + 64 + 16 + 4 ) / 256; ofs = LittleLong( mt->offsets[0] ); - if( ofs + size > length ) { + endpos = ofs + size; + if( endpos < ofs || endpos > length ) { Com_DPrintf( "R_LoadWal: %s is malformed\n", name ); fs.FreeFile( ( void * )mt ); return r_notexture_mip; @@ -301,7 +301,7 @@ R_InitImages */ void R_InitImages( void ) { byte *data; - int length; + size_t length; registration_sequence = 1; |