(Input) Cleanups

This commit is contained in:
twinaphex 2015-06-13 00:02:28 +02:00
parent f85965925c
commit daf4f5719b
6 changed files with 27 additions and 24 deletions

View File

@ -165,7 +165,7 @@ static bool android_input_lookup_name_prekitkat(char *buf,
jmethodID method, getName;
jobject device, name;
const char *str = NULL;
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
if (!env)
goto error;
@ -225,7 +225,7 @@ static bool android_input_lookup_name(char *buf,
jmethodID method, getName, getVendorId, getProductId;
jobject device, name;
const char *str = NULL;
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
JNIEnv *env = (JNIEnv*)jni_thread_getenv();
if (!env)
goto error;
@ -566,11 +566,12 @@ static void handle_hotplug(android_input_t *android,
struct android_app *android_app, unsigned *port, unsigned id,
int source)
{
char device_name[256], name_buf[256];
char device_name[256] = {0};
char name_buf[256] = {0};
autoconfig_params_t params = {{0}};
name_buf[0] = device_name[0] = 0;
int vendorId = 0, productId = 0;
autoconfig_params_t params = {{0}};
settings_t *settings = config_get_ptr();
int vendorId = 0, productId = 0;
settings_t *settings = config_get_ptr();
if (!settings->input.autodetect_enable)
return;

View File

@ -166,7 +166,7 @@ static void qnx_process_gamepad_event(
static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
qnx_input_device_t* controller, int port)
{
char name_buf[256];
char name_buf[256] = {0};
settings_t *settings = config_get_ptr();
if (!qnx)

View File

@ -139,9 +139,9 @@ static bool guid_is_xinput_device(const GUID* product_guid)
for (i = 0; i < num_raw_devs; i++)
{
RID_DEVICE_INFO rdi;
char devName[128];
UINT rdiSize = sizeof(rdi);
UINT nameSize = sizeof(devName);
char devName[128] = {0};
UINT rdiSize = sizeof(rdi);
UINT nameSize = sizeof(devName);
rdi.cbSize = sizeof (rdi);

View File

@ -95,7 +95,8 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p
if (g_hotplug)
{
char msg[512];
char msg[512] = {0};
snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", (unsigned)(pad - linuxraw_pads), pad->ident);
rarch_main_msg_queue_push(msg, 0, 60, false);
}
@ -166,7 +167,7 @@ static void handle_plugged_pad(void)
else if (event->mask & (IN_CREATE | IN_ATTRIB))
{
bool ret;
char path[PATH_MAX_LENGTH];
char path[PATH_MAX_LENGTH] = {0};
snprintf(path, sizeof(path), "/dev/input/%s", event->name);
ret = linuxraw_joypad_init_pad(path, &linuxraw_pads[idx]);
@ -224,7 +225,7 @@ static bool linuxraw_joypad_init(void *data)
for (i = 0; i < MAX_USERS; i++)
{
char path[PATH_MAX_LENGTH];
char path[PATH_MAX_LENGTH] = {0};
autoconfig_params_t params = {{0}};
struct linuxraw_joypad *pad = (struct linuxraw_joypad*)&linuxraw_pads[i];

View File

@ -226,12 +226,12 @@ static void parport_free_pad(struct parport_joypad *pad)
static bool parport_joypad_init(void *data)
{
unsigned i, j;
bool found_enabled_button;
bool found_disabled_button;
char buf[PARPORT_NUM_BUTTONS * 3 + 1];
char pin[3 + 1];
settings_t *settings = config_get_ptr();
autoconfig_params_t params = {{0}};
bool found_enabled_button = false;
bool found_disabled_button = false;
char buf[PARPORT_NUM_BUTTONS * 3 + 1] = {0};
char pin[3 + 1] = {0};
settings_t *settings = config_get_ptr();
autoconfig_params_t params = {{0}};
(void)data;
@ -239,7 +239,7 @@ static bool parport_joypad_init(void *data)
for (i = 0; i < MAX_USERS; i++)
{
char path[PATH_MAX_LENGTH];
char path[PATH_MAX_LENGTH] = {0};
struct parport_joypad *pad = &parport_pads[i];
pad->fd = -1;
@ -309,7 +309,7 @@ static bool parport_joypad_init(void *data)
static void parport_joypad_destroy(void)
{
unsigned i;
struct parport_joypad *pad;
struct parport_joypad *pad = NULL;
for (i = 0; i < MAX_USERS; i++)
{

View File

@ -204,10 +204,10 @@ error:
static int udev_add_pad(struct udev_device *dev, unsigned p, int fd, const char *path)
{
int ret = 0;
int i;
const char *buf;
struct stat st;
int ret = 0;
const char *buf = NULL;
unsigned buttons = 0;
unsigned axes = 0;
struct udev_device *parent = NULL;
@ -351,7 +351,8 @@ static void udev_check_device(struct udev_device *dev, const char *path, bool ho
default:
if (hotplugged)
{
char msg[PATH_MAX_LENGTH];
char msg[PATH_MAX_LENGTH] = {0};
snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", pad, path);
rarch_main_msg_queue_push(msg, 0, 60, false);
RARCH_LOG("[udev]: %s\n", msg);