mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-25 04:10:39 +00:00
Simplify strlcpy/strlcat combinations to single snprintf
This commit is contained in:
parent
9829051841
commit
3b64752f4f
20
core_info.c
20
core_info.c
@ -1357,8 +1357,8 @@ static bool core_info_path_is_locked(core_lock_file_path_list_t *lock_list,
|
||||
if (lock_list->size < 1)
|
||||
return false;
|
||||
|
||||
strlcpy(lock_filename, core_file_name, sizeof(lock_filename));
|
||||
strlcat(lock_filename, FILE_PATH_LOCK_EXTENSION, sizeof(lock_filename));
|
||||
snprintf(lock_filename, sizeof(lock_filename),
|
||||
"%s" FILE_PATH_LOCK_EXTENSION, core_file_name);
|
||||
|
||||
hash = core_info_hash_string(lock_filename);
|
||||
|
||||
@ -2818,8 +2818,6 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
|
||||
bool lock_file_exists = false;
|
||||
char lock_file_path[PATH_MAX_LENGTH];
|
||||
|
||||
lock_file_path[0] = '\0';
|
||||
|
||||
#if defined(ANDROID)
|
||||
/* Play Store builds do not support
|
||||
* core locking */
|
||||
@ -2838,10 +2836,8 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
|
||||
return false;
|
||||
|
||||
/* Get lock file path */
|
||||
strlcpy(lock_file_path, core_info->path,
|
||||
sizeof(lock_file_path));
|
||||
strlcat(lock_file_path, FILE_PATH_LOCK_EXTENSION,
|
||||
sizeof(lock_file_path));
|
||||
snprintf(lock_file_path, sizeof(lock_file_path),
|
||||
"%s" FILE_PATH_LOCK_EXTENSION, core_info->path);
|
||||
|
||||
/* Check whether lock file exists */
|
||||
lock_file_exists = path_is_valid(lock_file_path);
|
||||
@ -2894,8 +2890,6 @@ bool core_info_get_core_lock(const char *core_path, bool validate_path)
|
||||
bool is_locked = false;
|
||||
char lock_file_path[PATH_MAX_LENGTH];
|
||||
|
||||
lock_file_path[0] = '\0';
|
||||
|
||||
#if defined(ANDROID)
|
||||
/* Play Store builds do not support
|
||||
* core locking */
|
||||
@ -2921,10 +2915,8 @@ bool core_info_get_core_lock(const char *core_path, bool validate_path)
|
||||
return false;
|
||||
|
||||
/* Get lock file path */
|
||||
strlcpy(lock_file_path, core_file_path,
|
||||
sizeof(lock_file_path));
|
||||
strlcat(lock_file_path, FILE_PATH_LOCK_EXTENSION,
|
||||
sizeof(lock_file_path));
|
||||
snprintf(lock_file_path, sizeof(lock_file_path),
|
||||
"%s" FILE_PATH_LOCK_EXTENSION, core_file_path);
|
||||
|
||||
/* Check whether lock file exists */
|
||||
is_locked = path_is_valid(lock_file_path);
|
||||
|
@ -2676,8 +2676,10 @@ int generic_menu_entry_action(
|
||||
|
||||
if (!string_is_empty(title_name))
|
||||
snprintf(speak_string, sizeof(speak_string),
|
||||
"%s ", title_name);
|
||||
strlcat(speak_string, current_label, sizeof(speak_string));
|
||||
"%s %s", title_name, current_label);
|
||||
else
|
||||
strlcpy(speak_string, current_label, sizeof(speak_string));
|
||||
|
||||
if (!string_is_equal(current_value, "..."))
|
||||
{
|
||||
strlcat(speak_string, " ", sizeof(speak_string));
|
||||
|
Loading…
x
Reference in New Issue
Block a user