Lines Matching refs:blob_info

264 MagickExport void AttachBlob(BlobInfo *blob_info,const void *blob,  in AttachBlob()  argument
267 assert(blob_info != (BlobInfo *) NULL); in AttachBlob()
268 if (blob_info->debug != MagickFalse) in AttachBlob()
270 blob_info->length=length; in AttachBlob()
271 blob_info->extent=length; in AttachBlob()
272 blob_info->quantum=(size_t) MagickMaxBlobExtent; in AttachBlob()
273 blob_info->offset=0; in AttachBlob()
274 blob_info->type=BlobStream; in AttachBlob()
275 blob_info->file_info.file=(FILE *) NULL; in AttachBlob()
276 blob_info->data=(unsigned char *) blob; in AttachBlob()
277 blob_info->mapped=MagickFalse; in AttachBlob()
305 MagickExport void AttachCustomStream(BlobInfo *blob_info, in AttachCustomStream() argument
308 assert(blob_info != (BlobInfo *) NULL); in AttachCustomStream()
311 if (blob_info->debug != MagickFalse) in AttachCustomStream()
313 blob_info->type=CustomStream; in AttachCustomStream()
314 blob_info->custom_stream=custom_stream; in AttachCustomStream()
432 *blob_info, in BlobToImage() local
450 blob_info=CloneImageInfo(image_info); in BlobToImage()
451 blob_info->blob=(void *) blob; in BlobToImage()
452 blob_info->length=length; in BlobToImage()
453 if (*blob_info->magick == '\0') in BlobToImage()
454 (void) SetImageInfo(blob_info,0,exception); in BlobToImage()
455 magick_info=GetMagickInfo(blob_info->magick,exception); in BlobToImage()
460 blob_info->magick); in BlobToImage()
461 blob_info=DestroyImageInfo(blob_info); in BlobToImage()
472 (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent); in BlobToImage()
473 (void) FormatLocaleString(blob_info->filename,MagickPathExtent,"%s:%s", in BlobToImage()
474 blob_info->magick,filename); in BlobToImage()
475 image=ReadImage(blob_info,exception); in BlobToImage()
478 blob_info=DestroyImageInfo(blob_info); in BlobToImage()
484 blob_info->blob=(void *) NULL; in BlobToImage()
485 blob_info->length=0; in BlobToImage()
486 *blob_info->filename='\0'; in BlobToImage()
487 status=BlobToFile(blob_info->filename,blob,length,exception); in BlobToImage()
490 (void) RelinquishUniqueFileResource(blob_info->filename); in BlobToImage()
491 blob_info=DestroyImageInfo(blob_info); in BlobToImage()
494 clone_info=CloneImageInfo(blob_info); in BlobToImage()
496 blob_info->magick,blob_info->filename); in BlobToImage()
518 (void) RelinquishUniqueFileResource(blob_info->filename); in BlobToImage()
519 blob_info=DestroyImageInfo(blob_info); in BlobToImage()
546 MagickExport BlobInfo *CloneBlobInfo(const BlobInfo *blob_info) in CloneBlobInfo() argument
556 if (blob_info == (BlobInfo *) NULL) in CloneBlobInfo()
559 (void) memcpy(clone_info,blob_info,sizeof(*clone_info)); in CloneBlobInfo()
560 if (blob_info->mapped != MagickFalse) in CloneBlobInfo()
561 (void) AcquireMagickResource(MapResource,blob_info->length); in CloneBlobInfo()
592 static inline void ThrowBlobException(BlobInfo *blob_info) in ThrowBlobException() argument
594 if ((blob_info->status == MagickFalse) && (errno != 0)) in ThrowBlobException()
595 blob_info->error_number=errno; in ThrowBlobException()
596 blob_info->status=MagickTrue; in ThrowBlobException()
602 *magick_restrict blob_info; in CloseBlob() local
614 blob_info=image->blob; in CloseBlob()
615 if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream)) in CloseBlob()
618 switch (blob_info->type) in CloseBlob()
626 if (blob_info->synchronize != MagickFalse) in CloseBlob()
628 status=fflush(blob_info->file_info.file); in CloseBlob()
630 ThrowBlobException(blob_info); in CloseBlob()
631 status=fsync(fileno(blob_info->file_info.file)); in CloseBlob()
633 ThrowBlobException(blob_info); in CloseBlob()
635 if ((status != 0) && (ferror(blob_info->file_info.file) != 0)) in CloseBlob()
636 ThrowBlobException(blob_info); in CloseBlob()
643 (void) gzerror(blob_info->file_info.gzfile,&status); in CloseBlob()
645 ThrowBlobException(blob_info); in CloseBlob()
653 (void) BZ2_bzerror(blob_info->file_info.bzfile,&status); in CloseBlob()
655 ThrowBlobException(blob_info); in CloseBlob()
663 if (blob_info->file_info.file != (FILE *) NULL) in CloseBlob()
665 if (blob_info->synchronize != MagickFalse) in CloseBlob()
667 status=fflush(blob_info->file_info.file); in CloseBlob()
669 ThrowBlobException(blob_info); in CloseBlob()
670 status=fsync(fileno(blob_info->file_info.file)); in CloseBlob()
672 ThrowBlobException(blob_info); in CloseBlob()
674 if ((status != 0) && (ferror(blob_info->file_info.file) != 0)) in CloseBlob()
675 ThrowBlobException(blob_info); in CloseBlob()
682 blob_info->size=GetBlobSize(image); in CloseBlob()
683 image->extent=blob_info->size; in CloseBlob()
684 blob_info->eof=MagickFalse; in CloseBlob()
685 blob_info->error=0; in CloseBlob()
686 blob_info->mode=UndefinedBlobMode; in CloseBlob()
687 if (blob_info->exempt != MagickFalse) in CloseBlob()
689 blob_info->type=UndefinedStream; in CloseBlob()
690 return(blob_info->status); in CloseBlob()
692 switch (blob_info->type) in CloseBlob()
699 if (fileno(blob_info->file_info.file) != -1) in CloseBlob()
701 status=fclose(blob_info->file_info.file); in CloseBlob()
703 ThrowBlobException(blob_info); in CloseBlob()
710 status=pclose(blob_info->file_info.file); in CloseBlob()
712 ThrowBlobException(blob_info); in CloseBlob()
719 status=gzclose(blob_info->file_info.gzfile); in CloseBlob()
721 ThrowBlobException(blob_info); in CloseBlob()
728 BZ2_bzclose(blob_info->file_info.bzfile); in CloseBlob()
736 if (blob_info->file_info.file != (FILE *) NULL) in CloseBlob()
738 status=fclose(blob_info->file_info.file); in CloseBlob()
740 ThrowBlobException(blob_info); in CloseBlob()
747 (void) DetachBlob(blob_info); in CloseBlob()
748 return(blob_info->status); in CloseBlob()
787 *blob_info; in CustomStreamToImage() local
798 blob_info=CloneImageInfo(image_info); in CustomStreamToImage()
799 if (*blob_info->magick == '\0') in CustomStreamToImage()
800 (void) SetImageInfo(blob_info,0,exception); in CustomStreamToImage()
801 magick_info=GetMagickInfo(blob_info->magick,exception); in CustomStreamToImage()
806 blob_info->magick); in CustomStreamToImage()
807 blob_info=DestroyImageInfo(blob_info); in CustomStreamToImage()
812 (*blob_info->filename != '\0')) in CustomStreamToImage()
821 (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent); in CustomStreamToImage()
822 (void) FormatLocaleString(blob_info->filename,MagickPathExtent,"%s:%s", in CustomStreamToImage()
823 blob_info->magick,filename); in CustomStreamToImage()
824 image=ReadImage(blob_info,exception); in CustomStreamToImage()
845 blob_info->custom_stream=(CustomStreamInfo *) NULL; in CustomStreamToImage()
852 blob_info=DestroyImageInfo(blob_info); in CustomStreamToImage()
861 blob_info=DestroyImageInfo(blob_info); in CustomStreamToImage()
864 clone_info=CloneImageInfo(blob_info); in CustomStreamToImage()
865 blob_info->file=fdopen(file,"wb+"); in CustomStreamToImage()
866 if (blob_info->file != (FILE *) NULL) in CustomStreamToImage()
878 (void) fclose(blob_info->file); in CustomStreamToImage()
880 "%s:%s",blob_info->magick,unique); in CustomStreamToImage()
907 blob_info=DestroyImageInfo(blob_info); in CustomStreamToImage()
936 *magick_restrict blob_info; in DestroyBlob() local
947 blob_info=image->blob; in DestroyBlob()
949 LockSemaphoreInfo(blob_info->semaphore); in DestroyBlob()
950 blob_info->reference_count--; in DestroyBlob()
951 assert(blob_info->reference_count >= 0); in DestroyBlob()
952 if (blob_info->reference_count == 0) in DestroyBlob()
954 UnlockSemaphoreInfo(blob_info->semaphore); in DestroyBlob()
961 if (blob_info->mapped != MagickFalse) in DestroyBlob()
963 (void) UnmapBlob(blob_info->data,blob_info->length); in DestroyBlob()
964 RelinquishMagickResource(MapResource,blob_info->length); in DestroyBlob()
966 if (blob_info->semaphore != (SemaphoreInfo *) NULL) in DestroyBlob()
967 RelinquishSemaphoreInfo(&blob_info->semaphore); in DestroyBlob()
968 blob_info->signature=(~MagickCoreSignature); in DestroyBlob()
969 image->blob=(BlobInfo *) RelinquishMagickMemory(blob_info); in DestroyBlob()
1028 MagickExport void *DetachBlob(BlobInfo *blob_info) in DetachBlob() argument
1033 assert(blob_info != (BlobInfo *) NULL); in DetachBlob()
1034 if (blob_info->debug != MagickFalse) in DetachBlob()
1036 if (blob_info->mapped != MagickFalse) in DetachBlob()
1038 (void) UnmapBlob(blob_info->data,blob_info->length); in DetachBlob()
1039 blob_info->data=NULL; in DetachBlob()
1040 RelinquishMagickResource(MapResource,blob_info->length); in DetachBlob()
1042 blob_info->mapped=MagickFalse; in DetachBlob()
1043 blob_info->length=0; in DetachBlob()
1044 blob_info->offset=0; in DetachBlob()
1045 blob_info->eof=MagickFalse; in DetachBlob()
1046 blob_info->error=0; in DetachBlob()
1047 blob_info->exempt=MagickFalse; in DetachBlob()
1048 blob_info->type=UndefinedStream; in DetachBlob()
1049 blob_info->file_info.file=(FILE *) NULL; in DetachBlob()
1050 data=blob_info->data; in DetachBlob()
1051 blob_info->data=(unsigned char *) NULL; in DetachBlob()
1052 blob_info->stream=(StreamHandler) NULL; in DetachBlob()
1053 blob_info->custom_stream=(CustomStreamInfo *) NULL; in DetachBlob()
1084 *magick_restrict blob_info, in DisassociateBlob() local
1096 blob_info=image->blob; in DisassociateBlob()
1098 LockSemaphoreInfo(blob_info->semaphore); in DisassociateBlob()
1099 assert(blob_info->reference_count >= 0); in DisassociateBlob()
1100 if (blob_info->reference_count > 1) in DisassociateBlob()
1102 UnlockSemaphoreInfo(blob_info->semaphore); in DisassociateBlob()
1105 clone_info=CloneBlobInfo(blob_info); in DisassociateBlob()
1231 *magick_restrict blob_info; in EOFBlob() local
1239 blob_info=image->blob; in EOFBlob()
1240 switch (blob_info->type) in EOFBlob()
1248 blob_info->eof=feof(blob_info->file_info.file) != 0 ? MagickTrue : in EOFBlob()
1255 blob_info->eof=gzeof(blob_info->file_info.gzfile) != 0 ? MagickTrue : in EOFBlob()
1267 (void) BZ2_bzerror(blob_info->file_info.bzfile,&status); in EOFBlob()
1268 blob_info->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse; in EOFBlob()
1274 blob_info->eof=MagickFalse; in EOFBlob()
1282 return((int) blob_info->eof); in EOFBlob()
1311 *magick_restrict blob_info; in ErrorBlob() local
1319 blob_info=image->blob; in ErrorBlob()
1320 switch (blob_info->type) in ErrorBlob()
1328 blob_info->error=ferror(blob_info->file_info.file); in ErrorBlob()
1334 (void) gzerror(blob_info->file_info.gzfile,&blob_info->error); in ErrorBlob()
1341 (void) BZ2_bzerror(blob_info->file_info.bzfile,&blob_info->error); in ErrorBlob()
1347 blob_info->error=0; in ErrorBlob()
1355 return(blob_info->error); in ErrorBlob()
1584 *magick_restrict blob_info; in WriteBlobStream() local
1595 blob_info=image->blob; in WriteBlobStream()
1596 if (blob_info->type != BlobStream) in WriteBlobStream()
1598 extent=(MagickSizeType) (blob_info->offset+(MagickOffsetType) length); in WriteBlobStream()
1599 if (extent >= blob_info->extent) in WriteBlobStream()
1601 extent=blob_info->extent+blob_info->quantum+length; in WriteBlobStream()
1602 blob_info->quantum<<=1; in WriteBlobStream()
1606 q=blob_info->data+blob_info->offset; in WriteBlobStream()
1608 blob_info->offset+=length; in WriteBlobStream()
1609 if (blob_info->offset >= (MagickOffsetType) blob_info->length) in WriteBlobStream()
1610 blob_info->length=(size_t) blob_info->offset; in WriteBlobStream()
1776 MagickExport void GetBlobInfo(BlobInfo *blob_info) in GetBlobInfo() argument
1778 assert(blob_info != (BlobInfo *) NULL); in GetBlobInfo()
1779 (void) memset(blob_info,0,sizeof(*blob_info)); in GetBlobInfo()
1780 blob_info->type=UndefinedStream; in GetBlobInfo()
1781 blob_info->quantum=(size_t) MagickMaxBlobExtent; in GetBlobInfo()
1782 blob_info->properties.st_mtime=GetMagickTime(); in GetBlobInfo()
1783 blob_info->properties.st_ctime=blob_info->properties.st_mtime; in GetBlobInfo()
1784 blob_info->debug=IsEventLogging(); in GetBlobInfo()
1785 blob_info->reference_count=1; in GetBlobInfo()
1786 blob_info->semaphore=AcquireSemaphoreInfo(); in GetBlobInfo()
1787 blob_info->signature=MagickCoreSignature; in GetBlobInfo()
1847 *magick_restrict blob_info; in GetBlobSize() local
1857 blob_info=image->blob; in GetBlobSize()
1859 switch (blob_info->type) in GetBlobSize()
1864 extent=blob_info->size; in GetBlobSize()
1872 extent=(MagickSizeType) blob_info->properties.st_size; in GetBlobSize()
1874 extent=blob_info->size; in GetBlobSize()
1875 file_descriptor=fileno(blob_info->file_info.file); in GetBlobSize()
1878 if (fstat(file_descriptor,&blob_info->properties) == 0) in GetBlobSize()
1879 extent=(MagickSizeType) blob_info->properties.st_size; in GetBlobSize()
1884 extent=blob_info->size; in GetBlobSize()
1893 status=GetPathAttributes(image->filename,&blob_info->properties); in GetBlobSize()
1895 extent=(MagickSizeType) blob_info->properties.st_size; in GetBlobSize()
1902 extent=(MagickSizeType) blob_info->length; in GetBlobSize()
1907 if ((blob_info->custom_stream->teller != (CustomStreamTeller) NULL) && in GetBlobSize()
1908 (blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL)) in GetBlobSize()
1913 offset=blob_info->custom_stream->teller( in GetBlobSize()
1914 blob_info->custom_stream->data); in GetBlobSize()
1915 extent=(MagickSizeType) blob_info->custom_stream->seeker(0,SEEK_END, in GetBlobSize()
1916 blob_info->custom_stream->data); in GetBlobSize()
1917 (void) blob_info->custom_stream->seeker(offset,SEEK_SET, in GetBlobSize()
1918 blob_info->custom_stream->data); in GetBlobSize()
2026 *blob_info; in ImageToBlob() local
2044 blob_info=CloneImageInfo(image_info); in ImageToBlob()
2045 blob_info->adjoin=MagickFalse; in ImageToBlob()
2046 (void) SetImageInfo(blob_info,1,exception); in ImageToBlob()
2047 if (*blob_info->magick != '\0') in ImageToBlob()
2048 (void) CopyMagickString(image->magick,blob_info->magick,MagickPathExtent); in ImageToBlob()
2055 blob_info=DestroyImageInfo(blob_info); in ImageToBlob()
2058 (void) CopyMagickString(blob_info->magick,image->magick,MagickPathExtent); in ImageToBlob()
2064 blob_info->length=0; in ImageToBlob()
2065 blob_info->blob=AcquireQuantumMemory(MagickMaxBlobExtent, in ImageToBlob()
2067 if (blob_info->blob == NULL) in ImageToBlob()
2075 status=WriteImage(blob_info,image,exception); in ImageToBlob()
2079 blob_info->blob=RelinquishMagickMemory(blob_info->blob); in ImageToBlob()
2105 blob_info->file=fdopen(file,"wb"); in ImageToBlob()
2106 if (blob_info->file != (FILE *) NULL) in ImageToBlob()
2110 status=WriteImage(blob_info,image,exception); in ImageToBlob()
2112 (void) fclose(blob_info->file); in ImageToBlob()
2119 blob_info=DestroyImageInfo(blob_info); in ImageToBlob()
2891 *magick_restrict blob_info; in IsBlobSeekable() local
2897 blob_info=image->blob; in IsBlobSeekable()
2898 switch (blob_info->type) in IsBlobSeekable()
2907 if (blob_info->file_info.file == (FILE *) NULL) in IsBlobSeekable()
2909 status=fseek(blob_info->file_info.file,0,SEEK_CUR); in IsBlobSeekable()
2918 if (blob_info->file_info.gzfile == (gzFile) NULL) in IsBlobSeekable()
2920 offset=gzseek(blob_info->file_info.gzfile,0,SEEK_CUR); in IsBlobSeekable()
2934 if ((blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL) && in IsBlobSeekable()
2935 (blob_info->custom_stream->teller != (CustomStreamTeller) NULL)) in IsBlobSeekable()
3218 *magick_restrict blob_info; in OpenBlob() local
3240 blob_info=image->blob; in OpenBlob()
3244 blob_info->stream=(StreamHandler) image_info->stream; in OpenBlob()
3245 AttachBlob(blob_info,image_info->blob,image_info->length); in OpenBlob()
3251 blob_info->type=CustomStream; in OpenBlob()
3252 blob_info->custom_stream=image_info->custom_stream; in OpenBlob()
3255 (void) DetachBlob(blob_info); in OpenBlob()
3256 blob_info->mode=mode; in OpenBlob()
3268 blob_info->synchronize=image_info->synchronize; in OpenBlob()
3271 blob_info->stream=image_info->stream; in OpenBlob()
3274 blob_info->type=FifoStream; in OpenBlob()
3296 blob_info->file_info.file=(*type == 'r') ? stdin : stdout; in OpenBlob()
3299 setmode(fileno(blob_info->file_info.file),_O_BINARY); in OpenBlob()
3301 blob_info->type=StandardStream; in OpenBlob()
3302 blob_info->exempt=MagickTrue; in OpenBlob()
3313 blob_info->file_info.file=fdopen(StringToLong(filename+3),fileMode); in OpenBlob()
3314 if (blob_info->file_info.file == (FILE *) NULL) in OpenBlob()
3321 setmode(fileno(blob_info->file_info.file),_O_BINARY); in OpenBlob()
3323 blob_info->type=FileStream; in OpenBlob()
3324 blob_info->exempt=MagickTrue; in OpenBlob()
3344 blob_info->file_info.file=(FILE *) popen_utf8(sanitize_command,fileMode); in OpenBlob()
3346 if (blob_info->file_info.file == (FILE *) NULL) in OpenBlob()
3351 blob_info->type=PipeStream; in OpenBlob()
3352 blob_info->exempt=MagickTrue; in OpenBlob()
3356 status=GetPathAttributes(filename,&blob_info->properties); in OpenBlob()
3358 if ((status != MagickFalse) && S_ISFIFO(blob_info->properties.st_mode)) in OpenBlob()
3360 blob_info->file_info.file=(FILE *) fopen_utf8(filename,type); in OpenBlob()
3361 if (blob_info->file_info.file == (FILE *) NULL) in OpenBlob()
3366 blob_info->type=FileStream; in OpenBlob()
3367 blob_info->exempt=MagickTrue; in OpenBlob()
3406 blob_info->file_info.file=image_info->file; in OpenBlob()
3407 blob_info->type=FileStream; in OpenBlob()
3408 blob_info->exempt=MagickTrue; in OpenBlob()
3413 blob_info->file_info.file=(FILE *) fopen_utf8(filename,type); in OpenBlob()
3414 if (blob_info->file_info.file != (FILE *) NULL) in OpenBlob()
3422 blob_info->type=FileStream; in OpenBlob()
3425 count=fread(magick,1,sizeof(magick),blob_info->file_info.file); in OpenBlob()
3426 (void) fseek(blob_info->file_info.file,-((off_t) count),SEEK_CUR); in OpenBlob()
3428 (void) fflush(blob_info->file_info.file); in OpenBlob()
3436 if (blob_info->file_info.file != (FILE *) NULL) in OpenBlob()
3437 (void) fclose(blob_info->file_info.file); in OpenBlob()
3438 blob_info->file_info.file=(FILE *) NULL; in OpenBlob()
3439 blob_info->file_info.gzfile=gzopen(filename,"rb"); in OpenBlob()
3440 if (blob_info->file_info.gzfile != (gzFile) NULL) in OpenBlob()
3441 blob_info->type=ZipStream; in OpenBlob()
3447 if (blob_info->file_info.file != (FILE *) NULL) in OpenBlob()
3448 (void) fclose(blob_info->file_info.file); in OpenBlob()
3449 blob_info->file_info.file=(FILE *) NULL; in OpenBlob()
3450 blob_info->file_info.bzfile=BZ2_bzopen(filename,"r"); in OpenBlob()
3451 if (blob_info->file_info.bzfile != (BZFILE *) NULL) in OpenBlob()
3452 blob_info->type=BZipStream; in OpenBlob()
3455 if (blob_info->type == FileStream) in OpenBlob()
3469 length=(size_t) blob_info->properties.st_size; in OpenBlob()
3478 blob=MapBlob(fileno(blob_info->file_info.file),ReadMode,0, in OpenBlob()
3488 blob_info->exempt=MagickFalse; in OpenBlob()
3491 (void) fclose(blob_info->file_info.file); in OpenBlob()
3492 blob_info->file_info.file=(FILE *) NULL; in OpenBlob()
3494 AttachBlob(blob_info,blob,length); in OpenBlob()
3495 blob_info->mapped=MagickTrue; in OpenBlob()
3508 blob_info->file_info.gzfile=gzopen(filename,"wb"); in OpenBlob()
3509 if (blob_info->file_info.gzfile != (gzFile) NULL) in OpenBlob()
3510 blob_info->type=ZipStream; in OpenBlob()
3517 blob_info->file_info.bzfile=BZ2_bzopen(filename,"w"); in OpenBlob()
3518 if (blob_info->file_info.bzfile != (BZFILE *) NULL) in OpenBlob()
3519 blob_info->type=BZipStream; in OpenBlob()
3524 blob_info->file_info.file=(FILE *) fopen_utf8(filename,type); in OpenBlob()
3525 if (blob_info->file_info.file != (FILE *) NULL) in OpenBlob()
3527 blob_info->type=FileStream; in OpenBlob()
3531 blob_info->status=MagickFalse; in OpenBlob()
3532 blob_info->error_number=MagickFalse; in OpenBlob()
3533 if (blob_info->type != UndefinedStream) in OpenBlob()
3534 blob_info->size=GetBlobSize(image); in OpenBlob()
3729 *magick_restrict blob_info; in ReadBlob() local
3747 blob_info=image->blob; in ReadBlob()
3750 switch (blob_info->type) in ReadBlob()
3762 count=(ssize_t) fread(q,1,length,blob_info->file_info.file); in ReadBlob()
3767 c=getc(blob_info->file_info.file); in ReadBlob()
3775 c=getc(blob_info->file_info.file); in ReadBlob()
3783 c=getc(blob_info->file_info.file); in ReadBlob()
3791 c=getc(blob_info->file_info.file); in ReadBlob()
3801 (ferror(blob_info->file_info.file) != 0)) in ReadBlob()
3802 ThrowBlobException(blob_info); in ReadBlob()
3820 count=(ssize_t) gzread(blob_info->file_info.gzfile,q+i, in ReadBlob()
3834 c=gzgetc(blob_info->file_info.gzfile); in ReadBlob()
3842 c=gzgetc(blob_info->file_info.gzfile); in ReadBlob()
3850 c=gzgetc(blob_info->file_info.gzfile); in ReadBlob()
3858 c=gzgetc(blob_info->file_info.gzfile); in ReadBlob()
3868 (void) gzerror(blob_info->file_info.gzfile,&status); in ReadBlob()
3870 ThrowBlobException(blob_info); in ReadBlob()
3871 if (blob_info->eof == MagickFalse) in ReadBlob()
3872 blob_info->eof=gzeof(blob_info->file_info.gzfile) != 0 ? MagickTrue : in ReadBlob()
3888 count=(ssize_t) BZ2_bzread(blob_info->file_info.bzfile,q+i, in ReadBlob()
3899 (void) BZ2_bzerror(blob_info->file_info.bzfile,&status); in ReadBlob()
3901 ThrowBlobException(blob_info); in ReadBlob()
3912 if (blob_info->offset >= (MagickOffsetType) blob_info->length) in ReadBlob()
3914 blob_info->eof=MagickTrue; in ReadBlob()
3917 p=blob_info->data+blob_info->offset; in ReadBlob()
3919 blob_info->length-blob_info->offset); in ReadBlob()
3920 blob_info->offset+=count; in ReadBlob()
3922 blob_info->eof=MagickTrue; in ReadBlob()
3928 if (blob_info->custom_stream->reader != (CustomStreamHandler) NULL) in ReadBlob()
3929 count=blob_info->custom_stream->reader(q,length, in ReadBlob()
3930 blob_info->custom_stream->data); in ReadBlob()
3962 *magick_restrict blob_info; in ReadBlobByte() local
3974 blob_info=image->blob; in ReadBlobByte()
3975 switch (blob_info->type) in ReadBlobByte()
3985 c=getc(blob_info->file_info.file); in ReadBlobByte()
4778 *magick_restrict blob_info; in ReadBlobStream() local
4785 blob_info=image->blob; in ReadBlobStream()
4786 if (blob_info->type != BlobStream) in ReadBlobStream()
4792 if (blob_info->offset >= (MagickOffsetType) blob_info->length) in ReadBlobStream()
4795 blob_info->eof=MagickTrue; in ReadBlobStream()
4798 data=blob_info->data+blob_info->offset; in ReadBlobStream()
4800 blob_info->length-blob_info->offset); in ReadBlobStream()
4801 blob_info->offset+=(*count); in ReadBlobStream()
4803 blob_info->eof=MagickTrue; in ReadBlobStream()
4935 *magick_restrict blob_info; in SeekBlob() local
4943 blob_info=image->blob; in SeekBlob()
4944 switch (blob_info->type) in SeekBlob()
4955 if (fseek(blob_info->file_info.file,offset,whence) < 0) in SeekBlob()
4957 blob_info->offset=TellBlob(image); in SeekBlob()
4963 if (gzseek(blob_info->file_info.gzfile,offset,whence) < 0) in SeekBlob()
4966 blob_info->offset=TellBlob(image); in SeekBlob()
4982 blob_info->offset=offset; in SeekBlob()
4987 if (((offset > 0) && (blob_info->offset > (MAGICK_SSIZE_MAX-offset))) || in SeekBlob()
4988 ((offset < 0) && (blob_info->offset < (MAGICK_SSIZE_MIN-offset)))) in SeekBlob()
4993 if ((blob_info->offset+offset) < 0) in SeekBlob()
4995 blob_info->offset+=offset; in SeekBlob()
5000 if (((MagickOffsetType) blob_info->length+offset) < 0) in SeekBlob()
5002 blob_info->offset=blob_info->length+offset; in SeekBlob()
5006 if (blob_info->offset < (MagickOffsetType) ((off_t) blob_info->length)) in SeekBlob()
5008 blob_info->eof=MagickFalse; in SeekBlob()
5011 if (blob_info->offset >= (MagickOffsetType) ((off_t) blob_info->extent)) in SeekBlob()
5017 if (blob_info->custom_stream->seeker == (CustomStreamSeeker) NULL) in SeekBlob()
5019 blob_info->offset=blob_info->custom_stream->seeker(offset,whence, in SeekBlob()
5020 blob_info->custom_stream->data); in SeekBlob()
5024 return(blob_info->offset); in SeekBlob()
5091 *magick_restrict blob_info; in SetBlobExtent() local
5099 blob_info=image->blob; in SetBlobExtent()
5100 switch (blob_info->type) in SetBlobExtent()
5125 blob_info->file_info.file); in SetBlobExtent()
5127 if (blob_info->synchronize != MagickFalse) in SetBlobExtent()
5132 file=fileno(blob_info->file_info.file); in SetBlobExtent()
5154 if (blob_info->mapped != MagickFalse) in SetBlobExtent()
5162 (void) UnmapBlob(blob_info->data,blob_info->length); in SetBlobExtent()
5163 RelinquishMagickResource(MapResource,blob_info->length); in SetBlobExtent()
5173 blob_info->file_info.file); in SetBlobExtent()
5175 if (blob_info->synchronize != MagickFalse) in SetBlobExtent()
5180 file=fileno(blob_info->file_info.file); in SetBlobExtent()
5190 blob_info->data=(unsigned char*) MapBlob(fileno( in SetBlobExtent()
5191 blob_info->file_info.file),WriteMode,0,(size_t) extent); in SetBlobExtent()
5192 blob_info->extent=(size_t) extent; in SetBlobExtent()
5193 blob_info->length=(size_t) extent; in SetBlobExtent()
5197 blob_info->extent=(size_t) extent; in SetBlobExtent()
5198 blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data, in SetBlobExtent()
5199 blob_info->extent+1,sizeof(*blob_info->data)); in SetBlobExtent()
5201 if (blob_info->data == (unsigned char *) NULL) in SetBlobExtent()
5203 (void) DetachBlob(blob_info); in SetBlobExtent()
5404 *magick_restrict blob_info; in SyncBlob() local
5415 blob_info=image->blob; in SyncBlob()
5417 switch (blob_info->type) in SyncBlob()
5425 status=fflush(blob_info->file_info.file); in SyncBlob()
5431 status=gzflush(blob_info->file_info.gzfile,Z_SYNC_FLUSH); in SyncBlob()
5438 status=BZ2_bzflush(blob_info->file_info.bzfile); in SyncBlob()
5477 *magick_restrict blob_info; in TellBlob() local
5488 blob_info=image->blob; in TellBlob()
5490 switch (blob_info->type) in TellBlob()
5497 offset=ftell(blob_info->file_info.file); in TellBlob()
5505 offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile); in TellBlob()
5515 offset=blob_info->offset; in TellBlob()
5520 if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL) in TellBlob()
5521 offset=blob_info->custom_stream->teller(blob_info->custom_stream->data); in TellBlob()
5600 *magick_restrict blob_info; in WriteBlob() local
5621 blob_info=image->blob; in WriteBlob()
5625 switch (blob_info->type) in WriteBlob()
5638 blob_info->file_info.file); in WriteBlob()
5643 c=putc((int) *p++,blob_info->file_info.file); in WriteBlob()
5650 c=putc((int) *p++,blob_info->file_info.file); in WriteBlob()
5657 c=putc((int) *p++,blob_info->file_info.file); in WriteBlob()
5664 c=putc((int) *p++,blob_info->file_info.file); in WriteBlob()
5673 (ferror(blob_info->file_info.file) != 0)) in WriteBlob()
5674 ThrowBlobException(blob_info); in WriteBlob()
5692 count=(ssize_t) gzwrite(blob_info->file_info.gzfile,q+i, in WriteBlob()
5706 c=gzputc(blob_info->file_info.gzfile,(int) *p++); in WriteBlob()
5713 c=gzputc(blob_info->file_info.gzfile,(int) *p++); in WriteBlob()
5720 c=gzputc(blob_info->file_info.gzfile,(int) *p++); in WriteBlob()
5727 c=gzputc(blob_info->file_info.gzfile,(int) *p++); in WriteBlob()
5736 (void) gzerror(blob_info->file_info.gzfile,&status); in WriteBlob()
5738 ThrowBlobException(blob_info); in WriteBlob()
5753 count=(ssize_t) BZ2_bzwrite(blob_info->file_info.bzfile,q+i, in WriteBlob()
5764 (void) BZ2_bzerror(blob_info->file_info.bzfile,&status); in WriteBlob()
5766 ThrowBlobException(blob_info); in WriteBlob()
5772 count=(ssize_t) blob_info->stream(image,data,length); in WriteBlob()
5777 if ((blob_info->offset+(MagickOffsetType) length) >= in WriteBlob()
5778 (MagickOffsetType) blob_info->extent) in WriteBlob()
5780 if (blob_info->mapped != MagickFalse) in WriteBlob()
5782 blob_info->extent+=length+blob_info->quantum; in WriteBlob()
5783 blob_info->quantum<<=1; in WriteBlob()
5784 blob_info->data=(unsigned char *) ResizeQuantumMemory( in WriteBlob()
5785 blob_info->data,blob_info->extent+1,sizeof(*blob_info->data)); in WriteBlob()
5787 if (blob_info->data == (unsigned char *) NULL) in WriteBlob()
5789 (void) DetachBlob(blob_info); in WriteBlob()
5793 q=blob_info->data+blob_info->offset; in WriteBlob()
5795 blob_info->offset+=length; in WriteBlob()
5796 if (blob_info->offset >= (MagickOffsetType) blob_info->length) in WriteBlob()
5797 blob_info->length=(size_t) blob_info->offset; in WriteBlob()
5803 if (blob_info->custom_stream->writer != (CustomStreamHandler) NULL) in WriteBlob()
5804 count=blob_info->custom_stream->writer((unsigned char *) data, in WriteBlob()
5805 length,blob_info->custom_stream->data); in WriteBlob()
5840 *magick_restrict blob_info; in WriteBlobByte() local
5849 blob_info=image->blob; in WriteBlobByte()
5851 switch (blob_info->type) in WriteBlobByte()
5860 c=putc((int) value,blob_info->file_info.file); in WriteBlobByte()
5863 if (ferror(blob_info->file_info.file) != 0) in WriteBlobByte()
5864 ThrowBlobException(blob_info); in WriteBlobByte()