mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-02-21 10:41:08 +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
|
// skip double slash comments
|
||||||
if ( c == '/' && data[1] == '/' )
|
if ( c == '/' && data[1] == '/' )
|
||||||
{
|
{
|
||||||
while (*data && *data != '\n')
|
data += 2;
|
||||||
|
while (*data && *data != '\n') {
|
||||||
data++;
|
data++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// skip /* */ comments
|
// skip /* */ comments
|
||||||
else if ( c=='/' && data[1] == '*' )
|
else if ( c=='/' && data[1] == '*' )
|
||||||
{
|
{
|
||||||
|
data += 2;
|
||||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||||
{
|
{
|
||||||
data++;
|
data++;
|
||||||
|
@ -1481,7 +1484,7 @@ static char *CommaParse( char **data_p ) {
|
||||||
*data_p = ( char * ) data;
|
*data_p = ( char * ) data;
|
||||||
return com_token;
|
return com_token;
|
||||||
}
|
}
|
||||||
if (len < MAX_TOKEN_CHARS)
|
if (len < MAX_TOKEN_CHARS - 1)
|
||||||
{
|
{
|
||||||
com_token[len] = c;
|
com_token[len] = c;
|
||||||
len++;
|
len++;
|
||||||
|
@ -1492,7 +1495,7 @@ static char *CommaParse( char **data_p ) {
|
||||||
// parse a regular word
|
// parse a regular word
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (len < MAX_TOKEN_CHARS)
|
if (len < MAX_TOKEN_CHARS - 1)
|
||||||
{
|
{
|
||||||
com_token[len] = c;
|
com_token[len] = c;
|
||||||
len++;
|
len++;
|
||||||
|
@ -1501,11 +1504,6 @@ static char *CommaParse( char **data_p ) {
|
||||||
c = *data;
|
c = *data;
|
||||||
} while (c>32 && c != ',' );
|
} 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;
|
com_token[len] = 0;
|
||||||
|
|
||||||
*data_p = ( char * ) data;
|
*data_p = ( char * ) data;
|
||||||
|
|
|
@ -3007,12 +3007,15 @@ static char *CommaParse( char **data_p ) {
|
||||||
// skip double slash comments
|
// skip double slash comments
|
||||||
if ( c == '/' && data[1] == '/' )
|
if ( c == '/' && data[1] == '/' )
|
||||||
{
|
{
|
||||||
while (*data && *data != '\n')
|
data += 2;
|
||||||
|
while (*data && *data != '\n') {
|
||||||
data++;
|
data++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// skip /* */ comments
|
// skip /* */ comments
|
||||||
else if ( c=='/' && data[1] == '*' )
|
else if ( c=='/' && data[1] == '*' )
|
||||||
{
|
{
|
||||||
|
data += 2;
|
||||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||||
{
|
{
|
||||||
data++;
|
data++;
|
||||||
|
@ -3045,7 +3048,7 @@ static char *CommaParse( char **data_p ) {
|
||||||
*data_p = ( char * ) data;
|
*data_p = ( char * ) data;
|
||||||
return com_token;
|
return com_token;
|
||||||
}
|
}
|
||||||
if (len < MAX_TOKEN_CHARS)
|
if (len < MAX_TOKEN_CHARS - 1)
|
||||||
{
|
{
|
||||||
com_token[len] = c;
|
com_token[len] = c;
|
||||||
len++;
|
len++;
|
||||||
|
@ -3056,7 +3059,7 @@ static char *CommaParse( char **data_p ) {
|
||||||
// parse a regular word
|
// parse a regular word
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (len < MAX_TOKEN_CHARS)
|
if (len < MAX_TOKEN_CHARS - 1)
|
||||||
{
|
{
|
||||||
com_token[len] = c;
|
com_token[len] = c;
|
||||||
len++;
|
len++;
|
||||||
|
@ -3065,11 +3068,6 @@ static char *CommaParse( char **data_p ) {
|
||||||
c = *data;
|
c = *data;
|
||||||
} while (c>32 && c != ',' );
|
} 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;
|
com_token[len] = 0;
|
||||||
|
|
||||||
*data_p = ( char * ) data;
|
*data_p = ( char * ) data;
|
||||||
|
|
Loading…
Reference in a new issue