From: Matthew Fernandez Date: Sun, 2 May 2021 02:50:50 +0000 (-0700) Subject: squash some -Wfloat-conversion warnings in lib/glcomp X-Git-Tag: 2.47.2~7^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4802f4c182a30515ea30688a9a7f283346422f8;p=graphviz squash some -Wfloat-conversion warnings in lib/glcomp 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. --- diff --git a/lib/glcomp/glcompbutton.c b/lib/glcomp/glcompbutton.c index 36b833f61..f4988d40f 100644 --- a/lib/glcomp/glcompbutton.c +++ b/lib/glcomp/glcompbutton.c @@ -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); diff --git a/lib/glcomp/glcomppanel.c b/lib/glcomp/glcomppanel.c index b54c715d0..6ffa911db 100644 --- a/lib/glcomp/glcomppanel.c +++ b/lib/glcomp/glcomppanel.c @@ -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);