summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-07-06 16:45:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-07-10 10:37:58 +1000
commit7b5ca6204b95b922fb1fd2319552fc3e1aa32782 (patch)
tree93c10baea8a72d2f84e168bbd92372ea11bfe949 /test
parentc196a160c996bf7cd1806508d43d2e33e5fbf15f (diff)
downloadlibinput-7b5ca6204b95b922fb1fd2319552fc3e1aa32782.tar.gz
Fix a few things scan-build complains about
Uninitialized variables, potential NULL dereferences, dead assignments and an unused return value. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/test-keyboard.c6
-rw-r--r--test/test-log.c6
-rw-r--r--test/test-path.c3
-rw-r--r--test/test-tablet.c12
-rw-r--r--test/test-touchpad.c12
5 files changed, 18 insertions, 21 deletions
diff --git a/test/test-keyboard.c b/test/test-keyboard.c
index 23538083..dc2e630e 100644
--- a/test/test-keyboard.c
+++ b/test/test-keyboard.c
@@ -213,9 +213,9 @@ START_TEST(keyboard_key_auto_release)
libinput_dispatch(libinput);
event = libinput_get_event(libinput);
- kevent = litest_is_keyboard_event(event,
- key,
- LIBINPUT_KEY_STATE_PRESSED);
+ litest_is_keyboard_event(event,
+ key,
+ LIBINPUT_KEY_STATE_PRESSED);
libinput_event_destroy(event);
}
diff --git a/test/test-log.c b/test/test-log.c
index c07e6bd5..6b1e3923 100644
--- a/test/test-log.c
+++ b/test/test-log.c
@@ -148,9 +148,13 @@ axisrange_warning_log_handler(struct libinput *libinput,
const char *format,
va_list args)
{
+ const char *substr;
+
axisrange_log_handler_called++;
litest_assert_notnull(format);
- litest_assert_notnull(strstr(format, "is outside expected range"));
+
+ substr = strstr(format, "is outside expected range");
+ litest_assert_notnull(substr);
}
START_TEST(log_axisrange_warning)
diff --git a/test/test-path.c b/test/test-path.c
index 66f41ae0..05fbe6f7 100644
--- a/test/test-path.c
+++ b/test/test-path.c
@@ -650,8 +650,7 @@ START_TEST(path_add_device_suspend_resume)
device = libinput_path_add_device(li,
libevdev_uinput_get_devnode(uinput1));
ck_assert(device != NULL);
- device = libinput_path_add_device(li,
- libevdev_uinput_get_devnode(uinput2));
+ libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput2));
libinput_dispatch(li);
diff --git a/test/test-tablet.c b/test/test-tablet.c
index d61478fc..a9ad9592 100644
--- a/test/test-tablet.c
+++ b/test/test-tablet.c
@@ -907,7 +907,7 @@ START_TEST(proximity_out_clear_buttons)
*/
for (button = BTN_TOUCH + 1; button <= BTN_STYLUS2; button++) {
bool button_released = false;
- uint32_t event_button;
+ uint32_t event_button = 0;
enum libinput_button_state state;
if (!libevdev_has_event_code(dev->evdev, EV_KEY, button))
@@ -1505,8 +1505,6 @@ START_TEST(left_handed)
tablet_event = litest_is_tablet_event(event,
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
- tablet_event = libinput_event_get_tablet_tool_event(event);
-
x = libinput_event_tablet_tool_get_x(tablet_event);
y = libinput_event_tablet_tool_get_y(tablet_event);
@@ -2368,7 +2366,6 @@ START_TEST(tool_capabilities)
event = libinput_get_event(li);
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
tool = libinput_event_tablet_tool_get_tool(t);
- tool = libinput_event_tablet_tool_get_tool(t);
ck_assert(libinput_tablet_tool_has_pressure(tool));
ck_assert(libinput_tablet_tool_has_distance(tool));
@@ -3036,8 +3033,7 @@ START_TEST(tablet_calibration_set_matrix_delta)
libinput_event_destroy(event);
event = libinput_get_event(li);
- tablet_event = litest_is_tablet_event(event,
- LIBINPUT_EVENT_TABLET_TOOL_TIP);
+ litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP);
libinput_event_destroy(event);
litest_tablet_motion(dev, 80, 80, axes);
@@ -3067,8 +3063,7 @@ START_TEST(tablet_calibration_set_matrix_delta)
libinput_event_destroy(event);
event = libinput_get_event(li);
- tablet_event = litest_is_tablet_event(event,
- LIBINPUT_EVENT_TABLET_TOOL_TIP);
+ litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP);
libinput_event_destroy(event);
litest_tablet_motion(dev, 80, 80, axes);
@@ -3434,7 +3429,6 @@ START_TEST(tablet_pressure_range)
event = libinput_get_event(li);
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
p = libinput_event_tablet_tool_get_pressure(tev);
- p = libinput_event_tablet_tool_get_pressure(tev);
ck_assert_double_ge(p, 0.0);
ck_assert_double_le(p, 1.0);
libinput_event_destroy(event);
diff --git a/test/test-touchpad.c b/test/test-touchpad.c
index 01d659e4..33c0d5ba 100644
--- a/test/test-touchpad.c
+++ b/test/test-touchpad.c
@@ -855,9 +855,9 @@ START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll)
libinput_event_destroy(event);
event = libinput_get_event(li);
- ptrev = litest_is_button_event(event,
- BTN_RIGHT,
- LIBINPUT_BUTTON_STATE_PRESSED);
+ litest_is_button_event(event,
+ BTN_RIGHT,
+ LIBINPUT_BUTTON_STATE_PRESSED);
libinput_event_destroy(event);
@@ -905,9 +905,9 @@ START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll)
libinput_event_destroy(event);
event = libinput_get_event(li);
- ptrev = litest_is_button_event(event,
- BTN_LEFT,
- LIBINPUT_BUTTON_STATE_PRESSED);
+ litest_is_button_event(event,
+ BTN_LEFT,
+ LIBINPUT_BUTTON_STATE_PRESSED);
libinput_event_destroy(event);