From: Sung-Jin Park Date: Mon, 13 Nov 2017 06:39:40 +0000 (+0900) Subject: evdev: fix integer division problem by casting one of two integers as double X-Git-Tag: accepted/tizen/unified/20250205.095548~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d769df6d97e9743039bda2f46f5fd1a65bcc6ed6;p=platform%2Fupstream%2Flibinput.git evdev: fix integer division problem by casting one of two integers as double Change-Id: Ice7caf41c4834b625825335c37e14266c31f5cc4 Signed-off-by: Sung-Jin Park --- diff --git a/src/evdev.h b/src/evdev.h index 5228a8d0..3aeae5be 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -912,8 +912,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; } @@ -940,8 +940,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; }