]> granicus.if.org Git - graphviz/commitdiff
Fix holes in code for writing when using libcgraph
authorerg <devnull@localhost>
Fri, 4 Sep 2009 02:44:21 +0000 (02:44 +0000)
committererg <devnull@localhost>
Fri, 4 Sep 2009 02:44:21 +0000 (02:44 +0000)
plugin/core/gvrender_core_dot.c

index e1294b9f17722381a33e0a88318ce093738cf00b..353d44af3325fe1aec4e8a64700a01585196162c 100644 (file)
@@ -413,11 +413,22 @@ static void xdot_end_graph(graph_t* g)
 static void dot_end_graph(GVJ_t *job)
 {
     graph_t *g = job->obj->u.g;
+#ifdef WITH_CGRAPH
+    Agiodisc_t* io_save;
+    static Agiodisc_t io;
+
+    if (io.afread == NULL) {
+       io.afread = AgIoDisc.afread;
+       io.putstr = gvputs;
+       io.flush = gvflush;
+    }
+#endif
 
 #ifndef WITH_CGRAPH
     agsetiodisc(NULL, gvfwrite, gvferror);
 #else
-    // FIXME
+    io_save = g->clos->disc.io;
+    g->clos->disc.io = &io;
 #endif
     switch (job->render.id) {
        case FORMAT_PLAIN:
@@ -440,7 +451,7 @@ static void dot_end_graph(GVJ_t *job)
 #ifndef WITH_CGRAPH
     agsetiodisc(NULL, NULL, NULL);
 #else
-    // FIXME
+    g->clos->disc.io = io_save;
 #endif
 }