From bc06f2766411e35763630cc36882552f2a0b4de9 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 24 Aug 2019 17:29:45 -0400 Subject: [PATCH] ... --- coders/url.c | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/coders/url.c b/coders/url.c index e491dd5c3..79853da15 100644 --- a/coders/url.c +++ b/coders/url.c @@ -139,7 +139,9 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) *file; Image - *image; + *image, + *images, + *next; ImageInfo *read_info; @@ -147,24 +149,19 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) int unique_file; + images=(Image *) NULL; + image=AcquireImage(image_info,exception); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__) if (LocaleCompare(read_info->magick,"https") == 0) { - Image - *image, - *images, - *next; - MagickBooleanType status; /* Leverage delegate to read HTTPS link. */ - images=(Image *) NULL; - image=AcquireImage(image_info,exception); status=InvokeDelegate(read_info,image,"https:decode",(char *) NULL, exception); if (status != MagickFalse) @@ -196,9 +193,10 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) CopyMagickString(read_info->filename,image_info->filename+2, MagickPathExtent); *read_info->magick='\0'; - image=ReadImage(read_info,exception); + images=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); - return(GetFirstImageInList(image)); + image=DestroyImage(image); + return(GetFirstImageInList(images)); } file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(read_info->filename); @@ -216,14 +214,24 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) LocaleLower(filename); (void) ConcatenateMagickString(filename,image_info->filename, MagickPathExtent); -#if defined(MAGICKCORE_WINDOWS_SUPPORT) && \ - !defined(__MINGW32__) +#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__) (void) fclose(file); if (URLDownloadToFile(NULL,filename,read_info->filename,0,NULL) != S_OK) { ThrowFileException(exception,FileOpenError,"UnableToOpenFile", filename); (void) RelinquishUniqueFileResource(read_info->filename); + (void) CopyMagickString(read_info->filename,image->filename, + MagickPathExtent); + (void) SetImageInfo(read_info,1,exception); + if (images != (Image *) NULL) + for (next=images; next != (Image *) NULL; next=next->next) + { + (void) CopyMagickString(next->filename,image->filename, + MagickPathExtent); + (void) CopyMagickString(next->magick,read_info->magick, + MagickPathExtent); + } read_info=DestroyImageInfo(read_info); return((Image *) NULL); } @@ -278,18 +286,27 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) fclose(file); #endif *read_info->magick='\0'; - image=ReadImage(read_info,exception); + images=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); + (void) CopyMagickString(read_info->filename,image->filename,MagickPathExtent); + (void) SetImageInfo(read_info,1,exception); + if (images != (Image *) NULL) + for (next=images; next != (Image *) NULL; next=next->next) + { + (void) CopyMagickString(next->filename,image->filename,MagickPathExtent); + (void) CopyMagickString(next->magick,read_info->magick,MagickPathExtent); + } read_info=DestroyImageInfo(read_info); - if (image != (Image *) NULL) - GetPathComponent(image_info->filename,TailPath,image->filename); + image=DestroyImage(image); + if (images != (Image *) NULL) + GetPathComponent(image_info->filename,TailPath,images->filename); else { (void) ThrowMagickException(exception,GetMagickModule(),CoderError, "NoDataReturned","`%s'",filename); return((Image *) NULL); } - return(GetFirstImageInList(image)); + return(GetFirstImageInList(images)); } /* -- 2.40.0