skip sub-blocks (except the 1st) in GFX2MODE GIF extension

That's to be future proof and be able to add more data to this extension
in the future !
This commit is contained in:
Thomas Bernard 2018-12-11 12:45:23 +01:00
parent cdcb4e93da
commit c7e3850b9a
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -4293,8 +4293,16 @@ void Load_GIF(T_IO_Context * context)
label[size_to_read] = '\0';
image_mode = Constraint_mode_from_label(label);
GFX2_Log(GFX2_DEBUG, " mode = %s (%d)\n", label, image_mode);
Read_byte(GIF_file,&size_to_read);
free(label);
Read_byte(GIF_file,&size_to_read);
// be future proof, skip following sub-blocks :
while (size_to_read!=0 && !File_error)
{
if (fseek(GIF_file,size_to_read,SEEK_CUR) < 0)
File_error = 1;
if (!Read_byte(GIF_file,&size_to_read))
File_error = 1;
}
}
}
else
@ -4303,8 +4311,10 @@ void Load_GIF(T_IO_Context * context)
Read_byte(GIF_file,&size_to_read);
while (size_to_read!=0 && !File_error)
{
fseek(GIF_file,size_to_read,SEEK_CUR);
Read_byte(GIF_file,&size_to_read);
if (fseek(GIF_file,size_to_read,SEEK_CUR) < 0)
File_error = 1;
if (!Read_byte(GIF_file,&size_to_read))
File_error = 1;
}
}
}