mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Try to reduce fixed size char arrays from PATH_MAX_LENGTH to lower sizes (#14062)
* Try to reduce fixed size char arrays from PATH_MAX_LENGTH to lower sizes
This commit is contained in:
parent
9a1f678e31
commit
4a38831c47
@ -917,8 +917,8 @@ bool audio_driver_dsp_filter_init(const char *device)
|
||||
retro_dsp_filter_t *audio_driver_dsp = NULL;
|
||||
struct string_list *plugs = NULL;
|
||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
char ext_name[32];
|
||||
char basedir[256];
|
||||
|
||||
basedir[0] = ext_name[0] = '\0';
|
||||
|
||||
@ -1350,9 +1350,9 @@ static void audio_driver_load_menu_bgm_callback(retro_task_t *task,
|
||||
|
||||
void audio_driver_load_system_sounds(void)
|
||||
{
|
||||
char basename_noext[256];
|
||||
char sounds_path[PATH_MAX_LENGTH];
|
||||
char sounds_fallback_path[PATH_MAX_LENGTH];
|
||||
char basename_noext[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *dir_assets = settings->paths.directory_assets;
|
||||
const bool audio_enable_menu = settings->bools.audio_enable_menu;
|
||||
|
51
command.c
51
command.c
@ -1232,8 +1232,8 @@ void command_event_load_auto_state(void)
|
||||
void command_event_set_savestate_auto_index(settings_t *settings)
|
||||
{
|
||||
size_t i;
|
||||
char state_base[128];
|
||||
char state_dir[PATH_MAX_LENGTH];
|
||||
char state_base[PATH_MAX_LENGTH];
|
||||
|
||||
struct string_list *dir_list = NULL;
|
||||
unsigned max_idx = 0;
|
||||
@ -1301,7 +1301,7 @@ void command_event_set_savestate_garbage_collect(
|
||||
{
|
||||
size_t i, cnt = 0;
|
||||
char state_dir[PATH_MAX_LENGTH];
|
||||
char state_base[PATH_MAX_LENGTH];
|
||||
char state_base[128];
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
|
||||
struct string_list *dir_list = NULL;
|
||||
@ -1394,14 +1394,10 @@ bool command_set_shader(command_t *cmd, const char *arg)
|
||||
/* rebase on shader directory */
|
||||
if (!path_is_absolute(arg))
|
||||
{
|
||||
static char abs_arg[PATH_MAX_LENGTH];
|
||||
char abs_arg[PATH_MAX_LENGTH];
|
||||
const char *ref_path = settings->paths.directory_video_shader;
|
||||
fill_pathname_join(abs_arg,
|
||||
ref_path, arg, sizeof(abs_arg));
|
||||
/* TODO/FIXME - pointer to local variable -
|
||||
* making abs_arg static for now to workaround this
|
||||
*/
|
||||
arg = abs_arg;
|
||||
fill_pathname_join(abs_arg, ref_path, arg, sizeof(abs_arg));
|
||||
return apply_shader(settings, type, abs_arg, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1415,10 +1411,10 @@ bool command_event_save_core_config(
|
||||
const char *rarch_path_config)
|
||||
{
|
||||
char msg[128];
|
||||
char config_name[PATH_MAX_LENGTH];
|
||||
char config_name[255];
|
||||
char config_path[PATH_MAX_LENGTH];
|
||||
char config_dir[PATH_MAX_LENGTH];
|
||||
bool found_path = false;
|
||||
bool new_path_available = false;
|
||||
bool overrides_active = false;
|
||||
const char *core_path = NULL;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
@ -1447,40 +1443,33 @@ bool command_event_save_core_config(
|
||||
if (path_is_valid(core_path))
|
||||
{
|
||||
unsigned i;
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
RARCH_LOG("[Config]: %s\n", msg_hash_to_str(MSG_USING_CORE_NAME_FOR_NEW_CONFIG));
|
||||
|
||||
fill_pathname_base_noext(
|
||||
config_name,
|
||||
core_path,
|
||||
sizeof(config_name));
|
||||
fill_pathname_join(config_path, config_dir, config_name,
|
||||
sizeof(config_path));
|
||||
|
||||
/* In case of collision, find an alternative name. */
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
char tmp[64];
|
||||
|
||||
fill_pathname_base_noext(
|
||||
config_name,
|
||||
core_path,
|
||||
sizeof(config_name));
|
||||
|
||||
fill_pathname_join(config_path, config_dir, config_name,
|
||||
sizeof(config_path));
|
||||
|
||||
if (i)
|
||||
snprintf(tmp, sizeof(tmp), "-%u.cfg", i);
|
||||
snprintf(tmp, sizeof(tmp), "%s-%u.cfg", config_path, i);
|
||||
else
|
||||
{
|
||||
tmp[0] = '\0';
|
||||
strlcpy(tmp, ".cfg", sizeof(tmp));
|
||||
}
|
||||
snprintf(tmp, sizeof(tmp), "%s.cfg", config_path);
|
||||
|
||||
strlcat(config_path, tmp, sizeof(config_path));
|
||||
|
||||
if (!path_is_valid(config_path))
|
||||
if (!path_is_valid(tmp))
|
||||
{
|
||||
found_path = true;
|
||||
new_path_available = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_path)
|
||||
if (!new_path_available)
|
||||
{
|
||||
/* Fallback to system time... */
|
||||
RARCH_WARN("[Config]: %s\n",
|
||||
|
@ -151,7 +151,7 @@ typedef struct
|
||||
char name[256];
|
||||
char display_name[256];
|
||||
char config_path[PATH_MAX_LENGTH]; /* Path to the RetroArch config file */
|
||||
char config_name[PATH_MAX_LENGTH]; /* Base name of the RetroArch config file */
|
||||
char config_name[256]; /* Base name of the RetroArch config file */
|
||||
bool autoconfigured;
|
||||
} input_device_info_t;
|
||||
|
||||
|
@ -383,7 +383,7 @@ void net_http_urlencode_full(char *dest,
|
||||
{
|
||||
size_t buf_pos = 0;
|
||||
char *tmp = NULL;
|
||||
char url_domain[PATH_MAX_LENGTH] = {0};
|
||||
char url_domain[256] = {0};
|
||||
char url_path[PATH_MAX_LENGTH] = {0};
|
||||
int count = 0;
|
||||
|
||||
|
@ -2153,7 +2153,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
}
|
||||
else if (!string_is_empty(info->path))
|
||||
{
|
||||
char lpl_basename[PATH_MAX_LENGTH];
|
||||
char lpl_basename[256];
|
||||
lpl_basename[0] = '\0';
|
||||
|
||||
fill_pathname_base_noext(lpl_basename, info->path, sizeof(lpl_basename));
|
||||
@ -3282,8 +3282,8 @@ static int menu_displaylist_parse_horizontal_list(
|
||||
|
||||
if (!string_is_empty(item->path))
|
||||
{
|
||||
char lpl_basename[256];
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
char lpl_basename[PATH_MAX_LENGTH];
|
||||
const char *dir_playlist = settings->paths.directory_playlist;
|
||||
|
||||
lpl_basename[0] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user