Start deprecating trivial functions in file_path.c

This commit is contained in:
libretroadmin 2022-07-11 19:56:46 +02:00
parent 4bcc479041
commit d706c9c5bf
11 changed files with 114 additions and 85 deletions

View file

@ -172,10 +172,11 @@ bool cheat_manager_save(
if (!cheat_database)
strlcpy(cheats_file, path, sizeof(cheats_file));
else
fill_pathname_join_concat(cheats_file,
cheat_database, path,
".cht",
sizeof(cheats_file));
{
fill_pathname_join(cheats_file,
cheat_database, path, sizeof(cheats_file));
strlcat(cheats_file, ".cht", sizeof(cheats_file));
}
if (!overwrite)
conf = config_file_new_from_path_to_string(cheats_file);

View file

@ -4265,8 +4265,9 @@ static void save_keybind_joykey(config_file_t *conf,
key[0] = '\0';
fill_pathname_join_delim_concat(key, prefix,
base, '_', "_btn", sizeof(key));
fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key));
strlcat(key, "_btn", sizeof(key));
if (bind->joykey == NO_BTN)
{
@ -4288,12 +4289,10 @@ static void save_keybind_axis(config_file_t *conf,
unsigned axis = 0;
char dir = '\0';
key[0] = '\0';
key[0] = '\0';
fill_pathname_join_delim_concat(key,
prefix, base, '_',
"_axis",
sizeof(key));
fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
strlcat(key, "_axis", sizeof(key));
if (bind->joyaxis == AXIS_NONE)
{
@ -4331,8 +4330,9 @@ static void save_keybind_mbutton(config_file_t *conf,
key[0] = '\0';
fill_pathname_join_delim_concat(key, prefix,
base, '_', "_mbtn", sizeof(key));
fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key));
strlcat(key, "_mbtn", sizeof(key));
switch (bind->mbutton)
{
@ -4529,11 +4529,12 @@ bool config_save_autoconf_profile(const
fill_pathname_join(buf, autoconf_dir, joypad_driver, sizeof(buf));
if (path_is_directory(buf))
fill_pathname_join_concat(autoconf_file, buf,
sanitised_name, ".cfg", sizeof(autoconf_file));
fill_pathname_join(autoconf_file, buf,
sanitised_name, sizeof(autoconf_file));
else
fill_pathname_join_concat(autoconf_file, autoconf_dir,
sanitised_name, ".cfg", sizeof(autoconf_file));
fill_pathname_join(autoconf_file, autoconf_dir,
sanitised_name, sizeof(autoconf_file));
strlcat(autoconf_file, ".cfg", sizeof(autoconf_file));
/* Open config file */
if ( !(conf = config_file_new_from_path_to_string(autoconf_file))

View file

@ -486,11 +486,12 @@ static bool core_updater_list_set_paths(
entry->local_core_path = strdup(local_core_path);
/* local_info_path */
fill_pathname_join_noext(
fill_pathname_join(
local_info_path,
path_libretro_info,
filename_str,
sizeof(local_info_path));
path_remove_extension(local_info_path);
if (is_archive)
path_remove_extension(local_info_path);

View file

@ -2230,8 +2230,11 @@ void input_config_get_bind_string_joykey(
if (bind->joykey_label &&
!string_is_empty(bind->joykey_label)
&& input_descriptor_label_show)
fill_pathname_join_delim_concat(buf, prefix,
bind->joykey_label, ' ', " (hat)", size);
{
fill_pathname_join_delim(buf, prefix,
bind->joykey_label, ' ', size);
strlcat(buf, " (hat)", size);
}
else
{
const char *dir = "?";
@ -2263,8 +2266,11 @@ void input_config_get_bind_string_joykey(
if (bind->joykey_label &&
!string_is_empty(bind->joykey_label)
&& input_descriptor_label_show)
fill_pathname_join_delim_concat(buf, prefix,
bind->joykey_label, ' ', " (btn)", size);
{
fill_pathname_join_delim(buf, prefix,
bind->joykey_label, ' ', size);
strlcat(buf, " (btn)", size);
}
else
snprintf(buf, size, "%s%u (%s)", prefix, (unsigned)bind->joykey,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
@ -2279,8 +2285,11 @@ void input_config_get_bind_string_joyaxis(
if (bind->joyaxis_label &&
!string_is_empty(bind->joyaxis_label)
&& input_descriptor_label_show)
fill_pathname_join_delim_concat(buf, prefix,
bind->joyaxis_label, ' ', " (axis)", size);
{
fill_pathname_join_delim(buf, prefix,
bind->joyaxis_label, ' ', size);
strlcat(buf, " (axis)", size);
}
else
{
unsigned axis = 0;

View file

@ -964,22 +964,6 @@ size_t fill_pathname_join_concat_noext(char *out_path,
return strlcat(out_path, concat, size);
}
size_t fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size)
{
fill_pathname_join(out_path, dir, path, size);
return strlcat(out_path, concat, size);
}
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size)
{
fill_pathname_join(out_path, dir, path, size);
path_remove_extension(out_path);
}
/**
* fill_pathname_join_delim:
* @out_path : output path
@ -1009,14 +993,6 @@ size_t fill_pathname_join_delim(char *out_path, const char *dir,
return copied;
}
size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size)
{
fill_pathname_join_delim(out_path, dir, path, delim, size);
return strlcat(out_path, concat, size);
}
/**
* fill_short_pathname_representation:
* @out_rep : output representation
@ -1045,13 +1021,6 @@ size_t fill_short_pathname_representation(char* out_rep,
return strlcpy(out_rep, path_short, size);
}
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size)
{
fill_short_pathname_representation(out_rep, in_path, size);
path_remove_extension(out_rep);
}
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size)
{
@ -1444,3 +1413,35 @@ bool is_path_accessible_using_standard_io(const char *path)
return true;
#endif
}
/* Deprecated functions */
size_t fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size)
{
fill_pathname_join(out_path, dir, path, size);
return strlcat(out_path, concat, size);
}
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size)
{
fill_pathname_join(out_path, dir, path, size);
path_remove_extension(out_path);
}
size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size)
{
fill_pathname_join_delim(out_path, dir, path, delim, size);
return strlcat(out_path, concat, size);
}
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size)
{
fill_short_pathname_representation(out_rep, in_path, size);
path_remove_extension(out_rep);
}

View file

@ -412,14 +412,6 @@ size_t fill_pathname_join_concat_noext(char *out_path,
const char *concat,
size_t size);
size_t fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size);
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size);
/**
* fill_pathname_join_delim:
* @out_path : output path
@ -434,10 +426,6 @@ void fill_pathname_join_noext(char *out_path,
size_t fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size);
size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size);
/**
* fill_short_pathname_representation:
* @out_rep : output representation
@ -456,9 +444,6 @@ size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
size_t fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size);
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size);
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size);
@ -555,6 +540,22 @@ int32_t path_get_size(const char *path);
bool is_path_accessible_using_standard_io(const char *path);
/* Deprecated functions */
size_t fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size);
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size);
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size);
size_t fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size);
RETRO_END_DECLS
#endif

View file

@ -4379,13 +4379,17 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
fill_pathname_base_noext(sysname, path, sizeof(sysname));
fill_pathname_join_concat(texturepath, icons_path, sysname,
".png", sizeof(texturepath));
fill_pathname_join(texturepath, icons_path, sysname,
sizeof(texturepath));
strlcat(texturepath, ".png", sizeof(texturepath));
/* If the playlist icon doesn't exist return default */
if (!path_is_valid(texturepath))
fill_pathname_join_concat(texturepath, icons_path, "default",
".png", sizeof(texturepath));
{
fill_pathname_join(texturepath, icons_path, "default",
sizeof(texturepath));
strlcat(texturepath, ".png", sizeof(texturepath));
}
ti.width = 0;
ti.height = 0;

View file

@ -1093,11 +1093,12 @@ static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
if (tmp)
{
fill_pathname_join_noext(
fill_pathname_join(
path,
dir_dynamic_wallpapers,
tmp,
sizeof(path));
path_remove_extension(path);
free(tmp);
}
@ -2265,14 +2266,19 @@ static void xmb_context_reset_horizontal_list(
fill_pathname_application_special(iconpath, sizeof(iconpath),
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS);
fill_pathname_join_concat(texturepath, iconpath, sysname,
FILE_PATH_PNG_EXTENSION, sizeof(texturepath));
fill_pathname_join(texturepath, iconpath, sysname,
sizeof(texturepath));
strlcat(texturepath, FILE_PATH_PNG_EXTENSION, sizeof(texturepath));
/* If the playlist icon doesn't exist return default */
if (!path_is_valid(texturepath))
fill_pathname_join_concat(texturepath, iconpath, "default",
FILE_PATH_PNG_EXTENSION, sizeof(texturepath));
{
fill_pathname_join(texturepath, iconpath, "default",
sizeof(texturepath));
strlcat(texturepath, FILE_PATH_PNG_EXTENSION,
sizeof(texturepath));
}
ti.width = 0;
ti.height = 0;

View file

@ -2414,8 +2414,9 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
if (!db_info)
goto error;
fill_short_pathname_representation_noext(path_base, info->path,
fill_short_pathname_representation(path_base, info->path,
sizeof(path_base));
path_remove_extension(path_base);
menu_driver_set_thumbnail_system(path_base, sizeof(path_base));
@ -4715,10 +4716,11 @@ static unsigned menu_displaylist_parse_content_information(
db_path[0] = '\0';
fill_pathname_join_noext(db_path,
fill_pathname_join(db_path,
settings->paths.path_content_database,
db_name,
sizeof(db_path));
path_remove_extension(db_path);
strlcat(db_path, ".rdb", sizeof(db_path));
if (path_is_valid(db_path))

View file

@ -528,14 +528,15 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
newrdb.playlist_crcs = NULL;
newrdb.playlist_names = NULL;
systemname_len = db_ext - db_name;
systemname_len = db_ext - db_name;
if (systemname_len >= sizeof(newrdb.systemname))
systemname_len = sizeof(newrdb.systemname)-1;
memcpy(newrdb.systemname, db_name, systemname_len);
newrdb.systemname[systemname_len] = '\0';
fill_pathname_join_noext(
fill_pathname_join(
tmp, directory_database, db_name, sizeof(tmp));
path_remove_extension(tmp);
strlcat(tmp, ".rdb", sizeof(tmp));
if (libretrodb_open(tmp, newrdb.handle) != 0)

View file

@ -756,8 +756,9 @@ static int database_info_list_iterate_found_match(
db_playlist_base_str[0] = '\0';
entry_path_str[0] = '\0';
fill_short_pathname_representation_noext(db_playlist_base_str,
fill_short_pathname_representation(db_playlist_base_str,
db_path, str_len);
path_remove_extension(db_playlist_base_str);
strlcat(db_playlist_base_str, ".lpl", str_len);
@ -1011,8 +1012,9 @@ static int task_database_iterate_playlist_lutro(
game_title[0] = '\0';
fill_short_pathname_representation_noext(game_title,
fill_short_pathname_representation(game_title,
path, sizeof(game_title));
path_remove_extension(game_title);
/* the push function reads our entry as const,
* so these casts are safe */