mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 05:01:40 +00:00
Port COM_ParseExt fixes to CommaParse
This commit is contained in:
parent
1d95ef210e
commit
e742952db8
2 changed files with 12 additions and 16 deletions
|
@ -1443,12 +1443,15 @@ static char *CommaParse( char **data_p ) {
|
|||
// skip double slash comments
|
||||
if ( c == '/' && data[1] == '/' )
|
||||
{
|
||||
while (*data && *data != '\n')
|
||||
data += 2;
|
||||
while (*data && *data != '\n') {
|
||||
data++;
|
||||
}
|
||||
}
|
||||
// skip /* */ comments
|
||||
else if ( c=='/' && data[1] == '*' )
|
||||
{
|
||||
data += 2;
|
||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||
{
|
||||
data++;
|
||||
|
@ -1481,7 +1484,7 @@ static char *CommaParse( char **data_p ) {
|
|||
*data_p = ( char * ) data;
|
||||
return com_token;
|
||||
}
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -1492,7 +1495,7 @@ static char *CommaParse( char **data_p ) {
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -1501,11 +1504,6 @@ static char *CommaParse( char **data_p ) {
|
|||
c = *data;
|
||||
} while (c>32 && c != ',' );
|
||||
|
||||
if (len == MAX_TOKEN_CHARS)
|
||||
{
|
||||
// ri.Printf (PRINT_DEVELOPER, "Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
|
||||
len = 0;
|
||||
}
|
||||
com_token[len] = 0;
|
||||
|
||||
*data_p = ( char * ) data;
|
||||
|
|
|
@ -3007,12 +3007,15 @@ static char *CommaParse( char **data_p ) {
|
|||
// skip double slash comments
|
||||
if ( c == '/' && data[1] == '/' )
|
||||
{
|
||||
while (*data && *data != '\n')
|
||||
data += 2;
|
||||
while (*data && *data != '\n') {
|
||||
data++;
|
||||
}
|
||||
}
|
||||
// skip /* */ comments
|
||||
else if ( c=='/' && data[1] == '*' )
|
||||
{
|
||||
data += 2;
|
||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||
{
|
||||
data++;
|
||||
|
@ -3045,7 +3048,7 @@ static char *CommaParse( char **data_p ) {
|
|||
*data_p = ( char * ) data;
|
||||
return com_token;
|
||||
}
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -3056,7 +3059,7 @@ static char *CommaParse( char **data_p ) {
|
|||
// parse a regular word
|
||||
do
|
||||
{
|
||||
if (len < MAX_TOKEN_CHARS)
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
|
@ -3065,11 +3068,6 @@ static char *CommaParse( char **data_p ) {
|
|||
c = *data;
|
||||
} while (c>32 && c != ',' );
|
||||
|
||||
if (len == MAX_TOKEN_CHARS)
|
||||
{
|
||||
// ri.Printf (PRINT_DEVELOPER, "Token exceeded %i chars, discarded.\n", MAX_TOKEN_CHARS);
|
||||
len = 0;
|
||||
}
|
||||
com_token[len] = 0;
|
||||
|
||||
*data_p = ( char * ) data;
|
||||
|
|
Loading…
Reference in a new issue