Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #2584
  • Loading branch information
jeanlf committed Sep 4, 2023
1 parent 895ac12 commit 6914d01
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/scene_manager/loader_bt.c
Expand Up @@ -134,24 +134,31 @@ static GF_Err gf_bt_report(GF_BTParser *parser, GF_Err e, char *format, ...)

void gf_bt_check_line(GF_BTParser *parser)
{
while (1) {
reload_line:
while (parser->line_pos < parser->line_size) {
switch (parser->line_buffer[parser->line_pos]) {
case ' ':
case '\t':
case '\n':
case '\r':
parser->line_pos++;
continue;
case '\0':
parser->line_pos = parser->line_size;
default:
break;
}
break;
}

if (parser->line_buffer[parser->line_pos]=='#') {
parser->line_size = parser->line_pos;
if (parser->line_pos < parser->line_size) {
if (parser->line_buffer[parser->line_pos]=='#') {
parser->line_size = parser->line_pos;
}
else if ((parser->line_buffer[parser->line_pos]=='/') && (parser->line_buffer[parser->line_pos+1]=='/') ) {
parser->line_size = parser->line_pos;
}
}
else if ((parser->line_buffer[parser->line_pos]=='/') && (parser->line_buffer[parser->line_pos+1]=='/') ) parser->line_size = parser->line_pos;

if (parser->line_size == parser->line_pos) {
/*string based input - done*/
Expand Down Expand Up @@ -405,10 +412,15 @@ void gf_bt_check_line(GF_BTParser *parser)
}
}
if (!parser->line_size) {
if (!gf_gzeof(parser->gz_in)) gf_bt_check_line(parser);
else parser->done = 1;
if (!gf_gzeof(parser->gz_in))
//avoid recursion
goto reload_line;
else
parser->done = 1;
}
else if (!parser->done && (parser->line_size == parser->line_pos)) gf_bt_check_line(parser);
else if (!parser->done && (parser->line_size == parser->line_pos))
//avoid recursion
goto reload_line;
}

void gf_bt_force_line(GF_BTParser *parser)
Expand Down

0 comments on commit 6914d01

Please sign in to comment.