Add Initialization of variable
authordyamy-lee <dyamy.lee@samsung.com>
Mon, 26 Apr 2021 05:05:42 +0000 (14:05 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Feb 2025 10:03:45 +0000 (19:03 +0900)
Add initialization for uninitialized pointer field.
Add initialization for uninitialized value of struct field.

Change-Id: I2faf84800bf54abdff4f18a1d920b1a162a07ad0

haltests/test_hal_libinput.h
haltests/test_hal_libinput_info.cpp

index 8e365c3103889a3061ad972a1160d7adb171fa95..cb19a33066858f28ced46c84027eb5eb171cce20 100644 (file)
@@ -22,8 +22,8 @@ class LibInputHalTest : public ::testing::Test
                void SetUp(void);
                void TearDown(void);
 
-               struct libinput *li;
-               struct udev *udev_context;
+               struct libinput *li = NULL;
+               struct udev *udev_context = NULL;
 };
 
 #endif // __LIBINPUT_TESTS_H__
index ce0fa1c581e1674891f1dd6e59566f5c992fe248..b39f3dc624b8bb6da4ee608e393a8ffb9fd082c6 100644 (file)
@@ -438,6 +438,8 @@ int create_mouse_event(struct libinput *li, int idx)
                {LIBINPUT_EVENT_POINTER_MOTION, 0, 120, 120, 2},
                {LIBINPUT_EVENT_POINTER_BUTTON, (int) BTN_LEFT, 200, 200, 0}
        };
+       struct record_libinput_event_keyboard k = {LIBINPUT_EVENT_NONE, 0, 0};
+       struct record_libinput_event_touch t = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
 
        if(devices[idx].cap == LIBINPUT_DEVICE_CAP_POINTER){
                LOG("create_mouse_event\n");
@@ -452,6 +454,8 @@ int create_mouse_event(struct libinput *li, int idx)
                for(int i=0; i<n; ++i)
                {
                        rc_e.p = p[i];
+                       rc_e.k = k;
+                       rc_e.t = t;
 
                        if(input_mouse_event_gen(fd, p[i].button, p[i].x, p[i].y, p[i].state) < 0) {
                                LOG("No device\n");
@@ -481,6 +485,8 @@ int create_keyboard_event(struct libinput *li, int idx)
                {LIBINPUT_EVENT_KEYBOARD_KEY, KEY_A, 1},  // keycode KEY_A, press
                {LIBINPUT_EVENT_KEYBOARD_KEY, KEY_A, 0},   // keycode KEY_A, release
        };
+       struct record_libinput_event_pointer p = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
+       struct record_libinput_event_touch t = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
 
        if(devices[idx].cap == LIBINPUT_DEVICE_CAP_KEYBOARD){
                LOG("create_keyboard_event\n");
@@ -495,6 +501,8 @@ int create_keyboard_event(struct libinput *li, int idx)
                for(int i=0; i<n; ++i)
                {
                        rc_e.k = k[i];
+                       rc_e.p = p;
+                       rc_e.t = t;
 
                        if(input_keyboard_event_gen(fd, k[i].key, k[i].state) < 0) {
                                LOG("No device\n");
@@ -554,6 +562,8 @@ int create_touch_event(struct libinput *li, int idx)
                {LIBINPUT_EVENT_TOUCH_MOTION, 1, 120, 150, 2},
                {LIBINPUT_EVENT_TOUCH_UP, 1, 120, 150, 0},
        };
+       struct record_libinput_event_pointer p = {LIBINPUT_EVENT_NONE, 0, 0, 0, 0};
+       struct record_libinput_event_keyboard k = {LIBINPUT_EVENT_NONE, 0, 0};
 
        if(devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH){
                LOG("create_touch_event\n");
@@ -568,6 +578,8 @@ int create_touch_event(struct libinput *li, int idx)
                for(int i=0; i<n; ++i)
                {
                        rc_e.t = t[i];
+                       rc_e.p = p;
+                       rc_e.k = k;
 
                        if(input_touch_event_gen(fd, t[i].idx, t[i].x, t[i].y, t[i].state) < 0) {
                                LOG("No device\n");