From a4a1e96210c5e76baf0175a86d59006a8587ae4a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 16 Oct 2016 01:40:29 +0200 Subject: [PATCH] Prevent more implicit memsets --- input/drivers/android_input.c | 8 +++++--- input/drivers_joypad/udev_joypad.c | 4 +++- input/drivers_keyboard/keyboard_event_x11.c | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index d3f8e33c63..dd1e7150a2 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -640,14 +640,16 @@ static void handle_hotplug(android_input_data_t *android_data, struct android_app *android_app, int *port, int id, int source) { - char device_name[256] = {0}; - char device_model[256] = {0}; - char name_buf[256] = {0}; + char device_name[256]; + char device_model[256]; + char name_buf[256]; int vendorId = 0; int productId = 0; bool back_mapped = false; settings_t *settings = config_get_ptr(); + device_name[0] = device_model[0] = name_buf[0] = '\0'; + frontend_android_get_name(device_model, sizeof(device_model)); RARCH_LOG("Device model: (%s).\n", device_model); diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c index 96cfcc18ab..cacde5b446 100644 --- a/input/drivers_joypad/udev_joypad.c +++ b/input/drivers_joypad/udev_joypad.c @@ -362,7 +362,9 @@ static void udev_check_device(struct udev_device *dev, const char *path, bool ho default: if (hotplugged) { - char msg[PATH_MAX_LENGTH] = {0}; + char msg[PATH_MAX_LENGTH]; + + msg[0] = '\0'; snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", pad, path); runloop_msg_queue_push(msg, 0, 60, false); diff --git a/input/drivers_keyboard/keyboard_event_x11.c b/input/drivers_keyboard/keyboard_event_x11.c index d632b6d4e8..833db24d48 100644 --- a/input/drivers_keyboard/keyboard_event_x11.c +++ b/input/drivers_keyboard/keyboard_event_x11.c @@ -39,15 +39,19 @@ void x11_handle_key_event(XEvent *event, XIC ic, bool filter) int i; unsigned state, key; uint16_t mod = 0; - uint32_t chars[32] = {0}; + uint32_t chars[32]; bool down = event->type == KeyPress; int num = 0; KeySym keysym = 0; + + chars[0] = '\0'; if (down && !filter) { - char keybuf[32] = {0}; + char keybuf[32]; + + keybuf[0] = '\0'; #ifdef X_HAVE_UTF8_STRING Status status = 0;