From 6b1f9e092a2312710df0a129a251168b3cd6ee3e Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Fri, 26 Apr 2019 14:34:05 +0900 Subject: [PATCH] Fix misused function of g_timeout_add_seconds Input value of g_timeout_add_seconds() should be integer. But the input is float in some cases. So, change g_timeout_add_seconds to g_timeout_add on this cases. Change-Id: I95b843b46e13c078398f39bac374f7faa5d03917 Signed-off-by: lokilee73 --- plugins/iot/display/auto-brightness.c | 4 ++-- plugins/iot/display/core.c | 4 ++-- plugins/mobile/display/auto-brightness.c | 4 ++-- plugins/mobile/display/core.c | 4 ++-- plugins/tv/display/auto-brightness.c | 4 ++-- plugins/tv/display/core.c | 4 ++-- plugins/wearable/display/auto-brightness.c | 4 ++-- plugins/wearable/display/core.c | 4 ++-- src/led/touch-key.c | 14 +++++++++----- 9 files changed, 25 insertions(+), 21 deletions(-) mode change 100755 => 100644 plugins/iot/display/auto-brightness.c mode change 100755 => 100644 plugins/iot/display/core.c mode change 100755 => 100644 plugins/mobile/display/auto-brightness.c mode change 100755 => 100644 plugins/mobile/display/core.c mode change 100755 => 100644 plugins/tv/display/auto-brightness.c mode change 100755 => 100644 plugins/tv/display/core.c mode change 100755 => 100644 plugins/wearable/display/auto-brightness.c mode change 100755 => 100644 plugins/wearable/display/core.c diff --git a/plugins/iot/display/auto-brightness.c b/plugins/iot/display/auto-brightness.c old mode 100755 new mode 100644 index d49c463..88ff66a --- a/plugins/iot/display/auto-brightness.c +++ b/plugins/iot/display/auto-brightness.c @@ -47,7 +47,7 @@ #define MAX_FAULT 5 #define DEFAULT_AUTOMATIC_BRT 5 #define AUTOMATIC_DEVIDE_VAL 10 -#define AUTOMATIC_DELAY_TIME 0.5 /* 0.5 sec */ +#define AUTOMATIC_DELAY_TIME 500 /* 0.5 sec */ #define RADIAN_VALUE (57.2957) #define ROTATION_90 90 @@ -513,7 +513,7 @@ static void update_auto_brightness(bool update) } if (update) { - update_timeout = g_timeout_add_seconds(AUTOMATIC_DELAY_TIME, + update_timeout = g_timeout_add(AUTOMATIC_DELAY_TIME, update_handler, NULL); } } diff --git a/plugins/iot/display/core.c b/plugins/iot/display/core.c old mode 100755 new mode 100644 index dcddfc6..6333b08 --- a/plugins/iot/display/core.c +++ b/plugins/iot/display/core.c @@ -174,7 +174,7 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = { #define ACTIVE_ACT "active" #define INACTIVE_ACT "inactive" -#define LOCK_SCREEN_WATING_TIME 0.3 /* 0.3 second */ +#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ #define LONG_PRESS_INTERVAL 2 /* 2 seconds */ #define SAMPLING_INTERVAL 1 /* 1 sec */ #define BRIGHTNESS_CHANGE_STEP 10 @@ -1498,7 +1498,7 @@ static void check_lock_screen(void) } /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add_seconds(display_conf.lock_wait_time, + lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, lcd_on_expired, NULL); return; diff --git a/plugins/mobile/display/auto-brightness.c b/plugins/mobile/display/auto-brightness.c old mode 100755 new mode 100644 index 73597f1..a9d4100 --- a/plugins/mobile/display/auto-brightness.c +++ b/plugins/mobile/display/auto-brightness.c @@ -47,7 +47,7 @@ #define MAX_FAULT 5 #define DEFAULT_AUTOMATIC_BRT 5 #define AUTOMATIC_DEVIDE_VAL 10 -#define AUTOMATIC_DELAY_TIME 0.5 /* 0.5 sec */ +#define AUTOMATIC_DELAY_TIME 500 /* 0.5 sec */ #define RADIAN_VALUE (57.2957) #define ROTATION_90 90 @@ -513,7 +513,7 @@ static void update_auto_brightness(bool update) } if (update) { - update_timeout = g_timeout_add_seconds(AUTOMATIC_DELAY_TIME, + update_timeout = g_timeout_add(AUTOMATIC_DELAY_TIME, update_handler, NULL); } } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c old mode 100755 new mode 100644 index dcddfc6..6333b08 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -174,7 +174,7 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = { #define ACTIVE_ACT "active" #define INACTIVE_ACT "inactive" -#define LOCK_SCREEN_WATING_TIME 0.3 /* 0.3 second */ +#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ #define LONG_PRESS_INTERVAL 2 /* 2 seconds */ #define SAMPLING_INTERVAL 1 /* 1 sec */ #define BRIGHTNESS_CHANGE_STEP 10 @@ -1498,7 +1498,7 @@ static void check_lock_screen(void) } /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add_seconds(display_conf.lock_wait_time, + lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, lcd_on_expired, NULL); return; diff --git a/plugins/tv/display/auto-brightness.c b/plugins/tv/display/auto-brightness.c old mode 100755 new mode 100644 index c32306f..ed957cd --- a/plugins/tv/display/auto-brightness.c +++ b/plugins/tv/display/auto-brightness.c @@ -47,7 +47,7 @@ #define MAX_FAULT 5 #define DEFAULT_AUTOMATIC_BRT 5 #define AUTOMATIC_DEVIDE_VAL 10 -#define AUTOMATIC_DELAY_TIME 0.5 /* 0.5 sec */ +#define AUTOMATIC_DELAY_TIME 500 /* 0.5 sec */ #define RADIAN_VALUE (57.2957) #define ROTATION_90 90 @@ -513,7 +513,7 @@ static void update_auto_brightness(bool update) } if (update) { - update_timeout = g_timeout_add_seconds(AUTOMATIC_DELAY_TIME, + update_timeout = g_timeout_add(AUTOMATIC_DELAY_TIME, update_handler, NULL); } } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c old mode 100755 new mode 100644 index 869b398..4a6d3ce --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -176,7 +176,7 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = { #define ACTIVE_ACT "active" #define INACTIVE_ACT "inactive" -#define LOCK_SCREEN_WATING_TIME 0.3 /* 0.3 second */ +#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ #define LONG_PRESS_INTERVAL 2 /* 2 seconds */ #define SAMPLING_INTERVAL 1 /* 1 sec */ #define BRIGHTNESS_CHANGE_STEP 10 @@ -1499,7 +1499,7 @@ static void check_lock_screen(void) } /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add_seconds(display_conf.lock_wait_time, + lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, lcd_on_expired, NULL); return; diff --git a/plugins/wearable/display/auto-brightness.c b/plugins/wearable/display/auto-brightness.c old mode 100755 new mode 100644 index d85fd8c..efc415c --- a/plugins/wearable/display/auto-brightness.c +++ b/plugins/wearable/display/auto-brightness.c @@ -47,7 +47,7 @@ #define MAX_FAULT 5 #define DEFAULT_AUTOMATIC_BRT 5 #define AUTOMATIC_DEVIDE_VAL 10 -#define AUTOMATIC_DELAY_TIME 0.5 /* 0.5 sec */ +#define AUTOMATIC_DELAY_TIME 500 /* 0.5 sec */ #define RADIAN_VALUE (57.2957) #define ROTATION_90 90 @@ -513,7 +513,7 @@ static void update_auto_brightness(bool update) } if (update) { - update_timeout = g_timeout_add_seconds(AUTOMATIC_DELAY_TIME, + update_timeout = g_timeout_add(AUTOMATIC_DELAY_TIME, update_handler, NULL); } } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c old mode 100755 new mode 100644 index c446ac8..211ea08 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -174,7 +174,7 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = { #define ACTIVE_ACT "active" #define INACTIVE_ACT "inactive" -#define LOCK_SCREEN_WATING_TIME 0.3 /* 0.3 second */ +#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ #define LONG_PRESS_INTERVAL 2 /* 2 seconds */ #define SAMPLING_INTERVAL 1 /* 1 sec */ #define BRIGHTNESS_CHANGE_STEP 10 @@ -1497,7 +1497,7 @@ static void check_lock_screen(void) } /* Use time to check lock is done. */ - lock_timeout_id = g_timeout_add_seconds(display_conf.lock_wait_time, + lock_timeout_id = g_timeout_add(display_conf.lock_wait_time, lcd_on_expired, NULL); return; diff --git a/src/led/touch-key.c b/src/led/touch-key.c index 7b18984..2852ac2 100644 --- a/src/led/touch-key.c +++ b/src/led/touch-key.c @@ -102,6 +102,7 @@ static void process_touchkey_press(void) static void process_touchkey_release(void) { float fduration; + int duration; /* release existing timer */ if (hardkey_timeout_id > 0) { @@ -114,8 +115,9 @@ static void process_touchkey_release(void) return; /* start timer */ fduration = (float)hardkey_duration / KEYBACKLIGHT_BASE_TIME; - hardkey_timeout_id = g_timeout_add_seconds( - fduration, + duration = (int)(fduration * 1000); + hardkey_timeout_id = g_timeout_add( + duration, key_backlight_expired, NULL); } @@ -156,7 +158,8 @@ static void process_touchkey_enable(bool enable) static void hardkey_duration_cb(keynode_t *key, void *data) { - float duration; + float fduration; + int duration; hardkey_duration = vconf_keynode_get_int(key); @@ -181,8 +184,9 @@ static void hardkey_duration_cb(keynode_t *key, void *data) return; /* start timer */ - duration = (float)hardkey_duration / KEYBACKLIGHT_BASE_TIME; - hardkey_timeout_id = g_timeout_add_seconds( + fduration = (float)hardkey_duration / KEYBACKLIGHT_BASE_TIME; + duration = (int)(fduration * 1000); + hardkey_timeout_id = g_timeout_add( duration, key_backlight_expired, NULL); } -- 2.7.4