magick_info=GetMagickInfo(blob_info->magick,exception);
if (magick_info == (const MagickInfo *) NULL)
{
- blob_info=DestroyImageInfo(blob_info);
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
- image_info->filename);
+ blob_info->magick);
+ blob_info=DestroyImageInfo(blob_info);
return((Image *) NULL);
}
if (GetMagickBlobSupport(magick_info) != MagickFalse)
*images;
/*
- Restore original filenames.
+ Restore original filenames and image format.
*/
for (images=GetFirstImageInList(image); images != (Image *) NULL; )
{
- (void) CopyMagickMemory(images->filename,image_info->filename,
- sizeof(images->filename));
- (void) CopyMagickMemory(images->magick_filename,image_info->filename,
- sizeof(images->magick_filename));
+ (void) CopyMagickString(images->filename,image_info->filename,
+ MaxTextExtent);
+ (void) CopyMagickString(images->magick_filename,image_info->filename,
+ MaxTextExtent);
+ (void) CopyMagickString(images->magick,magick_info->name,
+ MaxTextExtent);
images=GetNextImageInList(images);
}
}
if (blob_info->mapped != MagickFalse)
{
(void) UnmapBlob(blob_info->data,blob_info->length);
+ blob_info->data=(unsigned char *) NULL;
RelinquishMagickResource(MapResource,blob_info->length);
}
blob_info->mapped=MagickFalse;
blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob));
if (blob == (unsigned char *) NULL)
{
+ file=close(file);
ThrowFileException(exception,ResourceLimitError,"MemoryAllocationFailed",
filename);
return(MagickFalse);
{
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
- image->filename);
+ image->magick);
+ blob_info=DestroyImageInfo(blob_info);
return(blob);
}
(void) CopyMagickString(blob_info->magick,image->magick,MaxTextExtent);
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
if ((file == -1) || (i < length))
{
+ if (file != -1)
+ file=close(file);
ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename);
return(MagickFalse);
}
{
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
- images->filename);
+ images->magick);
+ blob_info=DestroyImageInfo(blob_info);
return(blob);
}
if (GetMagickAdjoin(magick_info) == MagickFalse)
if (((int) magick[0] == 0x1F) && ((int) magick[1] == 0x8B) &&
((int) magick[2] == 0x08))
{
- (void) fclose(image->blob->file_info.file);
+ if (image->blob->file_info.file != (FILE *) NULL)
+ (void) fclose(image->blob->file_info.file);
+ image->blob->file_info.file=(FILE *) NULL;
image->blob->file_info.gzfile=gzopen(filename,type);
if (image->blob->file_info.gzfile != (gzFile) NULL)
image->blob->type=ZipStream;
#if defined(MAGICKCORE_BZLIB_DELEGATE)
if (strncmp((char *) magick,"BZh",3) == 0)
{
- (void) fclose(image->blob->file_info.file);
+ if (image->blob->file_info.file != (FILE *) NULL)
+ (void) fclose(image->blob->file_info.file);
+ image->blob->file_info.file=(FILE *) NULL;
image->blob->file_info.bzfile=BZ2_bzopen(filename,type);
if (image->blob->file_info.bzfile != (BZFILE *) NULL)
image->blob->type=BZipStream;
return(-1);
case FileStream:
{
+ if ((whence == SEEK_SET) && (offset < 0))
+ return(-1);
if (fseek(image->blob->file_info.file,offset,whence) < 0)
return(-1);
image->blob->offset=TellBlob(image);