mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Replace more strlcat calls
This commit is contained in:
parent
458fe7a761
commit
b7e122a4fa
@ -1168,17 +1168,14 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
|
||||
if (shader->luts)
|
||||
{
|
||||
char textures[4096];
|
||||
|
||||
textures[0] = '\0';
|
||||
|
||||
/* Names of the textures */
|
||||
strlcpy(textures, shader->lut[0].id, sizeof(textures));
|
||||
size_t _len = strlcpy(textures, shader->lut[0].id, sizeof(textures));
|
||||
|
||||
for (i = 1; i < shader->luts; i++)
|
||||
{
|
||||
/* O(n^2), but number of textures is very limited. */
|
||||
strlcat(textures, ";", sizeof(textures));
|
||||
strlcat(textures, shader->lut[i].id, sizeof(textures));
|
||||
_len += strlcpy(textures + _len, ";", sizeof(textures) - _len);
|
||||
_len += strlcpy(textures + _len, shader->lut[i].id, sizeof(textures) - _len);
|
||||
}
|
||||
|
||||
config_set_string(conf, "textures", textures);
|
||||
|
@ -1635,34 +1635,36 @@ static int action_bind_sublabel_netplay_room(file_list_t *list,
|
||||
": %s (%s)\n"
|
||||
"%s: %s (%s)\n"
|
||||
"%s: %s ",
|
||||
!string_is_empty(room->retroarch_version) ? room->retroarch_version :
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
!string_is_empty(room->retroarch_version)
|
||||
? room->retroarch_version
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
(!string_is_empty(room->frontend) &&
|
||||
!string_is_equal_case_insensitive(room->frontend, "N/A")) ?
|
||||
room->frontend :
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
!string_is_equal_case_insensitive(room->frontend, "N/A"))
|
||||
? room->frontend
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME),
|
||||
room->corename, room->coreversion,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT),
|
||||
(!string_is_empty(room->gamename) &&
|
||||
!string_is_equal_case_insensitive(room->gamename, "N/A")) ?
|
||||
room->gamename :
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
|
||||
!string_is_equal_case_insensitive(room->gamename, "N/A"))
|
||||
? room->gamename
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
|
||||
|
||||
if ( string_is_empty(room->subsystem_name)
|
||||
|| string_is_equal_case_insensitive(room->subsystem_name, "N/A"))
|
||||
snprintf(buf, sizeof(buf), "(%08lX)",
|
||||
(unsigned long)(unsigned)room->gamecrc);
|
||||
_len = snprintf(buf, sizeof(buf), "(%08lX)",
|
||||
(unsigned long)(unsigned)room->gamecrc);
|
||||
else
|
||||
{
|
||||
buf[0 ] = '(';
|
||||
buf[1 ] = '\0';
|
||||
_len = strlcat(buf, room->subsystem_name, sizeof(buf));
|
||||
_len = 0;
|
||||
buf[ _len] = '(';
|
||||
buf[++_len] = '\0';
|
||||
_len += strlcpy(buf + _len, room->subsystem_name, sizeof(buf) - _len);
|
||||
buf[ _len] = ')';
|
||||
buf[++_len] = '\0';
|
||||
}
|
||||
|
||||
strlcat(s, buf, len);
|
||||
strlcpy(s + _len, buf, len - _len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -9143,8 +9143,8 @@ static bool setting_append_list_input_player_options(
|
||||
{
|
||||
char label[NAME_MAX_LENGTH];
|
||||
char name[NAME_MAX_LENGTH];
|
||||
|
||||
i = (j < RARCH_ANALOG_BIND_LIST_END)
|
||||
size_t _len = 0;
|
||||
i = (j < RARCH_ANALOG_BIND_LIST_END)
|
||||
? input_config_bind_order[j]
|
||||
: j;
|
||||
|
||||
@ -9155,7 +9155,7 @@ static bool setting_append_list_input_player_options(
|
||||
|
||||
if (!string_is_empty(buffer[user]))
|
||||
{
|
||||
size_t _len = strlcpy(label, buffer[user], sizeof(label));
|
||||
_len = strlcpy(label, buffer[user], sizeof(label));
|
||||
label[ _len] = ' ';
|
||||
label[++_len] = '\0';
|
||||
}
|
||||
@ -9170,18 +9170,20 @@ static bool setting_append_list_input_player_options(
|
||||
)
|
||||
{
|
||||
if (system->input_desc_btn[user][i])
|
||||
strlcat(label,
|
||||
strlcpy(label + _len,
|
||||
system->input_desc_btn[user][i],
|
||||
sizeof(label));
|
||||
sizeof(label) - _len);
|
||||
else
|
||||
{
|
||||
strlcat(label, value_na, sizeof(label));
|
||||
strlcpy(label + _len, value_na, sizeof(label) - _len);
|
||||
if (settings->bools.input_descriptor_hide_unbound)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
strlcat(label, input_config_bind_map_get_desc(i), sizeof(label));
|
||||
strlcpy(label + _len,
|
||||
input_config_bind_map_get_desc(i),
|
||||
sizeof(label) - _len);
|
||||
|
||||
snprintf(name, sizeof(name), "p%u_%s", user + 1, input_config_bind_map_get_base(i));
|
||||
|
||||
|
17
retroarch.c
17
retroarch.c
@ -6342,22 +6342,19 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
{
|
||||
{
|
||||
char str_output[256];
|
||||
const char *cpu_model = NULL;
|
||||
str_output[0] = '\0';
|
||||
|
||||
cpu_model = frontend_driver_get_cpu_model_name();
|
||||
|
||||
strlcpy(str_output,
|
||||
const char *cpu_model = frontend_driver_get_cpu_model_name();
|
||||
size_t _len = strlcpy(str_output,
|
||||
"=== Build =======================================\n",
|
||||
sizeof(str_output));
|
||||
|
||||
if (!string_is_empty(cpu_model))
|
||||
{
|
||||
size_t _len;
|
||||
/* TODO/FIXME - localize */
|
||||
strlcat(str_output, FILE_PATH_LOG_INFO " CPU Model Name: ",
|
||||
sizeof(str_output));
|
||||
_len = strlcat(str_output, cpu_model, sizeof(str_output));
|
||||
_len += strlcpy(str_output + _len,
|
||||
FILE_PATH_LOG_INFO " CPU Model Name: ",
|
||||
sizeof(str_output) - _len);
|
||||
_len += strlcpy(str_output + _len, cpu_model,
|
||||
sizeof(str_output) - _len);
|
||||
str_output[ _len] = '\n';
|
||||
str_output[++_len] = '\0';
|
||||
}
|
||||
|
@ -4064,12 +4064,13 @@ static bool runloop_path_init_subsystem(runloop_state_t *runloop_st)
|
||||
union string_list_elem_attr attr;
|
||||
char savename[PATH_MAX_LENGTH];
|
||||
char path[PATH_MAX_LENGTH];
|
||||
size_t _len = 0;
|
||||
const struct retro_subsystem_memory_info *mem =
|
||||
(const struct retro_subsystem_memory_info*)
|
||||
&info->roms[i].memory[j];
|
||||
ext[0] = '.';
|
||||
ext[1] = '\0';
|
||||
strlcat(ext, mem->extension, sizeof(ext));
|
||||
ext[ _len] = '.';
|
||||
ext[++_len] = '\0';
|
||||
strlcpy(ext + _len, mem->extension, sizeof(ext) - _len);
|
||||
strlcpy(savename,
|
||||
runloop_st->subsystem_fullpaths->elems[i].data,
|
||||
sizeof(savename));
|
||||
|
Loading…
Reference in New Issue
Block a user