From: cristy Date: Mon, 9 Feb 2015 22:59:26 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~1311 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21ef17b65dbe7001236b74866985fa88257645b1;p=imagemagick --- diff --git a/MagickCore/utility.c b/MagickCore/utility.c index 16ced5594..ef0f65842 100644 --- a/MagickCore/utility.c +++ b/MagickCore/utility.c @@ -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); } /* diff --git a/MagickCore/utility.h b/MagickCore/utility.h index 3e4f80ad8..9dbc80f68 100644 --- a/MagickCore/utility.h +++ b/MagickCore/utility.h @@ -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 diff --git a/coders/gif.c b/coders/gif.c index c92c3d383..6723b0ee1 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -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; }