}
#endif
-static Image *ReadMNGImage(const ImageInfo *image_info,
+static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
MagickOffsetType
offset;
- MngInfo
- *mng_info;
-
MngBox
default_fb,
fb,
default_fb.left=0;
default_fb.right=0;
- /* Open image file. */
-
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickCoreSignature);
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image_info->filename);
- assert(exception != (ExceptionInfo *) NULL);
- assert(exception->signature == MagickCoreSignature);
- logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadMNGImage()");
- image=AcquireImage(image_info,exception);
- mng_info=(MngInfo *) NULL;
- status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
-
- if (status == MagickFalse)
- return((Image *) NULL);
-
- first_mng_object=MagickFalse;
- skipping_loop=(-1);
-
- /* Allocate a MngInfo structure. */
-
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
-
- if (mng_info == (MngInfo *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-
- /* Initialize members of the MngInfo structure. */
+ logging=LogMagickEvent(CoderEvent,GetMagickModule(),
+ " Enter ReadOneMNGImage()");
- (void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
- mng_info->image=image;
+ image=mng_info->image;
if (LocaleCompare(image_info->magick,"MNG") == 0)
{
mng_info->exists[0]=MagickTrue;
}
+ skipping_loop=(-1);
first_mng_object=MagickTrue;
mng_type=0;
#if defined(MNG_INSERT_LAYERS)
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"exit ReadJNGImage() with error");
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
{
(void) CloseBlob(image);
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
(next == (Quantum *) NULL))
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
if (image != (Image *) NULL)
image=DestroyImageList(image);
- mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
}
}
- image=GetFirstImageInList(image);
+ if (logging != MagickFalse)
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " exit ReadOneMNGImage();");
+
+ return(image);
+}
+
+static Image *ReadMNGImage(const ImageInfo *image_info,
+ ExceptionInfo *exception)
+{
+ Image
+ *image;
+
+ MagickBooleanType
+ logging,
+ status;
+
+ MngInfo
+ *mng_info;
+
+ /* Open image file. */
+
+ assert(image_info != (const ImageInfo *) NULL);
+ assert(image_info->signature == MagickCoreSignature);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
+ image_info->filename);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ logging=LogMagickEvent(CoderEvent,GetMagickModule(),"Enter ReadMNGImage()");
+ image=AcquireImage(image_info,exception);
+ mng_info=(MngInfo *) NULL;
+ status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
+
+ if (status == MagickFalse)
+ return((Image *) NULL);
+
+ /* Allocate a MngInfo structure. */
+
+ mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+
+ if (mng_info == (MngInfo *) NULL)
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+
+ /* Initialize members of the MngInfo structure. */
+
+ (void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
+ mng_info->image=image;
+ image=ReadOneMNGImage(mng_info,image_info,exception);
mng_info=MngInfoFreeStruct(mng_info);
+ if (image == (Image *) NULL)
+ {
+ if (logging != MagickFalse)
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ "exit ReadMNGImage() with error");
+
+ return((Image *) NULL);
+ }
+ (void) CloseBlob(image);
+
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit ReadMNGImage()");