mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 05:11:51 +08:00
public: crtlib: add quotation mark support for ParseFile, required for filesystem_stdio
This commit is contained in:
@@ -3098,11 +3098,7 @@ handle colon separately
|
||||
*/
|
||||
char *pfnParseFile( char *data, char *token )
|
||||
{
|
||||
char *out;
|
||||
|
||||
out = _COM_ParseFileSafe( data, token, PFILE_TOKEN_MAX_LENGTH, PFILE_HANDLECOLON, NULL );
|
||||
|
||||
return out;
|
||||
return COM_ParseFileSafe( data, token, PFILE_TOKEN_MAX_LENGTH, PFILE_HANDLECOLON, NULL, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1224,6 +1224,11 @@ static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, cha
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned int flags, int *len )
|
||||
{
|
||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||
}
|
||||
|
||||
static ui_extendedfuncs_t gExtendedfuncs =
|
||||
{
|
||||
pfnEnableTextInput,
|
||||
@@ -1232,7 +1237,7 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
||||
Con_UtfMoveRight,
|
||||
pfnGetRenderers,
|
||||
Sys_DoubleTime,
|
||||
_COM_ParseFileSafe,
|
||||
pfnParseFileSafe,
|
||||
NET_AdrToString
|
||||
};
|
||||
|
||||
|
||||
@@ -103,6 +103,11 @@ static void pfnTouch_RemoveButton( const char *name )
|
||||
Touch_RemoveButton( name, true );
|
||||
}
|
||||
|
||||
static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned int flags, int *len )
|
||||
{
|
||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||
}
|
||||
|
||||
static mobile_engfuncs_t gpMobileEngfuncs =
|
||||
{
|
||||
MOBILITY_API_VERSION,
|
||||
@@ -118,7 +123,7 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
||||
Sys_Warn,
|
||||
pfnGetNativeObject,
|
||||
ID_SetCustomClientID,
|
||||
_COM_ParseFileSafe
|
||||
pfnParseFileSafe
|
||||
};
|
||||
|
||||
qboolean Mobile_Init( void )
|
||||
|
||||
@@ -864,7 +864,7 @@ void CL_QuakeExecStuff( void )
|
||||
|
||||
if( !*text ) break;
|
||||
|
||||
text = _COM_ParseFileSafe( text, token, sizeof( token ), PFILE_IGNOREBRACKET, NULL );
|
||||
text = COM_ParseFileSafe( text, token, sizeof( token ), PFILE_IGNOREBRACKET, NULL, NULL );
|
||||
|
||||
if( !text ) break;
|
||||
|
||||
|
||||
@@ -647,7 +647,7 @@ void Cmd_TokenizeString( const char *text )
|
||||
if( cmd_argc == 1 )
|
||||
cmd_args = text;
|
||||
|
||||
text = _COM_ParseFileSafe( (char*)text, cmd_token, sizeof( cmd_token ), PFILE_IGNOREBRACKET, NULL );
|
||||
text = COM_ParseFileSafe( (char*)text, cmd_token, sizeof( cmd_token ), PFILE_IGNOREBRACKET, NULL, NULL );
|
||||
|
||||
if( !text ) return;
|
||||
|
||||
|
||||
@@ -1182,22 +1182,22 @@ void Test_RunCommon( void )
|
||||
|
||||
Msg( "Checking COM_ParseFile...\n" );
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "q" ) && len == 1);
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "asdf" ) && len == 4);
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "qwer" ) && len == -1);
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "f \"f" ) && len == 4);
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "meow" ) && len == -1);
|
||||
|
||||
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||
file = COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len, NULL );
|
||||
TASSERT( !Q_strcmp( buf, "bark" ) && len == 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user