]> granicus.if.org Git - graphviz/commitdiff
smyrna: squash -Wmaybe-uninitialized warnings in 'set_boundaries'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 5 May 2022 15:33:16 +0000 (08:33 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 11 May 2022 03:14:22 +0000 (20:14 -0700)
This code is assuming there is at least one point to scan in the loop. In case
there is not (and to pacify the compiler) set an initial trivial bounding box.

cmd/smyrna/topviewfuncs.c

index 0da50faa076e9d952b8037fbbfaace8c8cb831a9..e1b87bc442f060332900960da37f0ffd4629a9b0 100644 (file)
@@ -22,6 +22,7 @@
 #include <common/types.h>
 #include <common/utils.h>
 #include <ctype.h>
+#include <float.h>
 
 static xdot *parseXdotwithattrs(void *e)
 {
@@ -52,7 +53,7 @@ static void set_boundaries(Agraph_t * g)
     Agnode_t *v;
     Agsym_t* pos_attr = GN_pos(g);
     glCompPoint pos;
-    float left, right, top, bottom;
+    float left = FLT_MAX, right = -FLT_MAX, top = FLT_MAX, bottom = -FLT_MAX;
     int id=0;
 
     for (v = agfstnode(g); v; v = agnxtnode(g, v))