Fix uninitialized scalar variable warnings

This commit is contained in:
twinaphex 2016-06-03 04:02:27 +02:00
parent ff8d00e12b
commit 21bc56aa04
1 changed files with 35 additions and 32 deletions

View File

@ -110,9 +110,9 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
if (settings) if (settings)
{ {
char display_name[PATH_MAX_LENGTH]; char display_name[PATH_MAX_LENGTH] = {0};
char core_path[PATH_MAX_LENGTH] = {0}; char core_path[PATH_MAX_LENGTH] = {0};
char *last = NULL; char *last = NULL;
fill_pathname_join( fill_pathname_join(
core_path, core_path,
@ -214,8 +214,8 @@ static void print_buf_lines_extended(file_list_t *list, char *buf, int buf_size,
if (settings) if (settings)
{ {
char core_path[PATH_MAX_LENGTH] = {0}; char core_path[PATH_MAX_LENGTH] = {0};
char display_name[PATH_MAX_LENGTH]; char display_name[PATH_MAX_LENGTH] = {0};
char *last = NULL; char *last = NULL;
fill_pathname_join( fill_pathname_join(
core_path, core_path,
@ -278,7 +278,7 @@ static void menu_displaylist_push_perfcounter(
static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
{ {
unsigned i; unsigned i;
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
core_info_t *core_info = NULL; core_info_t *core_info = NULL;
@ -458,13 +458,11 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
{ {
char tmp[PATH_MAX_LENGTH]; bool ret = false;
char tmp[PATH_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
bool ret;
menu_entries_add(info->list, "Directory Tests:", "", menu_entries_add(info->list, "Directory Tests:", "",
MENU_SETTINGS_CORE_INFO_NONE, 0, 0); MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
@ -569,7 +567,7 @@ static int menu_displaylist_parse_debug_info(menu_displaylist_info_t *info)
static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info)
{ {
unsigned k = 0; unsigned k = 0;
net_ifinfo_t *list = net_ifinfo_t *list =
(net_ifinfo_t*)calloc(1, sizeof(*list)); (net_ifinfo_t*)calloc(1, sizeof(*list));
if (!list) if (!list)
@ -580,7 +578,7 @@ static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info)
for (k = 0; k < list->size; k++) for (k = 0; k < list->size; k++)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
snprintf(tmp, sizeof(tmp), "Interface (%s) : %s\n", snprintf(tmp, sizeof(tmp), "Interface (%s) : %s\n",
list->entries[k].name, list->entries[k].host); list->entries[k].name, list->entries[k].host);
menu_entries_add(info->list, tmp, "", menu_entries_add(info->list, tmp, "",
@ -599,7 +597,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
#if defined(HAVE_OPENGL) || defined(HAVE_GLES) #if defined(HAVE_OPENGL) || defined(HAVE_GLES)
gfx_ctx_ident_t ident_info; gfx_ctx_ident_t ident_info;
#endif #endif
char tmp[PATH_MAX_LENGTH], feat_str[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
char feat_str[PATH_MAX_LENGTH] = {0};
const char *tmp_string = NULL; const char *tmp_string = NULL;
const frontend_ctx_driver_t *frontend = frontend_get_ptr(); const frontend_ctx_driver_t *frontend = frontend_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -633,7 +632,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
#endif #endif
{ {
char cpu_str[PATH_MAX_LENGTH]; char cpu_str[PATH_MAX_LENGTH] = {0};
strlcpy(cpu_str, strlcpy(cpu_str,
menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES), menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES),
@ -647,9 +646,9 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
} }
{ {
char cpu_str[PATH_MAX_LENGTH]; char cpu_str[PATH_MAX_LENGTH] = {0};
char cpu_arch_str[PATH_MAX_LENGTH]; char cpu_arch_str[PATH_MAX_LENGTH] = {0};
char cpu_text_str[PATH_MAX_LENGTH]; char cpu_text_str[PATH_MAX_LENGTH] = {0};
enum frontend_architecture arch = frontend_driver_get_cpu_architecture(); enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
strlcpy(cpu_text_str, "CPU Architecture: ", sizeof(cpu_text_str)); strlcpy(cpu_text_str, "CPU Architecture: ", sizeof(cpu_text_str));
@ -689,8 +688,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
} }
{ {
char cpu_str[PATH_MAX_LENGTH]; char cpu_str[PATH_MAX_LENGTH] = {0};
unsigned amount_cores = cpu_features_get_core_amount(); unsigned amount_cores = cpu_features_get_core_amount();
snprintf(cpu_str, sizeof(cpu_str), "CPU Cores: %d\n", amount_cores); snprintf(cpu_str, sizeof(cpu_str), "CPU Cores: %d\n", amount_cores);
menu_entries_add(info->list, cpu_str, "", menu_entries_add(info->list, cpu_str, "",
@ -717,8 +716,9 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
if (frontend) if (frontend)
{ {
char tmp2[PATH_MAX_LENGTH]; char tmp2[PATH_MAX_LENGTH] = {0};
int major = 0, minor = 0; int major = 0;
int minor = 0;
strlcpy(tmp, strlcpy(tmp,
menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER), menu_hash_to_str(MENU_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER),
@ -1470,7 +1470,8 @@ static int menu_displaylist_parse_shader_options(menu_displaylist_info_t *info)
for (i = 0; i < shader->passes; i++) for (i = 0; i < shader->passes; i++)
{ {
char buf_tmp[64], buf[64]; char buf_tmp[64] = {0};
char buf[64] = {0};
snprintf(buf_tmp, sizeof(buf_tmp), snprintf(buf_tmp, sizeof(buf_tmp),
"%s #%u", menu_hash_to_str(MENU_VALUE_SHADER), i); "%s #%u", menu_hash_to_str(MENU_VALUE_SHADER), i);
@ -1499,7 +1500,7 @@ static int create_string_list_rdb_entry_string(
const char *actual_string, const char *path, const char *actual_string, const char *path,
file_list_t *list) file_list_t *list)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
union string_list_elem_attr attr = {0}; union string_list_elem_attr attr = {0};
char *output_label = NULL; char *output_label = NULL;
int str_len = 0; int str_len = 0;
@ -1544,7 +1545,7 @@ static int create_string_list_rdb_entry_int(
const char *desc, const char *label, const char *desc, const char *label,
int actual_int, const char *path, file_list_t *list) int actual_int, const char *path, file_list_t *list)
{ {
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH] = {0};
union string_list_elem_attr attr = {0}; union string_list_elem_attr attr = {0};
char str[PATH_MAX_LENGTH] = {0}; char str[PATH_MAX_LENGTH] = {0};
char *output_label = NULL; char *output_label = NULL;
@ -2605,7 +2606,8 @@ static int menu_displaylist_parse_options_remappings(
for (p = 0; p < settings->input.max_users; p++) for (p = 0; p < settings->input.max_users; p++)
{ {
char key_type[PATH_MAX_LENGTH], key_analog[PATH_MAX_LENGTH]; char key_type[PATH_MAX_LENGTH] = {0};
char key_analog[PATH_MAX_LENGTH] = {0};
snprintf(key_type, sizeof(key_type), snprintf(key_type, sizeof(key_type),
"input_libretro_device_p%u", p + 1); "input_libretro_device_p%u", p + 1);
snprintf(key_analog, sizeof(key_analog), snprintf(key_analog, sizeof(key_analog),
@ -2826,7 +2828,7 @@ static int menu_displaylist_parse_generic(
#ifndef HAVE_DYNAMIC #ifndef HAVE_DYNAMIC
if (frontend_driver_has_fork()) if (frontend_driver_has_fork())
{ {
char salamander_name[PATH_MAX_LENGTH]; char salamander_name[PATH_MAX_LENGTH] = {0};
if (frontend_driver_get_salamander_basename( if (frontend_driver_get_salamander_basename(
salamander_name, sizeof(salamander_name))) salamander_name, sizeof(salamander_name)))
@ -2906,7 +2908,8 @@ static int menu_displaylist_parse_generic(
for (i = 0; i < list_size; i++) for (i = 0; i < list_size; i++)
{ {
char core_path[PATH_MAX_LENGTH], display_name[PATH_MAX_LENGTH]; char core_path[PATH_MAX_LENGTH] = {0};
char display_name[PATH_MAX_LENGTH] = {0};
unsigned type = 0; unsigned type = 0;
const char *path = NULL; const char *path = NULL;
@ -2934,7 +2937,7 @@ static int menu_displaylist_parse_generic(
bool menu_playlist_find_associated_core(const char *path, char *s, size_t len) bool menu_playlist_find_associated_core(const char *path, char *s, size_t len)
{ {
unsigned j; unsigned j;
bool ret = false; bool ret = false;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
struct string_list *existing_core_names = struct string_list *existing_core_names =
string_split(settings->playlist_names, ";"); string_split(settings->playlist_names, ";");
@ -3317,7 +3320,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
break; break;
case DISPLAYLIST_USER_BINDS_LIST: case DISPLAYLIST_USER_BINDS_LIST:
{ {
char lbl[PATH_MAX_LENGTH]; char lbl[PATH_MAX_LENGTH] = {0};
snprintf(lbl, sizeof(lbl), snprintf(lbl, sizeof(lbl),
"Input User %.1s Binds", info->path); "Input User %.1s Binds", info->path);
ret = menu_displaylist_parse_settings(menu, info, ret = menu_displaylist_parse_settings(menu, info,
@ -3553,7 +3556,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
unsigned user; unsigned user;
for (user = 0; user < settings->input.max_users; user++) for (user = 0; user < settings->input.max_users; user++)
{ {
char binds_list[PATH_MAX_LENGTH]; char binds_list[PATH_MAX_LENGTH] = {0};
snprintf(binds_list, sizeof(binds_list), "%d_input_binds_list", user + 1); snprintf(binds_list, sizeof(binds_list), "%d_input_binds_list", user + 1);
menu_displaylist_parse_settings(menu, info, menu_displaylist_parse_settings(menu, info,
binds_list, PARSE_ACTION, false); binds_list, PARSE_ACTION, false);
@ -3854,8 +3857,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
break; break;
case DISPLAYLIST_HISTORY: case DISPLAYLIST_HISTORY:
{ {
char path_playlist[PATH_MAX_LENGTH]; char path_playlist[PATH_MAX_LENGTH] = {0};
playlist_t *playlist = g_defaults.history; playlist_t *playlist = g_defaults.history;
if (!playlist) if (!playlist)
command_event(CMD_EVENT_HISTORY_INIT, NULL); command_event(CMD_EVENT_HISTORY_INIT, NULL);
@ -4071,7 +4074,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
break; break;
case DISPLAYLIST_CORES: case DISPLAYLIST_CORES:
{ {
char ext_name[PATH_MAX_LENGTH]; char ext_name[PATH_MAX_LENGTH] = {0};
info->type_default = MENU_FILE_PLAIN; info->type_default = MENU_FILE_PLAIN;
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))