Fix processing of comment lines in .GPL files

Gimp palette files
This commit is contained in:
Thomas Bernard 2019-09-16 01:10:30 +02:00
parent dc8f42a5f2
commit 21f111eef7

View File

@ -185,11 +185,25 @@ void Load_GPL(T_IO_Context * context)
Read_byte_line(file, buffer, sizeof(buffer)); Read_byte_line(file, buffer, sizeof(buffer));
/// @todo set grafx2 columns setting to match. /// @todo set grafx2 columns setting to match.
// #<newline> // #<newline>
if (!Read_byte_line(file, buffer, sizeof(buffer)))
return;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
for (;;)
{
// skip comments
int c = getc(file);
if (c == '#')
{
if (!Read_byte_line(file, buffer, sizeof(buffer)))
return;
GFX2_Log(GFX2_DEBUG, "comment: %s", buffer);
}
else
{
fseek(file, -1, SEEK_CUR);
break;
}
}
skip_padding(file, 32); skip_padding(file, 32);
if (fscanf(file, "%d", &r) != 1) if (fscanf(file, "%d", &r) != 1)
break; break;