]> granicus.if.org Git - graphviz/commitdiff
gv2gml: use C99 support to portably print uint64_t variables
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 10 Sep 2021 04:15:23 +0000 (21:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 16 Sep 2021 04:31:00 +0000 (21:31 -0700)
This squashes a number of -Wformat compiler warnings, as reported by Stephen.¹

¹ https://forum.graphviz.org/t/tracking-down-warnings-old-news-to-some-of-you/821

cmd/tools/gv2gml.c

index 0b8c02acbf1923424aeaee4ac827a7557ed63746..b41a34ab6a3aef84b2e8139f542f19a952ed91d0 100644 (file)
@@ -418,7 +418,8 @@ static void
 emitNode (Agraph_t* G, Agnode_t* n, FILE* outFile)
 {
     agbindrec (n, "nodeinfo", sizeof(Agnodeinfo_t), TRUE);
-    fprintf (outFile, "  node [\n    id %lu\n    name \"%s\"\n", id, agnameof(n));
+    fprintf(outFile, "  node [\n    id %" PRIu64 "\n    name \"%s\"\n", id,
+            agnameof(n));
     ID(n) = id++;
     emitNodeAttrs (G, n, outFile, 2);
     fprintf (outFile, "  ]\n");
@@ -597,9 +598,9 @@ emitEdgeAttrs (Agraph_t* G, Agedge_t* ep, FILE* outFile, int ix)
 static void 
 emitEdge (Agraph_t* G, Agedge_t* e, FILE* outFile)
 {
-    fprintf (outFile, "  edge [\n    id %lu\n", (uint64_t)AGSEQ(e));
-    fprintf (outFile, "    source %lu\n", ID(agtail(e)));
-    fprintf (outFile, "    target %lu\n", ID(aghead(e)));
+    fprintf(outFile, "  edge [\n    id %" PRIu64 "\n", (uint64_t)AGSEQ(e));
+    fprintf(outFile, "    source %" PRIu64 "\n", ID(agtail(e)));
+    fprintf(outFile, "    target %" PRIu64 "\n", ID(aghead(e)));
     emitEdgeAttrs (G, e, outFile, 2);
     fprintf (outFile, "  ]\n");
 }