From: cristy Date: Tue, 5 Feb 2013 18:44:04 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~4293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e323674c9d45d10365849e4cee6db17b9d0935b;p=imagemagick --- diff --git a/MagickCore/version.c b/MagickCore/version.c index dc32a6c41..712805838 100644 --- a/MagickCore/version.c +++ b/MagickCore/version.c @@ -350,7 +350,35 @@ static unsigned int CRC32(const unsigned char *message,const size_t length) MagickExport unsigned int GetMagickSignature(const StringInfo *nonce) { - return(0); + register unsigned char + *p; + + StringInfo + *version; + + unsigned int + signature; + + version=AcquireStringInfo(MaxTextExtent); + p=GetStringInfoDatum(version); + signature=MagickLibVersion; + (void) memcpy(p,&signature,sizeof(signature)); + p+=sizeof(signature); + signature=MAGICKCORE_QUANTUM_DEPTH; + (void) memcpy(p,&signature,sizeof(signature)); + p+=sizeof(signature); + signature=MAGICKCORE_HDRI_ENABLE; + (void) memcpy(p,&signature,sizeof(signature)); + p+=sizeof(signature); + signature=1; /* endianess */ + (void) memcpy(p,&signature,sizeof(signature)); + p+=sizeof(signature); + SetStringInfoLength(version,p-GetStringInfoDatum(version)); + if (nonce != (const StringInfo *) NULL) + ConcatenateStringInfo(version,nonce); + signature=CRC32(GetStringInfoDatum(version),GetStringInfoLength(version)); + version=DestroyStringInfo(version); + return(signature); } /* diff --git a/coders/mpc.c b/coders/mpc.c index 88ffa2d8f..0f0c0d22d 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -177,8 +177,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) size_t depth, - length, - quantum_depth; + length; ssize_t count; @@ -186,6 +185,9 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) StringInfo *profile; + unsigned int + signature; + /* Open image file. */ @@ -222,7 +224,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) profiles=(LinkedListInfo *) NULL; length=MaxTextExtent; options=AcquireString((char *) NULL); - quantum_depth=MAGICKCORE_QUANTUM_DEPTH; + signature=GetMagickSignature((const StringInfo *) NULL); image->depth=8; image->compression=NoCompression; while ((isgraph(c) != MagickFalse) && (c != (int) ':')) @@ -605,11 +607,6 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) image->quality=StringToUnsignedLong(options); break; } - if (LocaleCompare(keyword,"quantum-depth") == 0) - { - quantum_depth=StringToUnsignedLong(options); - break; - } (void) SetImageProperty(image,keyword,options,exception); break; } @@ -661,6 +658,11 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) image->scene=StringToUnsignedLong(options); break; } + if (LocaleCompare(keyword,"signature") == 0) + { + signature=(unsigned int) StringToUnsignedLong(options); + break; + } (void) SetImageProperty(image,keyword,options,exception); break; } @@ -752,8 +754,8 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) (image->compression == UndefinedCompression) || (image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); - if (quantum_depth != MAGICKCORE_QUANTUM_DEPTH) - ThrowReaderException(CacheError,"InconsistentPersistentCacheDepth"); + if (signature != GetMagickSignature((const StringInfo *) NULL)) + ThrowReaderException(CacheError,"IncompatibleAPI"); if (image->montage != (char *) NULL) { register char @@ -1091,8 +1093,8 @@ static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image, (image->colors > (one << depth))) image->storage_class=DirectClass; (void) WriteBlobString(image,"id=MagickCache\n"); - (void) FormatLocaleString(buffer,MaxTextExtent,"quantum-depth=%d\n", - MAGICKCORE_QUANTUM_DEPTH); + (void) FormatLocaleString(buffer,MaxTextExtent,"signature=%u\n", + GetMagickSignature((const StringInfo *) NULL)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, "class=%s colors=%.20g alpha-trait=%s\n",CommandOptionToMnemonic( diff --git a/config/english.xml b/config/english.xml index 52c1fd2ff..2a0532f81 100644 --- a/config/english.xml +++ b/config/english.xml @@ -38,8 +38,8 @@ cache resources exhausted - - inconsistent persistent cache depth + + incompatible API no pixels defined in cache diff --git a/config/francais.xml b/config/francais.xml index 465f9a65c..ffdb388fc 100644 --- a/config/francais.xml +++ b/config/francais.xml @@ -38,8 +38,8 @@ Ressources du cache épuisées - - profondeur du cache persistant inconsistante + + incompatible API pas de pixels définis dans le cache