1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

Remove some more explicit NULL-termination when we're calling a

string function that calls strlcpy under the hood
This commit is contained in:
libretroadmin 2022-07-19 20:43:12 +02:00
parent a23231525d
commit 4b5c7856e6
7 changed files with 22 additions and 32 deletions

View File

@ -1199,8 +1199,6 @@ bool gfx_display_reset_textures_list(
char texpath[PATH_MAX_LENGTH];
struct texture_image ti;
texpath[0] = '\0';
ti.width = 0;
ti.height = 0;
ti.pixels = NULL;

View File

@ -84,9 +84,6 @@ static void fill_pathname_expanded_and_absolute(char *out_path,
const char *in_refpath, const char *in_path)
{
char expanded_path[PATH_MAX_LENGTH];
expanded_path[0] = '\0';
/* Expand paths which start with :\ to an absolute path */
fill_pathname_expand_special(expanded_path,
in_path, sizeof(expanded_path));
@ -2276,8 +2273,6 @@ void dir_check_shader(
if (shader && !string_is_empty(shader->loaded_preset_path))
{
char last_shader_path[PATH_MAX_LENGTH];
last_shader_path[0] = '\0';
fill_pathname_join(last_shader_path,
last_shader_preset_dir, last_shader_preset_file_name,
sizeof(last_shader_path));
@ -2386,8 +2381,6 @@ bool load_shader_preset(settings_t *settings, const char *core_name,
shader_path[0] = '\0';
content_dir_name[0] = '\0';
config_file_directory[0] = '\0';
old_presets_directory[0] = '\0';
if (has_content)
{
@ -2397,12 +2390,17 @@ bool load_shader_preset(settings_t *settings, const char *core_name,
}
if (!path_is_empty(RARCH_PATH_CONFIG))
fill_pathname_basedir(config_file_directory,
{
strlcpy(config_file_directory,
path_get(RARCH_PATH_CONFIG), sizeof(config_file_directory));
path_basedir(config_file_directory);
}
if (!string_is_empty(video_shader_directory))
fill_pathname_join(old_presets_directory,
video_shader_directory, "presets", sizeof(old_presets_directory));
else
old_presets_directory[0] = '\0';
dirs[0] = menu_config_directory;
dirs[1] = config_file_directory;

View File

@ -399,12 +399,8 @@ void config_file_add_reference(config_file_t *conf, char *path)
{
/* It is expected that the conf has it's path already set */
char short_path[PATH_MAX_LENGTH];
short_path[0] = '\0';
if (!conf->references)
conf->references = path_linked_list_new();
fill_pathname_abbreviated_or_relative(short_path, conf->path, path, sizeof(short_path));
path_linked_list_add_path(conf->references, short_path);
}
@ -540,7 +536,6 @@ static bool config_file_parse_line(config_file_t *conf,
return false;
}
real_path[0] = '\0';
config_file_add_sub_conf(conf, path,
real_path, sizeof(real_path), cb);
@ -1232,8 +1227,6 @@ void config_set_path(config_file_t *conf, const char *entry, const char *val)
config_set_string(conf, entry, val);
#else
char buf[PATH_MAX_LENGTH];
buf[0] = '\0';
fill_pathname_abbreviate_special(buf, val, sizeof(buf));
config_set_string(conf, entry, buf);
#endif

View File

@ -2874,10 +2874,12 @@ bool menu_shader_manager_save_preset(const struct video_shader *shader,
config_directory[0] = '\0';
if (!path_is_empty(RARCH_PATH_CONFIG))
fill_pathname_basedir(
config_directory,
{
strlcpy(config_directory,
path_get(RARCH_PATH_CONFIG),
sizeof(config_directory));
path_basedir(config_directory);
}
preset_dirs[0] = dir_video_shader;
preset_dirs[1] = dir_menu_config;
@ -3889,10 +3891,12 @@ bool menu_shader_manager_operate_auto_preset(
return false;
if (!path_is_empty(RARCH_PATH_CONFIG))
fill_pathname_basedir(
config_directory,
{
strlcpy(config_directory,
path_get(RARCH_PATH_CONFIG),
sizeof(config_directory));
path_basedir(config_directory);
}
/* We are only including this directory for compatibility purposes with
* versions 1.8.7 and older. */

View File

@ -8959,13 +8959,15 @@ static bool setting_append_list_input_player_options(
if (input_config_bind_map_get_meta(i))
continue;
label[0] = name[0] = '\0';
name[0] = '\0';
if (!string_is_empty(buffer[user]))
{
strlcpy(label, buffer[user], sizeof(label));
strlcat(label, " ", sizeof(label));
}
else
label[0] = '\0';
if (
settings->bools.input_descriptor_label_show

View File

@ -1949,12 +1949,11 @@ bool runloop_environment_cb(unsigned cmd, void *data)
if (!string_is_empty(fullpath))
{
char tmp_path[PATH_MAX_LENGTH];
tmp_path[0] = '\0';
if (string_is_empty(dir_system))
RARCH_WARN("[Environ]: SYSTEM DIR is empty, assume CONTENT DIR %s\n",
fullpath);
fill_pathname_basedir(tmp_path, fullpath, sizeof(tmp_path));
strlcpy(tmp_path, fullpath, sizeof(tmp_path));
path_basedir(tmp_path);
dir_set(RARCH_DIR_SYSTEM, tmp_path);
}

View File

@ -330,15 +330,11 @@ static bool screenshot_dump(
if ( string_is_empty(new_screenshot_dir) ||
settings->bools.screenshots_in_content_dir)
{
fill_pathname_basedir(new_screenshot_dir, name_base,
sizeof(new_screenshot_dir));
fill_pathname_join(state->filename, new_screenshot_dir,
state->shotname, sizeof(state->filename));
}
else
fill_pathname_join(state->filename, new_screenshot_dir,
state->shotname, sizeof(state->filename));
fill_pathname_join(state->filename, new_screenshot_dir,
state->shotname, sizeof(state->filename));
/* Create screenshot directory, if required */
if (!path_is_directory(new_screenshot_dir))