From: dirk Date: Tue, 20 Sep 2016 17:58:19 +0000 (+0200) Subject: Removed obsolete coders. X-Git-Tag: 7.0.3-1~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=927341f93127c4b23166c9add760cbd544416c3b;p=imagemagick Removed obsolete coders. --- diff --git a/MagickCore/coder.c b/MagickCore/coder.c index bb2a3d2b2..b8a6a419d 100644 --- a/MagickCore/coder.c +++ b/MagickCore/coder.c @@ -252,9 +252,6 @@ static const CoderMapInfo { "X3f", "DNG" }, { "XMP", "META" }, { "XTRNARRAY", "XTRN" }, - { "XTRNBLOB", "XTRN" }, - { "XTRNFILE", "XTRN" }, - { "XTRNIMAGE", "XTRN" }, { "XV", "VIFF" }, { "Y", "RAW" }, { "YCbCrA", "YCbCr" } diff --git a/coders/xtrn.c b/coders/xtrn.c index d07f93cc7..d11c006d4 100644 --- a/coders/xtrn.c +++ b/coders/xtrn.c @@ -37,18 +37,7 @@ % This coder is a kind of backdoor used by the COM object that allows it to % % pass blobs back and forth using the coder interface. It simply encodes and % % decodes the filename as a comma delimited string and extracts the info it % -% needs. The five methods of passing images are: % -% % -% FILE - same thing as filename so it should be a NOP % -% IMAGE - passes an image and image info structure % -% BLOB - passes binary blob containining the image % -% STREAM - passes pointers to stream hooks in and does the hooking % -% ARRAY - passes a pointer to a Win32 smart array and streams to it % -% % -% Of all of these, the only one getting any real use at the moment is the % -% ARRAY handler. It is the primary way that images are shuttled back and % -% forth as blobs via COM since this is what VB and VBSCRIPT use internally % -% for this purpose. % +% needs. % % % */ @@ -110,117 +99,68 @@ static MagickBooleanType % */ #if defined(MAGICKCORE_WINDOWS_SUPPORT) -# pragma warning(disable : 4477) static Image *ReadXTRNImage(const ImageInfo *image_info, ExceptionInfo *exception) { + char + *blob_data, + filename[MagickPathExtent]; + + HRESULT + hr; + Image *image; ImageInfo *clone_info; + long + lBoundl, + lBoundu; + + SAFEARRAY + *pSafeArray; + + size_t + blob_length; + void - *param1, - *param2, - *param3; + *param1; - param1 = param2 = param3 = (void *) NULL; - image = (Image *) NULL; + param1=(void *) NULL; + image=(Image *) NULL; clone_info=CloneImageInfo(image_info); if (clone_info->filename == NULL) { clone_info=DestroyImageInfo(clone_info); ThrowReaderException(FileOpenWarning,"No filename specified"); } - if (LocaleCompare(image_info->magick,"XTRNFILE") == 0) - { - image=ReadImage(clone_info,exception); - CatchException(exception); - } - else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0) - { - Image - **image_ptr; - -#ifdef ALL_IMAGEINFO - ImageInfo - **image_info_ptr; -#endif - - (void) sscanf(clone_info->filename,"%lx,%lx",¶m1,¶m2); - image_ptr=(Image **) param2; - if (*image_ptr != (Image *) NULL) - image=CloneImage(*image_ptr,0,0,MagickFalse,exception); -#ifdef ALL_IMAGEINFO - image_info_ptr=(ImageInfo **) param1; - if (*image_info_ptr != (ImageInfo *) NULL) - image_info=*image_info_ptr; -#endif - } - else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0) - { - char - **blob_data; - - size_t - *blob_length; - - char - filename[MagickPathExtent]; - - (void) sscanf(clone_info->filename,"%lx,%lx,%2048s",¶m1,¶m2, - filename); - blob_data=(char **) param1; - blob_length=(size_t *) param2; - image=BlobToImage(clone_info,*blob_data,*blob_length,exception); - CatchException(exception); - } - else if (LocaleCompare(image_info->magick,"XTRNARRAY") == 0) + *filename='\0'; + (void) sscanf(clone_info->filename,"%p,%2048s",¶m1,filename); + hr=S_OK; + pSafeArray=(SAFEARRAY *) param1; + if (pSafeArray) { - char - *blob_data, - filename[MagickPathExtent]; - - HRESULT - hr; - - long - lBoundl, - lBoundu; - - SAFEARRAY - *pSafeArray; - - size_t - blob_length; - - *filename='\0'; - (void) sscanf(clone_info->filename,"%lx,%2048s",¶m1,filename); - hr=S_OK; - pSafeArray=(SAFEARRAY *) param1; - if (pSafeArray) + hr=SafeArrayGetLBound(pSafeArray,1,&lBoundl); + if (SUCCEEDED(hr)) { - hr = SafeArrayGetLBound(pSafeArray, 1, &lBoundl); + hr=SafeArrayGetUBound(pSafeArray,1,&lBoundu); if (SUCCEEDED(hr)) { - hr = SafeArrayGetUBound(pSafeArray, 1, &lBoundu); + blob_length=lBoundu-lBoundl+1; + hr=SafeArrayAccessData(pSafeArray,(void**) &blob_data); if (SUCCEEDED(hr)) { - blob_length = lBoundu - lBoundl + 1; - hr = SafeArrayAccessData(pSafeArray,(void**) &blob_data); - if(SUCCEEDED(hr)) - { - *clone_info->filename='\0'; - *clone_info->magick='\0'; - if (*filename != '\0') - (void) CopyMagickString(clone_info->filename,filename, - MagickPathExtent); - image=BlobToImage(clone_info,blob_data,blob_length, - exception); - hr=SafeArrayUnaccessData(pSafeArray); - CatchException(exception); - } + *clone_info->filename='\0'; + *clone_info->magick='\0'; + if (*filename != '\0') + (void) CopyMagickString(clone_info->filename,filename, + MagickPathExtent); + image=BlobToImage(clone_info,blob_data,blob_length, + exception); + hr=SafeArrayUnaccessData(pSafeArray); + CatchException(exception); } } } @@ -228,7 +168,6 @@ static Image *ReadXTRNImage(const ImageInfo *image_info, clone_info=DestroyImageInfo(clone_info); return(image); } -# pragma warning(default : 4477) #endif /* @@ -259,32 +198,6 @@ ModuleExport size_t RegisterXTRNImage(void) MagickInfo *entry; - entry=AcquireMagickInfo("XTRN","XTRNFILE","External transfer of a file"); -#if defined(MAGICKCORE_WINDOWS_SUPPORT) - entry->decoder=ReadXTRNImage; - entry->encoder=WriteXTRNImage; -#endif - entry->flags^=CoderAdjoinFlag; - entry->flags|=CoderStealthFlag; - RegisterMagickInfo(entry); - entry=AcquireMagickInfo("XTRN","XTRNIMAGE", - "External transfer of a image in memory"); -#if defined(MAGICKCORE_WINDOWS_SUPPORT) - entry->decoder=ReadXTRNImage; - entry->encoder=WriteXTRNImage; -#endif - entry->flags^=CoderAdjoinFlag; - entry->flags|=CoderStealthFlag; - RegisterMagickInfo(entry); - entry=AcquireMagickInfo("XTRN","XTRNBLOB", - "IExternal transfer of a blob in memory"); -#if defined(MAGICKCORE_WINDOWS_SUPPORT) - entry->decoder=ReadXTRNImage; - entry->encoder=WriteXTRNImage; -#endif - entry->flags^=CoderAdjoinFlag; - entry->flags|=CoderStealthFlag; - RegisterMagickInfo(entry); entry=AcquireMagickInfo("XTRN","XTRNARRAY", "External transfer via a smart array interface"); #if defined(MAGICKCORE_WINDOWS_SUPPORT) @@ -318,9 +231,6 @@ ModuleExport size_t RegisterXTRNImage(void) */ ModuleExport void UnregisterXTRNImage(void) { - UnregisterMagickInfo("XTRNFILE"); - UnregisterMagickInfo("XTRNIMAGE"); - UnregisterMagickInfo("XTRNBLOB"); UnregisterMagickInfo("XTRNARRAY"); } @@ -404,8 +314,11 @@ static size_t SafeArrayFifo(const Image *image,const void *data, static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { - Image * - p; + char + filename[MagickPathExtent]; + + Image + *p; ImageInfo *clone_info; @@ -416,123 +329,43 @@ static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info, MagickBooleanType status; + size_t + blob_length; + + unsigned char + *blob_data; + void - *param1, - *param2, - *param3; + *param1; - param1 = param2 = param3 = (void *) NULL; + param1 = (void *) NULL; status=MagickTrue; - if (LocaleCompare(image_info->magick,"XTRNFILE") == 0) + clone_info=CloneImageInfo(image_info); + if (*clone_info->filename != '\0') { - clone_info=CloneImageInfo(image_info); - *clone_info->magick='\0'; - status=WriteImage(clone_info,image,exception); + (void) sscanf(clone_info->filename,"%p,%2048s",¶m1,filename); + image->client_data=param1; + scene=0; + (void) CopyMagickString(clone_info->filename,filename, + MagickPathExtent); + for (p=image; p != (Image *) NULL; p=GetNextImageInList(p)) + { + (void) CopyMagickString(p->filename,filename,MagickPathExtent); + p->scene=scene++; + } + SetImageInfo(clone_info,1,exception); + (void) CopyMagickString(image->magick,clone_info->magick, + MagickPathExtent); + blob_data=ImageToBlob(clone_info,image,&blob_length, + exception); + if (blob_data == (unsigned char *) NULL) + status=MagickFalse; + else + SafeArrayFifo(image,blob_data,blob_length); if (status == MagickFalse) CatchImageException(image); - clone_info=DestroyImageInfo(clone_info); - } - else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0) - { - Image - **image_ptr; - - ImageInfo - **image_info_ptr; - - clone_info=CloneImageInfo(image_info); - if (clone_info->filename[0]) - { - (void) sscanf(clone_info->filename,"%lx,%lx",¶m1,¶m2); - image_info_ptr=(ImageInfo **) param1; - image_ptr=(Image **) param2; - if ((image_info_ptr != (ImageInfo **) NULL) && - (image_ptr != (Image **) NULL)) - { - *image_ptr=CloneImage(image,0,0,MagickFalse,exception); - *image_info_ptr=clone_info; - } - } - } - else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0) - { - char - **blob_data; - - size_t - *blob_length; - - char - filename[MagickPathExtent]; - - clone_info=CloneImageInfo(image_info); - if (clone_info->filename[0]) - { - (void) sscanf(clone_info->filename,"%lx,%lx,%2048s", - ¶m1,¶m2,filename); - - blob_data=(char **) param1; - blob_length=(size_t *) param2; - scene = 0; - (void) CopyMagickString(clone_info->filename,filename, - MagickPathExtent); - for (p=image; p != (Image *) NULL; p=GetNextImageInList(p)) - { - (void) CopyMagickString(p->filename,filename,MagickPathExtent); - p->scene=scene++; - } - SetImageInfo(clone_info,1,exception); - (void) CopyMagickString(image->magick,clone_info->magick, - MagickPathExtent); - if (*blob_length == 0) - *blob_length=8192; - *blob_data=(char *) ImageToBlob(clone_info,image,blob_length, - exception); - if (*blob_data == NULL) - status=MagickFalse; - if (status == MagickFalse) - CatchImageException(image); - } - clone_info=DestroyImageInfo(clone_info); - } - else if (LocaleCompare(image_info->magick,"XTRNARRAY") == 0) - { - char - filename[MagickPathExtent]; - - size_t - blob_length; - - unsigned char - *blob_data; - - clone_info=CloneImageInfo(image_info); - if (*clone_info->filename != '\0') - { - (void) sscanf(clone_info->filename,"%lx,%2048s",¶m1,filename); - image->client_data=param1; - scene=0; - (void) CopyMagickString(clone_info->filename,filename, - MagickPathExtent); - for (p=image; p != (Image *) NULL; p=GetNextImageInList(p)) - { - (void) CopyMagickString(p->filename,filename,MagickPathExtent); - p->scene=scene++; - } - SetImageInfo(clone_info,1,exception); - (void) CopyMagickString(image->magick,clone_info->magick, - MagickPathExtent); - blob_data=ImageToBlob(clone_info,image,&blob_length, - exception); - if (blob_data == (unsigned char *) NULL) - status=MagickFalse; - else - SafeArrayFifo(image,blob_data,blob_length); - if (status == MagickFalse) - CatchImageException(image); - } - clone_info=DestroyImageInfo(clone_info); } + clone_info=DestroyImageInfo(clone_info); return(MagickTrue); } # pragma warning(default : 4477)