summaryrefslogtreecommitdiff
path: root/src/renderergl1
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2014-08-28 20:34:05 -0500
committerTim Angus <tim@ngus.net>2015-03-17 11:38:06 +0000
commitc09c6055cdd16affd85564d0d8184e2cd8d35d25 (patch)
tree141532a081cecdda80a7fa1bc20d3b0977195a35 /src/renderergl1
parent3c0e84cb40fbef18c79185e75b2917b8bce6e8e2 (diff)
Port COM_ParseExt fixes to CommaParse
Diffstat (limited to 'src/renderergl1')
-rw-r--r--src/renderergl1/tr_image.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/renderergl1/tr_image.c b/src/renderergl1/tr_image.c
index bf547ce8..d043b80d 100644
--- a/src/renderergl1/tr_image.c
+++ b/src/renderergl1/tr_image.c
@@ -1444,12 +1444,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++;
@@ -1482,7 +1485,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++;
@@ -1493,7 +1496,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++;
@@ -1502,11 +1505,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;