From dffa79e225adb8b20fde543455452b88b9d4f089 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 20 Feb 2013 00:57:26 +0000 Subject: [PATCH] --- coders/webp.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/coders/webp.c b/coders/webp.c index 5f20fb77f..398364dac 100644 --- a/coders/webp.c +++ b/coders/webp.c @@ -76,6 +76,40 @@ static MagickBooleanType WriteWEBPImage(const ImageInfo *,Image *,ExceptionInfo *); #endif +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% I s W E B P % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IsWEBP() returns MagickTrue if the image format type, identified by the +% magick string, is WebP. +% +% The format of the IsWEBP method is: +% +% MagickBooleanType IsWEBP(const unsigned char *magick,const size_t length) +% +% A description of each parameter follows: +% +% o magick: compare image format pattern against these bytes. +% +% o length: Specifies the length of the magick string. +% +*/ +static MagickBooleanType IsWEBP(const unsigned char *magick,const size_t length) +{ + if (length < 12) + return(MagickFalse); + if (LocaleNCompare((const char *) magick+8,"WEBP",4) == 0) + return(MagickTrue); + return(MagickFalse); +} + #if defined(MAGICKCORE_WEBP_DELEGATE) /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -253,6 +287,7 @@ ModuleExport size_t RegisterWEBPImage(void) entry->description=ConstantString("WebP Image Format"); entry->adjoin=MagickFalse; entry->module=ConstantString("WEBP"); + entry->magick=(IsImageFormatHandler *) IsWEBP; if (*version != '\0') entry->version=ConstantString(version); (void) RegisterMagickInfo(entry); -- 2.40.0