[libshumate] map-layer: Fix compiler warnings
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] map-layer: Fix compiler warnings
- Date: Sat, 23 Apr 2022 20:49:21 +0000 (UTC)
commit 74d8564b5e3262240f4a8a192c2b4d9d1ab78279
Author: James Westman <james flyingpimonster net>
Date: Sat Apr 23 15:36:23 2022 -0500
map-layer: Fix compiler warnings
Some compilers helpfully point out that we're passing a float to the integer
abs() function, but in this case we do want to convert to int anyway, so add a
cast.
shumate/shumate-map-layer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/shumate/shumate-map-layer.c b/shumate/shumate-map-layer.c
index 7d906b1..800105d 100644
--- a/shumate/shumate-map-layer.c
+++ b/shumate/shumate-map-layer.c
@@ -219,12 +219,12 @@ recompute_grid (ShumateMapLayer *self)
double rotation = shumate_viewport_get_rotation (viewport);
int size_x = MAX (
- abs (cos (rotation) * width/2.0 - sin (rotation) * height/2.0),
- abs (cos (rotation) * -width/2.0 - sin (rotation) * height/2.0)
+ abs ((int) (cos (rotation) * width/2.0 - sin (rotation) * height/2.0)),
+ abs ((int) (cos (rotation) * -width/2.0 - sin (rotation) * height/2.0))
);
int size_y = MAX (
- abs (sin (rotation) * width/2.0 + cos (rotation) * height/2.0),
- abs (sin (rotation) * -width/2.0 + cos (rotation) * height/2.0)
+ abs ((int) (sin (rotation) * width/2.0 + cos (rotation) * height/2.0)),
+ abs ((int) (sin (rotation) * -width/2.0 + cos (rotation) * height/2.0))
);
// This is the (column, row) of the top left tile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]