]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 9 Feb 2015 22:59:26 +0000 (22:59 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 9 Feb 2015 22:59:26 +0000 (22:59 +0000)
MagickCore/utility.c
MagickCore/utility.h
coders/gif.c

index 16ced559464a9fc9be7e597e8e1e3bf41668701b..ef0f6584293708b76bb2d91b9f324bcf6f18eee0 100644 (file)
@@ -1135,8 +1135,7 @@ MagickPrivate ssize_t GetMagickPageSize(void)
 %
 %  The path of the GetPathAttributes method is:
 %
-%      MagickBooleanType GetPathAttributes(const char *path,
-%        struct stat *attributes)
+%      MagickBooleanType GetPathAttributes(const char *path,void *attributes)
 %
 %  A description of each parameter follows.
 %
@@ -1146,15 +1145,20 @@ MagickPrivate ssize_t GetMagickPageSize(void)
 %
 */
 MagickExport MagickBooleanType GetPathAttributes(const char *path,
-  struct stat *attributes)
+  void *attributes)
 {
+  MagickBooleanType
+    status;
+  
   if (path == (const char *) NULL)
-    {
+    { 
       errno=EINVAL;
       return(MagickFalse);
     }
-  ResetMagickMemory(attributes,0,sizeof(*attributes));
-  return(stat_utf8(path,attributes) == 0 ? MagickTrue : MagickFalse);
+  (void) ResetMagickMemory(attributes,0,sizeof(stat)); 
+  status=stat_utf8(path,(struct stat *) attributes) == 0 ? MagickTrue :
+    MagickFalse;
+  return(status);
 }
 \f
 /*
index 3e4f80ad8a1d0fe4196a10c236205dc70a9844a9..9dbc80f684f9dc308f7e42e1faaa768d89d58e62 100644 (file)
@@ -42,7 +42,7 @@ extern MagickExport MagickBooleanType
   AcquireUniqueFilename(char *),
   AcquireUniqueSymbolicLink(const char *,char *),
   ExpandFilenames(int *,char ***),
-  GetPathAttributes(const char *,struct stat *),
+  GetPathAttributes(const char *,void *),
   IsPathAccessible(const char *);
 
 extern MagickExport size_t
index c92c3d383f492be861f77ad229b7f4074c1e1864..6723b0ee1194965948995e0c0fec025e3e150d06 100644 (file)
@@ -1589,7 +1589,8 @@ static MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,
         /*
           Identify transparent colormap index.
         */
-        (void) SetImageType(image,PaletteBilevelAlphaType,exception);
+        if ((image->storage_class == DirectClass) || (image->colors > 256))
+          (void) SetImageType(image,PaletteBilevelAlphaType,exception);
         for (i=0; i < (ssize_t) image->colors; i++)
           if (image->colormap[i].alpha != OpaqueAlpha)
             {
@@ -1598,9 +1599,8 @@ static MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,
                   opacity=i;
                   continue;
                 }
-              alpha=(double) TransparentAlpha-(double) image->colormap[i].alpha;
-              beta=(double) TransparentAlpha-(double)
-                image->colormap[opacity].alpha;
+              alpha=fabs(image->colormap[i].alpha-TransparentAlpha);
+              beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);
               if (alpha < beta)
                 opacity=i;
             }
@@ -1615,10 +1615,8 @@ static MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,
                       opacity=i;
                       continue;
                     }
-                  alpha=(Quantum) TransparentAlpha-(double)
-                    image->colormap[i].alpha;
-                  beta=(Quantum) TransparentAlpha-(double)
-                    image->colormap[opacity].alpha;
+                  alpha=fabs(image->colormap[i].alpha-TransparentAlpha);
+                  beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);
                   if (alpha < beta)
                     opacity=i;
                 }