evdev: fix integer division problem by casting one of two integers as double
authorSung-Jin Park <sj76.park@samsung.com>
Mon, 13 Nov 2017 06:39:40 +0000 (15:39 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 4 Dec 2023 10:24:41 +0000 (19:24 +0900)
Change-Id: Ice7caf41c4834b625825335c37e14266c31f5cc4
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/evdev.h

index bf15ea008088aabc6657cb2d8e68d167ea6f62ea..23ff12c79b35b8685dd32475a0860a4562468e74 100644 (file)
@@ -915,8 +915,8 @@ evdev_device_unit_delta_to_mm(const struct evdev_device* device,
        absx = device->abs.absinfo_x;
        absy = device->abs.absinfo_y;
 
-       mm.x = 1.0 * units->x/absx->resolution;
-       mm.y = 1.0 * units->y/absy->resolution;
+       mm.x = 1.0 * units->x/(double)absx->resolution;
+       mm.y = 1.0 * units->y/(double)absy->resolution;
 
        return mm;
 }
@@ -943,8 +943,8 @@ evdev_device_units_to_mm(const struct evdev_device* device,
        absx = device->abs.absinfo_x;
        absy = device->abs.absinfo_y;
 
-       mm.x = (units->x - absx->minimum)/absx->resolution;
-       mm.y = (units->y - absy->minimum)/absy->resolution;
+       mm.x = (units->x - absx->minimum)/(double)absx->resolution;
+       mm.y = (units->y - absy->minimum)/(double)absy->resolution;
 
        return mm;
 }