Replace some trivial strlcat usage - use return value of preceding

strlcpy then simply append the extension to it at this location
This commit is contained in:
LibretroAdmin 2022-08-04 03:44:19 +02:00
parent eab5898790
commit e7f3432e48
15 changed files with 316 additions and 147 deletions

View File

@ -1477,17 +1477,20 @@ static bool core_info_path_is_locked(
core_aux_file_path_list_t *lock_list,
const char *core_file_name)
{
size_t i;
size_t i, len;
uint32_t hash;
char lock_filename[NAME_MAX_LENGTH];
if (lock_list->size < 1)
return false;
strlcpy(lock_filename, core_file_name,
sizeof(lock_filename));
strlcat(lock_filename, FILE_PATH_LOCK_EXTENSION,
len = strlcpy(lock_filename, core_file_name,
sizeof(lock_filename));
lock_filename[len ] = '.';
lock_filename[len+1] = 'l';
lock_filename[len+2] = 'c';
lock_filename[len+3] = 'k';
lock_filename[len+4] = '\0';
hash = core_info_hash_string(lock_filename);
@ -1653,9 +1656,14 @@ static config_file_t *core_info_get_config_file(
"%s" ".info", core_file_id);
else
{
fill_pathname_join(info_path, info_dir, core_file_id,
size_t len = fill_pathname_join(info_path, info_dir, core_file_id,
sizeof(info_path));
strlcat(info_path, ".info", sizeof(info_path));
info_path[len] = '.';
info_path[len+1] = 'i';
info_path[len+2] = 'n';
info_path[len+3] = 'f';
info_path[len+4] = 'o';
info_path[len+5] = '\0';
}
return config_file_new_from_path_to_string(info_path);
@ -2869,6 +2877,7 @@ static bool core_info_update_core_aux_file(const char *path, bool create)
* core info list this is *not* thread safe */
bool core_info_set_core_lock(const char *core_path, bool lock)
{
size_t len;
core_info_t *core_info = NULL;
char lock_file_path[PATH_MAX_LENGTH];
@ -2887,8 +2896,13 @@ 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));
len = strlcpy(
lock_file_path, core_info->path, sizeof(lock_file_path));
lock_file_path[len ] = '.';
lock_file_path[len+1] = 'l';
lock_file_path[len+2] = 'c';
lock_file_path[len+3] = 'k';
lock_file_path[len+4] = '\0';
/* Create or delete lock file, as required */
if (!core_info_update_core_aux_file(lock_file_path, lock))
@ -2912,6 +2926,7 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
* must be checked externally */
bool core_info_get_core_lock(const char *core_path, bool validate_path)
{
size_t len;
core_info_t *core_info = NULL;
const char *core_file_path = NULL;
bool is_locked = false;
@ -2942,10 +2957,14 @@ 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,
len = strlcpy(
lock_file_path, core_file_path,
sizeof(lock_file_path));
lock_file_path[len ] = '.';
lock_file_path[len+1] = 'l';
lock_file_path[len+2] = 'c';
lock_file_path[len+3] = 'k';
lock_file_path[len+4] = '\0';
/* Check whether lock file exists */
is_locked = path_is_valid(lock_file_path);

View File

@ -1649,11 +1649,13 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
char driver_version[64];
char api_version[64];
char version_str[128];
size_t len = 0;
int pos = 0;
driver_version[0] = api_version[0] = '\0';
strlcpy(device_str, vk->context.gpu_properties.deviceName, sizeof(device_str));
strlcat(device_str, " ", sizeof(device_str));
len = strlcpy(device_str, vk->context.gpu_properties.deviceName, sizeof(device_str));
device_str[len ] = ' ';
device_str[len+1] = '\0';
pos += snprintf(driver_version + pos, sizeof(driver_version) - pos, "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.driverVersion));
strlcat(driver_version, ".", sizeof(driver_version));

View File

@ -378,8 +378,9 @@ static void *gl1_gfx_init(const video_info_t *video,
if (!string_is_empty(vendor))
{
strlcpy(device_str, vendor, sizeof(device_str));
strlcat(device_str, " ", sizeof(device_str));
size_t len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' ';
device_str[len+1] = '\0';
}
if (!string_is_empty(renderer))

View File

@ -3727,8 +3727,9 @@ static void *gl2_init(const video_info_t *video,
if (!string_is_empty(vendor))
{
strlcpy(device_str, vendor, sizeof(device_str));
strlcat(device_str, " ", sizeof(device_str));
size_t len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' ';
device_str[len+1] = '\0';
}
if (!string_is_empty(renderer))

View File

@ -1261,11 +1261,9 @@ static void *gl3_init(const video_info_t *video,
{
char device_str[128];
device_str[0] = '\0';
strlcpy(device_str, vendor, sizeof(device_str));
strlcat(device_str, " ", sizeof(device_str));
size_t len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' ';
device_str[len+1] = '\0';
strlcat(device_str, renderer, sizeof(device_str));
video_driver_set_gpu_device_string(device_str);

View File

@ -427,6 +427,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
id && shader->luts < GFX_MAX_TEXTURES;
shader->luts++, id = strtok_r(NULL, ";", &save))
{
size_t len;
char id_filter[64];
char id_wrap[64];
char id_mipmap[64];
@ -455,8 +456,15 @@ static bool video_shader_parse_textures(config_file_t *conf,
strlcpy(shader->lut[shader->luts].id, id,
sizeof(shader->lut[shader->luts].id));
strlcpy(id_filter, id, sizeof(id_filter));
strlcat(id_filter, "_linear", sizeof(id_filter));
len = strlcpy(id_filter, id, sizeof(id_filter));
id_filter[len ] = '_';
id_filter[len+1] = 'l';
id_filter[len+2] = 'i';
id_filter[len+3] = 'n';
id_filter[len+4] = 'e';
id_filter[len+5] = 'a';
id_filter[len+6] = 'r';
id_filter[len+7] = '\n';
if (config_get_bool(conf, id_filter, &smooth))
shader->lut[shader->luts].filter = smooth
? RARCH_FILTER_LINEAR
@ -464,15 +472,32 @@ static bool video_shader_parse_textures(config_file_t *conf,
else
shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;
strlcpy(id_wrap, id, sizeof(id_wrap));
strlcat(id_wrap, "_wrap_mode", sizeof(id_wrap));
len = strlcpy(id_wrap, id, sizeof(id_wrap));
id_wrap[len ] = '_';
id_wrap[len+1 ] = 'w';
id_wrap[len+2 ] = 'r';
id_wrap[len+3 ] = 'a';
id_wrap[len+4 ] = 'p';
id_wrap[len+5 ] = '_';
id_wrap[len+6 ] = 'm';
id_wrap[len+7 ] = 'o';
id_wrap[len+8 ] = 'd';
id_wrap[len+9 ] = 'e';
id_wrap[len+10] = '\n';
if ((entry = config_get_entry(conf, id_wrap))
&& !string_is_empty(entry->value))
shader->lut[shader->luts].wrap = wrap_str_to_mode(entry->value);
entry = NULL;
strlcpy(id_mipmap, id, sizeof(id_mipmap));
strlcat(id_mipmap, "_mipmap", sizeof(id_mipmap));
len = strlcpy(id_mipmap, id, sizeof(id_mipmap));
id_mipmap[len ] = '_';
id_mipmap[len+1 ] = 'm';
id_mipmap[len+2 ] = 'i';
id_mipmap[len+3 ] = 'p';
id_mipmap[len+4 ] = 'm';
id_mipmap[len+5 ] = 'a';
id_mipmap[len+6 ] = 'p';
id_mipmap[len+7 ] = '\n';
if (config_get_bool(conf, id_mipmap, &mipmap))
shader->lut[shader->luts].mipmap = mipmap;
else
@ -846,8 +871,15 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{
char k[128];
strlcpy(k, shader->lut[i].id, sizeof(k));
strlcat(k, "_linear", sizeof(k));
size_t len = strlcpy(k, shader->lut[i].id, sizeof(k));
k[len ] = '_';
k[len+1 ] = 'l';
k[len+2 ] = 'i';
k[len+3 ] = 'n';
k[len+4 ] = 'e';
k[len+5 ] = 'a';
k[len+6 ] = 'r';
k[len+7 ] = '\n';
config_set_string(conf, k,
(shader->lut[i].filter == RARCH_FILTER_LINEAR)
? "true"
@ -857,8 +889,18 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
/* Wrap Mode */
{
char k[128];
strlcpy(k, shader->lut[i].id, sizeof(k));
strlcat(k, "_wrap_mode", sizeof(k));
size_t len = strlcpy(k, shader->lut[i].id, sizeof(k));
k[len ] = '_';
k[len+1 ] = 'w';
k[len+2 ] = 'r';
k[len+3 ] = 'a';
k[len+4 ] = 'p';
k[len+5 ] = '_';
k[len+6 ] = 'm';
k[len+7 ] = 'o';
k[len+8 ] = 'd';
k[len+9 ] = 'e';
k[len+10] = '\n';
config_set_string(conf, k,
wrap_mode_to_str(shader->lut[i].wrap));
}
@ -866,8 +908,15 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
/* Mipmap On or Off */
{
char k[128];
strlcpy(k, shader->lut[i].id, sizeof(k));
strlcat(k, "_mipmap", sizeof(k));
size_t len = strlcpy(k, shader->lut[i].id, sizeof(k));
k[len ] = '_';
k[len+1 ] = 'm';
k[len+2 ] = 'i';
k[len+3 ] = 'p';
k[len+4 ] = 'm';
k[len+5 ] = 'a';
k[len+6 ] = 'p';
k[len+7 ] = '\n';
config_set_string(conf, k, shader->lut[i].mipmap
? "true"
: "false");

View File

@ -445,10 +445,13 @@ bool gfx_widget_start_load_content_animation(void)
* > Use db_name, if available */
if (has_db_name)
{
strlcpy(state->icon_file, state->system_name,
sizeof(state->icon_file));
strlcat(state->icon_file, ".png",
size_t len = strlcpy(state->icon_file, state->system_name,
sizeof(state->icon_file));
state->icon_file[len] = '.';
state->icon_file[len+1] = 'p';
state->icon_file[len+2] = 'n';
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join(icon_path,
state->icon_directory, state->icon_file,
@ -476,10 +479,13 @@ bool gfx_widget_start_load_content_animation(void)
if (!string_is_empty(core_db_name) &&
!string_is_equal(core_db_name, state->system_name))
{
strlcpy(state->icon_file, core_db_name,
sizeof(state->icon_file));
strlcat(state->icon_file, ".png",
size_t len = strlcpy(state->icon_file, core_db_name,
sizeof(state->icon_file));
state->icon_file[len] = '.';
state->icon_file[len+1] = 'p';
state->icon_file[len+2] = 'n';
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join(icon_path,
state->icon_directory, state->icon_file,

View File

@ -1309,8 +1309,9 @@ void fill_pathname_application_path(char *s, size_t len)
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
if (realpath(s, resolved_bundle_dir_buf))
{
strlcpy(s, resolved_bundle_dir_buf, len - 1);
strlcat(s, "/", len);
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);
s[_len ] = '/';
s[_len+1] = '\0';
}
}
#endif

View File

@ -4466,6 +4466,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
{
size_t len;
struct texture_image ti;
char sysname[PATH_MAX_LENGTH];
char texturepath[PATH_MAX_LENGTH];
@ -4477,16 +4478,24 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
fill_pathname_base(sysname, path, sizeof(sysname));
path_remove_extension(sysname);
fill_pathname_join(texturepath, ozone->icons_path, sysname,
len = fill_pathname_join(texturepath, ozone->icons_path, sysname,
sizeof(texturepath));
strlcat(texturepath, ".png", sizeof(texturepath));
texturepath[len] = '.';
texturepath[len+1] = 'p';
texturepath[len+2] = 'n';
texturepath[len+3] = 'g';
texturepath[len+4] = '\0';
/* If the playlist icon doesn't exist return default */
if (!path_is_valid(texturepath))
{
fill_pathname_join(texturepath, ozone->icons_path, "default",
len = fill_pathname_join(texturepath, ozone->icons_path, "default",
sizeof(texturepath));
strlcat(texturepath, ".png", sizeof(texturepath));
texturepath[len] = '.';
texturepath[len+1] = 'p';
texturepath[len+2] = 'n';
texturepath[len+3] = 'g';
texturepath[len+4] = '\0';
}
ti.width = 0;

View File

@ -537,13 +537,16 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
for (i = 0; i < ARRAY_SIZE(info_list); i++)
{
size_t len;
if (!info_list[i].name)
continue;
strlcpy(tmp,
len = strlcpy(tmp,
msg_hash_to_str(info_list[i].msg),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp,
info_list[i].name,
sizeof(tmp));
@ -556,10 +559,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->categories_list)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->categories_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -569,10 +574,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->authors_list)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->authors_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -582,10 +589,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->permissions_list)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->permissions_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -595,10 +604,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->licenses_list)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->licenses_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -608,11 +619,13 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->supported_extensions_list)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->supported_extensions_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -622,10 +635,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (core_info->required_hw_api)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
string_list_join_concat(tmp, sizeof(tmp),
core_info->required_hw_api_list, ", ");
if (menu_entries_append_enum(info->list, tmp, "",
@ -657,11 +672,15 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_DISABLED);
break;
}
strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
strlcat(tmp, savestate_support, sizeof(tmp));
{
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL),
sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, savestate_support, sizeof(tmp));
}
if (menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0))
@ -685,10 +704,12 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info,
if (update_missing_firmware)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
if (menu_entries_append_enum(info->list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0))
count++;
@ -1622,14 +1643,18 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
(void)tmp_string;
#ifdef HAVE_GIT_VERSION
strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
strlcat(tmp, retroarch_git_version, sizeof(tmp));
if (menu_entries_append_enum(list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0))
count++;
{
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GIT_VERSION),
sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, retroarch_git_version, sizeof(tmp));
if (menu_entries_append_enum(list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0))
count++;
}
#endif
retroarch_get_capabilities(RARCH_CAPABILITIES_COMPILER, tmp, sizeof(tmp));
@ -1652,10 +1677,12 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
{
char cpu_str[NAME_MAX_LENGTH];
const char *model = frontend_driver_get_cpu_model_name();
strlcpy(cpu_str,
size_t len = strlcpy(cpu_str,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_MODEL),
sizeof(cpu_str));
strlcat(cpu_str, ": ", sizeof(cpu_str));
cpu_str[len ] = ':';
cpu_str[len+1] = ' ';
cpu_str[len+2] = '\0';
if (string_is_empty(model))
strlcat(cpu_str, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(cpu_str));
@ -1669,11 +1696,13 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
{
char cpu_str[NAME_MAX_LENGTH];
strlcpy(cpu_str,
size_t len = strlcpy(cpu_str,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CPU_FEATURES),
sizeof(cpu_str));
strlcat(cpu_str, ": ", sizeof(cpu_str));
cpu_str[len ] = ':';
cpu_str[len+1] = ' ';
cpu_str[len+2] = '\0';
retroarch_get_capabilities(RARCH_CAPABILITIES_CPU,
cpu_str, sizeof(cpu_str));
@ -1765,16 +1794,19 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
if (frontend)
{
size_t len;
char tmp2[PATH_MAX_LENGTH];
int major = 0;
int minor = 0;
tmp2[0] = '\0';
strlcpy(tmp,
len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_IDENTIFIER),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, frontend->ident, sizeof(tmp));
if (menu_entries_append_enum(list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
@ -1783,12 +1815,15 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
if (frontend->get_lakka_version)
{
size_t len;
frontend->get_lakka_version(tmp2, sizeof(tmp2));
strlcpy(tmp,
len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LAKKA_VERSION),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, tmp2, sizeof(tmp));
if (menu_entries_append_enum(list, tmp, "",
@ -1799,12 +1834,15 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
if (frontend->get_name)
{
size_t len;
frontend->get_name(tmp2, sizeof(tmp2));
strlcpy(tmp,
len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FRONTEND_NAME),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, tmp2, sizeof(tmp));
if (menu_entries_append_enum(list, tmp, "",
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY,
@ -2063,13 +2101,13 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
for (i = 0; i < ARRAY_SIZE(info_list); i++)
{
strlcpy(feat_str,
size_t len = strlcpy(feat_str,
msg_hash_to_str(
info_list[i].msg),
sizeof(feat_str));
strlcat(feat_str,
": ",
sizeof(feat_str));
feat_str[len ] = ':';
feat_str[len+1] = ' ';
feat_str[len+2] = '\0';
strlcat(feat_str,
info_list[i].enabled ?
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) :
@ -2310,8 +2348,10 @@ static int create_string_list_rdb_entry_string(
string_list_join_concat(output_label, str_len, &str_list, "|");
string_list_deinitialize(&str_list);
strlcpy(tmp, desc, sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
str_len = strlcpy(tmp, desc, sizeof(tmp));
tmp[str_len ] = ':';
tmp[str_len+1] = ' ';
tmp[str_len+2] = '\0';
strlcat(tmp, actual_string, sizeof(tmp));
menu_entries_append_enum(list, tmp, output_label,
enum_idx,
@ -2486,10 +2526,12 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
if (db_info_entry->name)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, db_info_entry->name, sizeof(tmp));
menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_NAME),
@ -2499,10 +2541,12 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
if (db_info_entry->description)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, db_info_entry->description, sizeof(tmp));
menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_DESCRIPTION),
@ -2512,10 +2556,12 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
if (db_info_entry->genre)
{
strlcpy(tmp,
size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE),
sizeof(tmp));
strlcat(tmp, ": ", sizeof(tmp));
tmp[len ] = ':';
tmp[len+1] = ' ';
tmp[len+2] = '\0';
strlcat(tmp, db_info_entry->genre, sizeof(tmp));
menu_entries_append_enum(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_GENRE),

View File

@ -5432,6 +5432,7 @@ bool runloop_event_init_core(
void *input_data,
enum rarch_core_type type)
{
size_t len;
runloop_state_t *runloop_st = &runloop_state;
input_driver_state_t *input_st = (input_driver_state_t*)input_data;
video_driver_state_t *video_st = video_state_get_ptr();
@ -5487,13 +5488,12 @@ bool runloop_event_init_core(
if (!sys_info->info.library_version)
sys_info->info.library_version = "v0";
strlcpy(
len = strlcpy(
video_st->title_buf,
msg_hash_to_str(MSG_PROGRAM),
sizeof(video_st->title_buf));
strlcat(video_st->title_buf,
" ",
sizeof(video_st->title_buf));
video_st->title_buf[len ] = ' ';
video_st->title_buf[len+1] = '\0';
strlcat(video_st->title_buf,
sys_info->info.library_name,
sizeof(video_st->title_buf));
@ -5790,12 +5790,14 @@ bool runloop_path_init_subsystem(void)
if (!retroarch_override_setting_is_set(
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
{
strlcpy(runloop_st->name.savefile,
size_t len = strlcpy(runloop_st->name.savefile,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savefile));
strlcat(runloop_st->name.savefile,
".srm",
sizeof(runloop_st->name.savefile));
runloop_st->name.savefile[len ] = '.';
runloop_st->name.savefile[len+1] = 's';
runloop_st->name.savefile[len+2] = 'r';
runloop_st->name.savefile[len+3] = 'm';
runloop_st->name.savefile[len+4] = '\0';
}
if (path_is_directory(runloop_st->name.savefile))
@ -5832,32 +5834,38 @@ void runloop_path_fill_names(void)
if (string_is_empty(runloop_st->name.ups))
{
strlcpy(runloop_st->name.ups,
size_t len = strlcpy(runloop_st->name.ups,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ups));
strlcat(runloop_st->name.ups,
".ups",
sizeof(runloop_st->name.ups));
runloop_st->name.ups[len ] = '.';
runloop_st->name.ups[len+1] = 'u';
runloop_st->name.ups[len+2] = 'p';
runloop_st->name.ups[len+3] = 's';
runloop_st->name.ups[len+4] = '\0';
}
if (string_is_empty(runloop_st->name.bps))
{
strlcpy(runloop_st->name.bps,
size_t len = strlcpy(runloop_st->name.bps,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.bps));
strlcat(runloop_st->name.bps,
".bps",
sizeof(runloop_st->name.bps));
runloop_st->name.bps[len ] = '.';
runloop_st->name.bps[len+1] = 'b';
runloop_st->name.bps[len+2] = 'p';
runloop_st->name.bps[len+3] = 's';
runloop_st->name.bps[len+4] = '\0';
}
if (string_is_empty(runloop_st->name.ips))
{
strlcpy(runloop_st->name.ips,
size_t len = strlcpy(runloop_st->name.ips,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ips));
strlcat(runloop_st->name.ips,
".ips",
sizeof(runloop_st->name.ips));
runloop_st->name.ips[len ] = '.';
runloop_st->name.ips[len+1] = 'i';
runloop_st->name.ips[len+2] = 'p';
runloop_st->name.ips[len+3] = 's';
runloop_st->name.ips[len+4] = '\0';
}
}
@ -8513,34 +8521,44 @@ void runloop_path_set_names(void)
if (!retroarch_override_setting_is_set(
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
{
strlcpy(runloop_st->name.savefile,
size_t len = strlcpy(runloop_st->name.savefile,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savefile));
strlcat(runloop_st->name.savefile,
".srm",
sizeof(runloop_st->name.savefile));
runloop_st->name.savefile[len ] = '.';
runloop_st->name.savefile[len+1] = 's';
runloop_st->name.savefile[len+2] = 'r';
runloop_st->name.savefile[len+3] = 'm';
runloop_st->name.savefile[len+4] = '\0';
}
if (!retroarch_override_setting_is_set(
RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
{
strlcpy(runloop_st->name.savestate,
size_t len = strlcpy(
runloop_st->name.savestate,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savestate));
strlcat(runloop_st->name.savestate,
".state",
sizeof(runloop_st->name.savestate));
runloop_st->name.savestate[len ] = '.';
runloop_st->name.savestate[len+1] = 's';
runloop_st->name.savestate[len+2] = 't';
runloop_st->name.savestate[len+3] = 'a';
runloop_st->name.savestate[len+4] = 't';
runloop_st->name.savestate[len+5] = 'e';
runloop_st->name.savestate[len+6] = '\0';
}
#ifdef HAVE_CHEATS
if (!string_is_empty(runloop_st->runtime_content_path_basename))
{
strlcpy(runloop_st->name.cheatfile,
size_t len = strlcpy(
runloop_st->name.cheatfile,
runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.cheatfile));
strlcat(runloop_st->name.cheatfile,
".cht",
sizeof(runloop_st->name.cheatfile));
runloop_st->name.cheatfile[len ] = '.';
runloop_st->name.cheatfile[len+1] = 'c';
runloop_st->name.cheatfile[len+2] = 'h';
runloop_st->name.cheatfile[len+3] = 't';
runloop_st->name.cheatfile[len+4] = '\0';
}
#endif
}

View File

@ -235,6 +235,7 @@ runtime_log_t *runtime_log_init(
const char *dir_playlist,
bool log_per_core)
{
size_t len;
char content_name[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char log_file_dir[PATH_MAX_LENGTH];
@ -362,10 +363,14 @@ runtime_log_t *runtime_log_init(
return NULL;
/* Build final log file path */
fill_pathname_join(log_file_path, log_file_dir,
len = fill_pathname_join(log_file_path, log_file_dir,
content_name, sizeof(log_file_path));
strlcat(log_file_path, FILE_PATH_RUNTIME_EXTENSION,
sizeof(log_file_path));
log_file_path[len ] = '.';
log_file_path[len+1] = 'l';
log_file_path[len+2] = 'r';
log_file_path[len+3] = 't';
log_file_path[len+4] = 'l';
log_file_path[len+5] = '\0';
if (string_is_empty(log_file_path))
return NULL;

View File

@ -356,6 +356,7 @@ void* task_push_http_transfer_file(const char* url, bool mute,
const char* type,
retro_task_callback_t cb, file_transfer_t* transfer_data)
{
size_t len;
const char *s = NULL;
char tmp[255] = "";
retro_task_t *t = NULL;
@ -369,12 +370,13 @@ void* task_push_http_transfer_file(const char* url, bool mute,
return NULL;
if (transfer_data)
s = transfer_data->path;
s = transfer_data->path;
else
s = url;
s = url;
strlcpy(tmp, msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
strlcat(tmp, " ", sizeof(tmp));
len = strlcpy(tmp, msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
tmp[len ] = ' ';
tmp[len+1] = '\0';
if (string_ends_with_size(s, ".index",
strlen(s), STRLEN_CONST(".index")))

View File

@ -264,9 +264,13 @@ static bool screenshot_dump(
{
if (savestate)
{
strlcpy(state->filename,
size_t len = strlcpy(state->filename,
name_base, sizeof(state->filename));
strlcat(state->filename, ".png", sizeof(state->filename));
state->filename[len ] = '.';
state->filename[len+1] = 'p';
state->filename[len+2] = 'n';
state->filename[len+3] = 'g';
state->filename[len+4] = '\0';
}
else
{
@ -320,9 +324,14 @@ static bool screenshot_dump(
}
else
{
strlcpy(state->shotname, path_basename_nocompression(name_base),
size_t len = strlcpy(
state->shotname, path_basename_nocompression(name_base),
sizeof(state->shotname));
strlcat(state->shotname, ".png", sizeof(state->shotname));
state->shotname[len ] = '.';
state->shotname[len+1] = 'p';
state->shotname[len+2] = 'n';
state->shotname[len+3] = 'g';
state->shotname[len+4] = '\0';
}
if ( string_is_empty(new_screenshot_dir) ||

View File

@ -1403,6 +1403,7 @@ void MainWindow::deleteCurrentPlaylistItem()
QString MainWindow::getPlaylistDefaultCore(QString plName)
{
size_t len;
playlist_config_t playlist_config;
char playlistPath[PATH_MAX_LENGTH];
QByteArray plNameByteArray = plName.toUtf8();
@ -1419,17 +1420,19 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
playlist_config.fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
playlist_config_set_base_content_directory(&playlist_config, settings->bools.playlist_portable_paths ? settings->paths.directory_menu_content : NULL);
playlistPath[0] = '\0';
if (!settings || string_is_empty(plNameCString))
return corePath;
/* Get playlist path */
fill_pathname_join(
playlistPath,
settings->paths.directory_playlist, plNameCString,
sizeof(playlistPath));
strlcat(playlistPath, ".lpl", sizeof(playlistPath));
len = fill_pathname_join(
playlistPath,
settings->paths.directory_playlist, plNameCString,
sizeof(playlistPath));
playlistPath[len ] = '.';
playlistPath[len+1] = 'l';
playlistPath[len+2] = 'p';
playlistPath[len+3] = 'l';
playlistPath[len+4] = '\0';
/* Load playlist, if required */
if (cachedPlaylist)