mirror of
https://github.com/libretro/RetroArch
synced 2025-03-19 16:21:30 +00:00
menu_cbs) sublabel/title - replace some strlcat calls
This commit is contained in:
parent
97deec44f4
commit
2b273697c8
@ -86,7 +86,8 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
|
||||
s[_len ] = ':';
|
||||
s[_len+1] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
strlcat(s, tmp, len);
|
||||
_len += 2;
|
||||
strlcpy(s + _len, tmp, len - _len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -96,7 +97,8 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
|
||||
s[_len ] = ':';
|
||||
s[_len+1] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);
|
||||
_len += 2;
|
||||
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -1840,10 +1842,10 @@ static int action_bind_sublabel_playlist_entry(
|
||||
|
||||
/* Only add sublabel if a core is currently assigned
|
||||
* > Both core name and core path must be valid */
|
||||
if ( string_is_empty(entry->core_name) ||
|
||||
string_is_equal(entry->core_name, "DETECT") ||
|
||||
string_is_empty(entry->core_path) ||
|
||||
string_is_equal(entry->core_path, "DETECT"))
|
||||
if ( string_is_empty(entry->core_name)
|
||||
|| string_is_equal(entry->core_name, "DETECT")
|
||||
|| string_is_empty(entry->core_path)
|
||||
|| string_is_equal(entry->core_path, "DETECT"))
|
||||
return 0;
|
||||
|
||||
/* Add core name */
|
||||
@ -1855,20 +1857,20 @@ static int action_bind_sublabel_playlist_entry(
|
||||
|
||||
/* Get runtime info *if* required runtime log is enabled
|
||||
* *and* this is a valid playlist type */
|
||||
if (((playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE) &&
|
||||
!content_runtime_log) ||
|
||||
((playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_AGGREGATE) &&
|
||||
!content_runtime_log_aggregate))
|
||||
if ( ((playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE)
|
||||
&& !content_runtime_log)
|
||||
|| ((playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_AGGREGATE)
|
||||
&& !content_runtime_log_aggregate))
|
||||
return 0;
|
||||
|
||||
/* Note: This looks heavy, but each string_is_equal() call will
|
||||
* return almost immediately */
|
||||
if (!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)) &&
|
||||
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)) &&
|
||||
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST)) &&
|
||||
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB)) &&
|
||||
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) &&
|
||||
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)))
|
||||
if ( !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY))
|
||||
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB))
|
||||
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST))
|
||||
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_FAVORITES_TAB))
|
||||
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST))
|
||||
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_HORIZONTAL_MENU)))
|
||||
return 0;
|
||||
|
||||
/* Check whether runtime info should be loaded from log file */
|
||||
|
@ -75,7 +75,8 @@
|
||||
s[_len ] = ':'; \
|
||||
s[_len+1] = ' '; \
|
||||
s[_len+2] = '\0'; \
|
||||
strlcat(s, path, len); \
|
||||
_len += 2; \
|
||||
strlcpy(s + _len, path, len - _len); \
|
||||
} \
|
||||
return 1; \
|
||||
}
|
||||
@ -114,7 +115,10 @@ static void action_get_title_fill_path_search_filter_default(
|
||||
s[_len ] = ' ';
|
||||
s[_len+1] = '\0';
|
||||
if (!string_is_empty(path))
|
||||
strlcat(s, path, len);
|
||||
{
|
||||
_len += 2;
|
||||
strlcpy(s + _len, path, len - _len);
|
||||
}
|
||||
|
||||
menu_entries_search_append_terms_string(s, len);
|
||||
}
|
||||
@ -427,18 +431,19 @@ static int action_get_title_deferred_core_backup_list(
|
||||
s[_len ] = ':';
|
||||
s[_len+1] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
_len += 2;
|
||||
|
||||
/* Search for specified core
|
||||
* > If core is found, add display name */
|
||||
if (core_info_find(core_path, &core_info) &&
|
||||
core_info->display_name)
|
||||
strlcat(s, core_info->display_name, len);
|
||||
strlcpy(s + _len, core_info->display_name, len - _len);
|
||||
else
|
||||
{
|
||||
/* > If not, use core file name */
|
||||
const char *core_filename = path_basename_nocompression(core_path);
|
||||
if (!string_is_empty(core_filename))
|
||||
strlcat(s, core_filename, len);
|
||||
strlcpy(s + _len, core_filename, len - _len);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -507,7 +512,8 @@ static int action_get_core_information_steam_list(
|
||||
s[_len+1] = '-';
|
||||
s[_len+2] = ' ';
|
||||
s[_len+3] = '\0';
|
||||
strlcat(s, path, len);
|
||||
_len += 3;
|
||||
strlcpy(s + _len, path, len - _len);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -820,7 +826,8 @@ static int action_get_title_generic(char *s, size_t len,
|
||||
s[_len ] = ':';
|
||||
s[_len+1] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
strlcat(s, path_basename(elem0_path), len);
|
||||
_len += 2;
|
||||
strlcpy(s + _len, path_basename(elem0_path), len - _len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -855,8 +862,9 @@ static int action_get_sideload_core_list(const char *path, const char *label,
|
||||
size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST), len);
|
||||
s[_len ] = ' ';
|
||||
s[_len+1] = '\0';
|
||||
_len += 2;
|
||||
if (!string_is_empty(path))
|
||||
strlcat(s, path, len);
|
||||
strlcpy(s + _len, path, len - _len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -870,7 +878,8 @@ static int action_get_title_default(const char *path, const char *label,
|
||||
s[_len ] = ':';
|
||||
s[_len+1] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
strlcat(s, path, len);
|
||||
_len += 2;
|
||||
strlcpy(s + _len, path, len - _len);
|
||||
}
|
||||
|
||||
menu_entries_search_append_terms_string(s, len);
|
||||
@ -944,7 +953,8 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
s[_len+1] = '-';
|
||||
s[_len+2] = ' ';
|
||||
s[_len+2] = '\0';
|
||||
strlcat(s, elem1, len);
|
||||
_len += 3;
|
||||
strlcpy(s + _len, elem1, len - _len);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user