From: cristy Date: Sat, 20 Sep 2014 00:44:37 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~1993 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4916cb41d578e852d99764cd98c65e9fb1253cd9;p=imagemagick --- diff --git a/MagickCore/blob-private.h b/MagickCore/blob-private.h index d4f63f1fe..12b12ff3f 100644 --- a/MagickCore/blob-private.h +++ b/MagickCore/blob-private.h @@ -58,7 +58,6 @@ extern MagickPrivate StreamHandler extern MagickPrivate void GetBlobInfo(BlobInfo *), - GetBlobPrivate(Image *), SetBlobExempt(Image *,const MagickBooleanType); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/MagickCore/blob.c b/MagickCore/blob.c index 5ef8e8552..5c3154b1b 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -1292,57 +1292,6 @@ MagickPrivate void GetBlobInfo(BlobInfo *blob_info) blob_info->semaphore=AcquireSemaphoreInfo(); blob_info->signature=MagickSignature; } - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % -+ G e t B l o b P r i v a t e % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% GetBlobPrivate() checks if the blob of the specified image is referenced by -% other images. If the reference_count is higher then 1 a new blob is assigned -% to the specified image. -% -% The format of the GetBlobError method is: -% -% void GetBlobPrivate(Image *image) -% -% A description of each parameter follows: -% -% o image: the image. -% -*/ -MagickPrivate void GetBlobPrivate(Image *image) -{ - BlobInfo - *blob; - - MagickBooleanType - clone; - - assert(image != (Image *) NULL); - assert(image->signature == MagickSignature); - if (image->debug != MagickFalse) - (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - assert(image->blob != (BlobInfo *) NULL); - assert(image->blob->signature == MagickSignature); - clone=MagickFalse; - LockSemaphoreInfo(image->blob->semaphore); - assert(image->blob->reference_count >= 0); - if (image->blob->reference_count > 1) - clone=MagickTrue; - UnlockSemaphoreInfo(image->blob->semaphore); - if (clone == MagickFalse) - return; - blob=CloneBlobInfo(image->blob); - DestroyBlob(image); - image->blob=blob; -} /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/MagickCore/constitute.c b/MagickCore/constitute.c index 42c9eaebe..ff4c5d956 100644 --- a/MagickCore/constitute.c +++ b/MagickCore/constitute.c @@ -1000,7 +1000,6 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, assert(exception != (ExceptionInfo *) NULL); sans_exception=AcquireExceptionInfo(); write_info=CloneImageInfo(image_info); - GetBlobPrivate(image); (void) CopyMagickString(write_info->filename,image->filename,MaxTextExtent); if (*write_info->magick == '\0') (void) CopyMagickString(write_info->magick,image->magick,MaxTextExtent); @@ -1272,7 +1271,6 @@ MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, assert(exception != (ExceptionInfo *) NULL); write_info=CloneImageInfo(image_info); images=GetFirstImageInList(images); - GetBlobPrivate(images); if (filename != (const char *) NULL) for (p=images; p != (Image *) NULL; p=GetNextImageInList(p)) (void) CopyMagickString(p->filename,filename,MaxTextExtent); diff --git a/MagickCore/image.c b/MagickCore/image.c index 5193e37df..2cfc6ed41 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -1135,7 +1135,9 @@ MagickExport ImageInfo *DestroyImageInfo(ImageInfo *image_info) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% DisassociateImageStream() disassociates the image stream. +% DisassociateImageStream() disassociates the image stream. It checks if the +% blob of the specified image is referenced by other images. If the reference +% count is higher then 1 a new blob is assigned to the specified image. % % The format of the DisassociateImageStream method is: % @@ -1148,16 +1150,29 @@ MagickExport ImageInfo *DestroyImageInfo(ImageInfo *image_info) */ MagickExport void DisassociateImageStream(Image *image) { - unsigned char - *data; + BlobInfo + *blob; - assert(image != (const Image *) NULL); + MagickBooleanType + clone; + + assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - data=DetachBlob(image->blob); - if (data != (unsigned char *) NULL) - data=(unsigned char *) RelinquishMagickMemory(data); + assert(image->blob != (BlobInfo *) NULL); + assert(image->blob->signature == MagickSignature); + clone=MagickFalse; + LockSemaphoreInfo(image->blob->semaphore); + assert(image->blob->reference_count >= 0); + if (image->blob->reference_count > 1) + clone=MagickTrue; + UnlockSemaphoreInfo(image->blob->semaphore); + if (clone == MagickFalse) + return; + blob=CloneBlobInfo(image->blob); + DestroyBlob(image); + image->blob=blob; } /*