From 092d71c02dbd1269ba0ff69be9da446fd2d44082 Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 14 Oct 2011 18:01:29 +0000 Subject: [PATCH] --- Magick++/lib/Image.cpp | 8 +++++--- MagickCore/image.h | 2 -- MagickCore/profile.c | 29 +++++++++++++++++++---------- MagickCore/profile.h | 17 ++--------------- MagickCore/threshold.c | 10 ++++------ MagickCore/threshold.h | 2 +- MagickWand/magick-image.c | 8 +------- MagickWand/magick-property.c | 8 +------- MagickWand/mogrify.c | 6 ++---- MagickWand/operation.c | 10 ++++------ PerlMagick/Magick.xs | 8 ++++---- coders/msl.c | 2 +- 12 files changed, 44 insertions(+), 66 deletions(-) diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 5e12b302b..8f6d69eaf 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -3526,12 +3526,14 @@ void Magick::Image::profile( const std::string name_, const Magick::Blob &profile_ ) { modifyImage(); + ExceptionInfo exceptionInfo; + GetExceptionInfo( &exceptionInfo ); ssize_t result = ProfileImage( image(), name_.c_str(), (unsigned char *)profile_.data(), - profile_.length(), MagickTrue); + profile_.length(), &exceptionInfo); + throwException( exceptionInfo ); + (void) DestroyExceptionInfo( &exceptionInfo ); - if( !result ) - throwImageException(); } // Retrieve a named profile from the image. diff --git a/MagickCore/image.h b/MagickCore/image.h index de79c1eaa..3cdc1a8d4 100644 --- a/MagickCore/image.h +++ b/MagickCore/image.h @@ -313,8 +313,6 @@ struct _Image *ascii85; ProfileInfo - color_profile, - iptc_profile, *generic_profile; char diff --git a/MagickCore/profile.c b/MagickCore/profile.c index 20e8daf90..b33e29ac9 100644 --- a/MagickCore/profile.c +++ b/MagickCore/profile.c @@ -100,6 +100,24 @@ cmsOpenProfileFromMem(profile,length) #endif +/* + Typedef declarations +*/ +struct ProfileInfo +{ + char + *name; + + size_t + length; + + unsigned char + *info; + + size_t + signature; +}; + /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -134,10 +152,6 @@ MagickExport MagickBooleanType CloneImageProfiles(Image *image, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(clone_image != (const Image *) NULL); assert(clone_image->signature == MagickSignature); - image->color_profile.length=clone_image->color_profile.length; - image->color_profile.info=clone_image->color_profile.info; - image->iptc_profile.length=clone_image->iptc_profile.length; - image->iptc_profile.info=clone_image->iptc_profile.info; if (clone_image->profiles != (void *) NULL) image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles, (void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo); @@ -5618,8 +5632,7 @@ static int LCMSExceptionHandler(int severity,const char *message) #endif MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, - const void *datum,const size_t length, - const MagickBooleanType magick_unused(clone)) + const void *datum,const size_t length,ExceptionInfo *exception) { #define ProfileImageTag "Profile/Image" #define ThrowProfileException(severity,tag,context) \ @@ -5631,9 +5644,6 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, ThrowBinaryException(severity,tag,context); \ } - ExceptionInfo - *exception; - MagickBooleanType status; @@ -5645,7 +5655,6 @@ MagickExport MagickBooleanType ProfileImage(Image *image,const char *name, if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(name != (const char *) NULL); - exception=(&image->exception); if ((datum == (const void *) NULL) || (length == 0)) { char diff --git a/MagickCore/profile.h b/MagickCore/profile.h index d7a805174..585843b51 100644 --- a/MagickCore/profile.h +++ b/MagickCore/profile.h @@ -25,19 +25,7 @@ extern "C" { #include "MagickCore/string_.h" typedef struct _ProfileInfo -{ - char - *name; - - size_t - length; - - unsigned char - *info; - - size_t - signature; -} ProfileInfo; + ProfileInfo; typedef enum { @@ -57,8 +45,7 @@ extern MagickExport const StringInfo extern MagickExport MagickBooleanType CloneImageProfiles(Image *,const Image *), DeleteImageProfile(Image *,const char *), - ProfileImage(Image *,const char *,const void *,const size_t, - const MagickBooleanType), + ProfileImage(Image *,const char *,const void *,const size_t,ExceptionInfo *), SetImageProfile(Image *,const char *,const StringInfo *); extern MagickExport StringInfo diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c index 1d81464e0..5cd022b70 100644 --- a/MagickCore/threshold.c +++ b/MagickCore/threshold.c @@ -601,12 +601,14 @@ MagickExport MagickBooleanType BlackThresholdImage(Image *image, % % The format of the ClampImage method is: % -% MagickBooleanType ClampImage(Image *image) +% MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % +% o exception: return any errors or warnings in this structure. +% */ static inline Quantum ClampToUnsignedQuantum(const Quantum quantum) @@ -622,16 +624,13 @@ static inline Quantum ClampToUnsignedQuantum(const Quantum quantum) #endif } -MagickExport MagickBooleanType ClampImage(Image *image) +MagickExport MagickBooleanType ClampImage(Image *image,ExceptionInfo *exception) { #define ClampImageTag "Clamp/Image" CacheView *image_view; - ExceptionInfo - *exception; - MagickBooleanType status; @@ -669,7 +668,6 @@ MagickExport MagickBooleanType ClampImage(Image *image) */ status=MagickTrue; progress=0; - exception=(&image->exception); image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(dynamic,4) shared(progress,status) diff --git a/MagickCore/threshold.h b/MagickCore/threshold.h index 0fe13c36f..c99d4b69c 100644 --- a/MagickCore/threshold.h +++ b/MagickCore/threshold.h @@ -36,7 +36,7 @@ extern MagickExport ThresholdMap extern MagickExport MagickBooleanType BilevelImage(Image *,const double), BlackThresholdImage(Image *,const char *,ExceptionInfo *), - ClampImage(Image *), + ClampImage(Image *,ExceptionInfo *), ListThresholdMaps(FILE *,ExceptionInfo *), OrderedPosterizeImage(Image *,const char *,ExceptionInfo *), RandomThresholdImage(Image *,const char *,ExceptionInfo *), diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index f4a69df11..21bdf0c7d 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -1197,19 +1197,13 @@ WandExport MagickBooleanType MagickChopImage(MagickWand *wand, */ WandExport MagickBooleanType MagickClampImage(MagickWand *wand) { - MagickBooleanType - status; - assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - status=ClampImage(wand->images); - if (status == MagickFalse) - InheritException(wand->exception,&wand->images->exception); - return(status); + return(ClampImage(wand->images,wand->exception)); } /* diff --git a/MagickWand/magick-property.c b/MagickWand/magick-property.c index e24b5e26c..88e46771d 100644 --- a/MagickWand/magick-property.c +++ b/MagickWand/magick-property.c @@ -1725,19 +1725,13 @@ WandExport const char *MagickGetVersion(size_t *version) WandExport MagickBooleanType MagickProfileImage(MagickWand *wand, const char *name,const void *profile,const size_t length) { - MagickBooleanType - status; - assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); - status=ProfileImage(wand->images,name,profile,length,MagickTrue); - if (status == MagickFalse) - InheritException(wand->exception,&wand->images->exception); - return(status); + return(ProfileImage(wand->images,name,profile,length,wand->exception)); } /* diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index be5d208fe..329a17b05 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -1050,8 +1050,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, Clamp image. */ (void) SyncImageSettings(mogrify_info,*image); - (void) ClampImage(*image); - InheritException(exception,&(*image)->exception); + (void) ClampImage(*image,exception); break; } if (LocaleCompare("clip",option+1) == 0) @@ -2338,8 +2337,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, Remove a profile from the image. */ (void) ProfileImage(*image,argv[i+1],(const unsigned char *) - NULL,0,MagickTrue); - InheritException(exception,&(*image)->exception); + NULL,0,exception); break; } /* diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 9ac35816e..1e870ad35 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -1870,8 +1870,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, if (LocaleCompare("clamp",argv[0]+1) == 0) { (void) SyncImageSettings(image_info,*image); - (void) ClampImage(*image); - InheritException(exception,&(*image)->exception); + (void) ClampImage(*image,exception); break; } if (LocaleCompare("clip",argv[0]+1) == 0) @@ -3029,8 +3028,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, Remove a profile from the image. */ (void) ProfileImage(*image,argv[1],(const unsigned char *) - NULL,0,MagickTrue); - InheritException(exception,&(*image)->exception); + NULL,0,exception); break; } /* @@ -3055,7 +3053,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, { (void) ProfileImage(*image,profile_info->magick, GetStringInfoDatum(profile),(size_t) - GetStringInfoLength(profile),MagickFalse); + GetStringInfoLength(profile),exception); profile=DestroyStringInfo(profile); } profile_info=DestroyImageInfo(profile_info); @@ -3068,7 +3066,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, profile=GetImageProfile(profile_image,name); if (profile != (StringInfo *) NULL) (void) ProfileImage(*image,name,GetStringInfoDatum(profile), - (size_t) GetStringInfoLength(profile),MagickFalse); + (size_t) GetStringInfoLength(profile),exception); name=GetNextImageProfile(profile_image); } profile_image=DestroyImage(profile_image); diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 2725a4923..c7b4f018e 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -9300,7 +9300,7 @@ Mogrify(ref,...) Remove a profile from the image. */ (void) ProfileImage(image,name,(const unsigned char *) NULL,0, - MagickTrue); + exception); break; } /* @@ -9310,7 +9310,7 @@ Mogrify(ref,...) SetStringInfoDatum(profile,(const unsigned char *) argument_list[1].string_reference); (void) ProfileImage(image,name,GetStringInfoDatum(profile), - (size_t) GetStringInfoLength(profile),MagickFalse); + (size_t) GetStringInfoLength(profile),exception); profile=DestroyStringInfo(profile); break; } @@ -9333,7 +9333,7 @@ Mogrify(ref,...) profile=GetImageProfile(profile_image,name); if (profile != (const StringInfo *) NULL) (void) ProfileImage(image,name,GetStringInfoDatum(profile), - (size_t) GetStringInfoLength(profile),MagickFalse); + (size_t) GetStringInfoLength(profile),exception); name=GetNextImageProfile(profile_image); } profile_image=DestroyImage(profile_image); @@ -10645,7 +10645,7 @@ Mogrify(ref,...) if (attribute_flag[0] != 0) channel=(ChannelType) argument_list[0].integer_reference; channel_mask=SetPixelChannelMask(image,channel); - (void) ClampImage(image); + (void) ClampImage(image,exception); (void) SetPixelChannelMask(image,channel_mask); break; } diff --git a/coders/msl.c b/coders/msl.c index d1190c3da..7991ab01e 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -4361,7 +4361,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, Remove a profile from the image. */ (void) ProfileImage(msl_info->image[n],keyword, - (const unsigned char *) NULL,0,MagickTrue); + (const unsigned char *) NULL,0,&exception); continue; } /* -- 2.40.0