Browse Source

engine: client: fix ParseFile calls

pull/2/head
Alibek Omarov 3 years ago committed by a1batross
parent
commit
4ba95277b9
  1. 20
      engine/client/cl_efx.c
  2. 20
      engine/client/cl_game.c
  3. 2
      engine/client/cl_gameui.c
  4. 2
      engine/client/cl_parse.c
  5. 2
      engine/client/cl_video.c

20
engine/client/cl_efx.c

@ -513,19 +513,19 @@ void CL_ReadLineFile_f( void )
while( 1 ) while( 1 )
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p1[0] = Q_atof( token ); p1[0] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p1[1] = Q_atof( token ); p1[1] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p1[2] = Q_atof( token ); p1[2] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
if( token[0] != '-' ) if( token[0] != '-' )
@ -534,15 +534,15 @@ void CL_ReadLineFile_f( void )
break; break;
} }
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p2[0] = Q_atof( token ); p2[0] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p2[1] = Q_atof( token ); p2[1] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
p2[2] = Q_atof( token ); p2[2] = Q_atof( token );
@ -2020,15 +2020,15 @@ void CL_ReadPointFile_f( void )
while( 1 ) while( 1 )
{ {
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
org[0] = Q_atof( token ); org[0] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
org[1] = Q_atof( token ); org[1] = Q_atof( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
if( !pfile ) break; if( !pfile ) break;
org[2] = Q_atof( token ); org[2] = Q_atof( token );

20
engine/client/cl_game.c

@ -234,7 +234,7 @@ void CL_InitCDAudio( const char *filename )
pfile = (char *)afile; pfile = (char *)afile;
// format: trackname\n [num] // format: trackname\n [num]
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( !Q_stricmp( token, "blank" )) token[0] = '\0'; if( !Q_stricmp( token, "blank" )) token[0] = '\0';
Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] )); Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] ));
@ -1535,7 +1535,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
if( !afile ) return NULL; if( !afile ) return NULL;
pfile = (char *)afile; pfile = (char *)afile;
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
numSprites = Q_atoi( token ); numSprites = Q_atoi( token );
Q_strncpy( pEntry->szListName, psz, sizeof( pEntry->szListName )); Q_strncpy( pEntry->szListName, psz, sizeof( pEntry->szListName ));
@ -1545,30 +1545,30 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
for( index = 0; index < numSprites; index++ ) for( index = 0; index < numSprites; index++ )
{ {
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
break; break;
Q_strncpy( pEntry->pList[index].szName, token, sizeof( pEntry->pList[0].szName )); Q_strncpy( pEntry->pList[index].szName, token, sizeof( pEntry->pList[0].szName ));
// read resolution // read resolution
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
pEntry->pList[index].iRes = Q_atoi( token ); pEntry->pList[index].iRes = Q_atoi( token );
// read spritename // read spritename
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
Q_strncpy( pEntry->pList[index].szSprite, token, sizeof( pEntry->pList[0].szSprite )); Q_strncpy( pEntry->pList[index].szSprite, token, sizeof( pEntry->pList[0].szSprite ));
// parse rectangle // parse rectangle
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
pEntry->pList[index].rc.left = Q_atoi( token ); pEntry->pList[index].rc.left = Q_atoi( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
pEntry->pList[index].rc.top = Q_atoi( token ); pEntry->pList[index].rc.top = Q_atoi( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
pEntry->pList[index].rc.right = pEntry->pList[index].rc.left + Q_atoi( token ); pEntry->pList[index].rc.right = pEntry->pList[index].rc.left + Q_atoi( token );
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token, sizeof( token ));
pEntry->pList[index].rc.bottom = pEntry->pList[index].rc.top + Q_atoi( token ); pEntry->pList[index].rc.bottom = pEntry->pList[index].rc.top + Q_atoi( token );
pEntry->count++; pEntry->count++;
@ -3078,7 +3078,7 @@ char *pfnParseFile( char *data, char *token )
{ {
char *out; char *out;
out = _COM_ParseFileSafe( data, token, -1, PFILE_HANDLECOLON, NULL ); out = _COM_ParseFileSafe( data, token, INT_MAX, PFILE_HANDLECOLON, NULL );
return out; return out;
} }

2
engine/client/cl_gameui.c

@ -1115,7 +1115,7 @@ legacy wrapper
*/ */
static char *pfnParseFile( char *buf, char *token ) static char *pfnParseFile( char *buf, char *token )
{ {
return COM_ParseFile( buf, token ); return COM_ParseFile( buf, token, INT_MAX );
} }
// engine callbacks // engine callbacks

2
engine/client/cl_parse.c

@ -1743,7 +1743,7 @@ void CL_ParseResLocation( sizebuf_t *msg )
return; return;
} }
while( ( data = COM_ParseFile( data, token ) ) ) while( ( data = COM_ParseFile( data, token, sizeof( token ) ) ) )
{ {
Con_Reportf( "Adding %s as download location\n", token ); Con_Reportf( "Adding %s as download location\n", token );

2
engine/client/cl_video.c

@ -104,7 +104,7 @@ void SCR_CheckStartupVids( void )
pfile = (char *)afile; pfile = (char *)afile;
while(( pfile = COM_ParseFile( pfile, token )) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] )); Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] ));

Loading…
Cancel
Save