From: cristy Date: Fri, 12 Jun 2015 16:35:04 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~911 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df409586066e37b0cbc92ef3c2be565dd3fce86e;p=imagemagick --- diff --git a/MagickCore/cache-private.h b/MagickCore/cache-private.h index 8b54f440e..54a9b0080 100644 --- a/MagickCore/cache-private.h +++ b/MagickCore/cache-private.h @@ -98,6 +98,9 @@ typedef struct _CacheMethods DestroyPixelHandler destroy_pixel_handler; + + MagickBooleanType + stream; } CacheMethods; typedef struct _NexusInfo diff --git a/MagickCore/cache.c b/MagickCore/cache.c index bd37fae27..1296b36ce 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -3350,12 +3350,14 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if ((image->columns == 0) || (image->rows == 0)) ThrowBinaryException(CacheError,"NoPixelsDefinedInCache",image->filename); + cache_info=(CacheInfo *) image->cache; + assert(cache_info->signature == MagickSignature); + if (cache_info->methods.stream != MagickFalse) + return(MagickTrue); if ((AcquireMagickResource(WidthResource,image->columns) == MagickFalse) || (AcquireMagickResource(HeightResource,image->rows) == MagickFalse)) ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed", image->filename); - cache_info=(CacheInfo *) image->cache; - assert(cache_info->signature == MagickSignature); source_info=(*cache_info); source_info.file=(-1); (void) FormatLocaleString(cache_info->filename,MagickPathExtent,"%s[%.20g]", @@ -4472,6 +4474,7 @@ MagickPrivate void SetPixelCacheMethods(Cache cache,CacheMethods *cache_methods) (GetOneAuthenticPixelFromHandler) NULL) cache_info->methods.get_one_authentic_pixel_from_handler= cache_methods->get_one_authentic_pixel_from_handler; + cache_info->methods.stream=cache_methods->stream; } /* diff --git a/MagickCore/quantum-private.h b/MagickCore/quantum-private.h index 292ad7a84..a1770b39d 100644 --- a/MagickCore/quantum-private.h +++ b/MagickCore/quantum-private.h @@ -229,22 +229,22 @@ static inline const unsigned char *PushCharPixel(const unsigned char *pixels, static inline const unsigned char *PushLongPixel(const EndianType endian, const unsigned char *pixels,unsigned int *pixel) { - register unsigned int + register unsigned long quantum; if (endian == LSBEndian) { - quantum=(unsigned int) (*pixels++); - quantum|=(unsigned int) (*pixels++ << 8); - quantum|=(unsigned int) (*pixels++ << 16); - quantum|=(unsigned int) (*pixels++ << 24); + quantum=((unsigned long) *pixels++); + quantum|=((unsigned long) *pixels++ << 8); + quantum|=((unsigned long) *pixels++ << 16); + quantum|=((unsigned long) *pixels++ << 24); *pixel=(unsigned int) (quantum & 0xffffffff); return(pixels); } - quantum=(unsigned int) (*pixels++ << 24); - quantum|=(unsigned int) (*pixels++ << 16); - quantum|=(unsigned int) (*pixels++ << 8); - quantum|=(unsigned int) (*pixels++); + quantum=((unsigned long) *pixels++ << 24); + quantum|=((unsigned long) *pixels++ << 16); + quantum|=((unsigned long) *pixels++ << 8); + quantum|=((unsigned long) *pixels++); *pixel=(unsigned int) (quantum & 0xffffffff); return(pixels); } diff --git a/MagickCore/stream.c b/MagickCore/stream.c index 4facad81c..0fd456542 100644 --- a/MagickCore/stream.c +++ b/MagickCore/stream.c @@ -992,9 +992,9 @@ MagickExport Image *ReadStream(const ImageInfo *image_info,StreamHandler stream, read_info->cache=AcquirePixelCache(0); GetPixelCacheMethods(&cache_methods); cache_methods.get_virtual_pixel_handler=GetVirtualPixelStream; + cache_methods.get_virtual_pixels_handler=GetVirtualPixelsStream; cache_methods.get_virtual_metacontent_from_handler= GetVirtualMetacontentFromStream; - cache_methods.get_virtual_pixels_handler=GetVirtualPixelsStream; cache_methods.get_authentic_pixels_handler=GetAuthenticPixelsStream; cache_methods.queue_authentic_pixels_handler=QueueAuthenticPixelsStream; cache_methods.sync_authentic_pixels_handler=SyncAuthenticPixelsStream; @@ -1005,6 +1005,7 @@ MagickExport Image *ReadStream(const ImageInfo *image_info,StreamHandler stream, cache_methods.get_one_authentic_pixel_from_handler= GetOneAuthenticPixelFromStream; cache_methods.destroy_pixel_handler=DestroyPixelStream; + cache_methods.stream=MagickTrue; SetPixelCacheMethods(read_info->cache,&cache_methods); read_info->stream=stream; image=ReadImage(read_info,exception); diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c index a484483a2..22b2c3653 100644 --- a/MagickCore/xwindow.c +++ b/MagickCore/xwindow.c @@ -1151,7 +1151,7 @@ MagickPrivate XVisualInfo *XBestVisualInfo(Display *display, #define XVisualColormapSize(visual_info) MagickMin((unsigned int) (\ (visual_info->klass == TrueColor) || (visual_info->klass == DirectColor) ? \ visual_info->red_mask | visual_info->green_mask | visual_info->blue_mask : \ - (unsigned int) visual_info->colormap_size),1U << visual_info->depth) + (unsigned long) visual_info->colormap_size),1UL << visual_info->depth) char *map_type, diff --git a/MagickWand/composite.c b/MagickWand/composite.c index d3af6541f..25bb4aed2 100644 --- a/MagickWand/composite.c +++ b/MagickWand/composite.c @@ -381,6 +381,9 @@ static void RelinquishCompositeOptions(CompositeOptions *composite_options) if (composite_options->compose_args != (char *) NULL) composite_options->compose_args=(char *) RelinquishMagickMemory(composite_options->compose_args); + if (composite_options->geometry != (char *) NULL) + composite_options->geometry=(char *) + RelinquishMagickMemory(composite_options->geometry); } WandExport MagickBooleanType CompositeImageCommand(ImageInfo *image_info, diff --git a/coders/bmp.c b/coders/bmp.c index cd6dc7bec..285918d32 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -111,7 +111,7 @@ */ typedef struct _BMPInfo { - unsigned int + unsigned long file_size, ba_offset, offset_bits, @@ -125,7 +125,7 @@ typedef struct _BMPInfo planes, bits_per_pixel; - unsigned int + unsigned long compression, image_size, x_pixels, @@ -137,7 +137,7 @@ typedef struct _BMPInfo alpha_mask, colors_important; - int + long colorspace; PrimaryInfo @@ -594,7 +594,7 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) bmp_info.offset_bits=ReadBlobLSBLong(image); bmp_info.size=ReadBlobLSBLong(image); if (image->debug != MagickFalse) - (void) LogMagickEvent(CoderEvent,GetMagickModule()," BMP size: %u", + (void) LogMagickEvent(CoderEvent,GetMagickModule()," BMP size: %lu", bmp_info.size); if (bmp_info.size == 12) { @@ -690,20 +690,19 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Compression: UNKNOWN (%u)",bmp_info.compression); + " Compression: UNKNOWN (%lu)",bmp_info.compression); } } (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Number of colors: %u",bmp_info.number_colors); + " Number of colors: %lu",bmp_info.number_colors); } bmp_info.red_mask=ReadBlobLSBLong(image); bmp_info.green_mask=ReadBlobLSBLong(image); bmp_info.blue_mask=ReadBlobLSBLong(image); if (bmp_info.size > 40) { - double - sum; + gamma; /* Read color management information. @@ -724,24 +723,27 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) bmp_info.blue_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; - sum=bmp_info.red_primary.x+bmp_info.red_primary.y+ + gamma=bmp_info.red_primary.x+bmp_info.red_primary.y+ bmp_info.red_primary.z; - bmp_info.red_primary.x/=sum; - bmp_info.red_primary.y/=sum; + gamma=PerceptibleReciprocal(gamma); + bmp_info.red_primary.x*=gamma; + bmp_info.red_primary.y*=gamma; image->chromaticity.red_primary.x=bmp_info.red_primary.x; image->chromaticity.red_primary.y=bmp_info.red_primary.y; - sum=bmp_info.green_primary.x+bmp_info.green_primary.y+ + gamma=bmp_info.green_primary.x+bmp_info.green_primary.y+ bmp_info.green_primary.z; - bmp_info.green_primary.x/=sum; - bmp_info.green_primary.y/=sum; + gamma=PerceptibleReciprocal(gamma); + bmp_info.green_primary.x*=gamma; + bmp_info.green_primary.y*=gamma; image->chromaticity.green_primary.x=bmp_info.green_primary.x; image->chromaticity.green_primary.y=bmp_info.green_primary.y; - sum=bmp_info.blue_primary.x+bmp_info.blue_primary.y+ + gamma=bmp_info.blue_primary.x+bmp_info.blue_primary.y+ bmp_info.blue_primary.z; - bmp_info.blue_primary.x/=sum; - bmp_info.blue_primary.y/=sum; + gamma=PerceptibleReciprocal(gamma); + bmp_info.blue_primary.x*=gamma; + bmp_info.blue_primary.y*=gamma; image->chromaticity.blue_primary.x=bmp_info.blue_primary.x; image->chromaticity.blue_primary.y=bmp_info.blue_primary.y; @@ -1975,7 +1977,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Compression=UNKNOWN (%u)",bmp_info.compression); + " Compression=UNKNOWN (%lu)",bmp_info.compression); break; } } @@ -1984,7 +1986,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, " Number_colors=unspecified"); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Number_colors=%u",bmp_info.number_colors); + " Number_colors=%lu",bmp_info.number_colors); } (void) WriteBlob(image,2,(unsigned char *) "BM"); (void) WriteBlobLSBLong(image,bmp_info.file_size); @@ -2138,7 +2140,7 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Pixels: %u bytes",bmp_info.image_size); + " Pixels: %lu bytes",bmp_info.image_size); (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels); pixel_info=RelinquishVirtualMemory(pixel_info); if (GetNextImageInList(image) == (Image *) NULL) diff --git a/tests/wandtest.c b/tests/wandtest.c index c0e5eb5b1..3eef5ce26 100644 --- a/tests/wandtest.c +++ b/tests/wandtest.c @@ -5417,6 +5417,7 @@ int main(int argc,char **argv) (void) FormatLocaleFile(stderr,"Option does not match\n"); exit(1); } + option=(char *) MagickRelinquishMemory(option); options=MagickGetOptions(magick_wand,"*",&number_options); if (options != (char **) NULL) { @@ -5444,6 +5445,7 @@ int main(int argc,char **argv) (void) FormatLocaleFile(stderr,"Property does not match\n"); exit(1); } + property=(char *) MagickRelinquishMemory(property); properties=MagickGetImageProperties(magick_wand,"*",&number_properties); if (properties != (char **) NULL) {