From 94b11835effe9f2ded8638e50db5fb7acd92ea0b Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 8 Sep 2011 19:46:03 +0000 Subject: [PATCH] --- MagickCore/annotate.c | 8 +++---- MagickCore/distort.c | 8 +++---- MagickCore/image.c | 10 ++++----- MagickCore/log.c | 2 +- Makefile.am | 2 +- coders/art.c | 8 +++---- coders/cin.c | 6 ++--- coders/miff.c | 51 +++++++++++++++++++++++-------------------- coders/png.c | 2 +- coders/pnm.c | 6 ++--- coders/psd.c | 2 +- coders/tiff.c | 2 +- 12 files changed, 54 insertions(+), 53 deletions(-) diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index 5559c98aa..83f56d770 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -1297,7 +1297,7 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, if ((glyph.id != 0) && (last_glyph.id != 0)) { if (draw_info->kerning != 0.0) - origin.x+=64.0*direction*draw_info->kerning; + origin.x+=(FT_Pos) (64.0*direction*draw_info->kerning); else if (FT_HAS_KERNING(face)) { @@ -1307,7 +1307,7 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, status=FT_Get_Kerning(face,last_glyph.id,glyph.id, ft_kerning_default,&kerning); if (status == 0) - origin.x+=direction*kerning.x; + origin.x+=(FT_Pos) (direction*kerning.x); } } glyph.origin=origin; @@ -1450,9 +1450,9 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info, if ((draw_info->interword_spacing != 0.0) && (IsUTFSpace(GetUTFCode(p)) != MagickFalse) && (IsUTFSpace(code) == MagickFalse)) - origin.x+=64.0*direction*draw_info->interword_spacing; + origin.x+=(FT_Pos) (64.0*direction*draw_info->interword_spacing); else - origin.x+=direction*face->glyph->advance.x; + origin.x+=(FT_Pos) (direction*face->glyph->advance.x); metrics->origin.x=origin.x; metrics->origin.y=origin.y; if (last_glyph.id != 0) diff --git a/MagickCore/distort.c b/MagickCore/distort.c index 6413c53ed..6ab3fa9de 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -2188,10 +2188,10 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method, output_scaling = 1.0; if (artifact != (const char *) NULL) { output_scaling = fabs(InterpretLocaleValue(artifact,(char **) NULL)); - geometry.width *= output_scaling; - geometry.height *= output_scaling; - geometry.x *= output_scaling; - geometry.y *= output_scaling; + geometry.width *= (size_t) output_scaling; + geometry.height *= (size_t) output_scaling; + geometry.x *= (ssize_t) output_scaling; + geometry.y *= (ssize_t) output_scaling; if ( output_scaling < 0.1 ) { coeff = (double *) RelinquishMagickMemory(coeff); (void) ThrowMagickException(exception,GetMagickModule(),OptionError, diff --git a/MagickCore/image.c b/MagickCore/image.c index ee0e33460..85095fa84 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -100,25 +100,23 @@ /* Constant declaration. */ -MagickPrivate const char +const char BackgroundColor[] = "#ffffff", /* white */ BorderColor[] = "#dfdfdf", /* gray */ DefaultTileFrame[] = "15x15+3+3", - ForegroundColor[] = "#000", /* black */ - MatteColor[] = "#bdbdbd"; /* gray */ - -MagickExport const char DefaultTileGeometry[] = "120x120+4+3>", DefaultTileLabel[] = "%f\n%G\n%b", + ForegroundColor[] = "#000", /* black */ LoadImageTag[] = "Load/Image", LoadImagesTag[] = "Load/Images", + MatteColor[] = "#bdbdbd", /* gray */ PSDensityGeometry[] = "72.0x72.0", PSPageGeometry[] = "612x792", SaveImageTag[] = "Save/Image", SaveImagesTag[] = "Save/Images", TransparentColor[] = "#00000000"; /* transparent black */ -MagickExport const double +const double DefaultResolution = 72.0; /* diff --git a/MagickCore/log.c b/MagickCore/log.c index 36e3c7190..f5f2cb96d 100644 --- a/MagickCore/log.c +++ b/MagickCore/log.c @@ -1180,7 +1180,7 @@ MagickBooleanType LogMagickEventList(const LogEventType type,const char *module, file_info.st_size=0; if (log_info->file != (FILE *) NULL) (void) fstat(fileno(log_info->file),&file_info); - if (file_info.st_size > (1024*1024*log_info->limit)) + if (file_info.st_size > (ssize_t) (1024*1024*log_info->limit)) { (void) FormatLocaleFile(log_info->file,"\n"); (void) fclose(log_info->file); diff --git a/Makefile.am b/Makefile.am index 0e26d599d..8843b3611 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ # Top-Level Makefile for building ImageMagick. # -AUTOMAKE_OPTIONS = 1.11 subdir-objects parallel-tests color-tests dist-zip dist-bzip2 dist-xz dist-lzma foreign +AUTOMAKE_OPTIONS = 1.11 subdir-objects parallel-tests color-tests dist-zip dist-bzip2 dist-xz foreign topincludedir = @includedir@/ImageMagick diff --git a/coders/art.c b/coders/art.c index 4df65f40e..42ccd5eba 100644 --- a/coders/art.c +++ b/coders/art.c @@ -290,11 +290,11 @@ static MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image, register const Quantum *p; - ssize_t - count; - size_t - length, + length; + + ssize_t + count, y; unsigned char diff --git a/coders/cin.c b/coders/cin.c index 3fd45fee1..0ec21d4f3 100644 --- a/coders/cin.c +++ b/coders/cin.c @@ -625,17 +625,17 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception) cin.film.id=ReadBlobByte(image); offset++; c=cin.film.id; - if (c != ~0U) + if (c != ~0) (void) FormatImageProperty(image,"dpx:film.id","%d",cin.film.id); cin.film.type=ReadBlobByte(image); offset++; c=cin.film.type; - if (c != ~0U) + if (c != ~0) (void) FormatImageProperty(image,"dpx:film.type","%d",cin.film.type); cin.film.offset=ReadBlobByte(image); offset++; c=cin.film.offset; - if (c != ~0U) + if (c != ~0) (void) FormatImageProperty(image,"dpx:film.offset","%d", cin.film.offset); cin.film.reserve1=ReadBlobByte(image); diff --git a/coders/miff.c b/coders/miff.c index bd064e389..5f803340a 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -1407,17 +1407,17 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, } length--; if (image->storage_class == PseudoClass) - SetPixelIndex(image,pixel.index,q); + SetPixelIndex(image,ClampToQuantum(pixel.index),q); else { - SetPixelRed(image,pixel.red,q); - SetPixelGreen(image,pixel.green,q); - SetPixelBlue(image,pixel.blue,q); + SetPixelRed(image,ClampToQuantum(pixel.red),q); + SetPixelGreen(image,ClampToQuantum(pixel.green),q); + SetPixelBlue(image,ClampToQuantum(pixel.blue),q); if (image->colorspace == CMYKColorspace) - SetPixelBlack(image,pixel.black,q); + SetPixelBlack(image,ClampToQuantum(pixel.black),q); } if (image->matte != MagickFalse) - SetPixelAlpha(image,pixel.alpha,q); + SetPixelAlpha(image,ClampToQuantum(pixel.alpha),q); q+=GetPixelChannels(image); } break; @@ -1675,7 +1675,7 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, if (image->matte != MagickFalse) { - value=ScaleQuantumToLong(pixel->alpha); + value=ScaleQuantumToLong(ClampToQuantum(pixel->alpha)); pixels=PopLongPixel(MSBEndian,value,pixels); } break; @@ -1687,7 +1687,7 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, if (image->matte != MagickFalse) { - value=ScaleQuantumToShort(pixel->alpha); + value=ScaleQuantumToShort(ClampToQuantum(pixel->alpha)); pixels=PopShortPixel(MSBEndian,value,pixels); } break; @@ -1699,7 +1699,8 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, if (image->matte != MagickFalse) { - value=(unsigned char) ScaleQuantumToChar(pixel->alpha); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum( + pixel->alpha)); pixels=PopCharPixel(value,pixels); } break; @@ -1718,20 +1719,20 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, unsigned int value; - value=ScaleQuantumToLong(pixel->red); + value=ScaleQuantumToLong(ClampToQuantum(pixel->red)); pixels=PopLongPixel(MSBEndian,value,pixels); - value=ScaleQuantumToLong(pixel->green); + value=ScaleQuantumToLong(ClampToQuantum(pixel->green)); pixels=PopLongPixel(MSBEndian,value,pixels); - value=ScaleQuantumToLong(pixel->blue); + value=ScaleQuantumToLong(ClampToQuantum(pixel->blue)); pixels=PopLongPixel(MSBEndian,value,pixels); if (image->colorspace == CMYKColorspace) { - value=ScaleQuantumToLong(pixel->black); + value=ScaleQuantumToLong(ClampToQuantum(pixel->black)); pixels=PopLongPixel(MSBEndian,value,pixels); } if (image->matte != MagickFalse) { - value=ScaleQuantumToLong(pixel->alpha); + value=ScaleQuantumToLong(ClampToQuantum(pixel->alpha)); pixels=PopLongPixel(MSBEndian,value,pixels); } break; @@ -1741,20 +1742,20 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, unsigned short value; - value=ScaleQuantumToShort(pixel->red); + value=ScaleQuantumToShort(ClampToQuantum(pixel->red)); pixels=PopShortPixel(MSBEndian,value,pixels); - value=ScaleQuantumToShort(pixel->green); + value=ScaleQuantumToShort(ClampToQuantum(pixel->green)); pixels=PopShortPixel(MSBEndian,value,pixels); - value=ScaleQuantumToShort(pixel->blue); + value=ScaleQuantumToShort(ClampToQuantum(pixel->blue)); pixels=PopShortPixel(MSBEndian,value,pixels); if (image->colorspace == CMYKColorspace) { - value=ScaleQuantumToShort(pixel->black); + value=ScaleQuantumToShort(ClampToQuantum(pixel->black)); pixels=PopShortPixel(MSBEndian,value,pixels); } if (image->matte != MagickFalse) { - value=ScaleQuantumToShort(pixel->alpha); + value=ScaleQuantumToShort(ClampToQuantum(pixel->alpha)); pixels=PopShortPixel(MSBEndian,value,pixels); } break; @@ -1764,20 +1765,22 @@ static unsigned char *PopRunlengthPacket(Image *image,unsigned char *pixels, unsigned char value; - value=(unsigned char) ScaleQuantumToChar(pixel->red); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum(pixel->red)); pixels=PopCharPixel(value,pixels); - value=(unsigned char) ScaleQuantumToChar(pixel->green); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum(pixel->green)); pixels=PopCharPixel(value,pixels); - value=(unsigned char) ScaleQuantumToChar(pixel->blue); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum(pixel->blue)); pixels=PopCharPixel(value,pixels); if (image->colorspace == CMYKColorspace) { - value=(unsigned char) ScaleQuantumToChar(pixel->black); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum( + pixel->black)); pixels=PopCharPixel(value,pixels); } if (image->matte != MagickFalse) { - value=(unsigned char) ScaleQuantumToChar(pixel->alpha); + value=(unsigned char) ScaleQuantumToChar(ClampToQuantum( + pixel->alpha)); pixels=PopCharPixel(value,pixels); } break; diff --git a/coders/png.c b/coders/png.c index 3617563ad..a16e8904b 100644 --- a/coders/png.c +++ b/coders/png.c @@ -9552,7 +9552,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, ping_bit_depth=1; one=1; - while ((one << ping_bit_depth) < (ssize_t) number_colors) + while ((one << ping_bit_depth) < (size_t) number_colors) ping_bit_depth <<= 1; } diff --git a/coders/pnm.c b/coders/pnm.c index 767d757a8..85eb53ba4 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -564,9 +564,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) pixel.blue=(MagickRealType) scale[ConstrainPixel(image,(ssize_t) pixel.blue,max_value)]; } - SetPixelRed(image,pixel.red,q); - SetPixelGreen(image,pixel.green,q); - SetPixelBlue(image,pixel.blue,q); + SetPixelRed(image,ClampToQuantum(pixel.red),q); + SetPixelGreen(image,ClampToQuantum(pixel.green),q); + SetPixelBlue(image,ClampToQuantum(pixel.blue),q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) diff --git a/coders/psd.c b/coders/psd.c index 198a2bf22..e168e5f44 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -2033,7 +2033,7 @@ static void RemoveResolutionFromResourceBlock(StringInfo *bim_profile) p=PushShortPixel(MSBEndian,p,&id); p=PushShortPixel(MSBEndian,p,&short_sans); p=PushLongPixel(MSBEndian,p,&count); - if ((id == 0x000003ed) && (PSDQuantum(count) < (length-12))) + if ((id == 0x000003ed) && (PSDQuantum(count) < (ssize_t) (length-12))) { (void) CopyMagickMemory(q,q+PSDQuantum(count)+12,length- (PSDQuantum(count)+12)-(q-datum)); diff --git a/coders/tiff.c b/coders/tiff.c index 9250c3d55..16dbeefb8 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -360,7 +360,7 @@ static Image *ReadGROUP4Image(const ImageInfo *image_info, length=WriteLSBLong(file,(size_t) (strip_offset-8)); length=fwrite("\050\001\003\000\001\000\000\000\002\000\000\000",1,12,file); length=fwrite("\000\000\000\000",1,4,file); - length=WriteLSBLong(file,image->x_resolution); + length=WriteLSBLong(file,(long) image->x_resolution); length=WriteLSBLong(file,1); for (length=0; (c=ReadBlobByte(image)) != EOF; length++) (void) fputc(c,file); -- 2.40.0