mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(menu_setting.c) Replace trivial usage of snprintf with strlcpy (where it only printed a
string and nothing else, or similar simple usage)
This commit is contained in:
parent
ee16c4558d
commit
d67cb22c7f
@ -736,10 +736,10 @@ static void setting_get_string_representation_uint_as_enum(
|
||||
rarch_setting_t *setting, char *s, size_t len)
|
||||
{
|
||||
if (setting)
|
||||
snprintf(s, len, "%s",
|
||||
strlcpy(s,
|
||||
msg_hash_to_str((enum msg_hash_enums)(
|
||||
setting->index_offset+(
|
||||
*setting->value.target.unsigned_integer))));
|
||||
*setting->value.target.unsigned_integer))), len);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -984,10 +984,12 @@ static void setting_get_string_representation_int_gpu_index(rarch_setting_t *set
|
||||
{
|
||||
struct string_list *list = video_driver_get_gpu_api_devices(video_context_driver_get_api());
|
||||
|
||||
snprintf(s, len, "%d", *setting->value.target.integer);
|
||||
if (list && (*setting->value.target.integer < (int)list->size) && !string_is_empty(list->elems[*setting->value.target.integer].data))
|
||||
snprintf(s, len, "%d - %s", *setting->value.target.integer, list->elems[*setting->value.target.integer].data);
|
||||
else
|
||||
snprintf(s, len, "%d", *setting->value.target.integer);
|
||||
{
|
||||
strlcat(s, " - ", len);
|
||||
strlcat(s, list->elems[*setting->value.target.integer].data, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6620,8 +6622,10 @@ static void setting_get_string_representation_uint_autosave_interval(
|
||||
return;
|
||||
|
||||
if (*setting->value.target.unsigned_integer)
|
||||
snprintf(s, len, "%u %s",
|
||||
*setting->value.target.unsigned_integer, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS));
|
||||
{
|
||||
snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len);
|
||||
}
|
||||
else
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
|
||||
}
|
||||
@ -6947,9 +6951,10 @@ static void setting_get_string_representation_uint_menu_screensaver_timeout(
|
||||
if (*setting->value.target.unsigned_integer == 0)
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
|
||||
else
|
||||
snprintf(s, len, "%u %s",
|
||||
*setting->value.target.unsigned_integer,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS));
|
||||
{
|
||||
snprintf(s, len, "%u ", *setting->value.target.unsigned_integer);
|
||||
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SECONDS), len);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_MATERIALUI) || defined(HAVE_XMB) || defined(HAVE_OZONE)
|
||||
@ -7692,9 +7697,8 @@ static void get_string_representation_mouse_index(rarch_setting_t *setting, char
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
map);
|
||||
else
|
||||
snprintf(s, len,
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE));
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DONT_CARE), len);
|
||||
}
|
||||
else
|
||||
snprintf(s, len,
|
||||
@ -8863,24 +8867,24 @@ static bool setting_append_list_input_player_options(
|
||||
snprintf(split_joycon_lbl[user], sizeof(label[user]),
|
||||
"%s %u", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_SPLIT_JOYCON), user + 1);
|
||||
|
||||
snprintf(label[user], sizeof(label[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX));
|
||||
snprintf(label_analog[user], sizeof(label_analog[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE));
|
||||
snprintf(label_bind_all[user], sizeof(label_bind_all[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL));
|
||||
snprintf(label_bind_defaults[user], sizeof(label_bind_defaults[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL));
|
||||
snprintf(label_bind_all_save_autoconfig[user], sizeof(label_bind_all_save_autoconfig[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG));
|
||||
snprintf(label_mouse_index[user], sizeof(label_mouse_index[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX));
|
||||
strlcpy(label[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_INDEX),
|
||||
sizeof(label[user]));
|
||||
strlcpy(label_analog[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ADC_TYPE),
|
||||
sizeof(label_analog[user]));
|
||||
strlcpy(label_bind_all[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_ALL),
|
||||
sizeof(label_bind_all[user]));
|
||||
strlcpy(label_bind_defaults[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_BIND_DEFAULT_ALL),
|
||||
sizeof(label_bind_defaults[user]));
|
||||
strlcpy(label_bind_all_save_autoconfig[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_SAVE_AUTOCONFIG),
|
||||
sizeof(label_bind_all_save_autoconfig[user]));
|
||||
strlcpy(label_mouse_index[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_MOUSE_INDEX),
|
||||
sizeof(label_mouse_index[user]));
|
||||
|
||||
CONFIG_UINT_ALT(
|
||||
list, list_info,
|
||||
@ -9112,9 +9116,9 @@ static bool setting_append_list_input_libretro_device_options(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_LIBRETRO_DEVICE),
|
||||
user + 1);
|
||||
|
||||
snprintf(label_device_type[user], sizeof(label_device_type[user]),
|
||||
"%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE));
|
||||
strlcpy(label_device_type[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_DEVICE_TYPE),
|
||||
sizeof(label_device_type[user]));
|
||||
|
||||
CONFIG_UINT_ALT(
|
||||
list, list_info,
|
||||
@ -9178,8 +9182,9 @@ static bool setting_append_list_input_remap_port_options(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_REMAP_PORT),
|
||||
user + 1);
|
||||
|
||||
snprintf(label_port[user], sizeof(label_port[user]), "%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_PORT));
|
||||
strlcpy(label_port[user],
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_REMAP_PORT),
|
||||
sizeof(label_port[user]));
|
||||
|
||||
CONFIG_UINT_ALT(
|
||||
list, list_info,
|
||||
|
Loading…
x
Reference in New Issue
Block a user