mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Use snprintf in more situations
This commit is contained in:
parent
2e4b734159
commit
e34c84d791
@ -4015,7 +4015,6 @@ static unsigned menu_displaylist_parse_content_information(
|
|||||||
content_path = loaded_content_path;
|
content_path = loaded_content_path;
|
||||||
core_path = loaded_core_path;
|
core_path = loaded_core_path;
|
||||||
|
|
||||||
if (core_info_find(core_path, &core_info))
|
|
||||||
if (!string_is_empty(core_info->display_name))
|
if (!string_is_empty(core_info->display_name))
|
||||||
strlcpy(core_name, core_info->display_name, sizeof(core_name));
|
strlcpy(core_name, core_info->display_name, sizeof(core_name));
|
||||||
}
|
}
|
||||||
@ -4654,20 +4653,18 @@ static int menu_displaylist_parse_input_description_kbd_list(
|
|||||||
const char *key_label = key_descriptors[i].desc;
|
const char *key_label = key_descriptors[i].desc;
|
||||||
char input_description[256];
|
char input_description[256];
|
||||||
|
|
||||||
input_description[0] = '\0';
|
|
||||||
|
|
||||||
if (string_is_empty(key_label))
|
if (string_is_empty(key_label))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* TODO/FIXME: Localise 'Keyboard' */
|
/* TODO/FIXME: Localise 'Keyboard' */
|
||||||
if (key_id == RETROK_FIRST)
|
if (key_id == RETROK_FIRST)
|
||||||
strcpy_literal(input_description, "---");
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
strcpy_literal(input_description, "Keyboard ");
|
input_description[0] = '\0';
|
||||||
strlcat(input_description, key_label,
|
strcpy_literal(input_description, "---");
|
||||||
sizeof(input_description));
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
snprintf(input_description, sizeof(input_description),
|
||||||
|
"Keyboard %s", key_label);
|
||||||
|
|
||||||
/* Add menu entry */
|
/* Add menu entry */
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
@ -9287,15 +9284,11 @@ unsigned menu_displaylist_netplay_refresh_rooms(file_list_t *list)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < netplay_room_count; i++)
|
for (i = 0; i < netplay_room_count; i++)
|
||||||
{
|
{
|
||||||
char country[PATH_MAX_LENGTH] = {0};
|
char country[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
if (*netplay_room_list[i].country)
|
if (*netplay_room_list[i].country)
|
||||||
{
|
snprintf(country, sizeof(country),
|
||||||
strcpy_literal(country, "(");
|
"(%s)", netplay_room_list[i].country);
|
||||||
strlcat(country, netplay_room_list[i].country,
|
|
||||||
sizeof(country));
|
|
||||||
strlcat(country, ")", sizeof(country));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Uncomment this to debug mismatched room parameters*/
|
/* Uncomment this to debug mismatched room parameters*/
|
||||||
#if 0
|
#if 0
|
||||||
@ -9734,11 +9727,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
if (!string_is_empty(cd_info.title))
|
if (!string_is_empty(cd_info.title))
|
||||||
{
|
{
|
||||||
char title[256];
|
char title[256];
|
||||||
|
snprintf(title, sizeof(title), "Title: %s", cd_info.title);
|
||||||
title[0] = '\0';
|
|
||||||
|
|
||||||
strcpy_literal(title, "Title: ");
|
|
||||||
strlcat(title, cd_info.title, sizeof(title));
|
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
title,
|
title,
|
||||||
@ -9751,11 +9740,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
if (!string_is_empty(cd_info.system))
|
if (!string_is_empty(cd_info.system))
|
||||||
{
|
{
|
||||||
char system[256];
|
char system[256];
|
||||||
|
snprintf(system, sizeof(system), "System: %s", cd_info.system);
|
||||||
system[0] = '\0';
|
|
||||||
|
|
||||||
strcpy_literal(system, "System: ");
|
|
||||||
strlcat(system, cd_info.system, sizeof(system));
|
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
system,
|
system,
|
||||||
@ -9768,12 +9753,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
if (!string_is_empty(cd_info.serial))
|
if (!string_is_empty(cd_info.serial))
|
||||||
{
|
{
|
||||||
char serial[256];
|
char serial[256];
|
||||||
|
|
||||||
serial[0] = '\0';
|
|
||||||
|
|
||||||
snprintf(serial, sizeof(serial),
|
snprintf(serial, sizeof(serial),
|
||||||
"%s#: ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL));
|
"%s#: %s",
|
||||||
strlcat(serial, cd_info.serial, sizeof(serial));
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL),
|
||||||
|
cd_info.serial
|
||||||
|
);
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
serial,
|
serial,
|
||||||
@ -9786,9 +9770,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
if (!string_is_empty(cd_info.version))
|
if (!string_is_empty(cd_info.version))
|
||||||
{
|
{
|
||||||
char version[256];
|
char version[256];
|
||||||
|
|
||||||
version[0] = '\0';
|
|
||||||
|
|
||||||
snprintf(version, sizeof(version),
|
snprintf(version, sizeof(version),
|
||||||
"%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION), cd_info.version);
|
"%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE_VERSION), cd_info.version);
|
||||||
|
|
||||||
@ -9803,11 +9784,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
if (!string_is_empty(cd_info.release_date))
|
if (!string_is_empty(cd_info.release_date))
|
||||||
{
|
{
|
||||||
char release_date[256];
|
char release_date[256];
|
||||||
|
snprintf(release_date, sizeof(release_date),
|
||||||
release_date[0] = '\0';
|
"Release Date: %s", cd_info.release_date);
|
||||||
|
|
||||||
strcpy_literal(release_date, "Release Date: ");
|
|
||||||
strlcat(release_date, cd_info.release_date, sizeof(release_date));
|
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
release_date,
|
release_date,
|
||||||
@ -9817,19 +9795,24 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (atip)
|
||||||
{
|
{
|
||||||
char atip_string[32] = {"Genuine Disc: "};
|
const char *atip_string = "Genuine Disc: No";
|
||||||
|
|
||||||
if (atip)
|
|
||||||
strlcat(atip_string, "No", sizeof(atip_string));
|
|
||||||
else
|
|
||||||
strlcat(atip_string, "Yes", sizeof(atip_string));
|
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
atip_string,
|
atip_string,
|
||||||
"",
|
"",
|
||||||
MSG_UNKNOWN,
|
MSG_UNKNOWN,
|
||||||
FILE_TYPE_NONE, 0, 0))
|
FILE_TYPE_NONE, 0, 0))
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *atip_string = "Genuine Disc: Yes";
|
||||||
|
if (menu_entries_append_enum(info->list,
|
||||||
|
atip_string,
|
||||||
|
"",
|
||||||
|
MSG_UNKNOWN,
|
||||||
|
FILE_TYPE_NONE, 0, 0))
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10079,8 +10062,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
fgets(current_profile, PATH_MAX_LENGTH, profile);
|
fgets(current_profile, PATH_MAX_LENGTH, profile);
|
||||||
pclose(profile);
|
pclose(profile);
|
||||||
|
|
||||||
strcpy_literal(text, "Current profile : ");
|
snprintf(text, sizeof(text),
|
||||||
strlcat(text, current_profile, sizeof(text));
|
"Current profile: %s", current_profile);
|
||||||
#else
|
#else
|
||||||
u32 currentClock = 0;
|
u32 currentClock = 0;
|
||||||
if (hosversionBefore(8, 0, 0))
|
if (hosversionBefore(8, 0, 0))
|
||||||
@ -10103,11 +10086,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
|
|
||||||
for (i = 0; i < profiles_count; i++)
|
for (i = 0; i < profiles_count; i++)
|
||||||
{
|
{
|
||||||
|
char title[PATH_MAX_LENGTH];
|
||||||
char* profile = SWITCH_CPU_PROFILES[i];
|
char* profile = SWITCH_CPU_PROFILES[i];
|
||||||
char* speed = SWITCH_CPU_SPEEDS[i];
|
char* speed = SWITCH_CPU_SPEEDS[i];
|
||||||
|
|
||||||
char title[PATH_MAX_LENGTH] = {0};
|
|
||||||
|
|
||||||
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
|
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list,
|
if (menu_entries_append_enum(info->list,
|
||||||
@ -10141,17 +10123,17 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
|
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||||
|
|
||||||
strcpy_literal(text, "Current profile : ");
|
snprintf(text, sizeof(text),
|
||||||
strlcat(text, current_profile, sizeof(text));
|
"Current profile : %s", current_profile);
|
||||||
|
|
||||||
if (menu_entries_append_enum(info->list, text, "", 0, MENU_INFO_MESSAGE, 0, 0))
|
if (menu_entries_append_enum(info->list, text, "", 0, MENU_INFO_MESSAGE, 0, 0))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
for (i = 0; i < profiles_count; i++)
|
for (i = 0; i < profiles_count; i++)
|
||||||
{
|
{
|
||||||
|
char title[PATH_MAX_LENGTH];
|
||||||
char* profile = SWITCH_GPU_PROFILES[i];
|
char* profile = SWITCH_GPU_PROFILES[i];
|
||||||
char* speed = SWITCH_GPU_SPEEDS[i];
|
char* speed = SWITCH_GPU_SPEEDS[i];
|
||||||
char title[PATH_MAX_LENGTH] = {0};
|
|
||||||
|
|
||||||
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
|
snprintf(title, sizeof(title), "%s (%s)", profile, speed);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user