From dc8555201d3794dafbf6854f04090c4c98f9090e Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 8 Jun 2019 17:13:49 +0100 Subject: [PATCH] use our sniffer as well is ismagick() We need to check files for magickload with our sniffer as well as the imagemagick one. --- libvips/foreign/magick.c | 7 +++++-- libvips/foreign/magick.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libvips/foreign/magick.c b/libvips/foreign/magick.c index 367a4ba5..75590f22 100644 --- a/libvips/foreign/magick.c +++ b/libvips/foreign/magick.c @@ -644,13 +644,16 @@ magick_set_magick_profile( Image *image, /* Does a few bytes look like a file IM can handle? */ gboolean -magick_ismagick( const unsigned char *buf, size_t length ) +magick_ismagick( const unsigned char *bytes, size_t length ) { char format[MagickPathExtent]; magick_genesis(); - return( GetImageMagick( buf, length, format ) ); + /* Try with our custom sniffers first. + */ + return( magick_sniff( bytes, length ) || + GetImageMagick( bytes, length, format ) ); } #endif /*HAVE_MAGICK*/ diff --git a/libvips/foreign/magick.h b/libvips/foreign/magick.h index 9c9be67d..05304134 100644 --- a/libvips/foreign/magick.h +++ b/libvips/foreign/magick.h @@ -84,6 +84,6 @@ int magick_set_vips_profile( VipsImage *im, Image *image ); int magick_set_magick_profile( Image *image, VipsImage *im, ExceptionInfo *exception ); -gboolean magick_ismagick( const unsigned char *buf, size_t length ); +gboolean magick_ismagick( const unsigned char *bytes, size_t length ); #endif /*HAVE_MAGICK6*/