]> granicus.if.org Git - imagemagick/blobdiff - coders/vid.c
...
[imagemagick] / coders / vid.c
index b3ebb2d19686b9589c1439373d2abef9daac4fe9..6493b4d8e3470c7406aa36cac3ae73ed1035ab84 100644 (file)
 %             Return a Visual Image Directory for matching images.            %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
 %  obtain a copy of the License at                                            %
 %                                                                             %
-%    http://www.imagemagick.org/script/license.php                            %
+%    https://www.imagemagick.org/script/license.php                           %
 %                                                                             %
 %  Unless required by applicable law or agreed to in writing, software        %
 %  distributed under the License is distributed on an "AS IS" BASIS,          %
@@ -67,7 +67,7 @@
   Forward declarations.
 */
 static MagickBooleanType
-  WriteVIDImage(const ImageInfo *,Image *);
+  WriteVIDImage(const ImageInfo *,Image *,ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -132,13 +132,13 @@ static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
     Expand the filename.
   */
   assert(image_info != (const ImageInfo *) NULL);
-  assert(image_info->signature == MagickSignature);
+  assert(image_info->signature == MagickCoreSignature);
   if (image_info->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
-  assert(exception->signature == MagickSignature);
-  image=AcquireImage(image_info);
+  assert(exception->signature == MagickCoreSignature);
+  image=AcquireImage(image_info,exception);
   filelist=(char **) AcquireMagickMemory(sizeof(*filelist));
   if (filelist == (char **) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
@@ -163,15 +163,16 @@ static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (image_info->debug != MagickFalse)
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),"name: %s",
         filelist[i]);
-    (void) CopyMagickString(read_info->filename,filelist[i],MaxTextExtent);
+    (void) CopyMagickString(read_info->filename,filelist[i],MagickPathExtent);
     filelist[i]=DestroyString(filelist[i]);
     *read_info->magick='\0';
     next_image=ReadImage(read_info,exception);
     CatchException(exception);
     if (next_image == (Image *) NULL)
       break;
-    label=InterpretImageProperties(image_info,next_image,DefaultTileLabel);
-    (void) SetImageProperty(next_image,"label",label);
+    label=InterpretImageProperties((ImageInfo *) image_info,next_image,
+      DefaultTileLabel,exception);
+    (void) SetImageProperty(next_image,"label",label,exception);
     label=DestroyString(label);
     if (image_info->debug != MagickFalse)
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
@@ -242,12 +243,10 @@ ModuleExport size_t RegisterVIDImage(void)
   MagickInfo
     *entry;
 
-  entry=SetMagickInfo("VID");
+  entry=AcquireMagickInfo("VID","VID","Visual Image Directory");
   entry->decoder=(DecodeImageHandler *) ReadVIDImage;
   entry->encoder=(EncodeImageHandler *) WriteVIDImage;
   entry->format_type=ImplicitFormatType;
-  entry->description=ConstantString("Visual Image Directory");
-  entry->module=ConstantString("VID");
   (void) RegisterMagickInfo(entry);
   return(MagickImageCoderSignature);
 }
@@ -291,7 +290,8 @@ ModuleExport void UnregisterVIDImage(void)
 %
 %  The format of the WriteVIDImage method is:
 %
-%      MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
+%      MagickBooleanType WriteVIDImage(const ImageInfo *image_info,
+%        Image *image,ExceptionInfo *exception)
 %
 %  A description of each parameter follows.
 %
@@ -299,8 +299,11 @@ ModuleExport void UnregisterVIDImage(void)
 %
 %    o image:  The image.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
-static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image,
+  ExceptionInfo *exception)
 {
   Image
     *montage_image;
@@ -321,21 +324,22 @@ static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
     Create the visual image directory.
   */
   for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))
-    (void) SetImageProperty(p,"label",DefaultTileLabel);
+    (void) SetImageProperty(p,"label",DefaultTileLabel,exception);
   montage_info=CloneMontageInfo(image_info,(MontageInfo *) NULL);
-  montage_image=MontageImageList(image_info,montage_info,image,
-    &image->exception);
+  montage_image=MontageImageList(image_info,montage_info,image,exception);
   montage_info=DestroyMontageInfo(montage_info);
   if (montage_image == (Image *) NULL)
-    ThrowWriterException(CorruptImageError,image->exception.reason);
+    return(MagickFalse);
   (void) CopyMagickString(montage_image->filename,image_info->filename,
-    MaxTextExtent);
+    MagickPathExtent);
   write_info=CloneImageInfo(image_info);
-  (void) SetImageInfo(write_info,1,&image->exception);
-  if (LocaleCompare(write_info->magick,"VID") == 0)
-    (void) FormatLocaleString(montage_image->filename,MaxTextExtent,
+  *write_info->magick='\0';
+  (void) SetImageInfo(write_info,1,exception);
+  if ((*write_info->magick == '\0') ||
+      (LocaleCompare(write_info->magick,"VID") == 0))
+    (void) FormatLocaleString(montage_image->filename,MagickPathExtent,
       "miff:%s",write_info->filename);
-  status=WriteImage(write_info,montage_image,&image->exception);
+  status=WriteImage(write_info,montage_image,exception);
   montage_image=DestroyImage(montage_image);
   write_info=DestroyImageInfo(write_info);
   return(status);