]> granicus.if.org Git - imagemagick/blobdiff - coders/msl.c
(no commit message)
[imagemagick] / coders / msl.c
index 038867e87338efcc16ad59a286dc464b1454d4b1..f0204a4f580f7ff7901eb5f281536658fe796ce3 100644 (file)
@@ -88,7 +88,7 @@
 #include "magick/threshold.h"
 #include "magick/utility.h"
 #if defined(MAGICKCORE_XML_DELEGATE)
-#  if defined(__WINDOWS__)
+#  if defined(MAGICKCORE_WINDOWS_SUPPORT)
 #    if defined(__MINGW32__)
 #      define _MSC_VER
 #    else
 */
 typedef struct _MSLGroupInfo
 {
-  unsigned long
+  size_t
     numImages;  /* how many images are in this group */
 } MSLGroupInfo;
 
@@ -122,7 +122,7 @@ typedef struct _MSLInfo
   ExceptionInfo
     *exception;
 
-  long
+  ssize_t
     n,
     number_groups;
 
@@ -545,7 +545,7 @@ static void MSLEndDocument(void *context)
 
 static void MSLPushImage(MSLInfo *msl_info,Image *image)
 {
-  long
+  ssize_t
     n;
 
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
@@ -629,7 +629,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
   int
     flags;
 
-  long
+  ssize_t
     option,
     j,
     n,
@@ -642,10 +642,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
   RectangleInfo
     geometry;
 
-  register long
+  register ssize_t
     i;
 
-  unsigned long
+  size_t
     height,
     width;
 
@@ -1061,17 +1061,18 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
-            geometry.width,geometry.height,geometry.x,geometry.y);
+          (void) FormatMagickString(text,MaxTextExtent,
+            "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+            geometry.height,(double) geometry.x,(double) geometry.y);
           CloneString(&draw_info->geometry,text);
-          draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
-          draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
-          draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
-          draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
-          draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
-            current.tx;
-          draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
-            current.ty;
+          draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+          draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+          draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+          draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+          draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+            affine.tx;
+          draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+            affine.ty;
           (void) AnnotateImage(msl_info->image[n],draw_info);
           draw_info=DestroyDrawInfo(draw_info);
           break;
@@ -1902,11 +1903,11 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"opacity") == 0)
                     {
-                      long
+                      ssize_t
                         opacity,
                         y;
 
-                      register long
+                      register ssize_t
                         x;
 
                       register PixelPacket
@@ -1927,14 +1928,14 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                       if (composite_image->matte != MagickTrue)
                         (void) SetImageOpacity(composite_image,OpaqueOpacity);
                       composite_view=AcquireCacheView(composite_image);
-                      for (y=0; y < (long) composite_image->rows ; y++)
+                      for (y=0; y < (ssize_t) composite_image->rows ; y++)
                       {
-                        q=GetCacheViewAuthenticPixels(composite_view,0,y,(long)
+                        q=GetCacheViewAuthenticPixels(composite_view,0,y,(ssize_t)
                           composite_image->columns,1,&exception);
-                        for (x=0; x < (long) composite_image->columns; x++)
+                        for (x=0; x < (ssize_t) composite_image->columns; x++)
                         {
                           if (q->opacity == OpaqueOpacity)
-                            q->opacity=RoundToQuantum(opacity);
+                            q->opacity=ClampToQuantum(opacity);
                           q++;
                         }
                         if (SyncCacheViewAuthenticPixels(composite_view,&exception) == MagickFalse)
@@ -1983,8 +1984,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                        image=msl_info->image[n];
                        height=composite_image->rows;
                        width=composite_image->columns;
-                       for (y=0; y < (long) image->rows; y+=height)
-                         for (x=0; x < (long) image->columns; x+=width)
+                       for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) height)
+                         for (x=0; x < (ssize_t) image->columns; x+=(ssize_t) width)
                          {
                            if (rotate_image != (Image *) NULL)
                              (void) CompositeImage(image,compose,rotate_image,
@@ -2039,8 +2040,9 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             }
           image=msl_info->image[n];
           (void) FormatMagickString(composite_geometry,MaxTextExtent,
-            "%lux%lu%+ld%+ld",composite_image->columns,composite_image->rows,
-            geometry.x,geometry.y);
+            "%.20gx%.20g%+.20g%+.20g",(double) composite_image->columns,
+            (double) composite_image->rows,(double) geometry.x,(double)
+            geometry.y);
           flags=ParseGravityGeometry(image,composite_geometry,&geometry,
             &exception);
           if (rotate_image == (Image *) NULL)
@@ -2051,9 +2053,9 @@ static void MSLStartElement(void *context,const xmlChar *tag,
               /*
                 Rotate image.
               */
-              geometry.x-=(long) (rotate_image->columns-
+              geometry.x-=(ssize_t) (rotate_image->columns-
                 composite_image->columns)/2;
-              geometry.y-=(long) (rotate_image->rows-composite_image->rows)/2;
+              geometry.y-=(ssize_t) (rotate_image->rows-composite_image->rows)/2;
               CompositeImageChannel(image,channel,compose,rotate_image,
                 geometry.x,geometry.y);
               rotate_image=DestroyImage(rotate_image);
@@ -2218,7 +2220,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
         }
       if (LocaleCompare((const char *) tag,"cycle-colormap") == 0)
         {
-          long
+          ssize_t
             display;
 
           /*
@@ -2649,17 +2651,18 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
-            geometry.width,geometry.height,geometry.x,geometry.y);
+          (void) FormatMagickString(text,MaxTextExtent,
+            "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+            geometry.height,(double) geometry.x,(double) geometry.y);
           CloneString(&draw_info->geometry,text);
-          draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
-          draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
-          draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
-          draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
-          draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
-            current.tx;
-          draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
-            current.ty;
+          draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+          draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+          draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+          draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+          draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+            affine.tx;
+          draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+            affine.ty;
           (void) DrawImage(msl_info->image[n],draw_info);
           draw_info=DestroyDrawInfo(draw_info);
           break;
@@ -3097,8 +3100,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          frame_info.x=(long) frame_info.width;
-          frame_info.y=(long) frame_info.height;
+          frame_info.x=(ssize_t) frame_info.width;
+          frame_info.y=(ssize_t) frame_info.height;
           frame_info.width=msl_info->image[n]->columns+2*frame_info.x;
           frame_info.height=msl_info->image[n]->rows+2*frame_info.y;
           frame_image=FrameImage(msl_info->image[n],&frame_info,
@@ -3262,8 +3265,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
               {
                 if (LocaleCompare(keyword,"height") == 0)
                   {
-                    (void) FormatMagickString(value,MaxTextExtent,"%ld",
-                      msl_info->image[n]->rows);
+                    (void) FormatMagickString(value,MaxTextExtent,"%.20g",
+                      (double) msl_info->image[n]->rows);
                     (void) SetImageProperty(msl_info->attributes[n],key,value);
                     break;
                   }
@@ -3274,8 +3277,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
               {
                 if (LocaleCompare(keyword,"width") == 0)
                   {
-                    (void) FormatMagickString(value,MaxTextExtent,"%ld",
-                      msl_info->image[n]->columns);
+                    (void) FormatMagickString(value,MaxTextExtent,"%.20g",
+                      (double) msl_info->image[n]->columns);
                     (void) SetImageProperty(msl_info->attributes[n],key,value);
                     break;
                   }
@@ -3746,7 +3749,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             }
           draw_info=CloneDrawInfo(msl_info->image_info[n],
             msl_info->draw_info[n]);
-          draw_info->fill.opacity=RoundToQuantum(opacity);
+          draw_info->fill.opacity=ClampToQuantum(opacity);
           (void) FloodfillPaintImage(msl_info->image[n],OpacityChannel,
             draw_info,&target,geometry.x,geometry.y,
             paint_method == FloodfillMethod ? MagickFalse : MagickTrue);
@@ -4345,7 +4348,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                   if (profile != (StringInfo *) NULL)
                     {
                       (void) ProfileImage(msl_info->image[n],name,
-                        GetStringInfoDatum(profile),(unsigned long)
+                        GetStringInfoDatum(profile),(size_t)
                         GetStringInfoLength(profile),MagickFalse);
                       profile=DestroyStringInfo(profile);
                     }
@@ -4358,7 +4361,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 profile=GetImageProfile(profile_image,name);
                 if (profile != (StringInfo *) NULL)
                   (void) ProfileImage(msl_info->image[n],name,
-                    GetStringInfoDatum(profile),(unsigned long)
+                    GetStringInfoDatum(profile),(size_t)
                     GetStringInfoLength(profile),MagickFalse);
                 name=GetNextImageProfile(profile_image);
               }
@@ -4791,17 +4794,18 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          (void) FormatMagickString(text,MaxTextExtent,"%lux%lu%+ld%+ld",
-            geometry.width,geometry.height,geometry.x,geometry.y);
+          (void) FormatMagickString(text,MaxTextExtent,
+            "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,(double)
+            geometry.height,(double) geometry.x,(double) geometry.y);
           CloneString(&draw_info->geometry,text);
-          draw_info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
-          draw_info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
-          draw_info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
-          draw_info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
-          draw_info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+
-            current.tx;
-          draw_info->affine.ty=current.rx*affine.tx+current.sy*affine.ty+
-            current.ty;
+          draw_info->affine.sx=affine.sx*current.sx+affine.ry*current.rx;
+          draw_info->affine.rx=affine.rx*current.sx+affine.sy*current.rx;
+          draw_info->affine.ry=affine.sx*current.ry+affine.ry*current.sy;
+          draw_info->affine.sy=affine.rx*current.ry+affine.sy*current.sy;
+          draw_info->affine.tx=affine.sx*current.tx+affine.ry*current.ty+
+            affine.tx;
+          draw_info->affine.ty=affine.rx*current.tx+affine.sy*current.ty+
+            affine.ty;
           status=GetTypeMetrics(msl_info->attributes[n],draw_info,&metrics);
           if (status != MagickFalse)
             {
@@ -4809,10 +4813,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 *image;
 
               image=msl_info->attributes[n];
-              FormatImageProperty(image,"msl:font-metrics.pixels_per_em.x","%g",
-                metrics.pixels_per_em.x);
-              FormatImageProperty(image,"msl:font-metrics.pixels_per_em.y","%g",
-                metrics.pixels_per_em.y);
+              FormatImageProperty(image,"msl:font-metrics.pixels_per_em.x",
+                "%g",metrics.pixels_per_em.x);
+              FormatImageProperty(image,"msl:font-metrics.pixels_per_em.y",
+                "%g",metrics.pixels_per_em.y);
               FormatImageProperty(image,"msl:font-metrics.ascent","%g",
                 metrics.ascent);
               FormatImageProperty(image,"msl:font-metrics.descent","%g",
@@ -5206,7 +5210,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
           {
             if (LocaleCompare(keyword,"geometry") == 0)
               {
-                long
+                ssize_t
                   flags;
 
                 flags=ParseGeometry(value,&geometry_info);
@@ -5261,10 +5265,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
         factor=1.0;
         if (msl_info->image[n]->units == PixelsPerCentimeterResolution)
           factor=2.54;
-        width=(unsigned long) (x_resolution*msl_info->image[n]->columns/
+        width=(size_t) (x_resolution*msl_info->image[n]->columns/
           (factor*(msl_info->image[n]->x_resolution == 0.0 ? DefaultResolution :
           msl_info->image[n]->x_resolution))+0.5);
-        height=(unsigned long) (y_resolution*msl_info->image[n]->rows/
+        height=(size_t) (y_resolution*msl_info->image[n]->rows/
           (factor*(msl_info->image[n]->y_resolution == 0.0 ? DefaultResolution :
           msl_info->image[n]->y_resolution))+0.5);
         resample_image=ResizeImage(msl_info->image[n],width,height,
@@ -5343,7 +5347,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"height") == 0)
                     {
-                      geometry.height=(unsigned long) StringToLong(value);
+                      geometry.height=StringToUnsignedLong(value);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -5714,7 +5718,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"height") == 0)
                     {
-                      geometry.height=(unsigned long) StringToLong(value);
+                      geometry.height=StringToUnsignedLong(value);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -5790,7 +5794,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 {
                   if (LocaleCompare(keyword,"height") == 0)
                     {
-                      geometry.height=(unsigned long) StringToLong(value);
+                      geometry.height=StringToUnsignedLong(value);
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -5970,7 +5974,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               if (LocaleCompare(keyword,"colorspace") == 0)
                 {
-                  long
+                  ssize_t
                     colorspace;
 
                   colorspace=(ColorspaceType) ParseMagickOption(
@@ -6006,8 +6010,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             {
               if (LocaleCompare(keyword, "opacity") == 0)
                 {
-                  long  opac = OpaqueOpacity,
-                  len = (long) strlen( value );
+                  ssize_t  opac = OpaqueOpacity,
+                  len = (ssize_t) strlen( value );
 
                   if (value[len-1] == '%') {
                     char  tmp[100];
@@ -6044,11 +6048,13 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 if (image_option != (const char *) NULL)
                   flags=ParseAbsoluteGeometry(image_option,&geometry);
                 flags=ParseAbsoluteGeometry(value,&geometry);
-                (void) FormatMagickString(page,MaxTextExtent,"%lux%lu",
-                  geometry.width,geometry.height);
+                (void) FormatMagickString(page,MaxTextExtent,"%.20gx%.20g",
+                  (double) geometry.width,(double) geometry.height);
                 if (((flags & XValue) != 0) || ((flags & YValue) != 0))
-                  (void) FormatMagickString(page,MaxTextExtent,"%lux%lu%+ld%+ld",
-                    geometry.width,geometry.height,geometry.x,geometry.y);
+                  (void) FormatMagickString(page,MaxTextExtent,
+                    "%.20gx%.20g%+.20g%+.20g",(double) geometry.width,
+                    (double) geometry.height,(double) geometry.x,(double)
+                    geometry.y);
                 (void) SetImageOption(msl_info->image_info[n],keyword,page);
                 msl_info->image_info[n]->page=GetPageGeometry(page);
                 break;
@@ -6248,8 +6254,8 @@ static void MSLStartElement(void *context,const xmlChar *tag,
               }
             }
           shadow_image=ShadowImage(msl_info->image[n],geometry_info.rho,
-            geometry_info.sigma,(long) (geometry_info.xi+0.5),(long)
-            (geometry_info.psi+0.5),&msl_info->image[n]->exception);
+            geometry_info.sigma,(ssize_t) ceil(geometry_info.xi-0.5),(ssize_t)
+            ceil(geometry_info.psi-0.5),&msl_info->image[n]->exception);
           if (shadow_image == (Image *) NULL)
             break;
           msl_info->image[n]=DestroyImage(msl_info->image[n]);
@@ -6790,7 +6796,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             *q,
             *swap;
 
-          long
+          ssize_t
             index,
             swap_index;
 
@@ -6817,9 +6823,9 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                   if (LocaleCompare(keyword,"indexes") == 0)
                     {
                       flags=ParseGeometry(value,&geometry_info);
-                      index=(long) geometry_info.rho;
+                      index=(ssize_t) geometry_info.rho;
                       if ((flags & SigmaValue) == 0)
-                        swap_index=(long) geometry_info.sigma;
+                        swap_index=(ssize_t) geometry_info.sigma;
                       break;
                     }
                   ThrowMSLException(OptionError,"UnrecognizedAttribute",
@@ -7050,7 +7056,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
         */
         {
         BilevelImageChannel(msl_info->image[n],
-          (ChannelType) ((long) (AllChannels &~ (long) OpacityChannel)),
+          (ChannelType) ((ssize_t) (AllChannels &~ (ssize_t) OpacityChannel)),
           threshold);
         break;
         }
@@ -7187,7 +7193,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
 
 static void MSLEndElement(void *context,const xmlChar *tag)
 {
-  long
+  ssize_t
     n;
 
   MSLInfo
@@ -7224,7 +7230,7 @@ static void MSLEndElement(void *context,const xmlChar *tag)
       {
         if (msl_info->group_info[msl_info->number_groups-1].numImages > 0 )
         {
-          long  i = (long)
+          ssize_t  i = (ssize_t)
             (msl_info->group_info[msl_info->number_groups-1].numImages);
           while ( i-- )
           {
@@ -7289,7 +7295,7 @@ static void MSLCharacters(void *context,const xmlChar *c,int length)
   register char
     *p;
 
-  register long
+  register ssize_t
     i;
 
   /*
@@ -7549,7 +7555,7 @@ static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,Image **im
   int
     status;
 
-  long
+  ssize_t
     n;
 
   MSLInfo
@@ -7591,7 +7597,7 @@ static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,Image **im
   msl_info.draw_info=(DrawInfo **) AcquireMagickMemory(
     sizeof(*msl_info.draw_info));
   /* top of the stack is the MSL file itself */
-  msl_info.image=(Image **) AcquireAlignedMemory(1,sizeof(*msl_info.image));
+  msl_info.image=(Image **) AcquireMagickMemory(sizeof(*msl_info.image));
   msl_info.attributes=(Image **) AcquireMagickMemory(
     sizeof(*msl_info.attributes));
   msl_info.group_info=(MSLGroupInfo *) AcquireMagickMemory(
@@ -7644,7 +7650,7 @@ static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,Image **im
     msl_image->filename);
   while (ReadBlobString(msl_image,message) != (char *) NULL)
   {
-    n=(long) strlen(message);
+    n=(ssize_t) strlen(message);
     if (n == 0)
       continue;
     status=xmlParseChunk(msl_info.parser,message,(int) n,MagickFalse);
@@ -7709,10 +7715,10 @@ static Image *ReadMSLImage(const ImageInfo *image_info,ExceptionInfo *exception)
 %
 %  The format of the RegisterMSLImage method is:
 %
-%      unsigned long RegisterMSLImage(void)
+%      size_t RegisterMSLImage(void)
 %
 */
-ModuleExport unsigned long RegisterMSLImage(void)
+ModuleExport size_t RegisterMSLImage(void)
 {
   MagickInfo
     *entry;
@@ -7728,6 +7734,7 @@ ModuleExport unsigned long RegisterMSLImage(void)
   return(MagickImageCoderSignature);
 }
 \f
+#if defined(MAGICKCORE_XML_DELEGATE)
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -7779,7 +7786,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
   int
     flags;
 
-  long
+  ssize_t
     n;
 
   assert(msl_info != (MSLInfo *) NULL);
@@ -7800,7 +7807,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
     {
       if (LocaleCompare(keyword,"adjoin") == 0)
         {
-          long
+          ssize_t
             adjoin;
 
           adjoin=ParseMagickOption(MagickBooleanOptions,MagickFalse,value);
@@ -7811,7 +7818,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
         }
       if (LocaleCompare(keyword,"alpha") == 0)
         {
-          long
+          ssize_t
             alpha;
 
           alpha=ParseMagickOption(MagickAlphaOptions,MagickFalse,value);
@@ -7823,7 +7830,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
         }
       if (LocaleCompare(keyword,"antialias") == 0)
         {
-          long
+          ssize_t
             antialias;
 
           antialias=ParseMagickOption(MagickBooleanOptions,MagickFalse,value);
@@ -7927,7 +7934,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
     {
       if (LocaleCompare(keyword,"gravity") == 0)
         {
-          long
+          ssize_t
             gravity;
 
           gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,value);
@@ -8017,6 +8024,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword,
   }
   return(MagickTrue);
 }
+#endif
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%