1
0
mirror of https://github.com/libretro/RetroArch synced 2024-06-28 22:44:21 +00:00

Get rid of some unnecessary strlcat usage

This commit is contained in:
libretroadmin 2024-06-16 15:09:31 +02:00
parent 37bcb4f093
commit 0ced85b91d
3 changed files with 10 additions and 11 deletions

View File

@ -1361,15 +1361,14 @@ static void build_ticker_loop_string(
size_t char_offset1, size_t num_chars1,
size_t char_offset2, size_t num_chars2,
size_t char_offset3, size_t num_chars3,
char *dest_str, size_t dest_str_len)
char *s, size_t len)
{
/* Copy 'trailing' chunk of source string, if required */
if (num_chars1 > 0)
utf8cpy(
dest_str, dest_str_len,
utf8cpy(s, len,
utf8skip(src_str, char_offset1), num_chars1);
else
dest_str[0] = '\0';
s[0] = '\0';
/* Copy chunk of spacer string, if required */
if (num_chars2 > 0)
@ -1378,7 +1377,7 @@ static void build_ticker_loop_string(
utf8cpy(
tmp, sizeof(tmp),
utf8skip(spacer, char_offset2), num_chars2);
strlcat(dest_str, tmp, dest_str_len);
strlcat(s, tmp, len);
}
/* Copy 'leading' chunk of source string, if required */
@ -1388,7 +1387,7 @@ static void build_ticker_loop_string(
utf8cpy(
tmp, sizeof(tmp),
utf8skip(src_str, char_offset3), num_chars3);
strlcat(dest_str, tmp, dest_str_len);
strlcat(s, tmp, len);
}
}

View File

@ -2780,11 +2780,12 @@ static bool video_shader_load_shader_preset_internal(
len);
else
{
size_t _len;
if (string_is_empty(special_name))
break;
fill_pathname_join(s, shader_directory, special_name, len);
strlcat(s, video_shader_get_preset_extension(types[i]), len);
_len = fill_pathname_join(s, shader_directory, special_name, len);
strlcpy(s + _len, video_shader_get_preset_extension(types[i]), len - _len);
}
if (path_is_valid(s))

View File

@ -824,9 +824,8 @@ static bool webdav_delete(const char *path, cloud_sync_complete_handler_t cb, vo
}
else
{
char dir[PATH_MAX_LENGTH] = {0};
size_t _len;
_len = strlcat(dir, "deleted/", sizeof(dir));
char dir[PATH_MAX_LENGTH];
size_t _len = strlcpy(dir, "deleted/", sizeof(dir));
fill_pathname_basedir(dir + _len, path, sizeof(dir) - _len);
webdav_ensure_dir(dir, webdav_do_backup, webdav_cb_st);
}