Get rid of more implicit memsets

This commit is contained in:
twinaphex 2016-10-26 06:23:05 +02:00
parent 170febb72c
commit 97d80d5e3e
7 changed files with 48 additions and 20 deletions

View File

@ -438,9 +438,11 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch(
{
int ret = -1;
#ifdef HAVE_LIBRETRODB
char query[PATH_MAX_LENGTH] = {0};
char query[PATH_MAX_LENGTH];
struct string_list *str_list = string_split(info->path, "|");
query[0] = '\0';
database_info_build_query(query, sizeof(query),
info->label, str_list->elems[0].data);

View File

@ -83,13 +83,15 @@ size_t core_len;
static void cb_net_generic_subdir(void *task_data, void *user_data, const char *err)
{
char subdir_path[PATH_MAX_LENGTH] = {0};
char subdir_path[PATH_MAX_LENGTH];
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
menu_file_transfer_t *state = (menu_file_transfer_t*)user_data;
if (!data || err)
goto finish;
subdir_path[0] = '\0';
memcpy(subdir_path, data->data, data->len * sizeof(char));
subdir_path[data->len] = '\0';
@ -1902,11 +1904,13 @@ static int action_ok_file_load_ffmpeg(const char *path,
static int action_ok_file_load_imageviewer(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char fullpath[PATH_MAX_LENGTH] = {0};
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
menu_entries_get_last(menu_stack, &menu_path, NULL, NULL, NULL);
fullpath[0] = '\0';
fill_pathname_join(fullpath, menu_path, path,
sizeof(fullpath));
return generic_action_ok_file_load(NULL, fullpath,

View File

@ -314,7 +314,9 @@ static int action_start_video_resolution(unsigned type, const char *label)
if (video_driver_get_video_output_size(&width, &height))
{
char msg[PATH_MAX_LENGTH] = {0};
char msg[PATH_MAX_LENGTH];
msg[0] = '\0';
video_driver_set_video_mode(width, height, true);

View File

@ -316,7 +316,7 @@ static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int
{
menu_animation_ctx_ticker_t ticker;
unsigned ticker_size;
char title_buf[PATH_MAX_LENGTH] = {0};
char title_buf[PATH_MAX_LENGTH];
uint64_t *frame_count = NULL;
unsigned id = zarch_zui_hash(zui, label);
int x2 = x1 + zui->width - 290 - 40;
@ -325,6 +325,8 @@ static bool zarch_zui_list_item(zui_t *zui, struct zui_tabbed *tab, int x1, int
const float *bg = zui_bg_panel;
frame_count = video_driver_get_frame_count_ptr();
title_buf[0] = '\0';
if (tab->active_id != tab->prev_id)
tab->prev_id = tab->active_id;
@ -512,10 +514,12 @@ static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbe
for (i = zui->recent_dlist_first; i < size; ++i)
{
char rich_label[PATH_MAX_LENGTH] = {0};
char entry_value[PATH_MAX_LENGTH] = {0};
char rich_label[PATH_MAX_LENGTH];
char entry_value[PATH_MAX_LENGTH];
menu_entry_t entry = {{0}};
rich_label[0] = entry_value[0] = '\0';
menu_entry_get(&entry, 0, i, NULL, true);
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value));
@ -562,10 +566,12 @@ static void zarch_zui_render_lay_root_load_set_new_path(zui_t *zui,
static int zarch_zui_render_lay_root_load(zui_t *zui,
struct zui_tabbed *tabbed)
{
char parent_dir[PATH_MAX_LENGTH] = {0};
char parent_dir[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
core_info_list_t *list = NULL;
parent_dir[0] = '\0';
if (zarch_zui_tab(zui, tabbed, "Load", 1))
{
unsigned cwd_offset;
@ -626,14 +632,16 @@ static int zarch_zui_render_lay_root_load(zui_t *zui,
for (i = skip + zui->load_dlist_first; i < size; ++i)
{
char label[PATH_MAX_LENGTH] = {0};
char label[PATH_MAX_LENGTH];
const char *path = NULL;
const char *basename = NULL;
if (j > 10)
break;
path = zui->load_dlist->elems[i].data;
label[0] = '\0';
path = zui->load_dlist->elems[i].data;
basename = path_basename(path);
*label = 0;
@ -703,7 +711,7 @@ static int zarch_zui_render_lay_root_downloads(
static int zarch_zui_render_lay_root(zui_t *zui)
{
char item[PATH_MAX_LENGTH] = {0};
char item[PATH_MAX_LENGTH];
static struct zui_tabbed tabbed = {~0U};
zarch_zui_tabbed_begin(zui, &tabbed, 0, 0);
@ -720,8 +728,9 @@ static int zarch_zui_render_lay_root(zui_t *zui)
if (zarch_zui_render_lay_root_downloads(zui, &tabbed))
return 0;
(void)item;
#ifdef ZARCH_DEBUG
item[0] = '\0';
snprintf(item, sizeof(item), "item id: %d\n", zui->active_id);
zarch_zui_draw_text(zui, ZUI_FG_NORMAL, 1600 +12, 300 + 41, item);
snprintf(item, sizeof(item), "tab idx: %d\n", tabbed.active_id);

View File

@ -3061,7 +3061,9 @@ static int menu_displaylist_parse_options_cheats(
for (i = 0; i < cheat_manager_get_size(); i++)
{
char cheat_label[64] = {0};
char cheat_label[64];
cheat_label[0] = '\0';
snprintf(cheat_label, sizeof(cheat_label),
"%s #%u: ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT), i);

View File

@ -1963,12 +1963,14 @@ static bool setting_append_list_input_player_options(
for (i = 0; i < RARCH_BIND_LIST_END; i ++)
{
char label[PATH_MAX_LENGTH] = {0};
char name[PATH_MAX_LENGTH] = {0};
char label[PATH_MAX_LENGTH];
char name[PATH_MAX_LENGTH];
if (input_config_bind_map_get_meta(i))
continue;
label[0] = name[0] = '\0';
fill_pathname_noext(label, buffer[user],
" ",
sizeof(label));
@ -2098,7 +2100,9 @@ static bool setting_append_list(
if (frontend_driver_has_fork())
#endif
{
char ext_name[PATH_MAX_LENGTH] = {0};
char ext_name[PATH_MAX_LENGTH];
ext_name[0] = '\0';
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
{

View File

@ -111,11 +111,13 @@ void menu_shader_manager_init(void)
break;
default:
{
char preset_path[PATH_MAX_LENGTH] = {0};
char preset_path[PATH_MAX_LENGTH];
const char *shader_dir =
*settings->directory.video_shader ?
settings->directory.video_shader : settings->directory.system;
preset_path[0] = '\0';
fill_pathname_join(preset_path, shader_dir,
"menu.glslp", sizeof(preset_path));
conf = config_file_new(preset_path);
@ -214,9 +216,9 @@ bool menu_shader_manager_save_preset(
const char *basename, bool apply, bool fullpath)
{
#ifdef HAVE_SHADER_MANAGER
char buffer[PATH_MAX_LENGTH] = {0};
char config_directory[PATH_MAX_LENGTH] = {0};
char preset_path[PATH_MAX_LENGTH] = {0};
char buffer[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
char preset_path[PATH_MAX_LENGTH];
unsigned d, type = RARCH_SHADER_NONE;
const char *dirs[3] = {0};
config_file_t *conf = NULL;
@ -225,6 +227,9 @@ bool menu_shader_manager_save_preset(
settings_t *settings = config_get_ptr();
menu_handle_t *menu = NULL;
buffer[0] = config_directory[0] = '\0';
preset_path[0] = '\0';
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
{
RARCH_ERR("Cannot save shader preset, menu handle"