]> granicus.if.org Git - graphviz/commitdiff
smyrna: use an 'unsigned' for 'topviewcache.node_id'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 7 Sep 2022 04:30:51 +0000 (21:30 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 10 Sep 2022 00:11:28 +0000 (17:11 -0700)
Squashes 4 -Wsign-conversion warnings. Note that this also changes the sentinel
from `-1` to `UINT_MAX`.

cmd/smyrna/smyrnadefs.h
cmd/smyrna/topviewfuncs.c

index 02181381fe95122aa115dc8cf93be0ab33653367..bcaa59c8e350b90fc617bd673c9bb429ce2d9af4 100644 (file)
@@ -140,7 +140,7 @@ typedef struct
 
     typedef struct
     {
-       int node_id;
+       unsigned node_id;
        int edge_id;
        int selnode_id;
        int seledge_id;
index f7387d426ef96a4cf5d686edc10dd02fff9262b1..110948ae2d1f470b9b77cceb67cad7aca9da190c 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/types.h>
 #include <common/utils.h>
 #include <ctype.h>
+#include <limits.h>
 #include <float.h>
 #include <math.h>
 #include <stddef.h>
@@ -744,7 +745,7 @@ static void renderEdgeLabels(Agraph_t * g)
 
 static void cacheNodes(Agraph_t * g,topview* t)
 {
-    if(t->cache.node_id!=-1)   /*clean existing cache*/
+    if (t->cache.node_id != UINT_MAX) // clean existing cache
        glDeleteLists(t->cache.node_id,1);
     t->cache.node_id=glGenLists(1);
     glNewList(t->cache.node_id,GL_COMPILE);
@@ -862,7 +863,7 @@ void initSmGraph(Agraph_t * g,topview* rv)
     rv->fisheyeParams.h = NULL;
 
     rv->fisheyeParams.active = 0;
-    rv->cache.node_id=-1;
+    rv->cache.node_id = UINT_MAX;
     rv->cache.selnode_id=-1;
     rv->cache.edge_id=-1;
     rv->cache.seledge_id=-1;