From 393e5ec89e34f449a28bfd0f31324f10c1a9d0dd Mon Sep 17 00:00:00 2001 From: "M. Kristall" Date: Sat, 3 Oct 2009 11:38:19 +0000 Subject: * (bug 3554) Make sure opened files get closed properly -- for real this time * (bug 3446) Allow the last spawn to be deconstructed when cheats are enabled and g_markDeconstruct is not (Ben Millwood) * (bug 3560) PTRC can be used while the original client is connected * remove unused functions from src/game/g_ptr.c --- src/cgame/cg_players.c | 4 ++-- src/cgame/cg_weapons.c | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index f729164a..9a7be70b 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -110,9 +110,9 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci ) if( len < 0 ) return qfalse; - if( len >= sizeof( text ) - 1 ) + if( len == 0 || len >= sizeof( text ) - 1 ) { - CG_Printf( "File %s too long\n", filename ); + CG_Printf( "File %s is %s\n", filename, len == 0 ? "empty" : "too long" ); trap_FS_FCloseFile( f ); return qfalse; } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index e2f7d363..3f290b5d 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -102,12 +102,13 @@ static qboolean CG_ParseWeaponAnimationFile( const char *filename, weaponInfo_t // load the file len = trap_FS_FOpenFile( filename, &f, FS_READ ); - if( len <= 0 ) + if( len < 0 ) return qfalse; - if( len >= sizeof( text ) - 1 ) + if( len == 0 || len >= sizeof( text ) - 1 ) { - CG_Printf( "File %s too long\n", filename ); + trap_FS_FCloseFile( f ); + CG_Printf( "File %s is %s\n", filename, len == 0 ? "empty" : "too long" ); return qfalse; } @@ -540,9 +541,10 @@ static qboolean CG_ParseWeaponFile( const char *filename, weaponInfo_t *wi ) if( len < 0 ) return qfalse; - if( len >= sizeof( text ) - 1 ) + if( len == 0 || len >= sizeof( text ) - 1 ) { - CG_Printf( "File %s too long\n", filename ); + trap_FS_FCloseFile( f ); + CG_Printf( "File %s is %s\n", filename, len == 0 ? "empty" : "too long" ); return qfalse; } -- cgit