]> granicus.if.org Git - graphviz/commitdiff
sccmap.c: use unsigned types consistently in sccstate
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 13 Nov 2021 02:58:45 +0000 (18:58 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 19 Nov 2021 01:52:27 +0000 (17:52 -0800)
Squashes a -Wconversion warning.

cmd/tools/sccmap.c

index 5d0b4b877a05f79c3f03acbebf9abb74f7c24f21..95cf1459bd161e61867ffceabbb7c21cd79247ea 100644 (file)
@@ -104,8 +104,8 @@ static Agnode_t *pop(Stack * sp)
 /********* end stack ***********/
 
 typedef struct {
-    int Comp;
-    int ID;
+    unsigned Comp;
+    unsigned ID;
     int N_nodes_in_nontriv_SCC;
 } sccstate;
 
@@ -167,7 +167,7 @@ static int visit(Agnode_t * n, Agraph_t * map, Stack * sp, sccstate * st)
        } else {
            char name[32];
            Agraph_t *G = agraphof(n);;
-           snprintf(name, sizeof(name), "cluster_%d", (st->Comp)++);
+           snprintf(name, sizeof(name), "cluster_%u", st->Comp++);
            subg = agsubg(G, name, TRUE);
            agbindrec(subg, "scc_graph", sizeof(Agraphinfo_t), TRUE);
            setrep(subg, agnode(map, name, TRUE));
@@ -270,12 +270,12 @@ static void process(Agraph_t * G)
     agclose(map);
 
     if (Verbose)
-       fprintf(stderr, "%d %d %d %d %.4f %d %.4f\n",
+       fprintf(stderr, "%d %d %d %u %.4f %d %.4f\n",
                agnnodes(G), agnedges(G), nc, state.Comp,
                state.N_nodes_in_nontriv_SCC / (double) agnnodes(G),
                Maxdegree, nontree_frac);
     else if (!Silent)
-       fprintf(stderr, "%d nodes, %d edges, %d strong components\n",
+       fprintf(stderr, "%d nodes, %d edges, %u strong components\n",
                agnnodes(G), agnedges(G), state.Comp);
 
 }