*/
MagickExport MagickBooleanType CloseBlob(Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
int
status;
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
- if (image->blob->type == UndefinedStream)
+ blob_info=image->blob;
+ if (blob_info->type == UndefinedStream)
return(MagickTrue);
status=SyncBlob(image);
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
case FileStream:
case PipeStream:
{
- if (image->blob->synchronize != MagickFalse)
- status=fsync(fileno(image->blob->file_info.file));
- status=ferror(image->blob->file_info.file);
+ if (blob_info->synchronize != MagickFalse)
+ status=fsync(fileno(blob_info->file_info.file));
+ status=ferror(blob_info->file_info.file);
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
- (void) gzerror(image->blob->file_info.gzfile,&status);
+ (void) gzerror(blob_info->file_info.gzfile,&status);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
- (void) BZ2_bzerror(image->blob->file_info.bzfile,&status);
+ (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);
#endif
break;
}
break;
case BlobStream:
{
- if ((image->blob->file_info.file != (FILE *) NULL) &&
- (image->blob->synchronize != MagickFalse))
+ if ((blob_info->file_info.file != (FILE *) NULL) &&
+ (blob_info->synchronize != MagickFalse))
{
- (void) fsync(fileno(image->blob->file_info.file));
- status=ferror(image->blob->file_info.file);
+ (void) fsync(fileno(blob_info->file_info.file));
+ status=ferror(blob_info->file_info.file);
}
break;
}
case CustomStream:
break;
}
- image->blob->status=status < 0 ? MagickTrue : MagickFalse;
- image->blob->size=GetBlobSize(image);
- image->extent=image->blob->size;
- image->blob->eof=MagickFalse;
- if (image->blob->exempt != MagickFalse)
+ blob_info->status=status < 0 ? MagickTrue : MagickFalse;
+ blob_info->size=GetBlobSize(image);
+ image->extent=blob_info->size;
+ blob_info->eof=MagickFalse;
+ if (blob_info->exempt != MagickFalse)
{
- image->blob->type=UndefinedStream;
- return(image->blob->status);
+ blob_info->type=UndefinedStream;
+ return(blob_info->status);
}
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
{
- status=fclose(image->blob->file_info.file);
+ status=fclose(blob_info->file_info.file);
break;
}
case PipeStream:
{
#if defined(MAGICKCORE_HAVE_PCLOSE)
- status=pclose(image->blob->file_info.file);
+ status=pclose(blob_info->file_info.file);
#endif
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
- status=gzclose(image->blob->file_info.gzfile);
+ status=gzclose(blob_info->file_info.gzfile);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
- BZ2_bzclose(image->blob->file_info.bzfile);
+ BZ2_bzclose(blob_info->file_info.bzfile);
#endif
break;
}
break;
case BlobStream:
{
- if (image->blob->file_info.file != (FILE *) NULL)
- status=fclose(image->blob->file_info.file);
+ if (blob_info->file_info.file != (FILE *) NULL)
+ status=fclose(blob_info->file_info.file);
break;
}
case CustomStream:
break;
}
- (void) DetachBlob(image->blob);
- image->blob->status=status < 0 ? MagickTrue : MagickFalse;
- return(image->blob->status);
+ (void) DetachBlob(blob_info);
+ blob_info->status=status < 0 ? MagickTrue : MagickFalse;
+ return(blob_info->status);
}
\f
/*
*/
MagickExport void DestroyBlob(Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
MagickBooleanType
destroy;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->signature == MagickCoreSignature);
+ blob_info=image->blob;
destroy=MagickFalse;
- LockSemaphoreInfo(image->blob->semaphore);
- image->blob->reference_count--;
- assert(image->blob->reference_count >= 0);
- if (image->blob->reference_count == 0)
+ LockSemaphoreInfo(blob_info->semaphore);
+ blob_info->reference_count--;
+ assert(blob_info->reference_count >= 0);
+ if (blob_info->reference_count == 0)
destroy=MagickTrue;
- UnlockSemaphoreInfo(image->blob->semaphore);
+ UnlockSemaphoreInfo(blob_info->semaphore);
if (destroy == MagickFalse)
return;
(void) CloseBlob(image);
- if (image->blob->mapped != MagickFalse)
+ if (blob_info->mapped != MagickFalse)
{
- (void) UnmapBlob(image->blob->data,image->blob->length);
- RelinquishMagickResource(MapResource,image->blob->length);
+ (void) UnmapBlob(blob_info->data,blob_info->length);
+ RelinquishMagickResource(MapResource,blob_info->length);
}
- if (image->blob->semaphore != (SemaphoreInfo *) NULL)
- RelinquishSemaphoreInfo(&image->blob->semaphore);
- image->blob->signature=(~MagickCoreSignature);
- image->blob=(BlobInfo *) RelinquishMagickMemory(image->blob);
+ if (blob_info->semaphore != (SemaphoreInfo *) NULL)
+ RelinquishSemaphoreInfo(&blob_info->semaphore);
+ blob_info->signature=(~MagickCoreSignature);
+ image->blob=(BlobInfo *) RelinquishMagickMemory(blob_info);
}
\f
/*
MagickExport void DisassociateBlob(Image *image)
{
BlobInfo
- *blob;
+ *restrict blob_info,
+ *clone_info;
MagickBooleanType
clone;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->signature == MagickCoreSignature);
+ blob_info=image->blob;
clone=MagickFalse;
- LockSemaphoreInfo(image->blob->semaphore);
- assert(image->blob->reference_count >= 0);
- if (image->blob->reference_count > 1)
+ LockSemaphoreInfo(blob_info->semaphore);
+ assert(blob_info->reference_count >= 0);
+ if (blob_info->reference_count > 1)
clone=MagickTrue;
- UnlockSemaphoreInfo(image->blob->semaphore);
+ UnlockSemaphoreInfo(blob_info->semaphore);
if (clone == MagickFalse)
return;
- blob=CloneBlobInfo(image->blob);
+ clone_info=CloneBlobInfo(blob_info);
DestroyBlob(image);
- image->blob=blob;
+ image->blob=clone_info;
}
\f
/*
*/
MagickExport int EOFBlob(const Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
- switch (image->blob->type)
+ blob_info=image->blob;
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
case FileStream:
case PipeStream:
{
- image->blob->eof=feof(image->blob->file_info.file) != 0 ? MagickTrue :
+ blob_info->eof=feof(blob_info->file_info.file) != 0 ? MagickTrue :
MagickFalse;
break;
}
case ZipStream:
{
- image->blob->eof=MagickFalse;
+ blob_info->eof=MagickFalse;
break;
}
case BZipStream:
status;
status=0;
- (void) BZ2_bzerror(image->blob->file_info.bzfile,&status);
- image->blob->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;
+ (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);
+ blob_info->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;
#endif
break;
}
case FifoStream:
{
- image->blob->eof=MagickFalse;
+ blob_info->eof=MagickFalse;
break;
}
case BlobStream:
case CustomStream:
break;
}
- return((int) image->blob->eof);
+ return((int) blob_info->eof);
}
\f
/*
*/
MagickExport MagickSizeType GetBlobSize(const Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
MagickSizeType
extent;
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
+ blob_info=image->blob;
extent=0;
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
{
- extent=image->blob->size;
+ extent=blob_info->size;
break;
}
case FileStream:
{
- if (fstat(fileno(image->blob->file_info.file),&image->blob->properties) == 0)
- extent=(MagickSizeType) image->blob->properties.st_size;
+ if (fstat(fileno(blob_info->file_info.file),&blob_info->properties) == 0)
+ extent=(MagickSizeType) blob_info->properties.st_size;
break;
}
case PipeStream:
{
- extent=image->blob->size;
+ extent=blob_info->size;
break;
}
case ZipStream:
MagickBooleanType
status;
- status=GetPathAttributes(image->filename,&image->blob->properties);
+ status=GetPathAttributes(image->filename,&blob_info->properties);
if (status != MagickFalse)
- extent=(MagickSizeType) image->blob->properties.st_size;
+ extent=(MagickSizeType) blob_info->properties.st_size;
break;
}
case FifoStream:
break;
case BlobStream:
{
- extent=(MagickSizeType) image->blob->length;
+ extent=(MagickSizeType) blob_info->length;
break;
}
case CustomStream:
{
- if ((image->blob->custom_stream->teller != (CustomStreamTeller) NULL) &&
- (image->blob->custom_stream->seeker != (CustomStreamSeeker) NULL))
+ if ((blob_info->custom_stream->teller != (CustomStreamTeller) NULL) &&
+ (blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL))
{
MagickOffsetType
offset;
- offset=image->blob->custom_stream->teller(
- image->blob->custom_stream->data);
- extent=(MagickSizeType) image->blob->custom_stream->seeker(0,SEEK_END,
- image->blob->custom_stream->data);
- (void) image->blob->custom_stream->seeker(offset,SEEK_SET,
- image->blob->custom_stream->data);
+ offset=blob_info->custom_stream->teller(
+ blob_info->custom_stream->data);
+ extent=(MagickSizeType) blob_info->custom_stream->seeker(0,SEEK_END,
+ blob_info->custom_stream->data);
+ (void) blob_info->custom_stream->seeker(offset,SEEK_SET,
+ blob_info->custom_stream->data);
}
break;
}
*magick_info;
ImageInfo
- *blob_info;
+ *clone_info;
MagickBooleanType
status;
assert(image_info->custom_stream->signature == MagickCoreSignature);
assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);
assert(exception != (ExceptionInfo *) NULL);
- blob_info=CloneImageInfo(image_info);
- blob_info->adjoin=MagickFalse;
- (void) SetImageInfo(blob_info,1,exception);
- if (*blob_info->magick != '\0')
- (void) CopyMagickString(image->magick,blob_info->magick,MagickPathExtent);
+ clone_info=CloneImageInfo(image_info);
+ clone_info->adjoin=MagickFalse;
+ (void) SetImageInfo(clone_info,1,exception);
+ if (*clone_info->magick != '\0')
+ (void) CopyMagickString(image->magick,clone_info->magick,MagickPathExtent);
magick_info=GetMagickInfo(image->magick,exception);
if (magick_info == (const MagickInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoEncodeDelegateForThisImageFormat","`%s'",
image->magick);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
- (void) CopyMagickString(blob_info->magick,image->magick,MagickPathExtent);
+ (void) CopyMagickString(clone_info->magick,image->magick,MagickPathExtent);
if (GetMagickBlobSupport(magick_info) != MagickFalse)
{
/*
*/
(void) CloseBlob(image);
*image->filename='\0';
- (void) WriteImage(blob_info,image,exception);
+ (void) WriteImage(clone_info,image,exception);
(void) CloseBlob(image);
}
else
/*
Write file to disk in blob image format.
*/
- blob_info->custom_stream=(CustomStreamInfo *) NULL;
+ clone_info->custom_stream=(CustomStreamInfo *) NULL;
blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,
sizeof(*blob));
if (blob == (unsigned char *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToWriteBlob",
image_info->filename);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
file=AcquireUniqueFileResource(unique);
ThrowFileException(exception,BlobError,"UnableToWriteBlob",
image_info->filename);
blob=(unsigned char *) RelinquishMagickMemory(blob);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
- blob_info->file=fdopen(file,"wb+");
- if (blob_info->file != (FILE *) NULL)
+ clone_info->file=fdopen(file,"wb+");
+ if (clone_info->file != (FILE *) NULL)
{
ssize_t
count;
(void) FormatLocaleString(image->filename,MagickPathExtent,
"%s:%s",image->magick,unique);
- status=WriteImage(blob_info,image,exception);
+ status=WriteImage(clone_info,image,exception);
(void) CloseBlob(image);
if (status != MagickFalse)
{
- (void) fseek(blob_info->file,0,SEEK_SET);
+ (void) fseek(clone_info->file,0,SEEK_SET);
count=(ssize_t) MagickMaxBufferExtent;
while (count == (ssize_t) MagickMaxBufferExtent)
{
count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,
- blob_info->file);
+ clone_info->file);
(void) image_info->custom_stream->writer(blob,(size_t) count,
image_info->custom_stream->data);
}
}
- (void) fclose(blob_info->file);
+ (void) fclose(clone_info->file);
}
blob=(unsigned char *) RelinquishMagickMemory(blob);
(void) RelinquishUniqueFileResource(unique);
}
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
}
\f
/*
*magick_info;
ImageInfo
- *blob_info;
+ *clone_info;
MagickBooleanType
status;
assert(exception != (ExceptionInfo *) NULL);
*length=0;
blob=(unsigned char *) NULL;
- blob_info=CloneImageInfo(image_info);
- (void) SetImageInfo(blob_info,(unsigned int) GetImageListLength(images),
+ clone_info=CloneImageInfo(image_info);
+ (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),
exception);
- if (*blob_info->magick != '\0')
- (void) CopyMagickString(images->magick,blob_info->magick,MagickPathExtent);
+ if (*clone_info->magick != '\0')
+ (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);
magick_info=GetMagickInfo(images->magick,exception);
if (magick_info == (const MagickInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
images->magick);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return(blob);
}
if (GetMagickAdjoin(magick_info) == MagickFalse)
{
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return(ImageToBlob(image_info,images,length,exception));
}
- (void) CopyMagickString(blob_info->magick,images->magick,MagickPathExtent);
+ (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);
if (GetMagickBlobSupport(magick_info) != MagickFalse)
{
/*
Native blob support for this images format.
*/
- blob_info->length=0;
- blob_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,
+ clone_info->length=0;
+ clone_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,
sizeof(unsigned char));
- if (blob_info->blob == (void *) NULL)
+ if (clone_info->blob == (void *) NULL)
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",images->filename);
else
(void) CloseBlob(images);
images->blob->exempt=MagickTrue;
*images->filename='\0';
- status=WriteImages(blob_info,images,images->filename,exception);
+ status=WriteImages(clone_info,images,images->filename,exception);
*length=images->blob->length;
blob=DetachBlob(images->blob);
if (status == MagickFalse)
}
else
{
- blob_info->file=fdopen(file,"wb");
- if (blob_info->file != (FILE *) NULL)
+ clone_info->file=fdopen(file,"wb");
+ if (clone_info->file != (FILE *) NULL)
{
(void) FormatLocaleString(filename,MagickPathExtent,"%s:%s",
images->magick,unique);
- status=WriteImages(blob_info,images,filename,exception);
+ status=WriteImages(clone_info,images,filename,exception);
(void) CloseBlob(images);
- (void) fclose(blob_info->file);
+ (void) fclose(clone_info->file);
if (status != MagickFalse)
blob=FileToBlob(unique,~0UL,length,exception);
}
(void) RelinquishUniqueFileResource(unique);
}
}
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return(blob);
}
\f
*magick_info;
ImageInfo
- *blob_info;
+ *clone_info;
MagickBooleanType
status;
assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL);
assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);
assert(exception != (ExceptionInfo *) NULL);
- blob_info=CloneImageInfo(image_info);
- (void) SetImageInfo(blob_info,(unsigned int) GetImageListLength(images),
+ clone_info=CloneImageInfo(image_info);
+ (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),
exception);
- if (*blob_info->magick != '\0')
- (void) CopyMagickString(images->magick,blob_info->magick,MagickPathExtent);
+ if (*clone_info->magick != '\0')
+ (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);
magick_info=GetMagickInfo(images->magick,exception);
if (magick_info == (const MagickInfo *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
MissingDelegateError,"NoEncodeDelegateForThisImageFormat","`%s'",
images->magick);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
- (void) CopyMagickString(blob_info->magick,images->magick,MagickPathExtent);
+ (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);
if (GetMagickBlobSupport(magick_info) != MagickFalse)
{
/*
*/
(void) CloseBlob(images);
*images->filename='\0';
- (void) WriteImages(blob_info,images,images->filename,exception);
+ (void) WriteImages(clone_info,images,images->filename,exception);
(void) CloseBlob(images);
}
else
/*
Write file to disk in blob image format.
*/
- blob_info->custom_stream=(CustomStreamInfo *) NULL;
+ clone_info->custom_stream=(CustomStreamInfo *) NULL;
blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,
sizeof(*blob));
if (blob == (unsigned char *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToWriteBlob",
image_info->filename);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
file=AcquireUniqueFileResource(unique);
ThrowFileException(exception,BlobError,"UnableToWriteBlob",
image_info->filename);
blob=(unsigned char *) RelinquishMagickMemory(blob);
- blob_info=DestroyImageInfo(blob_info);
+ clone_info=DestroyImageInfo(clone_info);
return;
}
- blob_info->file=fdopen(file,"wb+");
- if (blob_info->file != (FILE *) NULL)
+ clone_info->file=fdopen(file,"wb+");
+ if (clone_info->file != (FILE *) NULL)
{
ssize_t
count;
(void) FormatLocaleString(filename,MagickPathExtent,"%s:%s",
images->magick,unique);
- status=WriteImages(blob_info,images,filename,exception);
+ status=WriteImages(clone_info,images,filename,exception);
(void) CloseBlob(images);
if (status != MagickFalse)
{
- (void) fseek(blob_info->file,0,SEEK_SET);
+ (void) fseek(clone_info->file,0,SEEK_SET);
count=(ssize_t) MagickMaxBufferExtent;
while (count == (ssize_t) MagickMaxBufferExtent)
{
count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,
- blob_info->file);
+ clone_info->file);
(void) image_info->custom_stream->writer(blob,(size_t) count,
image_info->custom_stream->data);
}
}
- (void) fclose(blob_info->file);
+ (void) fclose(clone_info->file);
}
blob=(unsigned char *) RelinquishMagickMemory(blob);
(void) RelinquishUniqueFileResource(unique);
}
- blob_info=DestroyImageInfo(blob_info);
- return;
+ clone_info=DestroyImageInfo(clone_info);
}
\f
/*
*/
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
MagickBooleanType
seekable;
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- switch (image->blob->type)
+ blob_info=image->blob;
+ switch (blob_info->type)
{
case FileStream:
case BlobStream:
}
case CustomStream:
{
- if ((image->blob->custom_stream->seeker != (CustomStreamSeeker) NULL) &&
- (image->blob->custom_stream->teller != (CustomStreamTeller) NULL))
+ if ((blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL) &&
+ (blob_info->custom_stream->teller != (CustomStreamTeller) NULL))
seekable=MagickTrue;
else
seekable=MagickFalse;
MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,
Image *image,const BlobMode mode,ExceptionInfo *exception)
{
+ BlobInfo
+ *restrict blob_info;
+
char
extension[MagickPathExtent],
filename[MagickPathExtent];
image_info->filename);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
+ blob_info=image->blob;
if (image_info->blob != (void *) NULL)
{
if (image_info->stream != (StreamHandler) NULL)
- image->blob->stream=(StreamHandler) image_info->stream;
- AttachBlob(image->blob,image_info->blob,image_info->length);
+ blob_info->stream=(StreamHandler) image_info->stream;
+ AttachBlob(blob_info,image_info->blob,image_info->length);
return(MagickTrue);
}
if ((image_info->custom_stream != (CustomStreamInfo *) NULL) &&
(*image->filename == '\0'))
{
- image->blob->type=CustomStream;
- image->blob->custom_stream=image_info->custom_stream;
+ blob_info->type=CustomStream;
+ blob_info->custom_stream=image_info->custom_stream;
return(MagickTrue);
}
- (void) DetachBlob(image->blob);
+ (void) DetachBlob(blob_info);
switch (mode)
{
default: type="r"; break;
case AppendBinaryBlobMode: type="a+b"; break;
}
if (*type != 'r')
- image->blob->synchronize=image_info->synchronize;
+ blob_info->synchronize=image_info->synchronize;
if (image_info->stream != (StreamHandler) NULL)
{
- image->blob->stream=image_info->stream;
+ blob_info->stream=image_info->stream;
if (*type == 'w')
{
- image->blob->type=FifoStream;
+ blob_info->type=FifoStream;
return(MagickTrue);
}
}
if ((LocaleCompare(filename,"-") == 0) ||
((*filename == '\0') && (image_info->file == (FILE *) NULL)))
{
- image->blob->file_info.file=(*type == 'r') ? stdin : stdout;
+ blob_info->file_info.file=(*type == 'r') ? stdin : stdout;
#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
- setmode(fileno(image->blob->file_info.file),_O_BINARY);
+ setmode(fileno(blob_info->file_info.file),_O_BINARY);
#endif
- image->blob->type=StandardStream;
- image->blob->exempt=MagickTrue;
+ blob_info->type=StandardStream;
+ blob_info->exempt=MagickTrue;
return(SetStreamBuffering(image_info,image));
}
if (LocaleNCompare(filename,"fd:",3) == 0)
*fileMode =(*type);
fileMode[1]='\0';
- image->blob->file_info.file=fdopen(StringToLong(filename+3),fileMode);
+ blob_info->file_info.file=fdopen(StringToLong(filename+3),fileMode);
#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
- setmode(fileno(image->blob->file_info.file),_O_BINARY);
+ setmode(fileno(blob_info->file_info.file),_O_BINARY);
#endif
- image->blob->type=StandardStream;
- image->blob->exempt=MagickTrue;
+ blob_info->type=StandardStream;
+ blob_info->exempt=MagickTrue;
return(SetStreamBuffering(image_info,image));
}
#if defined(MAGICKCORE_HAVE_POPEN) && defined(MAGICKCORE_PIPES_SUPPORT)
*fileMode =(*type);
fileMode[1]='\0';
sanitize_command=SanitizeString(filename+1);
- image->blob->file_info.file=(FILE *) popen_utf8(sanitize_command,
- fileMode);
+ blob_info->file_info.file=(FILE *) popen_utf8(sanitize_command,fileMode);
sanitize_command=DestroyString(sanitize_command);
- if (image->blob->file_info.file == (FILE *) NULL)
+ if (blob_info->file_info.file == (FILE *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
return(MagickFalse);
}
- image->blob->type=PipeStream;
- image->blob->exempt=MagickTrue;
+ blob_info->type=PipeStream;
+ blob_info->exempt=MagickTrue;
return(SetStreamBuffering(image_info,image));
}
#endif
- status=GetPathAttributes(filename,&image->blob->properties);
+ status=GetPathAttributes(filename,&blob_info->properties);
#if defined(S_ISFIFO)
- if ((status != MagickFalse) && S_ISFIFO(image->blob->properties.st_mode))
+ if ((status != MagickFalse) && S_ISFIFO(blob_info->properties.st_mode))
{
- image->blob->file_info.file=(FILE *) fopen_utf8(filename,type);
- if (image->blob->file_info.file == (FILE *) NULL)
+ blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);
+ if (blob_info->file_info.file == (FILE *) NULL)
{
ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
return(MagickFalse);
}
- image->blob->type=FileStream;
- image->blob->exempt=MagickTrue;
+ blob_info->type=FileStream;
+ blob_info->exempt=MagickTrue;
return(SetStreamBuffering(image_info,image));
}
#endif
}
if (image_info->file != (FILE *) NULL)
{
- image->blob->file_info.file=image_info->file;
- image->blob->type=FileStream;
- image->blob->exempt=MagickTrue;
+ blob_info->file_info.file=image_info->file;
+ blob_info->type=FileStream;
+ blob_info->exempt=MagickTrue;
}
else
if (*type == 'r')
{
- image->blob->file_info.file=(FILE *) fopen_utf8(filename,type);
- if (image->blob->file_info.file != (FILE *) NULL)
+ blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);
+ if (blob_info->file_info.file != (FILE *) NULL)
{
size_t
count;
unsigned char
magick[3];
- image->blob->type=FileStream;
+ blob_info->type=FileStream;
(void) SetStreamBuffering(image_info,image);
(void) ResetMagickMemory(magick,0,sizeof(magick));
- count=fread(magick,1,sizeof(magick),image->blob->file_info.file);
- (void) fseek(image->blob->file_info.file,-((off_t) count),SEEK_CUR);
+ count=fread(magick,1,sizeof(magick),blob_info->file_info.file);
+ (void) fseek(blob_info->file_info.file,-((off_t) count),SEEK_CUR);
#if defined(MAGICKCORE_POSIX_SUPPORT)
- (void) fflush(image->blob->file_info.file);
+ (void) fflush(blob_info->file_info.file);
#endif
(void) LogMagickEvent(BlobEvent,GetMagickModule(),
" read %.20g magic header bytes",(double) count);
if (((int) magick[0] == 0x1F) && ((int) magick[1] == 0x8B) &&
((int) magick[2] == 0x08))
{
- 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 (blob_info->file_info.file != (FILE *) NULL)
+ (void) fclose(blob_info->file_info.file);
+ blob_info->file_info.file=(FILE *) NULL;
+ blob_info->file_info.gzfile=gzopen(filename,type);
+ if (blob_info->file_info.gzfile != (gzFile) NULL)
+ blob_info->type=ZipStream;
}
#endif
#if defined(MAGICKCORE_BZLIB_DELEGATE)
if (strncmp((char *) magick,"BZh",3) == 0)
{
- 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;
+ if (blob_info->file_info.file != (FILE *) NULL)
+ (void) fclose(blob_info->file_info.file);
+ blob_info->file_info.file=(FILE *) NULL;
+ blob_info->file_info.bzfile=BZ2_bzopen(filename,type);
+ if (blob_info->file_info.bzfile != (BZFILE *) NULL)
+ blob_info->type=BZipStream;
}
#endif
- if (image->blob->type == FileStream)
+ if (blob_info->type == FileStream)
{
const MagickInfo
*magick_info;
sans_exception=AcquireExceptionInfo();
magick_info=GetMagickInfo(image_info->magick,sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
- length=(size_t) image->blob->properties.st_size;
+ length=(size_t) blob_info->properties.st_size;
if ((magick_info != (const MagickInfo *) NULL) &&
(GetMagickBlobSupport(magick_info) != MagickFalse) &&
(length > MagickMaxBufferExtent) &&
void
*blob;
- blob=MapBlob(fileno(image->blob->file_info.file),ReadMode,0,
+ blob=MapBlob(fileno(blob_info->file_info.file),ReadMode,0,
length);
if (blob == (void *) NULL)
RelinquishMagickResource(MapResource,length);
Format supports blobs-- use memory-mapped I/O.
*/
if (image_info->file != (FILE *) NULL)
- image->blob->exempt=MagickFalse;
+ blob_info->exempt=MagickFalse;
else
{
- (void) fclose(image->blob->file_info.file);
- image->blob->file_info.file=(FILE *) NULL;
+ (void) fclose(blob_info->file_info.file);
+ blob_info->file_info.file=(FILE *) NULL;
}
- AttachBlob(image->blob,blob,length);
- image->blob->mapped=MagickTrue;
+ AttachBlob(blob_info,blob,length);
+ blob_info->mapped=MagickTrue;
}
}
}
{
if (mode == WriteBinaryBlobMode)
type="wb";
- image->blob->file_info.gzfile=gzopen(filename,type);
- if (image->blob->file_info.gzfile != (gzFile) NULL)
- image->blob->type=ZipStream;
+ blob_info->file_info.gzfile=gzopen(filename,type);
+ if (blob_info->file_info.gzfile != (gzFile) NULL)
+ blob_info->type=ZipStream;
}
else
#endif
#if defined(MAGICKCORE_BZLIB_DELEGATE)
if (LocaleCompare(extension,"bz2") == 0)
{
- image->blob->file_info.bzfile=BZ2_bzopen(filename,type);
- if (image->blob->file_info.bzfile != (BZFILE *) NULL)
- image->blob->type=BZipStream;
+ blob_info->file_info.bzfile=BZ2_bzopen(filename,type);
+ if (blob_info->file_info.bzfile != (BZFILE *) NULL)
+ blob_info->type=BZipStream;
}
else
#endif
{
- image->blob->file_info.file=(FILE *) fopen_utf8(filename,type);
- if (image->blob->file_info.file != (FILE *) NULL)
+ blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);
+ if (blob_info->file_info.file != (FILE *) NULL)
{
- image->blob->type=FileStream;
+ blob_info->type=FileStream;
(void) SetStreamBuffering(image_info,image);
}
}
- image->blob->status=MagickFalse;
- if (image->blob->type != UndefinedStream)
- image->blob->size=GetBlobSize(image);
+ blob_info->status=MagickFalse;
+ if (blob_info->type != UndefinedStream)
+ blob_info->size=GetBlobSize(image);
else
{
ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename);
*/
MagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)
{
+ BlobInfo
+ *restrict blob_info;
+
int
c;
if (length == 0)
return(0);
assert(data != (void *) NULL);
+ blob_info=image->blob;
count=0;
q=(unsigned char *) data;
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
break;
{
default:
{
- count=(ssize_t) fread(q,1,length,image->blob->file_info.file);
+ count=(ssize_t) fread(q,1,length,blob_info->file_info.file);
break;
}
case 4:
{
- c=getc(image->blob->file_info.file);
+ c=getc(blob_info->file_info.file);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 3:
{
- c=getc(image->blob->file_info.file);
+ c=getc(blob_info->file_info.file);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 2:
{
- c=getc(image->blob->file_info.file);
+ c=getc(blob_info->file_info.file);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 1:
{
- c=getc(image->blob->file_info.file);
+ c=getc(blob_info->file_info.file);
if (c == EOF)
break;
*q++=(unsigned char) c;
{
default:
{
- count=(ssize_t) gzread(image->blob->file_info.gzfile,q,
+ count=(ssize_t) gzread(blob_info->file_info.gzfile,q,
(unsigned int) length);
break;
}
case 4:
{
- c=gzgetc(image->blob->file_info.gzfile);
+ c=gzgetc(blob_info->file_info.gzfile);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 3:
{
- c=gzgetc(image->blob->file_info.gzfile);
+ c=gzgetc(blob_info->file_info.gzfile);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 2:
{
- c=gzgetc(image->blob->file_info.gzfile);
+ c=gzgetc(blob_info->file_info.gzfile);
if (c == EOF)
break;
*q++=(unsigned char) c;
}
case 1:
{
- c=gzgetc(image->blob->file_info.gzfile);
+ c=gzgetc(blob_info->file_info.gzfile);
if (c == EOF)
break;
*q++=(unsigned char) c;
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
- count=(ssize_t) BZ2_bzread(image->blob->file_info.bzfile,q,(int) length);
+ count=(ssize_t) BZ2_bzread(blob_info->file_info.bzfile,q,(int) length);
#endif
break;
}
register const unsigned char
*p;
- if (image->blob->offset >= (MagickOffsetType) image->blob->length)
+ if (blob_info->offset >= (MagickOffsetType) blob_info->length)
{
- image->blob->eof=MagickTrue;
+ blob_info->eof=MagickTrue;
break;
}
- p=image->blob->data+image->blob->offset;
+ p=blob_info->data+blob_info->offset;
count=(ssize_t) MagickMin((MagickOffsetType) length,(MagickOffsetType)
- image->blob->length-image->blob->offset);
- image->blob->offset+=count;
+ blob_info->length-blob_info->offset);
+ blob_info->offset+=count;
if (count != (ssize_t) length)
- image->blob->eof=MagickTrue;
+ blob_info->eof=MagickTrue;
(void) memcpy(q,p,(size_t) count);
break;
}
case CustomStream:
{
- if (image->blob->custom_stream->reader != (CustomStreamHandler) NULL)
- count=image->blob->custom_stream->reader(q,length,
- image->blob->custom_stream->data);
+ if (blob_info->custom_stream->reader != (CustomStreamHandler) NULL)
+ count=blob_info->custom_stream->reader(q,length,
+ blob_info->custom_stream->data);
break;
}
}
MagickExport MagickOffsetType SeekBlob(Image *image,
const MagickOffsetType offset,const int whence)
{
+ BlobInfo
+ *restrict blob_info;
+
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
- switch (image->blob->type)
+ blob_info=image->blob;
+ switch (blob_info->type)
{
case UndefinedStream:
break;
{
if ((offset < 0) && (whence == SEEK_SET))
return(-1);
- if (fseek(image->blob->file_info.file,offset,whence) < 0)
+ if (fseek(blob_info->file_info.file,offset,whence) < 0)
return(-1);
- image->blob->offset=TellBlob(image);
+ blob_info->offset=TellBlob(image);
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
- if (gzseek(image->blob->file_info.gzfile,(off_t) offset,whence) < 0)
+ if (gzseek(blob_info->file_info.gzfile,(off_t) offset,whence) < 0)
return(-1);
#endif
- image->blob->offset=TellBlob(image);
+ blob_info->offset=TellBlob(image);
break;
}
case BZipStream:
{
if (offset < 0)
return(-1);
- image->blob->offset=offset;
+ blob_info->offset=offset;
break;
}
case SEEK_CUR:
{
- if ((image->blob->offset+offset) < 0)
+ if ((blob_info->offset+offset) < 0)
return(-1);
- image->blob->offset+=offset;
+ blob_info->offset+=offset;
break;
}
case SEEK_END:
{
- if (((MagickOffsetType) image->blob->length+offset) < 0)
+ if (((MagickOffsetType) blob_info->length+offset) < 0)
return(-1);
- image->blob->offset=image->blob->length+offset;
+ blob_info->offset=blob_info->length+offset;
break;
}
}
- if (image->blob->offset < (MagickOffsetType)
- ((off_t) image->blob->length))
+ if (blob_info->offset < (MagickOffsetType) ((off_t) blob_info->length))
{
- image->blob->eof=MagickFalse;
+ blob_info->eof=MagickFalse;
break;
}
- if (image->blob->offset < (MagickOffsetType)
- ((off_t) image->blob->extent))
+ if (blob_info->offset < (MagickOffsetType) ((off_t) blob_info->extent))
break;
- if (image->blob->mapped != MagickFalse)
+ if (blob_info->mapped != MagickFalse)
{
- image->blob->eof=MagickTrue;
+ blob_info->eof=MagickTrue;
return(-1);
}
- image->blob->extent=(size_t) (image->blob->offset+image->blob->quantum);
- image->blob->quantum<<=1;
- image->blob->data=(unsigned char *) ResizeQuantumMemory(image->blob->data,
- image->blob->extent+1,sizeof(*image->blob->data));
+ blob_info->extent=(size_t) (blob_info->offset+blob_info->quantum);
+ blob_info->quantum<<=1;
+ blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data,
+ blob_info->extent+1,sizeof(*blob_info->data));
(void) SyncBlob(image);
- if (image->blob->data == NULL)
+ if (blob_info->data == NULL)
{
- (void) DetachBlob(image->blob);
+ (void) DetachBlob(blob_info);
return(-1);
}
break;
}
case CustomStream:
{
- if (image->blob->custom_stream->seeker == (CustomStreamSeeker) NULL)
+ if (blob_info->custom_stream->seeker == (CustomStreamSeeker) NULL)
return(-1);
- image->blob->offset=image->blob->custom_stream->seeker(offset,whence,
- image->blob->custom_stream->data);
+ blob_info->offset=blob_info->custom_stream->seeker(offset,whence,
+ blob_info->custom_stream->data);
break;
}
}
- return(image->blob->offset);
+ return(blob_info->offset);
}
\f
/*
MagickExport MagickBooleanType SetBlobExtent(Image *image,
const MagickSizeType extent)
{
+ BlobInfo
+ *restrict blob_info;
+
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
- switch (image->blob->type)
+ blob_info=image->blob;
+ switch (blob_info->type)
{
case UndefinedStream:
break;
if (offset < 0)
break;
count=(ssize_t) fwrite((const unsigned char *) "",1,1,
- image->blob->file_info.file);
+ blob_info->file_info.file);
#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
- if (image->blob->synchronize != MagickFalse)
+ if (blob_info->synchronize != MagickFalse)
{
int
file;
- file=fileno(image->blob->file_info.file);
+ file=fileno(blob_info->file_info.file);
if ((file == -1) || (offset < 0))
return(MagickFalse);
(void) posix_fallocate(file,offset,extent-offset);
{
if (extent != (MagickSizeType) ((size_t) extent))
return(MagickFalse);
- if (image->blob->mapped != MagickFalse)
+ if (blob_info->mapped != MagickFalse)
{
MagickOffsetType
offset;
ssize_t
count;
- (void) UnmapBlob(image->blob->data,image->blob->length);
- RelinquishMagickResource(MapResource,image->blob->length);
+ (void) UnmapBlob(blob_info->data,blob_info->length);
+ RelinquishMagickResource(MapResource,blob_info->length);
if (extent != (MagickSizeType) ((off_t) extent))
return(MagickFalse);
offset=SeekBlob(image,0,SEEK_END);
break;
offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);
count=(ssize_t) fwrite((const unsigned char *) "",1,1,
- image->blob->file_info.file);
+ blob_info->file_info.file);
#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
- if (image->blob->synchronize != MagickFalse)
+ if (blob_info->synchronize != MagickFalse)
{
int
file;
- file=fileno(image->blob->file_info.file);
+ file=fileno(blob_info->file_info.file);
if ((file == -1) || (offset < 0))
return(MagickFalse);
(void) posix_fallocate(file,offset,extent-offset);
if (count != 1)
return(MagickFalse);
(void) AcquireMagickResource(MapResource,extent);
- image->blob->data=(unsigned char*) MapBlob(fileno(
- image->blob->file_info.file),WriteMode,0,(size_t) extent);
- image->blob->extent=(size_t) extent;
- image->blob->length=(size_t) extent;
+ blob_info->data=(unsigned char*) MapBlob(fileno(
+ blob_info->file_info.file),WriteMode,0,(size_t) extent);
+ blob_info->extent=(size_t) extent;
+ blob_info->length=(size_t) extent;
(void) SyncBlob(image);
break;
}
- image->blob->extent=(size_t) extent;
- image->blob->data=(unsigned char *) ResizeQuantumMemory(image->blob->data,
- image->blob->extent+1,sizeof(*image->blob->data));
+ blob_info->extent=(size_t) extent;
+ blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data,
+ blob_info->extent+1,sizeof(*blob_info->data));
(void) SyncBlob(image);
- if (image->blob->data == (unsigned char *) NULL)
+ if (blob_info->data == (unsigned char *) NULL)
{
- (void) DetachBlob(image->blob);
+ (void) DetachBlob(blob_info);
return(MagickFalse);
}
break;
*/
static int SyncBlob(Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
int
status;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
+ blob_info=image->blob;
status=0;
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
case FileStream:
case PipeStream:
{
- status=fflush(image->blob->file_info.file);
+ status=fflush(blob_info->file_info.file);
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
- status=gzflush(image->blob->file_info.gzfile,Z_SYNC_FLUSH);
+ status=gzflush(blob_info->file_info.gzfile,Z_SYNC_FLUSH);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
- status=BZ2_bzflush(image->blob->file_info.bzfile);
+ status=BZ2_bzflush(blob_info->file_info.bzfile);
#endif
break;
}
*/
MagickExport MagickOffsetType TellBlob(const Image *image)
{
+ BlobInfo
+ *restrict blob_info;
+
MagickOffsetType
offset;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
+ blob_info=image->blob;
offset=(-1);
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
{
- offset=ftell(image->blob->file_info.file);
+ offset=ftell(blob_info->file_info.file);
break;
}
case PipeStream:
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
- offset=(MagickOffsetType) gztell(image->blob->file_info.gzfile);
+ offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile);
#endif
break;
}
break;
case BlobStream:
{
- offset=image->blob->offset;
+ offset=blob_info->offset;
break;
}
case CustomStream:
{
- if (image->blob->custom_stream->teller != (CustomStreamTeller) NULL)
- offset=image->blob->custom_stream->teller(image->blob->custom_stream->data);
+ if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL)
+ offset=blob_info->custom_stream->teller(blob_info->custom_stream->data);
break;
}
}
MagickExport ssize_t WriteBlob(Image *image,const size_t length,
const void *data)
{
+ BlobInfo
+ *restrict blob_info;
+
int
c;
if (length == 0)
return(0);
assert(data != (const void *) NULL);
+ blob_info=image->blob;
count=0;
p=(const unsigned char *) data;
- switch (image->blob->type)
+ switch (blob_info->type)
{
case UndefinedStream:
break;
default:
{
count=(ssize_t) fwrite((const char *) data,1,length,
- image->blob->file_info.file);
+ blob_info->file_info.file);
break;
}
case 4:
{
- c=putc((int) *p++,image->blob->file_info.file);
+ c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
}
case 3:
{
- c=putc((int) *p++,image->blob->file_info.file);
+ c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
}
case 2:
{
- c=putc((int) *p++,image->blob->file_info.file);
+ c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
}
case 1:
{
- c=putc((int) *p++,image->blob->file_info.file);
+ c=putc((int) *p++,blob_info->file_info.file);
if (c == EOF)
break;
count++;
{
default:
{
- count=(ssize_t) gzwrite(image->blob->file_info.gzfile,(void *) data,
+ count=(ssize_t) gzwrite(blob_info->file_info.gzfile,(void *) data,
(unsigned int) length);
break;
}
case 4:
{
- c=gzputc(image->blob->file_info.gzfile,(int) *p++);
+ c=gzputc(blob_info->file_info.gzfile,(int) *p++);
if (c == EOF)
break;
count++;
}
case 3:
{
- c=gzputc(image->blob->file_info.gzfile,(int) *p++);
+ c=gzputc(blob_info->file_info.gzfile,(int) *p++);
if (c == EOF)
break;
count++;
}
case 2:
{
- c=gzputc(image->blob->file_info.gzfile,(int) *p++);
+ c=gzputc(blob_info->file_info.gzfile,(int) *p++);
if (c == EOF)
break;
count++;
}
case 1:
{
- c=gzputc(image->blob->file_info.gzfile,(int) *p++);
+ c=gzputc(blob_info->file_info.gzfile,(int) *p++);
if (c == EOF)
break;
count++;
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
- count=(ssize_t) BZ2_bzwrite(image->blob->file_info.bzfile,(void *) data,
+ count=(ssize_t) BZ2_bzwrite(blob_info->file_info.bzfile,(void *) data,
(int) length);
#endif
break;
}
case FifoStream:
{
- count=(ssize_t) image->blob->stream(image,data,length);
+ count=(ssize_t) blob_info->stream(image,data,length);
break;
}
case BlobStream:
register unsigned char
*q;
- if ((image->blob->offset+(MagickOffsetType) length) >=
- (MagickOffsetType) image->blob->extent)
+ if ((blob_info->offset+(MagickOffsetType) length) >=
+ (MagickOffsetType) blob_info->extent)
{
- if (image->blob->mapped != MagickFalse)
+ if (blob_info->mapped != MagickFalse)
return(0);
- image->blob->extent+=length+image->blob->quantum;
- image->blob->quantum<<=1;
- image->blob->data=(unsigned char *) ResizeQuantumMemory(
- image->blob->data,image->blob->extent+1,sizeof(*image->blob->data));
+ blob_info->extent+=length+blob_info->quantum;
+ blob_info->quantum<<=1;
+ blob_info->data=(unsigned char *) ResizeQuantumMemory(
+ blob_info->data,blob_info->extent+1,sizeof(*blob_info->data));
(void) SyncBlob(image);
- if (image->blob->data == (unsigned char *) NULL)
+ if (blob_info->data == (unsigned char *) NULL)
{
- (void) DetachBlob(image->blob);
+ (void) DetachBlob(blob_info);
return(0);
}
}
- q=image->blob->data+image->blob->offset;
+ q=blob_info->data+blob_info->offset;
(void) memcpy(q,p,length);
- image->blob->offset+=length;
- if (image->blob->offset >= (MagickOffsetType) image->blob->length)
- image->blob->length=(size_t) image->blob->offset;
+ blob_info->offset+=length;
+ if (blob_info->offset >= (MagickOffsetType) blob_info->length)
+ blob_info->length=(size_t) blob_info->offset;
count=(ssize_t) length;
break;
}
case CustomStream:
{
- if (image->blob->custom_stream->writer != (CustomStreamHandler) NULL)
- count=image->blob->custom_stream->writer((unsigned char *) data,
- length,image->blob->custom_stream->data);
+ if (blob_info->custom_stream->writer != (CustomStreamHandler) NULL)
+ count=blob_info->custom_stream->writer((unsigned char *) data,
+ length,blob_info->custom_stream->data);
break;
}
}