summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_image.c
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/renderergl2/tr_image.c
parent3c0e84cb40fbef18c79185e75b2917b8bce6e8e2 (diff)
Port COM_ParseExt fixes to CommaParse
Diffstat (limited to 'src/renderergl2/tr_image.c')
-rw-r--r--src/renderergl2/tr_image.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/renderergl2/tr_image.c b/src/renderergl2/tr_image.c
index 060eb1c4..d4ccb170 100644
--- a/src/renderergl2/tr_image.c
+++ b/src/renderergl2/tr_image.c
@@ -3008,12 +3008,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++;
@@ -3046,7 +3049,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++;
@@ -3057,7 +3060,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++;
@@ -3066,11 +3069,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;