summaryrefslogtreecommitdiff
path: root/src/lib/elput
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-12-14 09:14:50 -0500
committerChris Michael <cp.michael@samsung.com>2016-12-14 09:18:14 -0500
commit6ff374256c0e603be9c18fe52652c99865cd950d (patch)
treebe0561db8b1d04c6f25dd53bbf687886e13cd8bd /src/lib/elput
parentb27ebc6294af07c6a95eefdc8a910973a14fcdc1 (diff)
elput: Properly check return values from libinput config functions
As libinput_config_status may contain 3 possible return values, we need to santize the return values there into Eina_Bool for use in our own functions. Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r--src/lib/elput/elput_touch.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/elput/elput_touch.c b/src/lib/elput/elput_touch.c
index f761ca56bf..dca8d9fcfc 100644
--- a/src/lib/elput/elput_touch.c
+++ b/src/lib/elput/elput_touch.c
@@ -1,9 +1,17 @@
1#include "elput_private.h" 1#include "elput_private.h"
2 2
3static inline Eina_Bool
4_check_status(int ret)
5{
6 if (ret == LIBINPUT_CONFIG_STATUS_SUCCESS)
7 return EINA_TRUE;
8 return EINA_FALSE;
9}
10
3EAPI Eina_Bool 11EAPI Eina_Bool
4elput_touch_drag_enabled_set(Elput_Device *device, Eina_Bool enabled) 12elput_touch_drag_enabled_set(Elput_Device *device, Eina_Bool enabled)
5{ 13{
6 Eina_Bool ret = EINA_FALSE; 14 int ret = -1;
7 15
8 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); 16 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
9 17
@@ -20,7 +28,7 @@ elput_touch_drag_enabled_set(Elput_Device *device, Eina_Bool enabled)
20 LIBINPUT_CONFIG_DRAG_DISABLED); 28 LIBINPUT_CONFIG_DRAG_DISABLED);
21 } 29 }
22 30
23 return ret; 31 return _check_status(ret);
24} 32}
25 33
26EAPI Eina_Bool 34EAPI Eina_Bool
@@ -34,7 +42,7 @@ elput_touch_drag_enabled_get(Elput_Device *device)
34EAPI Eina_Bool 42EAPI Eina_Bool
35elput_touch_drag_lock_enabled_set(Elput_Device *device, Eina_Bool enabled) 43elput_touch_drag_lock_enabled_set(Elput_Device *device, Eina_Bool enabled)
36{ 44{
37 Eina_Bool ret = EINA_FALSE; 45 int ret = -1;
38 46
39 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); 47 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
40 48
@@ -51,7 +59,7 @@ elput_touch_drag_lock_enabled_set(Elput_Device *device, Eina_Bool enabled)
51 LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); 59 LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
52 } 60 }
53 61
54 return ret; 62 return _check_status(ret);
55} 63}
56 64
57EAPI Eina_Bool 65EAPI Eina_Bool
@@ -65,7 +73,7 @@ elput_touch_drag_lock_enabled_get(Elput_Device *device)
65EAPI Eina_Bool 73EAPI Eina_Bool
66elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabled) 74elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabled)
67{ 75{
68 Eina_Bool ret = EINA_FALSE; 76 int ret = -1;
69 77
70 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); 78 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
71 79
@@ -85,7 +93,7 @@ elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabled)
85 LIBINPUT_CONFIG_DWT_DISABLED); 93 LIBINPUT_CONFIG_DWT_DISABLED);
86 } 94 }
87 95
88 return ret; 96 return _check_status(ret);
89} 97}
90 98
91EAPI Eina_Bool 99EAPI Eina_Bool
@@ -142,7 +150,7 @@ elput_touch_click_method_get(Elput_Device *device)
142EAPI Eina_Bool 150EAPI Eina_Bool
143elput_touch_tap_enabled_set(Elput_Device *device, Eina_Bool enabled) 151elput_touch_tap_enabled_set(Elput_Device *device, Eina_Bool enabled)
144{ 152{
145 Eina_Bool ret = EINA_FALSE; 153 int ret = -1;
146 154
147 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); 155 EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
148 156
@@ -159,7 +167,7 @@ elput_touch_tap_enabled_set(Elput_Device *device, Eina_Bool enabled)
159 LIBINPUT_CONFIG_TAP_DISABLED); 167 LIBINPUT_CONFIG_TAP_DISABLED);
160 } 168 }
161 169
162 return ret; 170 return _check_status(ret);
163} 171}
164 172
165EAPI Eina_Bool 173EAPI Eina_Bool