mirror of
https://github.com/UberGames/ioef.git
synced 2025-02-20 18:52:18 +00:00
Fix setting COM_Parse current line number
Fix initial off-by-one error. Count lines in /* */ comments and multi-line strings. Fix counting some lines twice if text has Unix newlines.
This commit is contained in:
parent
6c4d010f29
commit
c0a21d0898
1 changed files with 9 additions and 3 deletions
|
@ -289,7 +289,7 @@ static int com_lines;
|
|||
|
||||
void COM_BeginParseSession( const char *name )
|
||||
{
|
||||
com_lines = 0;
|
||||
com_lines = 1;
|
||||
Com_sprintf(com_parsename, sizeof(com_parsename), "%s", name);
|
||||
}
|
||||
|
||||
|
@ -473,6 +473,10 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
data += 2;
|
||||
while ( *data && ( *data != '*' || data[1] != '/' ) )
|
||||
{
|
||||
if ( *data == '\n' )
|
||||
{
|
||||
com_lines++;
|
||||
}
|
||||
data++;
|
||||
}
|
||||
if ( *data )
|
||||
|
@ -499,6 +503,10 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
*data_p = ( char * ) data;
|
||||
return com_token;
|
||||
}
|
||||
if ( c == '\n' )
|
||||
{
|
||||
com_lines++;
|
||||
}
|
||||
if (len < MAX_TOKEN_CHARS - 1)
|
||||
{
|
||||
com_token[len] = c;
|
||||
|
@ -517,8 +525,6 @@ char *COM_ParseExt( char **data_p, qboolean allowLineBreaks )
|
|||
}
|
||||
data++;
|
||||
c = *data;
|
||||
if ( c == '\n' )
|
||||
com_lines++;
|
||||
} while (c>32);
|
||||
|
||||
com_token[len] = 0;
|
||||
|
|
Loading…
Reference in a new issue