Add float typecasting to prevent the loss of fractional part in division 44/214544/1 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.014549 accepted/tizen/5.5/unified/mobile/hotfix/20201027.081255 accepted/tizen/unified/20190925.033612 submit/tizen/20190924.060448 submit/tizen_5.5/20191031.000001 submit/tizen_5.5_mobile_hotfix/20201026.185101 tizen_5.5.m2_release
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 24 Sep 2019 02:43:49 +0000 (11:43 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 24 Sep 2019 02:43:49 +0000 (11:43 +0900)
Change-Id: I596e67df50c253591bc8365e60623b31ca4c51d1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/device_manager_plugin_emul.c

index ebca0c4..6f0e226 100644 (file)
@@ -374,7 +374,7 @@ int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving)
                        devmgr_log("Can't read max_brightness node[%s]", path);
                        return ret;
                }
-               pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5);
+               pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5);
 
                if (*value > max_brightness - pwr_saving_offset)
                        *value = max_brightness;
@@ -409,7 +409,7 @@ static int OEM_sys_set_backlight_brightness(int index, int value, int power_savi
                        devmgr_log("Can't read max_brightness node[%s]", path);
                        return ret;
                }
-               pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5);
+               pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5);
 
                if (value < pwr_saving_offset)
                        value = 0;