From 78cb65a6a4368e725da8140f33f2186757dafee8 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 14 Jan 2021 01:58:29 -0500 Subject: [PATCH] [client] spice: correctly use fabs for floating point The prototype for abs is int abs (int n), which implicitly casts floating point values to integers. The correct function is fabs. This commit allows the client to compile under clang. --- client/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 557183bb..458051ac 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1010,7 +1010,7 @@ void handleMouseNormal(double ex, double ey) /* if we are in "autoCapture" and the delta was large don't test for exit */ if (params.autoCapture && - (abs(ex) > 100.0 / g_cursor.scale.x || abs(ey) > 100.0 / g_cursor.scale.y)) + (fabs(ex) > 100.0 / g_cursor.scale.x || fabs(ey) > 100.0 / g_cursor.scale.y)) testExit = false; /* translate the guests position to our coordinate space */ @@ -1067,7 +1067,7 @@ void handleMouseNormal(double ex, double ey) g_cursor.delta.x += x; g_cursor.delta.y += y; - if (abs(g_cursor.delta.x) > 50 || abs(g_cursor.delta.y) > 50) + if (fabs(g_cursor.delta.x) > 50 || fabs(g_cursor.delta.y) > 50) { g_cursor.delta.x = 0; g_cursor.delta.y = 0;