engine: client: fix ParseFile calls

This commit is contained in:
Alibek Omarov 2021-10-01 20:12:31 +03:00 committed by a1batross
parent cce7c7d782
commit 4ba95277b9
5 changed files with 23 additions and 23 deletions

View File

@ -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 );

View File

@ -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;
} }

View File

@ -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

View File

@ -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 );

View File

@ -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] ));