]> granicus.if.org Git - imagemagick/blobdiff - coders/dot.c
(no commit message)
[imagemagick] / coders / dot.c
index 2ce8815f29757697332319e55e12002a0ed31eaf..27bae00751790fa62279a79cc2202da8c8a593d8 100644 (file)
 %                      Read/Write Graphviz DOT Format                         %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 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  %
@@ -135,9 +135,16 @@ static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   (void) AcquireUniqueFilename(read_info->filename);
   (void) FormatLocaleString(command,MaxTextExtent,"-Tsvg -o%s %s",
     read_info->filename,image_info->filename);
+#if !defined(WITH_CGRAPH)
+  graph=agread(GetBlobFileHandle(image));
+#else
   graph=agread(GetBlobFileHandle(image),(Agdisc_t *) NULL);
+#endif
   if (graph == (graph_t *) NULL)
-    return ((Image *) NULL);
+    {
+      (void) RelinquishUniqueFileResource(read_info->filename);
+      return ((Image *) NULL);
+    }
   option=GetImageOption(image_info,"dot:layout-engine");
   if (option == (const char *) NULL)
     gvLayout(graphic_context,graph,(char *) "dot");
@@ -145,6 +152,7 @@ static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     gvLayout(graphic_context,graph,(char *) option);
   gvRenderFilename(graphic_context,graph,(char *) "svg",read_info->filename);
   gvFreeLayout(graphic_context,graph);
+  agclose(graph);
   /*
     Read SVG graph.
   */
@@ -189,7 +197,7 @@ ModuleExport size_t RegisterDOTImage(void)
 #if defined(MAGICKCORE_GVC_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadDOTImage;
 #endif
-  entry->blob_support=MagickFalse;
+  entry->flags^=CoderBlobSupportFlag;
   entry->description=ConstantString("Graphviz");
   entry->module=ConstantString("DOT");
   (void) RegisterMagickInfo(entry);
@@ -197,7 +205,7 @@ ModuleExport size_t RegisterDOTImage(void)
 #if defined(MAGICKCORE_GVC_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadDOTImage;
 #endif
-  entry->blob_support=MagickFalse;
+  entry->flags^=CoderBlobSupportFlag;
   entry->description=ConstantString("Graphviz");
   entry->module=ConstantString("DOT");
   (void) RegisterMagickInfo(entry);