]> granicus.if.org Git - graphviz/commitdiff
fix printf format code in write_nodename()
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Oct 2020 17:22:35 +0000 (10:22 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Oct 2020 01:46:51 +0000 (18:46 -0700)
This fixes a build warning on macOS when using CMake. Related to !1620.

lib/cgraph/write.c

index 4b3d8f7b987c8d87d7824ac0bd15973d024df5d4..5b2f2e2ae5317d615d5c5ba7bcc7d660383aa5fc 100644 (file)
@@ -15,6 +15,7 @@
 #include <ctype.h>
 #include <cgraph/cghdr.h>
 #include <cgraph/strcasecmp.h>
+#include <inttypes.h>
 
 #define EMPTY(s)               (((s) == 0) || (s)[0] == '\0')
 #define MAX(a,b)     ((a)>(b)?(a):(b))
@@ -506,7 +507,7 @@ static int write_nodename(Agnode_t * n, iochan_t * ofile)
        CHKRV(write_canonstr(g, ofile, name));
     } else {
        char buf[sizeof("__SUSPECT") + 20];
-       snprintf(buf, sizeof(buf), "_%ld_SUSPECT", AGID(n));    /* could be deadly wrong */
+       snprintf(buf, sizeof(buf), "_%" PRIu64 "_SUSPECT", AGID(n));    /* could be deadly wrong */
        CHKRV(ioput(g, ofile, buf));
     }
     return 0;