- switch(record_type)
- {
- case IMAGE_DESC_RECORD_TYPE:
- {
- if(DGifGetImageDesc(gif_file) == GIF_ERROR)
- {
- eprintf("FileGIF::read_frame %d: %s\n", __LINE__, GifErrorString());
- break;
- }
-
- int row = gif_file->Image.Top;
- int col = gif_file->Image.Left;
- int width = gif_file->Image.Width;
- int height = gif_file->Image.Height;
- if(gif_file->Image.Left + gif_file->Image.Width > gif_file->SWidth ||
- gif_file->Image.Top + gif_file->Image.Height > gif_file->SHeight)
- {
- DGifCloseFile(gif_file GIF_ERR);
- for(int k = 0; k < gif_file->SHeight; k++)
- {
- free(gif_buffer[k]);
- }
- free(gif_buffer);
- return 1;
- }
-
- if (gif_file->Image.Interlace)
- {
- static int InterlacedOffset[] = { 0, 4, 2, 1 };
- static int InterlacedJumps[] = { 8, 8, 4, 2 };
+ switch( record_type ) {
+ case IMAGE_DESC_RECORD_TYPE: {
+ if( DGifGetImageDesc(gif_file) == GIF_ERROR ) {
+ eprintf("FileGIF::read_frame %d: %s\n", __LINE__, GifErrorString(gif_err));
+ break;
+ }
+ int row = gif_file->Image.Top;
+ int col = gif_file->Image.Left;
+ int width = gif_file->Image.Width;
+ int height = gif_file->Image.Height;
+ int ret = 0;
+ if( gif_file->Image.Left + gif_file->Image.Width > gif_file->SWidth ||
+ gif_file->Image.Top + gif_file->Image.Height > gif_file->SHeight )
+ ret = 1;
+ if( !ret && gif_file->Image.Interlace ) {
+ static int InterlacedOffset[] = { 0, 4, 2, 1 };
+ static int InterlacedJumps[] = { 8, 8, 4, 2 };