]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 5 Nov 2011 02:15:45 +0000 (02:15 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 5 Nov 2011 02:15:45 +0000 (02:15 +0000)
19 files changed:
MagickCore/colorspace.c
MagickCore/display.c
MagickCore/draw.c
MagickCore/enhance.c
MagickCore/image.c
MagickCore/morphology.c
MagickCore/property.c
MagickCore/resize.c
MagickCore/resource.c
MagickCore/static.c
MagickCore/static.h
MagickCore/string-private.h
MagickWand/compare.c
MagickWand/mogrify.c
MagickWand/montage.c
MagickWand/operation.c
PerlMagick/Magick.xs
coders/mpc.c
coders/msl.c

index 84e5cd64e21f609d460ac835718e7302b66e7aaf..f4aa655c1896dd6e6c281416adf8f173c90a1935 100644 (file)
@@ -619,8 +619,8 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image,
       gamma=DisplayGamma;
       value=GetImageProperty(image,"gamma",exception);
       if (value != (const char *) NULL)
-        gamma=1.0/fabs(StringToDouble(value,(char **) NULL)) >=
-          MagickEpsilon ? StringToDouble(value,(char **) NULL) : 1.0;
+        gamma=1.0/fabs(StringToDouble(value,(char **) NULL)) >= MagickEpsilon ?
+          StringToDouble(value,(char **) NULL) : 1.0;
       film_gamma=FilmGamma;
       value=GetImageProperty(image,"film-gamma",exception);
       if (value != (const char *) NULL)
index 408251c574b0a9c6d5ac8a6df289fc45beca7e57..c924544e9efd7c92349e0747a1e2dc93dd91cf29 100644 (file)
@@ -3553,7 +3553,8 @@ static MagickBooleanType XColorEditImage(Display *display,
             if (*fuzz == '\0')
               break;
             (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
-            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0);
+            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+              1.0);
             break;
           }
           case ColorEditUndoCommand:
@@ -8310,7 +8311,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=StringToDoubleInterval(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       (void) BilevelImage(*image,threshold,exception);
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
@@ -8512,7 +8513,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=StringToDoubleInterval(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       sepia_image=SepiaToneImage(*image,threshold,exception);
       if (sepia_image != (Image *) NULL)
         {
@@ -8547,7 +8548,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=StringToDoubleInterval(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       (void) SolarizeImage(*image,threshold,exception);
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
@@ -9874,7 +9875,8 @@ static MagickBooleanType XMatteEditImage(Display *display,
             if (*fuzz == '\0')
               break;
             (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
-            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0);
+            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+              1.0);
             break;
           }
           case MatteEditValueCommand:
index 7ba5d516b9a632242f7a4953f404fbcb8596bd95..9ad24219d25837f980720786f77c6c656017362b 100644 (file)
@@ -2041,8 +2041,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
         if (LocaleCompare("font-size",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->pointsize=StringToDouble(token,
-              (char **) NULL);
+            graphic_context[n]->pointsize=StringToDouble(token,(char **) NULL);
             break;
           }
         if (LocaleCompare("font-stretch",keyword) == 0)
@@ -2156,8 +2155,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
         if (LocaleCompare("kerning",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->kerning=StringToDouble(token,
-              (char **) NULL);
+            graphic_context[n]->kerning=StringToDouble(token,(char **) NULL);
             break;
           }
         status=MagickFalse;
@@ -2359,13 +2357,13 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                 GetMagickToken(q,&q,token);
                 (void) CopyMagickString(name,token,MaxTextExtent);
                 GetMagickToken(q,&q,token);
-                bounds.x=(ssize_t) ceil(StringToDouble(token,
-                  (char **) NULL)-0.5);
+                bounds.x=(ssize_t) ceil(StringToDouble(token,(char **) NULL)-
+                  0.5);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
-                bounds.y=(ssize_t) ceil(StringToDouble(token,
-                  (char **) NULL)-0.5);
+                bounds.y=(ssize_t) ceil(StringToDouble(token,(char **) NULL)-
+                  0.5);
                 GetMagickToken(q,&q,token);
                 if (*token == ',')
                   GetMagickToken(q,&q,token);
@@ -2557,8 +2555,8 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
                   GetMagickToken(q,&q,token);
                   if (*token == ',')
                     GetMagickToken(q,&q,token);
-                  graphic_context[n]->dash_pattern[j]=StringToDouble(
-                    token,(char **) NULL);
+                  graphic_context[n]->dash_pattern[j]=StringToDouble(token,
+                    (char **) NULL);
                 }
                 if ((x & 0x01) != 0)
                   for ( ; j < (2*x); j++)
@@ -2695,23 +2693,23 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info,
         if (LocaleCompare("viewbox",keyword) == 0)
           {
             GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.x=(ssize_t) ceil(StringToDouble(
-              token,(char **) NULL)-0.5);
+            graphic_context[n]->viewbox.x=(ssize_t) ceil(StringToDouble(token,
+              (char **) NULL)-0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.y=(ssize_t) ceil(StringToDouble(
-              token,(char **) NULL)-0.5);
+            graphic_context[n]->viewbox.y=(ssize_t) ceil(StringToDouble(token,
+              (char **) NULL)-0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.width=(size_t) floor(
-              StringToDouble(token,(char **) NULL)+0.5);
+            graphic_context[n]->viewbox.width=(size_t) floor(StringToDouble(
+              token,(char **) NULL)+0.5);
             GetMagickToken(q,&q,token);
             if (*token == ',')
               GetMagickToken(q,&q,token);
-            graphic_context[n]->viewbox.height=(size_t) floor(
-              StringToDouble(token,(char **) NULL)+0.5);
+            graphic_context[n]->viewbox.height=(size_t) floor(StringToDouble(
+              token,(char **) NULL)+0.5);
             break;
           }
         status=MagickFalse;
@@ -4786,12 +4784,10 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info)
         draw_info->kerning=StringToDouble(option,(char **) NULL);
       option=GetImageOption(image_info,"interline-spacing");
       if (option != (const char *) NULL)
-        draw_info->interline_spacing=StringToDouble(option,
-          (char **) NULL);
+        draw_info->interline_spacing=StringToDouble(option,(char **) NULL);
       option=GetImageOption(image_info,"interword-spacing");
       if (option != (const char *) NULL)
-        draw_info->interword_spacing=StringToDouble(option,
-          (char **) NULL);
+        draw_info->interword_spacing=StringToDouble(option,(char **) NULL);
       option=GetImageOption(image_info,"direction");
       if (option != (const char *) NULL)
         draw_info->direction=(DirectionType) ParseCommandOption(
index 5514776bbbc4616eb73e11d67cc4a8e23782557c..fe9ef9adabad26d0835e49465f9356fc2b9817c2 100644 (file)
@@ -573,8 +573,7 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image,
             {
               case 0:
               {
-                color_correction.red.slope=StringToDouble(token,
-                  (char **) NULL);
+                color_correction.red.slope=StringToDouble(token,(char **) NULL);
                 break;
               }
               case 1:
@@ -639,8 +638,7 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image,
             {
               case 0:
               {
-                color_correction.red.power=StringToDouble(token,
-                  (char **) NULL);
+                color_correction.red.power=StringToDouble(token,(char **) NULL);
                 break;
               }
               case 1:
index e6c30558a00b06daef4813e926c2e551aee3f6ab..f7f9d1cbd6ee3efb681594a9eb86efd384b1a8a4 100644 (file)
@@ -4130,7 +4130,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info,
       exception);
   option=GetImageOption(image_info,"bias");
   if (option != (const char *) NULL)
-    image->bias=StringToDoubleInterval(option,QuantumRange);
+    image->bias=StringToDoubleInterval(option,(double) QuantumRange+1.0);
   option=GetImageOption(image_info,"black-point-compensation");
   if (option != (const char *) NULL)
     image->black_point_compensation=(MagickBooleanType) ParseCommandOption(
index 743ce7040e2a81c9230825800ac33e66c3fbd410..462b1f335194a638e8d0088df68df4a8225b62b3 100644 (file)
@@ -331,7 +331,7 @@ static KernelInfo *ParseKernelArray(const char *kernel_string)
       kernel->values[i] = nan; /* do not include this value in kernel */
     }
     else {
-      kernel->values[i] = StringToDouble(token,(char **) NULL);
+      kernel->values[i]=StringToDouble(token,(char **) NULL);
       ( kernel->values[i] < 0)
           ?  ( kernel->negative_range += kernel->values[i] )
           :  ( kernel->positive_range += kernel->values[i] );
index ce4a5f11bc8ae001fdd99264cf564a32f79740c6..1944be2b164e981e3be08012cbf550c93f8a3594 100644 (file)
@@ -3200,7 +3200,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
         }
       if (LocaleCompare(property,"bias") == 0)
         {
-          image->bias=StringToDoubleInterval(value,QuantumRange);
+          image->bias=StringToDoubleInterval(value,(double) QuantumRange+1.0);
           break;
         }
       status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
index f9c59be9fcff26247a5d7a12fce981c9da9c22b4..485209d47f388abf56b9855cbc5ccf9addad954d 100644 (file)
@@ -973,8 +973,7 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image,
     }
   artifact=GetImageArtifact(image,"filter:support");
   if (artifact != (const char *) NULL)
-    resize_filter->support=fabs(StringToDouble(artifact,
-      (char **) NULL)); /* override support */
+    resize_filter->support=fabs(StringToDouble(artifact,(char **) NULL)); /* override support */
   /*
     Scale windowing function separately to the support 'clipping' window that
     calling operator is planning to actually use (expert override).
@@ -982,8 +981,7 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image,
   resize_filter->window_support=resize_filter->support; /* default */
   artifact=GetImageArtifact(image,"filter:win-support");
   if (artifact != (const char *) NULL)
-    resize_filter->window_support=fabs(StringToDouble(artifact,
-      (char **) NULL));
+    resize_filter->window_support=fabs(StringToDouble(artifact,(char **) NULL));
   /*
     Adjust window function scaling to match windowing support for weighting
     function.  This avoids a division on every filter call.
index b92e205c05af361c2d555fb97649d0ac1a9c0ee4..f095032f3e490a5cc0fc2fb5555461449cce0950 100644 (file)
@@ -899,7 +899,7 @@ static inline MagickSizeType StringToSizeType(const char *string,
   double
     value;
 
-  value=StringToDoubleInterval(string,interval);
+  value=SiPrefixToDoubleInterval(string,interval);
   if (value >= (double) MagickULLConstant(~0))
     return(MagickULLConstant(~0));
   return((MagickSizeType) value);
index b0f311d3d35cd6a3970675449c493fc33b637ac7..9ef564c851d927477f6506e35a14e574b0f387a5 100644 (file)
@@ -247,9 +247,6 @@ MagickExport void RegisterStaticModules(void)
   (void) RegisterNULLImage();
   (void) RegisterOTBImage();
   (void) RegisterPALMImage();
-#if defined(MAGICKCORE_PANGO_DELEGATE)
-  (void) RegisterPANGOImage();
-#endif
   (void) RegisterPATTERNImage();
   (void) RegisterPCDImage();
   (void) RegisterPCLImage();
@@ -425,9 +422,6 @@ MagickExport void UnregisterStaticModules(void)
   UnregisterNULLImage();
   UnregisterOTBImage();
   UnregisterPALMImage();
-#if defined(MAGICKCORE_PANGO_DELEGATE)
-  UnregisterPANGOImage();
-#endif
   UnregisterPATTERNImage();
   UnregisterPCDImage();
   UnregisterPCLImage();
index 8888d020961ad8dd29edc03cf93d13a1ebeb70d6..fb412eb0a3c384db6087178af984f1c4018f9690 100644 (file)
@@ -107,7 +107,6 @@ extern ModuleExport size_t
   RegisterPBMImage(void),
   RegisterOTBImage(void),
   RegisterPALMImage(void),
-  RegisterPANGOImage(void),
   RegisterPATTERNImage(void),
   RegisterPCDImage(void),
   RegisterPCDSImage(void),
@@ -262,7 +261,6 @@ extern ModuleExport void
   UnregisterPBMImage(void),
   UnregisterOTBImage(void),
   UnregisterPALMImage(void),
-  UnregisterPANGOImage(void),
   UnregisterPATTERNImage(void),
   UnregisterPCDImage(void),
   UnregisterPCDSImage(void),
index 8c99324e24460222180f2bfd2d033abe56970e5b..b8948c85fd90983b9e4ff5da699c0456b2f700b1 100644 (file)
@@ -24,6 +24,21 @@ extern "C" {
 
 #include <MagickCore/locale_.h>
 
+static inline double SiPrefixToDoubleInterval(const char *string,
+  const double interval)
+{
+  char
+    *q;
+
+  double
+    value;
+
+  value=InterpretSiPrefixValue(string,&q);
+  if (*q == '%')
+    value*=interval/100.0;
+  return(value);
+}
+
 static inline double StringToDouble(const char *restrict string,
   char **restrict sentinal)
 {
@@ -39,7 +54,7 @@ static inline double StringToDoubleInterval(const char *string,
   double
     value;
 
-  value=InterpretSiPrefixValue(string,&q);
+  value=InterpretLocaleValue(string,&q);
   if (*q == '%')
     value*=interval/100.0;
   return(value);
index 481b38ede9003998e2bedebd05b3560bcdcc5f24..a665d7fba7bd3eb252c13d36c7802406a67f743f 100644 (file)
@@ -529,8 +529,7 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info,
             if (*option == '+')
               dissimilarity_threshold=DefaultDissimilarityThreshold;
             else
-              dissimilarity_threshold=StringToDouble(argv[i],
-                (char **) NULL);
+              dissimilarity_threshold=StringToDouble(argv[i],(char **) NULL);
             break;
           }
         if (LocaleCompare("duration",option+1) == 0)
index d002e861b8bc417b34ce3f1ef7dc2c13342cc17f..ed786652c43bf91a38670e77ae1f2b61ee01bf71 100644 (file)
@@ -1309,7 +1309,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if (*option == '+')
               threshold=40.0*QuantumRange/100.0;
             else
-              threshold=StringToDoubleInterval(argv[i+1],QuantumRange);
+              threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+
+                1.0);
             mogrify_image=DeskewImage(*image,threshold,exception);
             break;
           }
@@ -1507,7 +1508,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             (void) SyncImageSettings(mogrify_info,*image,exception);
             op=(MagickEvaluateOperator) ParseCommandOption(
               MagickEvaluateOptions,MagickFalse,argv[i+1]);
-            constant=StringToDoubleInterval(argv[i+2],QuantumRange);
+            constant=StringToDoubleInterval(argv[i+2],(double) QuantumRange+
+              1.0);
             (void) EvaluateImage(*image,op,constant,exception);
             break;
           }
@@ -1978,8 +1980,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
           }
         if (LocaleCompare("linewidth",option+1) == 0)
           {
-            draw_info->stroke_width=StringToDouble(argv[i+1],
-              (char **) NULL);
+            draw_info->stroke_width=StringToDouble(argv[i+1],(char **) NULL);
             break;
           }
         if (LocaleCompare("liquid-rescale",option+1) == 0)
@@ -2618,7 +2619,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               Sepia-tone image.
             */
             (void) SyncImageSettings(mogrify_info,*image,exception);
-            threshold=StringToDoubleInterval(argv[i+1],QuantumRange);
+            threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+
+              1.0);
             mogrify_image=SepiaToneImage(*image,threshold,exception);
             break;
           }
@@ -2782,7 +2784,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               threshold;
 
             (void) SyncImageSettings(mogrify_info,*image,exception);
-            threshold=StringToDoubleInterval(argv[i+1],QuantumRange);
+            threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+
+              1.0);
             (void) SolarizeImage(*image,threshold,exception);
             break;
           }
@@ -2888,8 +2891,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
           }
         if (LocaleCompare("strokewidth",option+1) == 0)
           {
-            draw_info->stroke_width=StringToDouble(argv[i+1],
-              (char **) NULL);
+            draw_info->stroke_width=StringToDouble(argv[i+1],(char **) NULL);
             break;
           }
         if (LocaleCompare("style",option+1) == 0)
@@ -2930,7 +2932,8 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
             if (*option == '+')
               threshold=(double) QuantumRange/2;
             else
-              threshold=StringToDoubleInterval(argv[i+1],QuantumRange);
+              threshold=StringToDoubleInterval(argv[i+1],(double) QuantumRange+
+                1.0);
             (void) BilevelImage(*image,threshold,exception);
             break;
           }
@@ -6247,7 +6250,8 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
 
             limit=MagickResourceInfinity;
             if (LocaleCompare("unlimited",argv[i+1]) != 0)
-              limit=(MagickSizeType) StringToDoubleInterval(argv[i+1],100.0);
+              limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+1],
+                100.0);
             (void) SetMagickResourceLimit(MemoryResource,limit);
             (void) SetMagickResourceLimit(MapResource,2*limit);
             break;
@@ -6653,7 +6657,8 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
               MagickFalse,argv[i+1]);
             limit=MagickResourceInfinity;
             if (LocaleCompare("unlimited",argv[i+2]) != 0)
-              limit=(MagickSizeType) StringToDoubleInterval(argv[i+2],100.0);
+              limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+2],
+                100.0);
             (void) SetMagickResourceLimit(type,limit);
             break;
           }
index 1995b1d5447ca3a2a17dbdf1f5b50b0b5bf3a130..befab247cd77c141c8dc7ebf774694c4d416c4a7 100644 (file)
@@ -1282,8 +1282,7 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info,
               ThrowMontageException(OptionError,"MissingArgument",option);
             if (IsGeometry(argv[i]) == MagickFalse)
               ThrowMontageInvalidArgumentException(option,argv[i]);
-            montage_info->pointsize=StringToDouble(argv[i],
-              (char **) NULL);
+            montage_info->pointsize=StringToDouble(argv[i],(char **) NULL);
             break;
           }
         if (LocaleCompare("polaroid",option+1) == 0)
index 8881e165d1cf3ddab82cd834868abd8c4ce4d352..8984b2016d026f4f73c174a92cb56dfda145401a 100644 (file)
@@ -557,15 +557,15 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare("unlimited",arg) != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(arg,100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(arg,100.0);
           (void) SetMagickResourceLimit(MemoryResource,limit);
           (void) SetMagickResourceLimit(MapResource,2*limit);
           break;
         }
       if (LocaleCompare("caption",option) == 0)
         {
-          (void) SetImageOption(image_info,option,
-               IfSetOption ? arg : (const char*)NULL);
+          (void) SetImageOption(image_info,option,IfSetOption ? arg :
+            (const char*)NULL);
           break;
         }
       if (LocaleCompare("channel",option) == 0)
@@ -832,7 +832,8 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
           */
           if (IfSetOption)
             {
-              image_info->fuzz=StringToDoubleInterval(arg,(double) QuantumRange+1.0);
+              image_info->fuzz=StringToDoubleInterval(arg,(double) QuantumRange+
+                1.0);
               (void) SetImageOption(image_info,option,arg);
               break;
             }
@@ -901,8 +902,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
 
           value = IfSetOption ? arg : "0"; /* undefined? */
           (void) SetImageOption(image_info,option, value);
-          draw_info->interline_spacing=StringToDouble(value,
-               (char **) NULL);
+          draw_info->interline_spacing=StringToDouble(value,(char **) NULL);
           break;
         }
       if (LocaleCompare("interpolate",option) == 0)
@@ -922,8 +922,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
 
           value = IfSetOption ? arg : "0"; /* undefined? */
           (void) SetImageOption(image_info,option, value);
-          draw_info->interword_spacing=StringToDouble(value,
-               (char **) NULL);
+          draw_info->interword_spacing=StringToDouble(value,(char **) NULL);
           break;
         }
       break;
@@ -965,7 +964,8 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
             MagickFalse,arg);
           limit=MagickResourceInfinity;
           if (LocaleCompare("unlimited",argv[2]) != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(argv[2],100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[2],
+              100.0);
           (void) SetMagickResourceLimit(type,limit);
           break;
         }
@@ -2115,7 +2115,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
           if (*argv[0] == '+')
             threshold=40.0*QuantumRange/100.0;
           else
-            threshold=StringToDoubleInterval(args[0],QuantumRange);
+            threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0);
           new_image=DeskewImage(*image,threshold,exception);
           break;
         }
@@ -2276,7 +2276,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
           (void) SyncImageSettings(image_info,*image,exception);
           op=(MagickEvaluateOperator) ParseCommandOption(
             MagickEvaluateOptions,MagickFalse,args[0]);
-          constant=StringToDoubleInterval(argv[2],QuantumRange);
+          constant=StringToDoubleInterval(argv[2],(double) QuantumRange+1.0);
           (void) EvaluateImage(*image,op,constant,exception);
           break;
         }
@@ -3218,7 +3218,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
             threshold;
 
           (void) SyncImageSettings(image_info,*image,exception);
-          threshold=StringToDoubleInterval(args[0],QuantumRange);
+          threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0);
           new_image=SepiaToneImage(*image,threshold,exception);
           break;
         }
@@ -3354,7 +3354,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
             threshold;
 
           (void) SyncImageSettings(image_info,*image,exception);
-          threshold=StringToDoubleInterval(args[0],QuantumRange);
+          threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0);
           (void) SolarizeImage(*image,threshold,exception);
           break;
         }
@@ -3433,7 +3433,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand,
           if (*argv[0] == '+')
             threshold=(double) QuantumRange/2;
           else
-            threshold=StringToDoubleInterval(args[0],QuantumRange);
+            threshold=StringToDoubleInterval(args[0],(double) QuantumRange+1.0);
           (void) BilevelImage(*image,threshold,exception);
           break;
         }
index 068fb1d97b51a9315d039a5a525bd4b493e09566..155237c859c87d88f7ca2d657930a78d9008469e 100644 (file)
@@ -1026,32 +1026,37 @@ static struct PackageInfo *GetPackageInfo(pTHX_ void *reference,
 %
 */
 
+static double SiPrefixToDoubleInterval(const char *string,const double interval)
+{
+  char
+    *q;
+
+  double
+    value;
+
+  value=InterpretSiPrefixValue(string,&q);
+  if (*q == '%')
+    value*=interval/100.0;
+  return(value);
+}
+
+static inline double StringToDouble(const char *restrict string,
+  char **restrict sentinal)
+{
+  return(InterpretLocaleValue(string,sentinal));
+}
+
 static double StringToDoubleInterval(const char *string,const double interval)
 {
   char
     *q;
 
   double
-    scale,
     value;
 
-  value=StringToDouble(string,&q);
-  scale=1000.0;
-  if ((*q != '\0') && (tolower((int) ((unsigned char) *(q+1))) == 'i'))
-    scale=1024.0;
-  switch (tolower((int) ((unsigned char) *q)))
-  {
-    case '%': value*=pow(scale,0)*interval/100.0; break;
-    case 'k': value*=pow(scale,1); break;
-    case 'm': value*=pow(scale,2); break;
-    case 'g': value*=pow(scale,3); break;
-    case 't': value*=pow(scale,4); break;
-    case 'p': value*=pow(scale,5); break;
-    case 'e': value*=pow(scale,6); break;
-    case 'z': value*=pow(scale,7); break;
-    case 'y': value*=pow(scale,8); break;
-    default:  break;
-  }
+  value=InterpretLocaleValue(string,&q);
+  if (*q == '%')
+    value*=interval/100.0;
   return(value);
 }
 
@@ -1137,7 +1142,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(AreaResource,limit);
           break;
         }
@@ -1175,7 +1181,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"bias") == 0)
         {
           for ( ; image; image=image->next)
-            image->bias=StringToDoubleInterval(SvPV(sval,na),QuantumRange);
+            image->bias=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           break;
         }
       if (LocaleCompare(attribute,"blue-primary") == 0)
@@ -1213,9 +1220,9 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"cache-threshold") == 0)
         {
           (void) SetMagickResourceLimit(MemoryResource,(MagickSizeType)
-            StringToDoubleInterval(SvPV(sval,na),100.0));
+            SiPrefixToDoubleInterval(SvPV(sval,na),100.0));
           (void) SetMagickResourceLimit(MapResource,(MagickSizeType)
-            (2*StringToDoubleInterval(SvPV(sval,na),100.0)));
+            (2.0*SiPrefixToDoubleInterval(SvPV(sval,na),100.0)));
           break;
         }
       if (LocaleCompare(attribute,"clip-mask") == 0)
@@ -1340,7 +1347,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(DiskResource,limit);
           break;
         }
@@ -1505,9 +1513,11 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"fuzz") == 0)
         {
           if (info)
-            info->image_info->fuzz=StringToDoubleInterval(SvPV(sval,na),QuantumRange);
+            info->image_info->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           for ( ; image; image=image->next)
-            image->fuzz=StringToDoubleInterval(SvPV(sval,na),QuantumRange);
+            image->fuzz=StringToDoubleInterval(SvPV(sval,na),(double)
+              QuantumRange+1.0);
           break;
         }
       if (info)
@@ -1665,7 +1675,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(MapResource,limit);
           break;
         }
@@ -1712,7 +1723,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(MemoryResource,limit);
           break;
         }
@@ -2035,7 +2047,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(ThreadResource,limit);
           break;
         }
@@ -2060,7 +2073,8 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
 
           limit=MagickResourceInfinity;
           if (LocaleCompare(SvPV(sval,na),"unlimited") != 0)
-            limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0);
+            limit=(MagickSizeType) SiPrefixToDoubleInterval(SvPV(sval,na),
+              100.0);
           (void) SetMagickResourceLimit(TimeResource,limit);
           break;
         }
@@ -7622,8 +7636,8 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=
-              StringToDoubleInterval(argument_list[5].string_reference,QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           image=CropImage(image,&geometry,exception);
           break;
         }
@@ -8222,8 +8236,8 @@ Mogrify(ref,...)
               invert=MagickTrue;
             }
           if (attribute_flag[5] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             invert=(MagickBooleanType) argument_list[6].integer_reference;
           (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
@@ -8259,7 +8273,7 @@ Mogrify(ref,...)
               if (compose != DissolveCompositeOp)
                 (void) SetImageAlpha(composite_image,(Quantum)
                   StringToDoubleInterval(argument_list[6].string_reference,
-                  QuantumRange),exception);
+                  (double) QuantumRange+1.0),exception);
               else
                 {
                   CacheView
@@ -8287,7 +8301,8 @@ Mogrify(ref,...)
                   (void) CloneString(&image->geometry,
                     argument_list[6].string_reference);
                   opacity=(Quantum) StringToDoubleInterval(
-                    argument_list[6].string_reference,QuantumRange);
+                    argument_list[6].string_reference,(double) QuantumRange+
+                    1.0);
                   if (composite_image->matte != MagickTrue)
                     (void) SetImageAlpha(composite_image,OpaqueAlpha,exception);
                   composite_view=AcquireCacheView(composite_image);
@@ -8789,11 +8804,12 @@ Mogrify(ref,...)
             QueryColorCompliance(argument_list[4].string_reference,
               AllCompliance,&target,exception);
           if (attribute_flag[3] != 0)
-            target.alpha=StringToDoubleInterval(argument_list[3].string_reference,
-              QuantumRange);
+            target.alpha=StringToDoubleInterval(
+              argument_list[3].string_reference,(double) (double) QuantumRange+
+              1.0);
           if (attribute_flag[5] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           invert=MagickFalse;
           if (attribute_flag[6] != 0)
             invert=(MagickBooleanType) argument_list[6].integer_reference;
@@ -8887,8 +8903,8 @@ Mogrify(ref,...)
             (void) QueryColorCompliance(argument_list[1].string_reference,
               AllCompliance,&fill_color,exception);
           if (attribute_flag[2] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[2].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
           invert=MagickFalse;
@@ -9007,7 +9023,7 @@ Mogrify(ref,...)
               &geometry_info);
           if (attribute_flag[1] != 0)
             geometry_info.rho=StringToDoubleInterval(
-             argument_list[1].string_reference,QuantumRange);
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
           (void) SolarizeImage(image,geometry_info.rho,exception);
           break;
         }
@@ -9060,10 +9076,10 @@ Mogrify(ref,...)
           opacity=TransparentAlpha;
           if (attribute_flag[1] != 0)
             opacity=StringToDoubleInterval(argument_list[1].string_reference,
-              QuantumRange);
+              (double) QuantumRange+1.0);
           if (attribute_flag[2] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[2].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[3] == 0)
             argument_list[3].integer_reference=0;
           invert=MagickFalse;
@@ -9083,7 +9099,7 @@ Mogrify(ref,...)
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
           threshold=StringToDoubleInterval(argument_list[0].string_reference,
-            QuantumRange);
+            (double) QuantumRange+1.0);
           channel_mask=SetPixelChannelMask(image,channel);
           (void) BilevelImage(image,threshold,exception);
           (void) SetPixelChannelMask(image,channel_mask);
@@ -9111,8 +9127,8 @@ Mogrify(ref,...)
         case 59:  /* Trim */
         {
           if (attribute_flag[0] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[0].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[0].string_reference,(double) QuantumRange+1.0);
           image=TrimImage(image,exception);
           break;
         }
@@ -9247,8 +9263,8 @@ Mogrify(ref,...)
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
           if (attribute_flag[2] != 0)
-            image->bias=StringToDoubleInterval(argument_list[2].string_reference,
-              QuantumRange);
+            image->bias=StringToDoubleInterval(
+              argument_list[2].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[3] != 0)
             {
               kernel=AcquireKernelInfo(argument_list[3].string_reference);
@@ -9600,8 +9616,8 @@ Mogrify(ref,...)
               goto PerlException;
             }
           if (attribute_flag[1] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[1].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
           (void) IsImagesEqual(image,argument_list[0].image_reference,
             exception);
           break;
@@ -9773,8 +9789,8 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             (void) QueryColorCompliance(argument_list[6].string_reference,
               AllCompliance,&image->background_color,exception);
@@ -9898,8 +9914,8 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             geometry.y=argument_list[4].integer_reference;
           if (attribute_flag[5] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             (void) QueryColorCompliance(argument_list[6].string_reference,
               AllCompliance,&image->background_color,exception);
@@ -10273,8 +10289,8 @@ Mogrify(ref,...)
             QueryColorCompliance(argument_list[4].string_reference,
               AllCompliance,&target,exception);
           if (attribute_flag[5] != 0)
-            image->fuzz=StringToDoubleInterval(argument_list[5].string_reference,
-              QuantumRange);
+            image->fuzz=StringToDoubleInterval(
+              argument_list[5].string_reference,(double) QuantumRange+1.0);
           if (attribute_flag[6] != 0)
             channel=(ChannelType) argument_list[6].integer_reference;
           invert=MagickFalse;
@@ -10393,7 +10409,7 @@ Mogrify(ref,...)
               &geometry_info);
           if (attribute_flag[1] != 0)
             geometry_info.rho=StringToDoubleInterval(
-              argument_list[1].string_reference,QuantumRange);
+              argument_list[1].string_reference,(double) QuantumRange+1.0);
           image=DeskewImage(image,geometry_info.rho,exception);
           break;
         }
index c10861bda7f21961186c85a1567ca3a256fb19de..02b3e37aa6090399748ed916a22a427e1768db3a 100644 (file)
@@ -444,8 +444,8 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   }
                 if (LocaleCompare(keyword,"error") == 0)
                   {
-                    image->error.mean_error_per_pixel=StringToDouble(
-                      options,(char **) NULL);
+                    image->error.mean_error_per_pixel=StringToDouble(options,
+                      (char **) NULL);
                     break;
                   }
                 (void) SetImageProperty(image,keyword,options,exception);
@@ -511,14 +511,14 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   }
                 if (LocaleCompare(keyword,"maximum-error") == 0)
                   {
-                    image->error.normalized_maximum_error=
-                      StringToDouble(options,(char **) NULL);
+                    image->error.normalized_maximum_error=StringToDouble(
+                      options,(char **) NULL);
                     break;
                   }
                 if (LocaleCompare(keyword,"mean-error") == 0)
                   {
-                    image->error.normalized_mean_error=StringToDouble(
-                      options,(char **) NULL);
+                    image->error.normalized_mean_error=StringToDouble(options,
+                      (char **) NULL);
                     break;
                   }
                 if (LocaleCompare(keyword,"montage") == 0)
index 1002fe9735a7da082b0cb78f9c26a2a0fcb745b6..c9d51d6c1e8befb797162f97d8de42f4f2f31b9e 100644 (file)
@@ -820,8 +820,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                     }
                   if (LocaleCompare(keyword,"antialias") == 0)
                     {
-                      option=ParseCommandOption(MagickBooleanOptions,MagickFalse,
-                        value);
+                      option=ParseCommandOption(MagickBooleanOptions,
+                        MagickFalse,value);
                       if (option < 0)
                         ThrowMSLException(OptionError,"UnrecognizedBooleanType",
                           value);
@@ -908,8 +908,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"pointsize") == 0)
                     {
-                      draw_info->pointsize=StringToDouble(value,
-                        (char **) NULL);
+                      draw_info->pointsize=StringToDouble(value,(char **) NULL);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -1211,8 +1210,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"radius") == 0)
                     {
-                      geometry_info.rho=StringToDouble(value,
-                        (char **) NULL);
+                      geometry_info.rho=StringToDouble(value,(char **) NULL);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -1466,19 +1464,19 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             case 'b':
             {
               if (LocaleCompare(keyword, "bias") == 0)
-              {
-                bias = StringToDouble(value,(char **) NULL);
-                break;
-              }
+                {
+                  bias=StringToDouble(value,(char **) NULL);
+                  break;
+                }
               ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
               break;
             }
             case 'R':
             case 'r':
             {
-              if (LocaleCompare(keyword, "radius") == 0)
+              if (LocaleCompare(keyword,"radius") == 0)
               {
-                radius = StringToDouble(value,(char **) NULL);
+                radius=StringToDouble(value,(char **) NULL);
                 break;
               }
               ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword);
@@ -2762,8 +2760,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"radius") == 0)
                     {
-                      geometry_info.rho=StringToDouble(value,
-                        (char **) NULL);
+                      geometry_info.rho=StringToDouble(value,(char **) NULL);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",