]> granicus.if.org Git - graphviz/commitdiff
squash some -Wfloat-conversion warnings in lib/glcomp
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 2 May 2021 02:50:50 +0000 (19:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 16 May 2021 16:40:28 +0000 (09:40 -0700)
These literals were doubles, but being implicitly converted to floats. This
resulted in precision loss. E.g. the compiler diagnoses:

  conversion from ‘double’ to ‘GLfloat’ {aka ‘float’} changes value from
  ‘-1.0e-3’ to ‘-1.00000005e-3’

By writing these as float literals to begin with, we can get a more precise
value.

lib/glcomp/glcompbutton.c
lib/glcomp/glcomppanel.c

index 36b833f61cf2f1d713bc4d15398646002d06a603..f4988d40ffedf9fe2df208ac27005a47b872736b 100644 (file)
@@ -131,7 +131,7 @@ void glCompButtonDraw(glCompButton * p)
        return;
     /*draw panel */
     glCompDrawRectPrism(&(ref.pos), ref.width, ref.height,
-                       p->common.borderWidth, 0.01, &(ref.color),
+                       p->common.borderWidth, 0.01f, &(ref.color),
                        !p->status);
     if (p->label)
        p->label->common.functions.draw((void *) p->label);
index b54c715d0cada7668ab6bcd173707bfcab872393..6ffa911db6159944126c01399f417b1f43149d29 100644 (file)
@@ -71,17 +71,17 @@ int glCompPanelDraw(glCompObj * o)
     r.w = ref.width;
     r.pos.x = ref.pos.x + p->shadowwidth;
     r.pos.y = ref.pos.y - p->shadowwidth;
-    r.pos.z = -0.001;
+    r.pos.z = -0.001f;
     glCompDrawRectangle(&r);
     r.h = ref.height;
     r.w = p->shadowwidth;
     r.pos.x = ref.pos.x + ref.width;
     r.pos.y = ref.pos.y - p->shadowwidth;
-    r.pos.z = -0.001;
+    r.pos.z = -0.001f;
     glCompDrawRectangle(&r);
     /*draw panel */
     glCompDrawRectPrism(&(ref.pos), ref.width, ref.height,
-                       p->common.borderWidth, 0.01, &(ref.color), 1);
+                       p->common.borderWidth, 0.01f, &(ref.color), 1);
     /*draw image if there is */
     if (p->image) {
        p->image->common.callbacks.draw((void *) p->image);