[PATCH xserver 1/8] gtf: Warning fix

Adam Jackson ajax at redhat.com
Thu Apr 5 17:13:54 UTC 2018


../hw/xfree86/utils/gtf/gtf.c: In function ‘print_fb_mode’:
../hw/xfree86/utils/gtf/gtf.c:241:50: warning: cast from function call of type ‘double’ to non-matching type ‘int’ [-Wbad-function-cast]
     printf("    timings %d %d %d %d %d %d %d\n", (int) rint(1000000.0 / m->pclk),       /* pixclock in picoseconds */

That's pretty nitpicky of you, gcc, but at least it's easy to fix.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/utils/gtf/gtf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/utils/gtf/gtf.c b/hw/xfree86/utils/gtf/gtf.c
index c31bc8f938..818ee0fd7a 100644
--- a/hw/xfree86/utils/gtf/gtf.c
+++ b/hw/xfree86/utils/gtf/gtf.c
@@ -238,7 +238,7 @@ print_fb_mode(mode * m)
     printf("    # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n",
            m->pclk, m->h_freq, m->v_freq);
     printf("    geometry %d %d %d %d 32\n", m->hr, m->vr, m->hr, m->vr);
-    printf("    timings %d %d %d %d %d %d %d\n", (int) rint(1000000.0 / m->pclk),       /* pixclock in picoseconds */
+    printf("    timings %d %d %d %d %d %d %d\n", (int)lrint(1000000.0 / m->pclk),       /* pixclock in picoseconds */
            m->hfl - m->hse,     /* left margin (in pixels) */
            m->hss - m->hr,      /* right margin (in pixels) */
            m->vfl - m->vse,     /* upper margin (in pixel lines) */
-- 
2.16.2



More information about the xorg-devel mailing list