}
}
-static void MngInfoFreeStruct(MngInfo *mng_info,
- MagickBooleanType *have_mng_structure)
+static MngInfo *MngInfoFreeStruct(MngInfo *mng_info)
{
- if (*have_mng_structure != MagickFalse && (mng_info != (MngInfo *) NULL))
- {
- register ssize_t
- i;
+ register ssize_t
+ i;
- for (i=1; i < MNG_MAX_OBJECTS; i++)
- MngInfoDiscardObject(mng_info,i);
+ if (mng_info == (MngInfo *) NULL)
+ return((MngInfo *) NULL);
- if (mng_info->global_plte != (png_colorp) NULL)
- mng_info->global_plte=(png_colorp)
- RelinquishMagickMemory(mng_info->global_plte);
+ for (i=1; i < MNG_MAX_OBJECTS; i++)
+ MngInfoDiscardObject(mng_info,i);
- mng_info=(MngInfo *) RelinquishMagickMemory(mng_info);
- *have_mng_structure=MagickFalse;
- }
+ if (mng_info->global_plte != (png_colorp) NULL)
+ mng_info->global_plte=(png_colorp)
+ RelinquishMagickMemory(mng_info->global_plte);
+
+ return((MngInfo *) RelinquishMagickMemory(mng_info));
}
static MngBox mng_minimum_box(MngBox box1,MngBox box2)
*image;
MagickBooleanType
- have_mng_structure,
logging,
status;
/*
Allocate a MngInfo structure.
*/
- have_mng_structure=MagickFalse;
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
*/
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
- have_mng_structure=MagickTrue;
image=ReadOnePNGImage(mng_info,image_info,exception);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
if (image == (Image *) NULL)
{
*image;
MagickBooleanType
- have_mng_structure,
logging,
status;
/* Allocate a MngInfo structure. */
- have_mng_structure=MagickFalse;
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(*mng_info));
if (mng_info == (MngInfo *) NULL)
/* Initialize members of the MngInfo structure. */
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
- have_mng_structure=MagickTrue;
mng_info->image=image;
image=ReadOneJNGImage(mng_info,image_info,exception);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
if (image == (Image *) NULL)
{
*image;
MagickBooleanType
- logging,
- have_mng_structure;
+ logging;
volatile int
first_mng_object,
first_mng_object=MagickFalse;
skipping_loop=(-1);
- have_mng_structure=MagickFalse;
/* Allocate a MngInfo structure. */
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
- have_mng_structure=MagickTrue;
if (LocaleCompare(image_info->magick,"MNG") == 0)
{
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"exit ReadJNGImage() with error");
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
{
(void) CloseBlob(image);
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
(next == (Quantum *) NULL))
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
if (image != (Image *) NULL)
image=DestroyImageList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
return((Image *) NULL);
}
}
image=GetFirstImageInList(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
- have_mng_structure=MagickFalse;
+ mng_info=MngInfoFreeStruct(mng_info);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit ReadMNGImage()");
MagickBooleanType
excluding,
logging,
- have_mng_structure,
status;
MngInfo
/*
Allocate a MngInfo structure.
*/
- have_mng_structure=MagickFalse;
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
mng_info->equal_backgrounds=MagickTrue;
- have_mng_structure=MagickTrue;
/* See if user has requested a specific PNG subformat */
status=WriteOnePNGImage(mng_info,image_info,image,exception);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit WritePNGImage()");
Image *image, ExceptionInfo *exception)
{
MagickBooleanType
- have_mng_structure,
logging,
status;
/*
Allocate a MngInfo structure.
*/
- have_mng_structure=MagickFalse;
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
*/
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
- have_mng_structure=MagickTrue;
(void) WriteBlob(image,8,(const unsigned char *) "\213JNG\r\n\032\n");
status=WriteOneJNGImage(mng_info,image_info,image,exception);
+ mng_info=MngInfoFreeStruct(mng_info);
(void) CloseBlob(image);
(void) CatchImageException(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit WriteJNGImage()");
return(status);
*next_image;
MagickBooleanType
- have_mng_structure,
status;
volatile MagickBooleanType
/*
Allocate a MngInfo structure.
*/
- have_mng_structure=MagickFalse;
mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
*/
(void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
mng_info->image=image;
- have_mng_structure=MagickTrue;
write_mng=LocaleCompare(image_info->magick,"MNG") == 0;
/*
if (status == MagickFalse)
{
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
(void) CloseBlob(image);
return(MagickFalse);
}
Relinquish resources.
*/
(void) CloseBlob(image);
- MngInfoFreeStruct(mng_info,&have_mng_structure);
+ mng_info=MngInfoFreeStruct(mng_info);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit WriteMNGImage()");