From 2b9a2692e8e2f3ed60fdf1e111ea5ffe1dfe0dcf Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Wed, 30 Aug 2017 11:40:26 -0700 Subject: [PATCH] evas font: do floating point division for calculating more accurately Summary: Assigning a result of integral division to a double type variable is not useful for next division calculation. For more accurate calculation, it needs to be casted to double before doing division. It does not fix some bugs. It was reported by a code quality advisor. Test Plan: N/A Reviewers: raster, cedric, jpeg, herdsman, eunue Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D5069 Signed-off-by: Cedric Bail --- src/lib/evas/common/evas_font_query.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/common/evas_font_query.c b/src/lib/evas/common/evas_font_query.c index c52486b..081f9a5 100644 --- a/src/lib/evas/common/evas_font_query.c +++ b/src/lib/evas/common/evas_font_query.c @@ -755,13 +755,13 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Evas_Text_Props *text if (text_props->bidi_dir == EVAS_BIDI_DIRECTION_LTR) { double part; - part = cluster_adv / items; + part = (double) cluster_adv / items; item_pos = (int) ((x - cluster_start) / part); } else { double part; - part = cluster_adv / items; + part = (double) cluster_adv / items; item_pos = items - ((int) ((x - cluster_start) / part)) - 1; } -- 2.7.4