Merge branch '8.8'

This commit is contained in:
John Cupitt 2019-08-26 11:09:53 +01:00
commit 3aed554fdb
1 changed files with 11 additions and 14 deletions

View File

@ -409,7 +409,7 @@ vips_foreign_load_gif_code_next( VipsForeignLoadGif *gif,
/* Quickly scan an image record.
*/
static int
vips_foreign_load_gif_scan_image_record( VipsForeignLoadGif *gif )
vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );
GifFileType *file = gif->file;
@ -418,6 +418,11 @@ vips_foreign_load_gif_scan_image_record( VipsForeignLoadGif *gif )
GifByteType *extension;
if( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {
vips_foreign_load_gif_error( gif );
return( -1 );
}
/* Check that the frame looks sane. Perhaps giflib checks
* this for us.
*/
@ -613,7 +618,9 @@ vips_foreign_load_gif_set_header( VipsForeignLoadGif *gif, VipsImage *image )
}
/* Attempt to quickly scan a GIF and discover what we need for our header. We
* need to scan the whole file to get n_pages, transparency and colour.
* need to scan the whole file to get n_pages, transparency and colour.
*
* Don't flag errors during header scan. Many GIFs do not follow spec.
*/
static int
vips_foreign_load_gif_header( VipsForeignLoad *load )
@ -631,21 +638,12 @@ vips_foreign_load_gif_header( VipsForeignLoad *load )
gif->n_pages = 0;
do {
/* Don't flag errors during header scan. Some corrupt GIFs
* will fail.
*/
if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR )
continue;
switch( record ) {
case IMAGE_DESC_RECORD_TYPE:
if( DGifGetImageDesc( gif->file ) == GIF_ERROR ) {
vips_foreign_load_gif_error( gif );
return( -1 );
}
if( vips_foreign_load_gif_scan_image_record( gif ) )
return( -1 );
(void) vips_foreign_load_gif_scan_image( gif );
gif->n_pages += 1;
@ -655,8 +653,7 @@ vips_foreign_load_gif_header( VipsForeignLoad *load )
/* We need to fetch the extensions to check for
* cmaps and transparency.
*/
if( vips_foreign_load_gif_scan_extension( gif ) )
return( -1 );
(void) vips_foreign_load_gif_scan_extension( gif );
break;
case TERMINATE_RECORD_TYPE: