]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 14 Oct 2011 18:01:29 +0000 (18:01 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 14 Oct 2011 18:01:29 +0000 (18:01 +0000)
12 files changed:
Magick++/lib/Image.cpp
MagickCore/image.h
MagickCore/profile.c
MagickCore/profile.h
MagickCore/threshold.c
MagickCore/threshold.h
MagickWand/magick-image.c
MagickWand/magick-property.c
MagickWand/mogrify.c
MagickWand/operation.c
PerlMagick/Magick.xs
coders/msl.c

index 5e12b302b13b07d6c102f3b50cb648b9ae0bcdd1..8f6d69eaf633e409637fd59e66f329c6f430a4a3 100644 (file)
@@ -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.
index de79c1eaa1d706f73663404422de69aab5a1f444..3cdc1a8d47b109da221cf5eab27036570b38d779 100644 (file)
@@ -313,8 +313,6 @@ struct _Image
     *ascii85;
 
   ProfileInfo
-    color_profile,
-    iptc_profile,
     *generic_profile;
 
   char
index 20e8daf905fc9dd7d8f48e98e293141180c6c906..b33e29ac906c91e6e85e9986df8de5ceffac0302 100644 (file)
   cmsOpenProfileFromMem(profile,length)
 #endif
 \f
+/*
+  Typedef declarations
+*/
+struct ProfileInfo
+{
+  char
+    *name;
+
+  size_t
+    length;
+
+  unsigned char
+    *info;
+
+  size_t
+    signature;
+};
+\f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -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
index d7a80517460b95222e29ec63b5a3ed08c5146c9f..585843b510ea799f7d349090b3455b0a6f5ea9b4 100644 (file)
@@ -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
index 1d81464e05160ffa7beab87a51c61e228722e5eb..5cd022b704286f75921c5a8007d3e3749541d4ce 100644 (file)
@@ -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)
index 0fe13c36f15a3f58ae4aada15259e359c28c91a9..c99d4b69caf433b8caadea56b930f2ddd21c4479 100644 (file)
@@ -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 *),
index f4a69df110785058836a1e86586c45e35093615a..21bdf0c7d8efdb2a98a3e567a050826371c07e41 100644 (file)
@@ -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));
 }
 \f
 /*
index e24b5e26cc184154cbadc906948c97c47561adc4..88e46771d42504452a818bcb9e9709cc7751eb3c 100644 (file)
@@ -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));
 }
 \f
 /*
index be5d208fe51fdc6dc73279fb7f1e7e7b8b39e752..329a17b055a6ba67147607f57d3df9624a975369 100644 (file)
@@ -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;
               }
             /*
index 9ac35816eecdb316cd10e9b9766476372edf1286..1e870ad355b24ac9ec993cd25e64b32ec9afba7b 100644 (file)
@@ -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);
index 2725a492305e99c1353f72c6b8a5b385bd263535..c7b4f018eda421c117dac64e1ca7ede0dc4988a5 100644 (file)
@@ -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;
         }
index d1190c3daa2a1ee7bd0258f5628ca55e6d05a924..7991ab01e1c067bfe5070f7bee13031b10281793 100644 (file)
@@ -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;
                 }
               /*