Be consistent with frontend_driver_get_core_extension - core extension

var should at most be 16 chars big, make only one exception once
This commit is contained in:
libretroadmin 2023-08-15 15:01:57 +02:00
parent 1765d491d1
commit 40a0ced947
7 changed files with 65 additions and 88 deletions

View File

@ -948,9 +948,8 @@ bool audio_driver_dsp_filter_init(const char *device)
retro_dsp_filter_t *audio_driver_dsp = NULL; retro_dsp_filter_t *audio_driver_dsp = NULL;
struct string_list *plugs = NULL; struct string_list *plugs = NULL;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN) #if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
char ext_name[32]; char ext_name[16];
char basedir[256]; char basedir[256];
ext_name[0] = '\0';
fill_pathname_basedir(basedir, device, sizeof(basedir)); fill_pathname_basedir(basedir, device, sizeof(basedir));
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return false; return false;

View File

@ -174,11 +174,9 @@ bool core_backup_get_backup_path(
/* Returns detected type of specified core backup file */ /* Returns detected type of specified core backup file */
enum core_backup_type core_backup_get_backup_type(const char *backup_path) enum core_backup_type core_backup_get_backup_type(const char *backup_path)
{ {
char core_ext[16];
const char *backup_ext = NULL; const char *backup_ext = NULL;
struct string_list *metadata_list = NULL; struct string_list *metadata_list = NULL;
char core_ext[255];
core_ext[0] = '\0';
if (string_is_empty(backup_path) || !path_is_valid(backup_path)) if (string_is_empty(backup_path) || !path_is_valid(backup_path))
goto error; goto error;

View File

@ -164,15 +164,12 @@ static void salamander_init(char *s, size_t len)
if (!config_valid) if (!config_valid)
{ {
char executable_name[PATH_MAX_LENGTH]; char core_ext[16];
executable_name[0] = '\0';
/* No config file - search filesystem for /* No config file - search filesystem for
* first available core */ * first available core */
frontend_driver_get_core_extension( frontend_driver_get_core_extension(
executable_name, sizeof(executable_name)); core_ext, sizeof(core_ext));
find_and_set_first_file(s, len, executable_name); find_and_set_first_file(s, len, core_ext);
/* Save result to new config file */ /* Save result to new config file */
if (!string_is_empty(s)) if (!string_is_empty(s))

View File

@ -1574,9 +1574,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
* selection of this core * selection of this core
* 3) Hope that the user does not attempt to * 3) Hope that the user does not attempt to
* load unsupported content... */ * load unsupported content... */
char exts[32]; char exts[16];
exts[0] = '\0';
/* Attempt to identify 'broken' platforms by fetching /* Attempt to identify 'broken' platforms by fetching
* the core file extension - if there is none, then * the core file extension - if there is none, then
* it is impossible for RetroArch to populate a * it is impossible for RetroArch to populate a
@ -14626,8 +14624,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
break; break;
case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE: case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE:
{ {
char ext_names[NAME_MAX_LENGTH]; char ext_names[32];
ext_names[0] = '\0';
info->type_default = FILE_TYPE_SIDELOAD_CORE; info->type_default = FILE_TYPE_SIDELOAD_CORE;
@ -14682,9 +14679,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
menu_entries_clear(info->list); menu_entries_clear(info->list);
{ {
char ext_name[16]; char ext_name[16];
ext_name[0] = '\0';
filebrowser_clear_type(); filebrowser_clear_type();
info->type_default = FILE_TYPE_PLAIN; info->type_default = FILE_TYPE_PLAIN;
if (frontend_driver_get_core_extension( if (frontend_driver_get_core_extension(

View File

@ -9489,10 +9489,7 @@ static bool setting_append_list(
if (frontend_driver_has_fork()) if (frontend_driver_has_fork())
#endif #endif
{ {
char ext_name[255]; char ext_name[16];
ext_name[0] = '\0';
if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
{ {
CONFIG_ACTION( CONFIG_ACTION(
@ -9504,7 +9501,7 @@ static bool setting_append_list(
parent_group); parent_group);
(*list)[list_info->index - 1].size = (uint32_t)path_get_realsize(RARCH_PATH_CORE); (*list)[list_info->index - 1].size = (uint32_t)path_get_realsize(RARCH_PATH_CORE);
(*list)[list_info->index - 1].value.target.string = path_get_ptr(RARCH_PATH_CORE); (*list)[list_info->index - 1].value.target.string = path_get_ptr(RARCH_PATH_CORE);
(*list)[list_info->index - 1].values = ext_name; (*list)[list_info->index - 1].values = ext_name;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_LOAD_CORE); MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_LOAD_CORE);
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_BROWSER_ACTION); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_BROWSER_ACTION);
} }

View File

@ -1368,7 +1368,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char ext_shaders[255]; char ext_shaders[255];
#endif #endif
char ext_name[255]; char ext_name[16];
const char *exts = NULL; const char *exts = NULL;
bool recursive = false; bool recursive = false;
@ -1378,11 +1378,8 @@ struct string_list *dir_list_new_special(const char *input_dir,
exts = filter; exts = filter;
break; break;
case DIR_LIST_CORES: case DIR_LIST_CORES:
ext_name[0] = '\0';
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return NULL; return NULL;
exts = ext_name; exts = ext_name;
break; break;
case DIR_LIST_RECURSIVE: case DIR_LIST_RECURSIVE:
@ -3256,14 +3253,12 @@ bool command_event(enum event_command cmd, void *data)
break; break;
case CMD_EVENT_CORE_INFO_INIT: case CMD_EVENT_CORE_INFO_INIT:
{ {
char ext_name[255]; char ext_name[16];
const char *dir_libretro = settings->paths.directory_libretro; const char *dir_libretro = settings->paths.directory_libretro;
const char *path_libretro_info = settings->paths.path_libretro_info; const char *path_libretro_info = settings->paths.path_libretro_info;
bool show_hidden_files = settings->bools.show_hidden_files; bool show_hidden_files = settings->bools.show_hidden_files;
bool core_info_cache_enable = settings->bools.core_info_cache_enable; bool core_info_cache_enable = settings->bools.core_info_cache_enable;
ext_name[0] = '\0';
command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL); command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL);
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
@ -5473,10 +5468,7 @@ static void retroarch_parse_input_libretro_path(const char *path)
if (!string_is_empty(path_ext)) if (!string_is_empty(path_ext))
{ {
char core_ext[255]; char core_ext[16];
core_ext[0] = '\0';
if ( string_is_empty(settings->paths.directory_libretro) if ( string_is_empty(settings->paths.directory_libretro)
|| !frontend_driver_get_core_extension(core_ext, || !frontend_driver_get_core_extension(core_ext,
sizeof(core_ext)) sizeof(core_ext))

View File

@ -5099,7 +5099,7 @@ void LoadCoreWindow::onLoadCustomCoreClicked()
size_t _len; size_t _len;
QString path; QString path;
QByteArray pathArray; QByteArray pathArray;
char core_ext[32]; char core_ext[16];
char filters[128]; char filters[128];
const char *pathData = NULL; const char *pathData = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();