Commit 7b5ca620 authored by Peter Hutterer's avatar Peter Hutterer

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's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent c196a160
......@@ -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);
}
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -491,10 +491,11 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv)
setup_path();
rc = execvp(executable, argv);
fprintf(stderr,
"Failed to execute '%s' (%s)\n",
command,
strerror(errno));
if (rc)
fprintf(stderr,
"Failed to execute '%s' (%s)\n",
command,
strerror(errno));
return EXIT_FAILURE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment