mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 00:11:39 +00:00
Fixed a bug with comments that don't have a newline after them.
This commit is contained in:
parent
7c4cecd700
commit
807e7de22e
1 changed files with 7 additions and 4 deletions
|
@ -309,6 +309,7 @@ void
|
||||||
extract_line (dstring_t * buffer, dstring_t * line)
|
extract_line (dstring_t * buffer, dstring_t * line)
|
||||||
{
|
{
|
||||||
int i, squotes = 0, dquotes = 0, braces = 0, n;
|
int i, squotes = 0, dquotes = 0, braces = 0, n;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
for (i = 0; buffer->str[i]; i++) {
|
for (i = 0; buffer->str[i]; i++) {
|
||||||
if (buffer->str[i] == '\'' && !escaped (buffer->str, i)
|
if (buffer->str[i] == '\'' && !escaped (buffer->str, i)
|
||||||
|
@ -329,10 +330,12 @@ extract_line (dstring_t * buffer, dstring_t * line)
|
||||||
if (buffer->str[i] == '/' && buffer->str[i + 1] == '/'
|
if (buffer->str[i] == '/' && buffer->str[i + 1] == '/'
|
||||||
&& !squotes && !dquotes) {
|
&& !squotes && !dquotes) {
|
||||||
// Filter out comments until newline
|
// Filter out comments until newline
|
||||||
for (n = 0;
|
if ((tmp = strchr (buffer->str+i, '\n')))
|
||||||
buffer->str[i + n] != '\n' && buffer->str[i + n] != '\r';
|
n = tmp - (buffer->str+i);
|
||||||
n++)
|
else if ((tmp = strchr (buffer->str+i, '\r')))
|
||||||
;
|
n = tmp - (buffer->str+i);
|
||||||
|
else
|
||||||
|
n = strlen(buffer->str+i); // snip till \0
|
||||||
dstring_snip (buffer, i, n);
|
dstring_snip (buffer, i, n);
|
||||||
}
|
}
|
||||||
if (buffer->str[i] == '\n' || buffer->str[i] == '\r') {
|
if (buffer->str[i] == '\n' || buffer->str[i] == '\r') {
|
||||||
|
|
Loading…
Reference in a new issue