engine: common: fix ParseFile calls

This commit is contained in:
Alibek Omarov 2021-10-01 20:40:36 +03:00 committed by a1batross
parent 004e190435
commit 29a8bfb1dc
8 changed files with 76 additions and 75 deletions

View File

@ -54,7 +54,7 @@ Return true if next token is pExpext and skip it
*/ */
qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error ) qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
{ {
char *tmp = COM_ParseFile( ps->buf, ps->token ); char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
if( !Q_stricmp( ps->token, pExpect ) ) if( !Q_stricmp( ps->token, pExpect ) )
{ {
@ -99,13 +99,13 @@ CSCR_ParseSingleCvar
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result ) qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
{ {
// read the name // read the name
ps->buf = COM_ParseFile( ps->buf, result->name ); ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->name ));
if( !CSCR_ExpectString( ps, "{", false, true )) if( !CSCR_ExpectString( ps, "{", false, true ))
return false; return false;
// read description // read description
ps->buf = COM_ParseFile( ps->buf, result->desc ); ps->buf = COM_ParseFile( ps->buf, result->desc, sizeof( result->desc ));
if( !CSCR_ExpectString( ps, "{", false, true )) if( !CSCR_ExpectString( ps, "{", false, true ))
return false; return false;
@ -121,11 +121,11 @@ qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
break; break;
case T_NUMBER: case T_NUMBER:
// min // min
ps->buf = COM_ParseFile( ps->buf, ps->token ); ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
result->fMin = Q_atof( ps->token ); result->fMin = Q_atof( ps->token );
// max // max
ps->buf = COM_ParseFile( ps->buf, ps->token ); ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
result->fMax = Q_atof( ps->token ); result->fMax = Q_atof( ps->token );
if( !CSCR_ExpectString( ps, "}", false, true )) if( !CSCR_ExpectString( ps, "}", false, true ))
@ -149,7 +149,7 @@ qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
return false; return false;
// default value // default value
ps->buf = COM_ParseFile( ps->buf, result->value ); ps->buf = COM_ParseFile( ps->buf, result->value, sizeof( result->value ));
if( !CSCR_ExpectString( ps, "}", false, true )) if( !CSCR_ExpectString( ps, "}", false, true ))
return false; return false;
@ -177,7 +177,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
// Parse in the version # // Parse in the version #
// Get the first token. // Get the first token.
ps->buf = COM_ParseFile( ps->buf, ps->token ); ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
if( Q_atof( ps->token ) != 1 ) if( Q_atof( ps->token ) != 1 )
{ {
@ -188,7 +188,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
if( !CSCR_ExpectString( ps, "DESCRIPTION", false, true )) if( !CSCR_ExpectString( ps, "DESCRIPTION", false, true ))
return false; return false;
ps->buf = COM_ParseFile( ps->buf, ps->token ); ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" )) if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ))
{ {
@ -247,7 +247,7 @@ static int CSCR_ParseFile( const char *scriptfilename,
break; break;
} }
if( COM_ParseFile( state.buf, state.token )) if( COM_ParseFile( state.buf, state.token, sizeof( state.token )))
Con_DPrintf( S_ERROR "Got extra tokens!\n" ); Con_DPrintf( S_ERROR "Got extra tokens!\n" );
else success = true; else success = true;
finish: finish:

View File

@ -120,24 +120,24 @@ int Cmd_ListMaps( search_t *t, char *lastmapname, size_t len )
message[0] = 0; // remove 'error' message[0] = 0; // remove 'error'
pfile = ents; pfile = ents;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( !Q_strcmp( token, "{" )) continue; if( !Q_strcmp( token, "{" )) continue;
else if( !Q_strcmp( token, "}" )) break; else if( !Q_strcmp( token, "}" )) break;
else if( !Q_strcmp( token, "message" )) else if( !Q_strcmp( token, "message" ))
{ {
// get the message contents // get the message contents
pfile = COM_ParseFile( pfile, message ); pfile = COM_ParseFile( pfile, message, sizeof( message ));
} }
else if( !Q_strcmp( token, "compiler" ) || !Q_strcmp( token, "_compiler" )) else if( !Q_strcmp( token, "compiler" ) || !Q_strcmp( token, "_compiler" ))
{ {
// get the message contents // get the message contents
pfile = COM_ParseFile( pfile, compiler ); pfile = COM_ParseFile( pfile, compiler, sizeof( compiler ));
} }
else if( !Q_strcmp( token, "generator" ) || !Q_strcmp( token, "_generator" )) else if( !Q_strcmp( token, "generator" ) || !Q_strcmp( token, "_generator" ))
{ {
// get the message contents // get the message contents
pfile = COM_ParseFile( pfile, generator ); pfile = COM_ParseFile( pfile, generator, sizeof( generator ));
} }
} }
Mem_Free( ents ); Mem_Free( ents );
@ -942,18 +942,18 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
Q_strncpy( message, "No Title", MAX_STRING ); Q_strncpy( message, "No Title", MAX_STRING );
pfile = ents; pfile = ents;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( token[0] == '}' && worldspawn ) if( token[0] == '}' && worldspawn )
worldspawn = false; worldspawn = false;
else if( !Q_strcmp( token, "message" ) && worldspawn ) else if( !Q_strcmp( token, "message" ) && worldspawn )
{ {
// get the message contents // get the message contents
pfile = COM_ParseFile( pfile, message ); pfile = COM_ParseFile( pfile, message, sizeof( message ));
} }
else if( !Q_strcmp( token, "classname" )) else if( !Q_strcmp( token, "classname" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !Q_strcmp( token, GI->mp_entity ) || use_filter ) if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
num_spawnpoints++; num_spawnpoints++;
} }

View File

@ -1597,69 +1597,69 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
qboolean found_linux = false, found_osx = false; qboolean found_linux = false, found_osx = false;
string token; string token;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
// different names in liblist/gameinfo // different names in liblist/gameinfo
if( !Q_stricmp( token, isGameInfo ? "title" : "game" )) if( !Q_stricmp( token, isGameInfo ? "title" : "game" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->title ); pfile = COM_ParseFile( pfile, GameInfo->title, sizeof( GameInfo->title ));
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "fallback_dir" )) else if( !Q_stricmp( token, "fallback_dir" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->falldir ); pfile = COM_ParseFile( pfile, GameInfo->falldir, sizeof( GameInfo->falldir ));
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "startmap" )) else if( !Q_stricmp( token, "startmap" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->startmap ); pfile = COM_ParseFile( pfile, GameInfo->startmap, sizeof( GameInfo->startmap ));
COM_StripExtension( GameInfo->startmap ); // HQ2:Amen has extension .bsp COM_StripExtension( GameInfo->startmap ); // HQ2:Amen has extension .bsp
} }
// only trainmap is valid for gameinfo // only trainmap is valid for gameinfo
else if( !Q_stricmp( token, "trainmap" ) || else if( !Q_stricmp( token, "trainmap" ) ||
(!isGameInfo && !Q_stricmp( token, "trainingmap" ))) (!isGameInfo && !Q_stricmp( token, "trainingmap" )))
{ {
pfile = COM_ParseFile( pfile, GameInfo->trainmap ); pfile = COM_ParseFile( pfile, GameInfo->trainmap, sizeof( GameInfo->trainmap ));
COM_StripExtension( GameInfo->trainmap ); // HQ2:Amen has extension .bsp COM_StripExtension( GameInfo->trainmap ); // HQ2:Amen has extension .bsp
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "url_info" )) else if( !Q_stricmp( token, "url_info" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->game_url ); pfile = COM_ParseFile( pfile, GameInfo->game_url, sizeof( GameInfo->game_url ));
} }
// different names // different names
else if( !Q_stricmp( token, isGameInfo ? "url_update" : "url_dl" )) else if( !Q_stricmp( token, isGameInfo ? "url_update" : "url_dl" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->update_url ); pfile = COM_ParseFile( pfile, GameInfo->update_url, sizeof( GameInfo->update_url ));
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "gamedll" )) else if( !Q_stricmp( token, "gamedll" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->game_dll ); pfile = COM_ParseFile( pfile, GameInfo->game_dll, sizeof( GameInfo->game_dll ));
COM_FixSlashes( GameInfo->game_dll ); COM_FixSlashes( GameInfo->game_dll );
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "gamedll_linux" )) else if( !Q_stricmp( token, "gamedll_linux" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->game_dll_linux ); pfile = COM_ParseFile( pfile, GameInfo->game_dll_linux, sizeof( GameInfo->game_dll_linux ));
found_linux = true; found_linux = true;
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "gamedll_osx" )) else if( !Q_stricmp( token, "gamedll_osx" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->game_dll_osx ); pfile = COM_ParseFile( pfile, GameInfo->game_dll_osx, sizeof( GameInfo->game_dll_osx ));
found_osx = true; found_osx = true;
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "icon" )) else if( !Q_stricmp( token, "icon" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->iconpath ); pfile = COM_ParseFile( pfile, GameInfo->iconpath, sizeof( GameInfo->iconpath ));
COM_FixSlashes( GameInfo->iconpath ); COM_FixSlashes( GameInfo->iconpath );
COM_DefaultExtension( GameInfo->iconpath, ".ico" ); COM_DefaultExtension( GameInfo->iconpath, ".ico" );
} }
else if( !Q_stricmp( token, "type" )) else if( !Q_stricmp( token, "type" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !isGameInfo && !Q_stricmp( token, "singleplayer_only" )) if( !isGameInfo && !Q_stricmp( token, "singleplayer_only" ))
{ {
@ -1689,43 +1689,43 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
// valid for both // valid for both
else if( !Q_stricmp( token, "version" )) else if( !Q_stricmp( token, "version" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->version = Q_atof( token ); GameInfo->version = Q_atof( token );
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "size" )) else if( !Q_stricmp( token, "size" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->size = Q_atoi( token ); GameInfo->size = Q_atoi( token );
} }
else if( !Q_stricmp( token, "edicts" )) else if( !Q_stricmp( token, "edicts" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->max_edicts = Q_atoi( token ); GameInfo->max_edicts = Q_atoi( token );
} }
else if( !Q_stricmp( token, isGameInfo ? "mp_entity" : "mpentity" )) else if( !Q_stricmp( token, isGameInfo ? "mp_entity" : "mpentity" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->mp_entity ); pfile = COM_ParseFile( pfile, GameInfo->mp_entity, sizeof( GameInfo->mp_entity ));
} }
else if( !Q_stricmp( token, isGameInfo ? "mp_filter" : "mpfilter" )) else if( !Q_stricmp( token, isGameInfo ? "mp_filter" : "mpfilter" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->mp_filter ); pfile = COM_ParseFile( pfile, GameInfo->mp_filter, sizeof( GameInfo->mp_filter ));
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "secure" )) else if( !Q_stricmp( token, "secure" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->secure = Q_atoi( token ); GameInfo->secure = Q_atoi( token );
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "nomodels" )) else if( !Q_stricmp( token, "nomodels" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->nomodels = Q_atoi( token ); GameInfo->nomodels = Q_atoi( token );
} }
else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" )) else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->max_edicts = bound( MIN_EDICTS, Q_atoi( token ), MAX_EDICTS ); GameInfo->max_edicts = bound( MIN_EDICTS, Q_atoi( token ), MAX_EDICTS );
} }
// only for gameinfo // only for gameinfo
@ -1734,40 +1734,40 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
if( !Q_stricmp( token, "basedir" )) if( !Q_stricmp( token, "basedir" ))
{ {
string fs_path; string fs_path;
pfile = COM_ParseFile( pfile, fs_path ); pfile = COM_ParseFile( pfile, fs_path, sizeof( fs_path ));
if( Q_stricmp( fs_path, GameInfo->basedir ) || Q_stricmp( fs_path, GameInfo->gamefolder )) if( Q_stricmp( fs_path, GameInfo->basedir ) || Q_stricmp( fs_path, GameInfo->gamefolder ))
Q_strncpy( GameInfo->basedir, fs_path, sizeof( GameInfo->basedir )); Q_strncpy( GameInfo->basedir, fs_path, sizeof( GameInfo->basedir ));
} }
else if( !Q_stricmp( token, "sp_entity" )) else if( !Q_stricmp( token, "sp_entity" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->sp_entity ); pfile = COM_ParseFile( pfile, GameInfo->sp_entity, sizeof( GameInfo->sp_entity ));
} }
else if( isGameInfo && !Q_stricmp( token, "dllpath" )) else if( isGameInfo && !Q_stricmp( token, "dllpath" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->dll_path ); pfile = COM_ParseFile( pfile, GameInfo->dll_path, sizeof( GameInfo->dll_path ));
} }
else if( isGameInfo && !Q_stricmp( token, "date" )) else if( isGameInfo && !Q_stricmp( token, "date" ))
{ {
pfile = COM_ParseFile( pfile, GameInfo->date ); pfile = COM_ParseFile( pfile, GameInfo->date, sizeof( GameInfo->date ));
} }
else if( !Q_stricmp( token, "max_tempents" )) else if( !Q_stricmp( token, "max_tempents" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->max_tents = bound( 300, Q_atoi( token ), 2048 ); GameInfo->max_tents = bound( 300, Q_atoi( token ), 2048 );
} }
else if( !Q_stricmp( token, "max_beams" )) else if( !Q_stricmp( token, "max_beams" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->max_beams = bound( 64, Q_atoi( token ), 512 ); GameInfo->max_beams = bound( 64, Q_atoi( token ), 512 );
} }
else if( !Q_stricmp( token, "max_particles" )) else if( !Q_stricmp( token, "max_particles" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->max_particles = bound( 4096, Q_atoi( token ), 32768 ); GameInfo->max_particles = bound( 4096, Q_atoi( token ), 32768 );
} }
else if( !Q_stricmp( token, "gamemode" )) else if( !Q_stricmp( token, "gamemode" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
// TODO: Remove this ugly hack too. // TODO: Remove this ugly hack too.
// This was made because Half-Life has multiplayer, // This was made because Half-Life has multiplayer,
// but for some reason it's marked as singleplayer_only. // but for some reason it's marked as singleplayer_only.
@ -1783,11 +1783,12 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
if( ambientNum < 0 || ambientNum > ( NUM_AMBIENTS - 1 )) if( ambientNum < 0 || ambientNum > ( NUM_AMBIENTS - 1 ))
ambientNum = 0; ambientNum = 0;
pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum] ); pfile = COM_ParseFile( pfile, GameInfo->ambientsound[ambientNum],
sizeof( GameInfo->ambientsound[ambientNum] ));
} }
else if( !Q_stricmp( token, "noskills" )) else if( !Q_stricmp( token, "noskills" ))
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->noskills = Q_atoi( token ); GameInfo->noskills = Q_atoi( token );
} }
} }

View File

@ -445,8 +445,8 @@ int ID_ProcessWMIC( bloomfilter_t *value, const char *cmdline )
if( !ID_RunWMIC( buffer, cmdline ) ) if( !ID_RunWMIC( buffer, cmdline ) )
return 0; return 0;
pbuf = COM_ParseFile( buffer, token ); // Header pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
while( pbuf = COM_ParseFile( pbuf, token ) ) while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
{ {
if( !ID_VerifyHEX( token ) ) if( !ID_VerifyHEX( token ) )
continue; continue;
@ -465,8 +465,8 @@ int ID_CheckWMIC( bloomfilter_t value, const char *cmdline )
if( !ID_RunWMIC( buffer, cmdline ) ) if( !ID_RunWMIC( buffer, cmdline ) )
return 0; return 0;
pbuf = COM_ParseFile( buffer, token ); // Header pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
while( pbuf = COM_ParseFile( pbuf, token ) ) while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
{ {
bloomfilter_t filter; bloomfilter_t filter;

View File

@ -189,11 +189,11 @@ static void NET_LoadMasters( void )
pfile = (char*)afile; pfile = (char*)afile;
// format: master <addr>\n // format: master <addr>\n
while( ( pfile = COM_ParseFile( pfile, token ) ) ) while( ( pfile = COM_ParseFile( pfile, token, sizeof( token ) ) ) )
{ {
if( !Q_strcmp( token, "master" ) ) // load addr if( !Q_strcmp( token, "master" ) ) // load addr
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ) );
NET_AddMaster( token, true ); NET_AddMaster( token, true );
} }

View File

@ -785,7 +785,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
pfile = (char *)entities; pfile = (char *)entities;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( token[0] != '{' ) if( token[0] != '{' )
Host_Error( "Mod_FindModelOrigin: found %s when expecting {\n", token ); Host_Error( "Mod_FindModelOrigin: found %s when expecting {\n", token );
@ -796,14 +796,14 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
while( 1 ) while( 1 )
{ {
// parse key // parse key
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
if( token[0] == '}' ) break; // end of desc if( token[0] == '}' ) break; // end of desc
Q_strncpy( keyname, token, sizeof( keyname )); Q_strncpy( keyname, token, sizeof( keyname ));
// parse value // parse value
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
if( token[0] == '}' ) if( token[0] == '}' )
@ -1679,7 +1679,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
bmod->wadlist.count = 0; bmod->wadlist.count = 0;
// parse all the wads for loading textures in right ordering // parse all the wads for loading textures in right ordering
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( token[0] != '{' ) if( token[0] != '{' )
Host_Error( "Mod_LoadEntities: found %s when expecting {\n", token ); Host_Error( "Mod_LoadEntities: found %s when expecting {\n", token );
@ -1687,14 +1687,14 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
while( 1 ) while( 1 )
{ {
// parse key // parse key
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
if( token[0] == '}' ) break; // end of desc if( token[0] == '}' ) break; // end of desc
Q_strncpy( keyname, token, sizeof( keyname )); Q_strncpy( keyname, token, sizeof( keyname ));
// parse value // parse value
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
if( token[0] == '}' ) if( token[0] == '}' )

View File

@ -561,7 +561,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
delta_field_t *pFieldInfo; delta_field_t *pFieldInfo;
char *oldpos; char *oldpos;
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( Q_strcmp( token, "(" )) if( Q_strcmp( token, "(" ))
{ {
Con_DPrintf( S_ERROR "Delta_ParseField: expected '(', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ParseField: expected '(', found '%s' instead\n", token );
@ -569,7 +569,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
} }
// read the variable name // read the variable name
if(( *delta_script = COM_ParseFile( *delta_script, token )) == NULL ) if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL )
{ {
Con_DPrintf( S_ERROR "Delta_ParseField: missing field name\n" ); Con_DPrintf( S_ERROR "Delta_ParseField: missing field name\n" );
return false; return false;
@ -582,7 +582,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
return false; return false;
} }
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( Q_strcmp( token, "," )) if( Q_strcmp( token, "," ))
{ {
Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ParseField: expected ',', found '%s' instead\n", token );
@ -596,7 +596,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
pField->flags = 0; pField->flags = 0;
// read delta-flags // read delta-flags
while(( *delta_script = COM_ParseFile( *delta_script, token )) != NULL ) while(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) != NULL )
{ {
if( !Q_strcmp( token, "," )) if( !Q_strcmp( token, "," ))
break; // end of flags argument break; // end of flags argument
@ -631,7 +631,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
} }
// read delta-bits // read delta-bits
if(( *delta_script = COM_ParseFile( *delta_script, token )) == NULL ) if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL )
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: %s field bits argument is missing\n", pField->name ); Con_DPrintf( S_ERROR "Delta_ReadField: %s field bits argument is missing\n", pField->name );
return false; return false;
@ -639,7 +639,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
pField->bits = Q_atoi( token ); pField->bits = Q_atoi( token );
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( Q_strcmp( token, "," )) if( Q_strcmp( token, "," ))
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token );
@ -647,7 +647,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
} }
// read delta-multiplier // read delta-multiplier
if(( *delta_script = COM_ParseFile( *delta_script, token )) == NULL ) if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL )
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: %s missing 'multiplier' argument\n", pField->name ); Con_DPrintf( S_ERROR "Delta_ReadField: %s missing 'multiplier' argument\n", pField->name );
return false; return false;
@ -657,7 +657,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
if( bPost ) if( bPost )
{ {
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( Q_strcmp( token, "," )) if( Q_strcmp( token, "," ))
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token );
@ -665,7 +665,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
} }
// read delta-postmultiplier // read delta-postmultiplier
if(( *delta_script = COM_ParseFile( *delta_script, token )) == NULL ) if(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) == NULL )
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: %s missing 'post_multiply' argument\n", pField->name ); Con_DPrintf( S_ERROR "Delta_ReadField: %s missing 'post_multiply' argument\n", pField->name );
return false; return false;
@ -680,7 +680,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
} }
// closing brace... // closing brace...
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( Q_strcmp( token, ")" )) if( Q_strcmp( token, ")" ))
{ {
Con_DPrintf( S_ERROR "Delta_ParseField: expected ')', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ParseField: expected ')', found '%s' instead\n", token );
@ -689,7 +689,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
// ... and trying to parse optional ',' post-symbol // ... and trying to parse optional ',' post-symbol
oldpos = *delta_script; oldpos = *delta_script;
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ));
if( token[0] != ',' ) *delta_script = oldpos; // not a ',' if( token[0] != ',' ) *delta_script = oldpos; // not a ','
return true; return true;
@ -709,7 +709,7 @@ void Delta_ParseTable( char **delta_script, delta_info_t *dt, const char *encode
dt->numFields = 0; dt->numFields = 0;
// assume we have handled '{' // assume we have handled '{'
while(( *delta_script = COM_ParseFile( *delta_script, token )) != NULL ) while(( *delta_script = COM_ParseFile( *delta_script, token, sizeof( token ))) != NULL )
{ {
Assert( dt->numFields <= dt->maxFields ); Assert( dt->numFields <= dt->maxFields );
@ -761,7 +761,7 @@ void Delta_InitFields( void )
pfile = (char *)afile; pfile = (char *)afile;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
dt = Delta_FindStruct( token ); dt = Delta_FindStruct( token );
@ -770,14 +770,14 @@ void Delta_InitFields( void )
Sys_Error( "%s: unknown struct %s\n", DELTA_PATH, token ); Sys_Error( "%s: unknown struct %s\n", DELTA_PATH, token );
} }
pfile = COM_ParseFile( pfile, encodeDll ); pfile = COM_ParseFile( pfile, encodeDll, sizeof( encodeDll ));
if( !Q_stricmp( encodeDll, "none" )) if( !Q_stricmp( encodeDll, "none" ))
Q_strcpy( encodeFunc, "null" ); Q_strcpy( encodeFunc, "null" );
else pfile = COM_ParseFile( pfile, encodeFunc ); else pfile = COM_ParseFile( pfile, encodeFunc, sizeof( encodeFunc ));
// jump to '{' // jump to '{'
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( token[0] != '{' ) if( token[0] != '{' )
{ {

View File

@ -2559,7 +2559,7 @@ void HTTP_Init( void )
if( serverfile ) if( serverfile )
{ {
while( ( line = COM_ParseFile( line, token ) ) ) while( ( line = COM_ParseFile( line, token, sizeof( token ) ) ) )
{ {
httpserver_t *server = HTTP_ParseURL( token ); httpserver_t *server = HTTP_ParseURL( token );