mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-12-23 09:16:04 +01:00
public: ParseFile drops const qualifier, return -1 length on overflow
As we usually put allocated data to ParseFile, we don't need const qualifier
This commit is contained in:
parent
a8c877c841
commit
378c4f30f3
@ -995,7 +995,7 @@ COM_ParseFile
|
||||
text parser
|
||||
==============
|
||||
*/
|
||||
const char *_COM_ParseFileSafe( const char *data, char *token, const int size, unsigned int flags, int *plen )
|
||||
char *_COM_ParseFileSafe( char *data, char *token, const int size, unsigned int flags, int *plen )
|
||||
{
|
||||
int c, len = 0;
|
||||
qboolean overflow = false;
|
||||
@ -1054,6 +1054,7 @@ skipwhite:
|
||||
token[len] = (byte)*data;
|
||||
len++;
|
||||
}
|
||||
else overflow = true;
|
||||
|
||||
data++;
|
||||
continue;
|
||||
@ -1071,6 +1072,7 @@ skipwhite:
|
||||
token[len] = c;
|
||||
len++;
|
||||
}
|
||||
else overflow = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1102,6 +1104,7 @@ skipwhite:
|
||||
token[len] = c;
|
||||
len++;
|
||||
}
|
||||
else overflow = true;
|
||||
|
||||
data++;
|
||||
c = ((byte)*data);
|
||||
|
@ -95,7 +95,7 @@ char COM_Hex2Char( uint8_t hex );
|
||||
void COM_Hex2String( uint8_t hex, char *str );
|
||||
#define COM_CheckString( string ) ( ( !string || !*string ) ? 0 : 1 )
|
||||
#define COM_CheckStringEmpty( string ) ( ( !*string ) ? 0 : 1 )
|
||||
const char *_COM_ParseFileSafe( const char *data, char *token, const int size, unsigned int flags, int *len );
|
||||
char *_COM_ParseFileSafe( char *data, char *token, const int size, unsigned int flags, int *len );
|
||||
#define COM_ParseFile( data, token, size ) _COM_ParseFileSafe( data, token, size, 0, NULL )
|
||||
#define COM_ParseFileLegacy( data, token ) COM_ParseFileSafe( data, token, INT_MAX )
|
||||
int matchpattern( const char *in, const char *pattern, qboolean caseinsensitive );
|
||||
|
Loading…
Reference in New Issue
Block a user