* PATH_MAX_LENGTH redefined from 4096 to 2048

* Massive reduction in heap space allocation, going from settings struct
264kb to 119Kb
* Use NAME_MAX_LENGTH for base paths/names, etc
* Use DIR_MAX_LENGTH for directory sizes
This commit is contained in:
libretroadmin 2024-09-09 05:47:32 +02:00
parent 01a9745f5b
commit b8391e233f
74 changed files with 1422 additions and 1391 deletions

View File

@ -44,7 +44,7 @@ For POD-types, try to order structs as follows (first to last):
bool fuzzy_archive_match;
bool autofix_paths;
char path[PATH_MAX_LENGTH];
char base_content_directory[PATH_MAX_LENGTH];
char base_content_directory[DIR_MAX_LENGTH];
} playlist_config_t;
size_t has the biggest alignment here, so 'struct playlist_config_t'

View File

@ -23,6 +23,7 @@
#include <string/stdstring.h>
#include <encodings/utf.h>
#include <retro_miscellaneous.h>
#include <clamping.h>
#include <memalign.h>
#include <audio/conversion/float_to_s16.h>
@ -950,7 +951,7 @@ bool audio_driver_dsp_filter_init(const char *device)
struct string_list *plugs = NULL;
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
char ext_name[16];
char basedir[256];
char basedir[NAME_MAX_LENGTH];
fill_pathname_basedir(basedir, device, sizeof(basedir));
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
return false;
@ -1329,7 +1330,7 @@ static void audio_driver_load_menu_bgm_callback(retro_task_t *task,
void audio_driver_load_system_sounds(void)
{
char basename_noext[256];
char basename_noext[NAME_MAX_LENGTH];
char sounds_path[PATH_MAX_LENGTH];
char sounds_fallback_path[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();

View File

@ -67,7 +67,7 @@ typedef struct video4linux
uint32_t *buffer_output;
bool ready;
char dev_name[255];
char dev_name[NAME_MAX_LENGTH];
} video4linux_t;
static int xioctl(int fd, unsigned long request, void *args)

View File

@ -1450,7 +1450,7 @@ static void scan_states(settings_t *settings,
size_t i, cnt = 0;
size_t cnt_in_range = 0;
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
/* Base name of 128 may be too short for some (<<1%) of the
tosec-based file names, but in practice truncating will not
lead to mismatch */
@ -1699,7 +1699,7 @@ void command_event_set_replay_auto_index(settings_t *settings)
{
size_t i;
char state_base[128];
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
struct string_list *dir_list = NULL;
unsigned max_idx = 0;
@ -1766,7 +1766,7 @@ void command_event_set_replay_garbage_collect(
{
/* TODO: debugme */
size_t i, cnt = 0;
char state_dir[PATH_MAX_LENGTH];
char state_dir[DIR_MAX_LENGTH];
char state_base[128];
runloop_state_t *runloop_st = runloop_state_get_ptr();
@ -1873,9 +1873,9 @@ bool command_event_save_core_config(
const char *rarch_path_config)
{
char msg[128];
char config_name[255];
char config_path[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
char config_name[NAME_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
bool new_path_available = false;
bool overrides_active = false;
const char *core_path = NULL;

View File

@ -3425,7 +3425,7 @@ static config_file_t *open_default_config_file(void)
if (!conf && has_application_data)
{
bool dir_created = false;
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
/* Try to create a new config file. */
fill_pathname_basedir(basedir, application_data, sizeof(basedir));
fill_pathname_join_special(conf_path, application_data,
@ -4294,8 +4294,8 @@ bool config_load_override(void *data)
char core_path[PATH_MAX_LENGTH];
char game_path[PATH_MAX_LENGTH];
char content_path[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
bool should_append = false;
bool show_notification = true;
rarch_system_info_t *sys_info = (rarch_system_info_t*)data;
@ -4478,7 +4478,7 @@ bool config_load_override(void *data)
bool config_load_override_file(const char *config_path)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
bool should_append = false;
bool show_notification = true;
settings_t *settings = config_st;
@ -4594,7 +4594,7 @@ bool config_unload_override(void)
bool config_load_remap(const char *directory_input_remapping,
void *data)
{
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
/* final path for core-specific configuration (prefix+suffix) */
char core_path[PATH_MAX_LENGTH];
/* final path for game-specific configuration (prefix+suffix) */
@ -5455,9 +5455,9 @@ int8_t config_save_overrides(enum override_type type,
struct config_array_setting *array_overrides= NULL;
struct config_path_setting *path_settings = NULL;
struct config_path_setting *path_overrides = NULL;
char config_directory[PATH_MAX_LENGTH];
char override_directory[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char override_directory[DIR_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char override_path[PATH_MAX_LENGTH];
settings_t *overrides = config_st;
int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder);
@ -5994,7 +5994,7 @@ bool input_remapping_save_file(const char *path)
size_t _len;
bool ret;
unsigned i, j;
char remap_file_dir[PATH_MAX_LENGTH];
char remap_file_dir[DIR_MAX_LENGTH];
char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][8] =
{
"b", "y", "select", "start",

View File

@ -465,10 +465,8 @@ typedef struct settings
char cloud_sync_driver[32];
char menu_driver[32];
char cheevos_username[32];
char cheevos_password[256];
char cheevos_token[32];
char cheevos_leaderboards_enable[32];
char cheevos_custom_host[64];
char video_context_driver[32];
char audio_driver[32];
char audio_resampler[32];
@ -477,43 +475,46 @@ typedef struct settings
char midi_driver[32];
char midi_input[32];
char midi_output[32];
char input_keyboard_layout[64];
#ifdef HAVE_LAKKA
char cpu_main_gov[32];
char cpu_menu_gov[32];
#endif
#ifdef HAVE_MICROPHONE
char microphone_driver[32];
char microphone_resampler[32];
char microphone_device[255];
#endif
char input_keyboard_layout[64];
char cheevos_custom_host[64];
#ifdef HAVE_LAKKA
char timezone[TIMEZONE_LENGTH];
#endif
char cheevos_password[NAME_MAX_LENGTH];
#ifdef HAVE_MICROPHONE
char microphone_device[NAME_MAX_LENGTH];
#endif
#ifdef ANDROID
char input_android_physical_keyboard[255];
char input_android_physical_keyboard[NAME_MAX_LENGTH];
#endif
char audio_device[NAME_MAX_LENGTH];
char camera_device[NAME_MAX_LENGTH];
char netplay_mitm_server[NAME_MAX_LENGTH];
char webdav_url[NAME_MAX_LENGTH];
char webdav_username[NAME_MAX_LENGTH];
char webdav_password[NAME_MAX_LENGTH];
char input_reserved_devices[MAX_USERS][255];
char audio_device[255];
char camera_device[255];
char netplay_mitm_server[255];
char crt_switch_timings[NAME_MAX_LENGTH];
char translation_service_url[2048];
char webdav_url[255];
char webdav_username[255];
char webdav_password[255];
char youtube_stream_key[PATH_MAX_LENGTH];
char twitch_stream_key[PATH_MAX_LENGTH];
char facebook_stream_key[PATH_MAX_LENGTH];
char discord_app_id[PATH_MAX_LENGTH];
char ai_service_url[PATH_MAX_LENGTH];
char crt_switch_timings[255];
#ifdef HAVE_LAKKA
char timezone[TIMEZONE_LENGTH];
char cpu_main_gov[32];
char cpu_menu_gov[32];
#endif
char input_reserved_devices[MAX_USERS][NAME_MAX_LENGTH];
} arrays;
struct
@ -525,18 +526,49 @@ typedef struct settings
char netplay_password[128];
char netplay_spectate_password[128];
char netplay_server[255];
char netplay_custom_mitm_server[255];
char network_buildbot_url[255];
char network_buildbot_assets_url[255];
char netplay_server[NAME_MAX_LENGTH];
char netplay_custom_mitm_server[NAME_MAX_LENGTH];
char network_buildbot_url[NAME_MAX_LENGTH];
char network_buildbot_assets_url[NAME_MAX_LENGTH];
char browse_url[4096];
char streaming_title[512];
char path_stream_url[8192];
char bundle_assets_dst_subdir[DIR_MAX_LENGTH];
char directory_audio_filter[DIR_MAX_LENGTH];
char directory_autoconfig[DIR_MAX_LENGTH];
char directory_video_filter[DIR_MAX_LENGTH];
char directory_video_shader[DIR_MAX_LENGTH];
char directory_libretro[DIR_MAX_LENGTH];
char directory_input_remapping[DIR_MAX_LENGTH];
char directory_overlay[DIR_MAX_LENGTH];
char directory_osk_overlay[DIR_MAX_LENGTH];
char directory_screenshot[DIR_MAX_LENGTH];
char directory_system[DIR_MAX_LENGTH];
char directory_cache[DIR_MAX_LENGTH];
char directory_playlist[DIR_MAX_LENGTH];
char directory_content_favorites[DIR_MAX_LENGTH];
char directory_content_history[DIR_MAX_LENGTH];
char directory_content_image_history[DIR_MAX_LENGTH];
char directory_content_music_history[DIR_MAX_LENGTH];
char directory_content_video_history[DIR_MAX_LENGTH];
char directory_runtime_log[DIR_MAX_LENGTH];
char directory_core_assets[DIR_MAX_LENGTH];
char directory_assets[DIR_MAX_LENGTH];
char directory_dynamic_wallpapers[DIR_MAX_LENGTH];
char directory_thumbnails[DIR_MAX_LENGTH];
char directory_menu_config[DIR_MAX_LENGTH];
char directory_menu_content[DIR_MAX_LENGTH];
#ifdef _3DS
char directory_bottom_assets[DIR_MAX_LENGTH];
#endif
#ifdef HAVE_TEST_DRIVERS
char test_input_file_joypad[PATH_MAX_LENGTH];
char test_input_file_general[PATH_MAX_LENGTH];
#endif
char log_dir[DIR_MAX_LENGTH];
char bundle_assets_src[PATH_MAX_LENGTH];
char bundle_assets_dst[PATH_MAX_LENGTH];
char bundle_assets_dst_subdir[PATH_MAX_LENGTH];
char path_menu_xmb_font[PATH_MAX_LENGTH];
char menu_content_show_settings_password[PATH_MAX_LENGTH];
char kiosk_mode_password[PATH_MAX_LENGTH];
@ -560,40 +592,11 @@ typedef struct settings
char path_font[PATH_MAX_LENGTH];
char path_rgui_theme_preset[PATH_MAX_LENGTH];
char directory_audio_filter[PATH_MAX_LENGTH];
char directory_autoconfig[PATH_MAX_LENGTH];
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];
char directory_overlay[PATH_MAX_LENGTH];
char directory_osk_overlay[PATH_MAX_LENGTH];
char directory_screenshot[PATH_MAX_LENGTH];
char directory_system[PATH_MAX_LENGTH];
char directory_cache[PATH_MAX_LENGTH];
char directory_playlist[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_image_history[PATH_MAX_LENGTH];
char directory_content_music_history[PATH_MAX_LENGTH];
char directory_content_video_history[PATH_MAX_LENGTH];
char directory_runtime_log[PATH_MAX_LENGTH];
char directory_core_assets[PATH_MAX_LENGTH];
char directory_assets[PATH_MAX_LENGTH];
char directory_dynamic_wallpapers[PATH_MAX_LENGTH];
char directory_thumbnails[PATH_MAX_LENGTH];
char directory_menu_config[PATH_MAX_LENGTH];
char directory_menu_content[PATH_MAX_LENGTH];
char streaming_title[PATH_MAX_LENGTH];
#ifdef _3DS
char directory_bottom_assets[PATH_MAX_LENGTH];
#endif
#ifdef HAVE_TEST_DRIVERS
char test_input_file_joypad[PATH_MAX_LENGTH];
char test_input_file_general[PATH_MAX_LENGTH];
#endif
char log_dir[PATH_MAX_LENGTH];
char app_icon[PATH_MAX_LENGTH];
char browse_url[4096];
char path_stream_url[8192];
} paths;

View File

@ -120,8 +120,8 @@ bool core_backup_get_backup_path(
time_t current_time;
struct tm time_info;
const char *core_filename = NULL;
char core_dir[PATH_MAX_LENGTH];
char backup_dir[PATH_MAX_LENGTH];
char core_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
char backup_filename[PATH_MAX_LENGTH];
backup_dir[0] = '\0';
@ -477,8 +477,8 @@ core_backup_list_t *core_backup_list_init(
struct string_list *dir_list = NULL;
core_backup_list_t *backup_list = NULL;
core_backup_list_entry_t *entries = NULL;
char core_dir[PATH_MAX_LENGTH];
char backup_dir[PATH_MAX_LENGTH];
char core_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
core_dir[0] = '\0';
backup_dir[0] = '\0';

View File

@ -542,7 +542,7 @@ static void NETRETROPAD_CORE_PREFIX(update_keyboard_cb)(bool down, unsigned keyc
uint32_t character, uint16_t key_modifiers)
{
struct retro_message message;
char buf[255];
char buf[NAME_MAX_LENGTH];
if (keycode < RETROK_LAST)
{

View File

@ -87,9 +87,9 @@ struct defaults
float settings_video_refresh_rate;
char dirs [DEFAULT_DIR_LAST + 1][PATH_MAX_LENGTH];
char dirs [DEFAULT_DIR_LAST + 1][DIR_MAX_LENGTH];
char path_config[PATH_MAX_LENGTH];
char path_buildbot_server_url[255];
char path_buildbot_server_url[NAME_MAX_LENGTH];
char settings_menu[32];
#ifdef HAVE_MENU

View File

@ -207,7 +207,7 @@ bool disk_index_file_init(
size_t len;
const char *content_file = NULL;
char content_name[256];
char disk_index_file_dir[PATH_MAX_LENGTH];
char disk_index_file_dir[DIR_MAX_LENGTH];
/* Sanity check */
if (!disk_index_file)

View File

@ -210,13 +210,13 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_ICONS:
#ifdef HAVE_XMB
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char temp_path[PATH_MAX_LENGTH];
char temp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
fill_pathname_join_special(temp_dir, dir_assets, "xmb", sizeof(temp_dir));
fill_pathname_join_special(temp_path, temp_dir, xmb_theme_ident(), sizeof(temp_path));
fill_pathname_join_special(s, temp_path, "png", len);
}
#endif
break;
@ -230,14 +230,14 @@ void fill_pathname_application_special(char *s,
strlcpy(s, path_menu_wallpaper, len);
else
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char s3[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
char tmp_path2[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s3, s1, "png", sizeof(s3));
fill_pathname_join_special(s, s3, FILE_PATH_BACKGROUND_IMAGE, len);
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(tmp_path2, tmp_path, "png", sizeof(tmp_path2));
fill_pathname_join_special(s, tmp_path2, FILE_PATH_BACKGROUND_IMAGE, len);
}
}
#endif
@ -254,11 +254,11 @@ void fill_pathname_application_special(char *s,
#ifdef HAVE_XMB
if (string_is_equal(menu_ident, "xmb"))
{
char s8[PATH_MAX_LENGTH];
char s4[PATH_MAX_LENGTH];
fill_pathname_join_special(s8, dir_assets, menu_ident, sizeof(s8));
fill_pathname_join_special(s4, s8, xmb_theme_ident(), sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(s, tmp_path, "sounds", len);
}
else
#endif
@ -266,9 +266,9 @@ void fill_pathname_application_special(char *s,
if ( string_is_equal(menu_ident, "glui")
|| string_is_equal(menu_ident, "ozone"))
{
char s4[PATH_MAX_LENGTH];
fill_pathname_join_special(s4, dir_assets, menu_ident, sizeof(s4));
fill_pathname_join_special(s, s4, "sounds", len);
char tmp_dir[DIR_MAX_LENGTH];
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "sounds", len);
}
else
#endif
@ -291,12 +291,12 @@ void fill_pathname_application_special(char *s,
#ifdef HAVE_XMB
if (string_is_equal(menu_ident, "xmb"))
{
char s1[PATH_MAX_LENGTH];
char s8[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, menu_ident, sizeof(s8));
fill_pathname_join_special(s1, s8, xmb_theme_ident(), sizeof(s1));
fill_pathname_join_special(s, s1, "png", len);
fill_pathname_join_special(tmp_dir, dir_assets, menu_ident, sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, tmp_dir, xmb_theme_ident(), sizeof(tmp_path));
fill_pathname_join_special(s, tmp_path, "png", len);
}
else
#endif
@ -304,20 +304,20 @@ void fill_pathname_application_special(char *s,
if ( string_is_equal(menu_ident, "ozone")
|| string_is_equal(menu_ident, "glui"))
{
char s5[PATH_MAX_LENGTH];
char s6[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
const char *dir_assets = settings->paths.directory_assets;
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "ozone", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "png", "icons", sizeof(tmp_path));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "monochrome", "png", sizeof(tmp_path));
#endif
fill_pathname_join_special(s, s5, s6, len);
fill_pathname_join_special(s, tmp_dir, tmp_path, len);
}
else
#endif
@ -329,20 +329,20 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_OZONE_ICONS:
#ifdef HAVE_OZONE
{
char s5[PATH_MAX_LENGTH];
char s6[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
char tmp_path[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
#if defined(WIIU) || defined(VITA)
/* Smaller 46x46 icons look better on low-DPI devices */
fill_pathname_join_special(s5, dir_assets, "ozone", sizeof(s5));
fill_pathname_join_special(s6, "png", "icons", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "ozone", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "png", "icons", sizeof(tmp_path));
#else
/* Otherwise, use large 256x256 icons */
fill_pathname_join_special(s5, dir_assets, "xmb", sizeof(s5));
fill_pathname_join_special(s6, "monochrome", "png", sizeof(s6));
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(tmp_path, "monochrome", "png", sizeof(tmp_path));
#endif
fill_pathname_join_special(s, s5, s6, len);
fill_pathname_join_special(s, tmp_dir, tmp_path, len);
}
#endif
break;
@ -350,11 +350,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_RGUI_FONT:
#ifdef HAVE_RGUI
{
char s7[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s7, dir_assets, "rgui", sizeof(s7));
fill_pathname_join_special(s, s7, "font", len);
fill_pathname_join_special(tmp_dir, dir_assets, "rgui", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "font", len);
}
#endif
break;
@ -362,11 +362,11 @@ void fill_pathname_application_special(char *s,
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB:
#ifdef HAVE_XMB
{
char s8[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s, s8, xmb_theme_ident(), len);
fill_pathname_join_special(tmp_dir, dir_assets, "xmb", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, xmb_theme_ident(), len);
}
#endif
break;
@ -380,35 +380,35 @@ void fill_pathname_application_special(char *s,
strlcpy(s, path_menu_xmb_font, len);
else
{
char s9[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "chinese-fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "chinese-fallback-font.ttf", len);
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join_special(s9,
settings->paths.directory_assets, "pkg", sizeof(s9));
fill_pathname_join_special(s, s9, "korean-fallback-font.ttf", len);
fill_pathname_join_special(tmp_dir,
settings->paths.directory_assets, "pkg", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "korean-fallback-font.ttf", len);
break;
default:
{
char s8[PATH_MAX_LENGTH];
char tmp_dir2[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_assets = settings->paths.directory_assets;
fill_pathname_join_special(s8, dir_assets, "xmb", sizeof(s8));
fill_pathname_join_special(s9, s8, xmb_theme_ident(), sizeof(s9));
fill_pathname_join_special(s, s9, FILE_PATH_TTF_FONT, len);
fill_pathname_join_special(tmp_dir2, dir_assets, "xmb", sizeof(tmp_dir2));
fill_pathname_join_special(tmp_dir, tmp_dir2, xmb_theme_ident(), sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, FILE_PATH_TTF_FONT, len);
}
break;
}
@ -418,21 +418,21 @@ void fill_pathname_application_special(char *s,
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_DISCORD_AVATARS:
{
char s10[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join_special(s10, dir_thumbnails, "discord", sizeof(s10));
fill_pathname_join_special(s, s10, "avatars", len);
fill_pathname_join_special(tmp_dir, dir_thumbnails, "discord", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "avatars", len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES:
{
char s12[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *dir_thumbnails = settings->paths.directory_thumbnails;
fill_pathname_join_special(s12, dir_thumbnails, "cheevos", len);
fill_pathname_join_special(s, s12, "badges", len);
fill_pathname_join_special(tmp_dir, dir_thumbnails, "cheevos", sizeof(tmp_dir));
fill_pathname_join_special(s, tmp_dir, "badges", len);
}
break;

View File

@ -341,9 +341,9 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
char assets_zip_path[PATH_MAX_LENGTH];
CFURLRef bundle_url;
CFStringRef bundle_path;
char temp_dir[PATH_MAX_LENGTH] = {0};
char temp_dir[DIR_MAX_LENGTH] = {0};
char bundle_path_buf[PATH_MAX_LENGTH] = {0};
char documents_dir_buf[PATH_MAX_LENGTH] = {0};
char documents_dir_buf[DIR_MAX_LENGTH] = {0};
char application_data[PATH_MAX_LENGTH] = {0};
CFBundleRef bundle = CFBundleGetMainBundle();

View File

@ -114,7 +114,7 @@ enum platform_android_flags
};
static pthread_key_t thread_key;
static char app_dir[PATH_MAX_LENGTH];
static char app_dir[DIR_MAX_LENGTH];
unsigned storage_permissions = 0;
struct android_app *g_android = NULL;
static uint8_t g_platform_android_flags = 0;
@ -1482,7 +1482,7 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
static char apk_dir[PATH_MAX_LENGTH];
static char apk_dir[DIR_MAX_LENGTH];
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
*apk_dir = '\0';

View File

@ -197,7 +197,7 @@ static int frontend_uwp_parse_drive_list(void *data, bool load_content)
{
#ifdef HAVE_MENU
int i;
char home_dir[PATH_MAX_LENGTH];
char home_dir[DIR_MAX_LENGTH];
file_list_t *list = (file_list_t*)data;
enum msg_hash_enums enum_idx = load_content ?
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR :

View File

@ -123,7 +123,7 @@ static void salamander_init(char *s, size_t len)
const char *rarch_config_path = g_defaults.path_config;
bool config_valid = false;
char config_path[PATH_MAX_LENGTH];
char config_dir[PATH_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
config_dir[0] = '\0';

View File

@ -63,7 +63,7 @@
* font file is missing */
bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
{
char font_dir[PATH_MAX_LENGTH];
char font_dir[DIR_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
const char *font_file = NULL;
void *bitmap_raw = NULL;

View File

@ -50,7 +50,7 @@
* font file is missing */
bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
{
char font_dir[PATH_MAX_LENGTH];
char font_dir[DIR_MAX_LENGTH];
char font_path[PATH_MAX_LENGTH];
const char *font_file = NULL;
void *bitmap_raw = NULL;

View File

@ -39,14 +39,15 @@
* content_label field (for internal use only) */
static void gfx_thumbnail_fill_content_img(char *s, size_t len, const char *src, bool shorten)
{
const char* cut = " (";
const char *cut = " (";
char *scrub_char_ptr = NULL;
/* Copy source label string */
size_t _len = strlcpy(s, src, len);
int bracketpos = -1;
/* Shortening logic: up to first space + bracket */
if (shorten) {
if (shorten)
{
bracketpos = string_find_index_substring_string(src, cut);
if (bracketpos > 0)
_len = bracketpos;
@ -569,12 +570,12 @@ bool gfx_thumbnail_set_content_playlist(
bool gfx_thumbnail_set_icon_playlist(
gfx_thumbnail_path_data_t *path_data, playlist_t *playlist, size_t idx)
{
char content_dir[DIR_MAX_LENGTH];
const char *content_path = NULL;
const char *content_label = NULL;
const char *core_name = NULL;
const char *db_name = NULL;
const struct playlist_entry *entry = NULL;
char content_dir[PATH_MAX_LENGTH];
const char *dir_thumbnails = NULL;
settings_t *settings = config_get_ptr();
@ -642,12 +643,11 @@ bool gfx_thumbnail_set_icon_playlist(
/* Determine content image name */
{
char* content_name_no_ext = NULL;
char tmp_buf[PATH_MAX_LENGTH];
char* content_name_no_ext = NULL;
/* Remove rom file extension
* > path_remove_extension() requires a char * (not const)
* so have to use a temporary buffer... */
const char* base_name = path_basename(path_data->content_path);
strlcpy(tmp_buf, base_name, sizeof(tmp_buf));
content_name_no_ext = path_remove_extension(tmp_buf);
@ -741,7 +741,7 @@ bool gfx_thumbnail_update_path(
gfx_thumbnail_path_data_t *path_data,
enum gfx_thumbnail_id thumbnail_id)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *system_name = NULL;
char *thumbnail_path = NULL;

View File

@ -246,7 +246,7 @@ typedef struct dispgfx_widget
uint8_t flags;
char assets_pkg_dir[PATH_MAX_LENGTH];
char assets_pkg_dir[DIR_MAX_LENGTH];
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
char ozone_regular_font_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
@ -254,7 +254,7 @@ typedef struct dispgfx_widget
char monochrome_png_path[PATH_MAX_LENGTH];
char gfx_widgets_path[PATH_MAX_LENGTH];
char gfx_widgets_status_text[255];
char gfx_widgets_status_text[NAME_MAX_LENGTH];
bool active;
} dispgfx_widget_t;

View File

@ -46,7 +46,7 @@ static void crt_adjust_sr_ini(videocrt_switch_t *p_switch);
/* Global local variables */
static bool ini_overrides_loaded = false;
static char core_name[NAME_MAX_LENGTH]; /* Same size as library_name on retroarch_data.h */
static char content_dir[PATH_MAX_LENGTH];
static char content_dir[DIR_MAX_LENGTH];
#if defined(HAVE_VIDEOCORE) /* Need to add video core to SR2 */
#include "include/userland/interface/vmcs_host/vc_vchi_gencmd.h"
@ -292,7 +292,7 @@ static void switch_res_crt(
int monitor_index, int super_width)
{
char current_core_name[NAME_MAX_LENGTH];
char current_content_dir[PATH_MAX_LENGTH];
char current_content_dir[DIR_MAX_LENGTH];
int flags = 0, ret;
const char *err_msg = NULL;
int w = native_width;
@ -458,7 +458,7 @@ void crt_switch_res_core(
void crt_adjust_sr_ini(videocrt_switch_t *p_switch)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char switchres_ini_override_file[PATH_MAX_LENGTH];
if (p_switch->sr2_active)

View File

@ -419,7 +419,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config,
{
softfilter_simd_mask_t cpu_features = (softfilter_simd_mask_t)cpu_features_get();
#ifdef HAVE_DYLIB
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
char ext_name[16];
#endif
struct string_list *plugs = NULL;

View File

@ -228,7 +228,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
{
case RARCH_WILDCARD_CONTENT_DIR:
{
char content_dir_name[PATH_MAX_LENGTH] = "";
char content_dir_name[DIR_MAX_LENGTH] = "";
const char* rarch_path_basename = path_get(RARCH_PATH_BASENAME);
if (rarch_path_basename)
fill_pathname_parent_dir_name(content_dir_name,
@ -335,7 +335,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
break;
case RARCH_WILDCARD_PRESET_DIR:
{
char preset_dir_name[PATH_MAX_LENGTH];
char preset_dir_name[DIR_MAX_LENGTH];
fill_pathname_parent_dir_name(preset_dir_name, in_preset_path, sizeof(preset_dir_name));
if (string_is_not_equal_fast(preset_dir_name, "", sizeof("")))
strlcpy(preset_dir_name, path_basename_nocompression(preset_dir_name), sizeof(preset_dir_name));
@ -1406,7 +1406,7 @@ static bool video_shader_write_referenced_preset(
bool ret = false;
bool continue_saving_ref = true;
char *new_preset_basedir = strdup(path_to_save);
char *config_dir = (char*)malloc(PATH_MAX_LENGTH);
char *config_dir = (char*)malloc(DIR_MAX_LENGTH);
char *relative_tmp_ref_path = (char*)malloc(PATH_MAX_LENGTH);
char *abs_tmp_ref_path = (char*)malloc(PATH_MAX_LENGTH);
char *path_to_ref = (char*)malloc(PATH_MAX_LENGTH);
@ -1426,7 +1426,7 @@ static bool video_shader_write_referenced_preset(
* loaded presets are located
* and where Save Game Preset, Save Core Preset,
* Save Global Preset save to */
fill_pathname_application_special(config_dir, PATH_MAX_LENGTH,
fill_pathname_application_special(config_dir, DIR_MAX_LENGTH,
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
/* If there is no initial preset path loaded */
@ -2831,9 +2831,9 @@ static bool video_shader_load_auto_shader_preset(settings_t *settings, const cha
size_t i = 0;
char shader_path[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_file_directory[PATH_MAX_LENGTH];
char old_presets_directory[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char config_file_directory[DIR_MAX_LENGTH];
char old_presets_directory[DIR_MAX_LENGTH];
shader_path[0] = '\0';
content_dir_name[0] = '\0';

View File

@ -98,7 +98,7 @@ struct gfx_widget_load_content_animation_state
char content_name[512];
char system_name[512];
char icon_directory[PATH_MAX_LENGTH];
char icon_directory[DIR_MAX_LENGTH];
char icon_file[PATH_MAX_LENGTH];
bool has_icon;

View File

@ -15,6 +15,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <retro_miscellaneous.h>
#include "../gfx_widgets.h"
#include "../gfx_animation.h"
#include "../gfx_display.h"
@ -92,8 +94,8 @@ static void gfx_widget_volume_frame(void* data, void *user_data)
if (state->alpha > 0.0f)
{
char msg[255];
char percentage_msg[255];
char msg[NAME_MAX_LENGTH];
char percentage_msg[NAME_MAX_LENGTH];
video_frame_info_t *video_info = (video_frame_info_t*)data;
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data;
gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular;

View File

@ -66,7 +66,7 @@ typedef struct
unsigned frame;
unsigned action;
unsigned param_num;
char param_str[255];
char param_str[NAME_MAX_LENGTH];
bool handled;
} input_test_step_t;

View File

@ -540,7 +540,7 @@ typedef struct udev_input_device
#endif
enum udev_input_dev_type type; /* Type of this device */
char devnode[NAME_MAX_LENGTH]; /* Device node path */
char ident[255]; /* Identifier of the device */
char ident[NAME_MAX_LENGTH]; /* Identifier of the device */
} udev_input_device_t;
typedef void (*device_handle_cb)(void *data,

View File

@ -26,6 +26,7 @@
#include <compat/strl.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../connect/joypad_connection.h"
#include "../input_defines.h"
@ -63,8 +64,8 @@ struct libusb_adapter
int endpoint_in_max_size;
int endpoint_out_max_size;
uint8_t manufacturer_name[255];
uint8_t name[255];
uint8_t manufacturer_name[NAME_MAX_LENGTH];
uint8_t name[NAME_MAX_LENGTH];
uint8_t data[2048];
int slot;

View File

@ -30,6 +30,7 @@
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include <formats/rjson.h>
#include <retro_miscellanous.h>
#include "../../config.def.h"
#include "../../verbosity.h"
@ -66,7 +67,7 @@ typedef struct
unsigned frame;
unsigned action;
unsigned param_num;
char param_str[255];
char param_str[NAME_MAX_LENGTH];
bool handled;
} input_test_step_t;

View File

@ -204,7 +204,7 @@ struct bsv_movie
size_t frame_ptr;
size_t min_file_pos;
size_t state_size;
bsv_key_data_t key_events[255]; /* uint32_t alignment */
bsv_key_data_t key_events[NAME_MAX_LENGTH]; /* uint32_t alignment */
/* Staging variables for keyboard events */
uint8_t key_event_count;
@ -257,7 +257,7 @@ typedef struct
char joypad_driver[32];
char name[128];
char display_name[128];
char config_name[256]; /* Base name of the RetroArch config file */
char config_name[NAME_MAX_LENGTH]; /* Base name of the RetroArch config file */
bool autoconfigured;
} input_device_info_t;
@ -280,7 +280,7 @@ struct input_remote
typedef struct
{
char display_name[256];
char display_name[NAME_MAX_LENGTH];
} input_mouse_info_t;
typedef struct input_remote input_remote_t;

View File

@ -1060,14 +1060,14 @@ size_t fill_pathname_expand_special(char *out_path,
char *app_dir = NULL;
if (in_path[0] == '~')
{
app_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
fill_pathname_home_dir(app_dir, PATH_MAX_LENGTH * sizeof(char));
app_dir = (char*)malloc(DIR_MAX_LENGTH * sizeof(char));
fill_pathname_home_dir(app_dir, DIR_MAX_LENGTH * sizeof(char));
}
else if (in_path[0] == ':')
{
app_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
app_dir = (char*)malloc(DIR_MAX_LENGTH * sizeof(char));
app_dir[0] = '\0';
fill_pathname_application_dir(app_dir, PATH_MAX_LENGTH * sizeof(char));
fill_pathname_application_dir(app_dir, DIR_MAX_LENGTH * sizeof(char));
}
if (app_dir)
@ -1103,8 +1103,8 @@ size_t fill_pathname_abbreviate_special(char *out_path,
unsigned i;
const char *candidates[3];
const char *notations[3];
char application_dir[PATH_MAX_LENGTH];
char home_dir[PATH_MAX_LENGTH];
char application_dir[DIR_MAX_LENGTH];
char home_dir[DIR_MAX_LENGTH];
application_dir[0] = '\0';
@ -1353,7 +1353,7 @@ void fill_pathname_application_path(char *s, size_t len)
/* This needs to be done so that the path becomes
* /private/var/... and this
* is used consistently throughout for the iOS bundle path */
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
char resolved_bundle_dir_buf[DIR_MAX_LENGTH] = {0};
if (realpath(s, resolved_bundle_dir_buf))
{
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);

View File

@ -473,7 +473,7 @@ bool m3u_file_save(
{
RFILE *file = NULL;
size_t i;
char base_dir[PATH_MAX_LENGTH];
char base_dir[DIR_MAX_LENGTH];
base_dir[0] = '\0';

View File

@ -123,24 +123,39 @@ static INLINE bool bits_any_different(uint32_t *a, uint32_t *b, uint32_t count)
return false;
}
#ifndef PATH_MAX_LENGTH
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(__PSL1GHT__) || defined(__PS3__) || defined(HAVE_EMSCRIPTEN)
#define PATH_MAX_LENGTH 512
#else
/**
* An upper limit for the length of a path (including the filename).
* If a path is longer than this, it may not work properly.
* This value may vary by platform.
*/
#define PATH_MAX_LENGTH 4096
#endif
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(PS2) || defined(GEKKO)|| defined(WIIU) || defined(__PSL1GHT__) || defined(__PS3__) || defined(HAVE_EMSCRIPTEN)
#ifndef PATH_MAX_LENGTH
#define PATH_MAX_LENGTH 512
#endif
#ifndef DIR_MAX_LENGTH
#define DIR_MAX_LENGTH 256
#endif
#else
#ifndef PATH_MAX_LENGTH
#define PATH_MAX_LENGTH 2048
#endif
#ifndef DIR_MAX_LENGTH
#define DIR_MAX_LENGTH 1024
#endif
#endif
#ifndef NAME_MAX_LENGTH
/**
* An upper limit for the length of a file or directory (excluding parent directories).
* If a path has a component longer than this, it may not work properly.
*/
#ifndef NAME_MAX_LENGTH
#define NAME_MAX_LENGTH 256
#endif

View File

@ -135,7 +135,7 @@ int main(int argc, char *argv[])
string_is_empty(out_file_path))
{
const char *in_file_name = path_basename(in_file_path);
char in_file_dir[PATH_MAX_LENGTH];
char in_file_dir[DIR_MAX_LENGTH];
in_file_dir[0] = '\0';

View File

@ -42,11 +42,11 @@ typedef struct
enum manual_content_scan_system_name_type system_name_type;
enum manual_content_scan_core_type core_type;
char content_dir[PATH_MAX_LENGTH];
char system_name_content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char system_name_content_dir[DIR_MAX_LENGTH];
char system_name_database[PATH_MAX_LENGTH];
char system_name_custom[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char core_name[NAME_MAX_LENGTH];
char core_path[PATH_MAX_LENGTH];
char file_exts_core[PATH_MAX_LENGTH];
char file_exts_custom[PATH_MAX_LENGTH];
@ -523,7 +523,7 @@ enum manual_content_scan_playlist_refresh_status
core_type = MANUAL_CONTENT_SCAN_CORE_DETECT;
enum manual_content_scan_playlist_refresh_status
playlist_status = MANUAL_CONTENT_SCAN_PLAYLIST_REFRESH_OK;
char system_name[PATH_MAX_LENGTH];
char system_name[NAME_MAX_LENGTH];
system_name[0] = '\0';
@ -593,9 +593,7 @@ enum manual_content_scan_playlist_refresh_status
{
const char *rdb_path = rdb_list->elems[i].data;
const char *rdb_file = NULL;
char rdb_name[PATH_MAX_LENGTH];
rdb_name[0] = '\0';
char rdb_name[NAME_MAX_LENGTH];
/* Sanity check */
if (string_is_empty(rdb_path))
@ -856,9 +854,7 @@ struct string_list *manual_content_scan_get_menu_system_name_list(
{
const char *rdb_path = rdb_list->elems[i].data;
const char *rdb_file = NULL;
char rdb_name[PATH_MAX_LENGTH];
rdb_name[0] = '\0';
char rdb_name[NAME_MAX_LENGTH];
/* Sanity check */
if (string_is_empty(rdb_path))

View File

@ -83,7 +83,7 @@ enum manual_content_scan_playlist_refresh_status
typedef struct
{
char playlist_file[PATH_MAX_LENGTH];
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char system_name[PATH_MAX_LENGTH];
char database_name[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];

View File

@ -417,7 +417,7 @@ GENERIC_DEFERRED_CURSOR_MANAGER(deferred_push_cursor_manager_list_deferred_query
static int general_push(menu_displaylist_info_t *info,
unsigned id, enum menu_displaylist_ctl_state state)
{
char newstr2[PATH_MAX_LENGTH];
char newstr2[PATH_MAX_LENGTH*2];
size_t _len = 0;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_state_get_ptr()->driver_data;

View File

@ -625,7 +625,7 @@ int generic_action_ok_displaylist_push(
{
menu_displaylist_info_t info;
char tmp[PATH_MAX_LENGTH];
char parent_dir[PATH_MAX_LENGTH];
char parent_dir[DIR_MAX_LENGTH];
enum menu_displaylist_ctl_state dl_type = DISPLAYLIST_NONE;
const char *menu_label = NULL;
const char *menu_path = NULL;
@ -1357,7 +1357,7 @@ int generic_action_ok_displaylist_push(
break;
case ACTION_OK_DL_RGUI_MENU_THEME_PRESET:
{
char rgui_assets_dir[PATH_MAX_LENGTH];
char rgui_assets_dir[DIR_MAX_LENGTH];
filebrowser_clear_type();
info.type = type;
@ -1970,6 +1970,9 @@ static int file_load_with_detect_core_wrapper(
{
menu_content_ctx_defer_info_t def_info;
#if IOS
char tmp_path[PATH_MAX_LENGTH];
#endif
char menu_path_new[PATH_MAX_LENGTH];
char new_core_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
@ -1980,7 +1983,6 @@ static int file_load_with_detect_core_wrapper(
menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL, NULL);
#if IOS
char tmp_path[PATH_MAX_LENGTH];
if (menu_path)
{
fill_pathname_expand_special(tmp_path, menu_path, sizeof(tmp_path));
@ -3644,7 +3646,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
unsigned action_type)
{
#ifdef HAVE_CONFIGFILE
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char remap_file_path[PATH_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
@ -4019,7 +4021,7 @@ static int action_ok_path_scan_directory(const char *path,
static int action_ok_path_manual_scan_directory(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
const char *flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MANUAL_CONTENT_SCAN_LIST);
unsigned flush_type = 0;
const char *menu_path = NULL;
@ -4042,7 +4044,7 @@ static int action_ok_path_manual_scan_directory(const char *path,
* can start with /private and this ensures the path starts with it.
* This will allow the path to be properly substituted when
* fill_pathname_expand_special() is called. */
char tmp_dir[PATH_MAX_LENGTH];
char tmp_dir[DIR_MAX_LENGTH];
tmp_dir[0] = '\0';
fill_pathname_expand_special(tmp_dir, content_dir, sizeof(content_dir));
realpath(tmp_dir, content_dir);
@ -4537,8 +4539,8 @@ static int action_ok_cheat_copy_after(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
int i;
struct item_cheat tmp;
char msg[256];
struct item_cheat tmp;
struct menu_state *menu_st = menu_state_get_ptr();
unsigned int new_size = cheat_manager_get_size() + 1;
@ -4940,8 +4942,8 @@ finish:
STRLEN_CONST(FILE_PATH_INDEX_DIRS_URL)
))
{
char parent_dir[PATH_MAX_LENGTH];
char parent_dir_encoded[PATH_MAX_LENGTH];
char parent_dir[DIR_MAX_LENGTH];
char parent_dir_encoded[DIR_MAX_LENGTH];
file_transfer_t *transf = NULL;
parent_dir_encoded[0] = '\0';
@ -5150,7 +5152,7 @@ void cb_generic_download(retro_task_t *task,
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
{
static char shaderdir[PATH_MAX_LENGTH] = {0};
static char shaderdir[DIR_MAX_LENGTH] = {0};
const char *dirname = NULL;
const char *dir_video_shader = settings->paths.directory_video_shader;
@ -5695,17 +5697,16 @@ static int action_ok_add_to_favorites(const char *path,
* > If content path is empty, cannot do anything... */
if (!string_is_empty(content_path))
{
union string_list_elem_attr attr;
char core_path[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char content_label[PATH_MAX_LENGTH];
runloop_state_t *runloop_st = runloop_state_get_ptr();
struct retro_system_info *sysinfo = &runloop_st->system.info;
struct string_list *str_list = NULL;
const char *crc32 = NULL;
const char *db_name = NULL;
union string_list_elem_attr attr;
char content_label[PATH_MAX_LENGTH];
char core_path[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
core_path[0] = '\0';
core_name[0] = '\0';

View File

@ -48,6 +48,9 @@ void handle_dbscan_finished(retro_task_t *task,
int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx)
{
#if IOS
char dir_path[DIR_MAX_LENGTH];
#endif
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
settings_t *settings = config_get_ptr();
@ -58,7 +61,6 @@ int action_scan_file(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
#if IOS
char dir_path[PATH_MAX_LENGTH];
fill_pathname_expand_special(dir_path, menu_path, sizeof(dir_path));
menu_path = dir_path;
#endif
@ -78,6 +80,9 @@ int action_scan_file(const char *path,
int action_scan_directory(const char *path,
const char *label, unsigned type, size_t idx)
{
#if IOS
char dir_path[DIR_MAX_LENGTH];
#endif
char fullpath[PATH_MAX_LENGTH];
const char *menu_path = NULL;
settings_t *settings = config_get_ptr();
@ -88,7 +93,6 @@ int action_scan_directory(const char *path,
menu_entries_get_last_stack(&menu_path, NULL, NULL, NULL, NULL);
#if IOS
char dir_path[PATH_MAX_LENGTH];
fill_pathname_expand_special(dir_path, menu_path, sizeof(dir_path));
menu_path = dir_path;
#endif

View File

@ -516,8 +516,8 @@ typedef struct
float delay_timer;
float alpha;
char str[MENU_SUBLABEL_MAX_LENGTH];
char runtime_fallback_str[255];
char last_played_fallback_str[255];
char runtime_fallback_str[NAME_MAX_LENGTH];
char last_played_fallback_str[NAME_MAX_LENGTH];
} materialui_status_bar_t;
/* Contains the file path(s) and texture pointer
@ -683,8 +683,8 @@ typedef struct materialui_handle
char sysicons_path[PATH_MAX_LENGTH];
char icons_path[PATH_MAX_LENGTH];
char msgbox[1024];
char menu_title[255];
char fullscreen_thumbnail_label[255];
char menu_title[NAME_MAX_LENGTH];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
} materialui_handle_t;
static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha)
@ -4257,7 +4257,7 @@ static void materialui_render_menu_entry_default(
int value_x_offset = 0;
uint32_t entry_value_color = 0;
unsigned entry_value_width_max = (usable_width / 2) - mui->margin;
char value_buf[255];
char value_buf[NAME_MAX_LENGTH];
value_buf[0] = '\0';
@ -4378,7 +4378,7 @@ static void materialui_render_menu_entry_default(
if (!string_is_empty(entry_label))
{
int label_width = usable_width;
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4603,7 +4603,7 @@ static void materialui_render_menu_entry_playlist_list(
/* Draw entry label */
if (!string_is_empty(entry_label))
{
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4780,7 +4780,7 @@ static void materialui_render_menu_entry_playlist_dual_icon(
(float)mui->font_data.list.line_centre_offset;
bool draw_text_outside = (x_offset != 0);
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -4891,7 +4891,7 @@ static void materialui_render_menu_entry_playlist_desktop(
/* Draw entry label */
if (!string_is_empty(entry_label))
{
char label_buf[255];
char label_buf[NAME_MAX_LENGTH];
label_buf[0] = '\0';
@ -5684,7 +5684,7 @@ static void materialui_render_header(
unsigned video_width, unsigned video_height,
math_matrix_4x4 *mymat)
{
char menu_title_buf[255];
char menu_title_buf[NAME_MAX_LENGTH];
size_t menu_title_margin = 0;
int usable_sys_bar_width = (int)video_width - (int)mui->nav_bar_layout_width;
int usable_title_bar_width = usable_sys_bar_width;
@ -5919,8 +5919,8 @@ static void materialui_render_header(
/* > Draw core name, if required */
if (menu_core_enable)
{
char core_title[255];
char core_title_buf[255];
char core_title[NAME_MAX_LENGTH];
char core_title_buf[NAME_MAX_LENGTH];
core_title[0] = '\0';
core_title_buf[0] = '\0';
@ -7199,7 +7199,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
if (menu_input_dialog_get_display_kb())
{
size_t _len;
char msg[255];
char msg[NAME_MAX_LENGTH];
struct menu_state *menu_st = menu_state_get_ptr();
const char *str = menu_input_dialog_get_buffer();
const char *label = menu_st->input_dialog_kb_label;
@ -11046,7 +11046,7 @@ static void materialui_list_insert(
for (i = 0; i < MAX_USERS; i++)
{
char val[255];
char val[NAME_MAX_LENGTH];
unsigned user_value = i + 1;
size_t _len = snprintf(val, sizeof(val), "%d", user_value);
strlcpy(val + _len,

View File

@ -624,7 +624,7 @@ struct ozone_handle
char icons_path[PATH_MAX_LENGTH];
char icons_path_default[PATH_MAX_LENGTH];
char tab_path[PATH_MAX_LENGTH];
char fullscreen_thumbnail_label[255];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
/* These have to be huge, because runloop_st->name.savestate
* has a hard-coded size of 8192...
@ -633,10 +633,10 @@ struct ozone_handle
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char selection_core_name[255];
char selection_playtime[255];
char selection_lastplayed[255];
char selection_entry_enumeration[255];
char selection_core_name[NAME_MAX_LENGTH];
char selection_playtime[NAME_MAX_LENGTH];
char selection_lastplayed[NAME_MAX_LENGTH];
char selection_entry_enumeration[NAME_MAX_LENGTH];
char thumbnails_left_status_prev;
char thumbnails_right_status_prev;
@ -2822,7 +2822,7 @@ static bool ozone_reset_theme_textures(ozone_handle_t *ozone)
"cursor_static.png"
};
unsigned i, j;
char theme_path[255];
char theme_path[NAME_MAX_LENGTH];
bool result = true;
for (j = 0; j < ARRAY_SIZE(ozone_themes); j++)
@ -3283,7 +3283,7 @@ static void ozone_draw_sidebar(
};
size_t y;
int entry_width;
char console_title[255];
char console_title[NAME_MAX_LENGTH];
unsigned i, sidebar_height;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
@ -4085,7 +4085,7 @@ static void ozone_go_to_sidebar(
#endif
}
static void linebreak_after_colon(char (*str)[255])
static void linebreak_after_colon(char (*str)[NAME_MAX_LENGTH])
{
char *delim = (char*)strchr(*str, ':');
if (delim)
@ -4852,7 +4852,7 @@ static void ozone_init_horizontal_list(
for (i = 0; i < list_size; i++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
char *console_name = NULL;
const char *playlist_file = ozone->horizontal_list.list[i].path;
@ -5744,8 +5744,8 @@ border_iterate:
for (i = 0; i < entries_end; i++)
{
char rich_label[255];
char entry_value_ticker[255];
char rich_label[NAME_MAX_LENGTH];
char entry_value_ticker[NAME_MAX_LENGTH];
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
uintptr_t texture;
menu_entry_t entry;
@ -5900,7 +5900,7 @@ border_iterate:
/* Ignore Explore Views */
for (offset = 0; offset < ozone->horizontal_list.size; offset++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
strlcpy(playlist_file_noext, ozone->horizontal_list.list[offset].path, sizeof(playlist_file_noext));
path_remove_extension(playlist_file_noext);
if (string_is_equal(playlist_file_noext, entry.rich_label))
@ -6415,7 +6415,7 @@ static void ozone_draw_thumbnail_bar(
if ( (!(ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER))
&& (!show_left_thumbnail || !show_right_thumbnail || (ozone->animations.left_thumbnail_alpha < 1.0f)))
{
char ticker_buf[255];
char ticker_buf[NAME_MAX_LENGTH];
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
@ -7766,7 +7766,7 @@ static bool INLINE ozone_fullscreen_thumbnails_available(ozone_handle_t *ozone,
static bool ozone_help_available(ozone_handle_t *ozone, size_t current_selection, bool menu_show_sublabels)
{
menu_entry_t last_entry;
char help_msg[255];
char help_msg[NAME_MAX_LENGTH];
help_msg[0] = '\0';
MENU_ENTRY_INITIALIZE(last_entry);
@ -10393,7 +10393,7 @@ static void ozone_draw_header(
bool timedate_enable,
math_matrix_4x4 *mymat)
{
char title[255];
char title[NAME_MAX_LENGTH];
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
@ -11183,8 +11183,8 @@ static void ozone_draw_footer(
{
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char core_title[255];
char core_title_buf[255];
char core_title[NAME_MAX_LENGTH];
char core_title_buf[NAME_MAX_LENGTH];
static const char* const ticker_spacer = OZONE_TICKER_SPACER;
int usable_width;
unsigned ticker_x_offset = 0;

View File

@ -337,7 +337,7 @@ typedef struct
ssize_t playlist_index;
uint8_t settings_selection_ptr;
size_t playlist_selection_ptr;
size_t playlist_selection[255];
size_t playlist_selection[NAME_MAX_LENGTH];
int16_t scroll_y;
rgui_colors_t colors; /* int16_t alignment */
@ -351,11 +351,11 @@ typedef struct
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char menu_title[NAME_MAX_LENGTH]; /* Must be a fixed length array... */
char msgbox[1024];
char theme_preset_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char theme_dynamic_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char last_theme_dynamic_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char menu_title[255]; /* Must be a fixed length array... */
char menu_sublabel[MENU_SUBLABEL_MAX_LENGTH]; /* Must be a fixed length array... */
} rgui_t;
@ -4666,7 +4666,7 @@ static void rgui_render_osk(
/* This can never happen, but have to make sure...
* If OSK cannot physically fit on the screen,
* fallback to old style 'message box' implementation */
char msg[255];
char msg[NAME_MAX_LENGTH];
size_t _len = strlcpy(msg, input_label, sizeof(msg));
msg[ _len] = '\n';
msg[++_len] = '\0';
@ -4731,7 +4731,7 @@ static void rgui_render_osk(
/* Draw input label text */
if (!string_is_empty(input_label))
{
char input_label_buf[255];
char input_label_buf[NAME_MAX_LENGTH];
unsigned input_label_length;
int input_label_x, input_label_y;
unsigned ticker_x_offset = 0;
@ -5189,7 +5189,7 @@ static void rgui_render(
* this is better than switching back to the text playlist
* view, which causes ugly flickering when scrolling quickly
* through a list...) */
char thumbnail_title_buf[255];
char thumbnail_title_buf[NAME_MAX_LENGTH];
unsigned title_x, title_width;
const char *thumbnail_title = NULL;
struct menu_state *menu_st = menu_state_get_ptr();
@ -5275,10 +5275,10 @@ static void rgui_render(
{
/* Render usual text */
size_t selection = menu_st->selection_ptr;
char title_buf[255];
size_t title_max_len;
size_t title_len;
unsigned title_x;
char title_buf[NAME_MAX_LENGTH];
unsigned title_y = rgui->term_layout.start_y - rgui->font_height_stride;
unsigned term_end_x = rgui->term_layout.start_x + (rgui->term_layout.width * rgui->font_width_stride);
unsigned timedate_x = term_end_x - (5 * rgui->font_width_stride);
@ -5446,8 +5446,8 @@ static void rgui_render(
for (i = new_start; i < end; i++, y += rgui->font_height_stride)
{
char entry_title_buf[255];
char type_str_buf[255];
char entry_title_buf[NAME_MAX_LENGTH];
char type_str_buf[NAME_MAX_LENGTH];
menu_entry_t entry;
const char *entry_value = NULL;
size_t entry_title_max_len = 0;

View File

@ -426,8 +426,8 @@ typedef struct xmb_handle
uint8_t system_tab_end;
uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH];
char title_name[255];
char title_name_alt[255];
char title_name[NAME_MAX_LENGTH];
char title_name_alt[NAME_MAX_LENGTH];
/* Cached texts showing current entry index / current list size */
char entry_index_str[32];
@ -439,7 +439,7 @@ typedef struct xmb_handle
* warnings...) */
char savestate_thumbnail_file_path[8204];
char prev_savestate_thumbnail_file_path[8204];
char fullscreen_thumbnail_label[255];
char fullscreen_thumbnail_label[NAME_MAX_LENGTH];
bool allow_horizontal_animation;
bool allow_dynamic_wallpaper;
@ -2482,7 +2482,7 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb)
/* Loop through list and set console names */
for (i = 0; i < xmb->horizontal_list.size; i++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
char *console_name = NULL;
const char *playlist_file = xmb->horizontal_list.list[i].path;
@ -4374,7 +4374,7 @@ static int xmb_draw_item(
float icon_x, icon_y, label_offset, gfx_icon_x, gfx_icon_y, gfx_icon_height, gfx_icon_width;
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char tmp[255];
char tmp[NAME_MAX_LENGTH];
unsigned ticker_x_offset = 0;
const char *ticker_str = NULL;
unsigned entry_type = 0;
@ -4852,7 +4852,7 @@ static int xmb_draw_item(
/* Ignore Explore Views */
for (offset = 0; offset < xmb->horizontal_list.size; offset++)
{
char playlist_file_noext[255];
char playlist_file_noext[NAME_MAX_LENGTH];
strlcpy(playlist_file_noext, xmb->horizontal_list.list[offset].path, sizeof(playlist_file_noext));
path_remove_extension(playlist_file_noext);
if (string_is_equal(playlist_file_noext, entry.rich_label))
@ -4880,7 +4880,7 @@ static int xmb_draw_item(
case XMB_SYSTEM_TAB_MAIN:
{
/* Special fall-through for "Load Content" > Playlists > Favorites */
char title[255];
char title[NAME_MAX_LENGTH];
menu_entries_get_title(title, sizeof(title));
if (string_is_equal(title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_GOTO_FAVORITES)))
; /* no-op */
@ -6286,7 +6286,7 @@ static void xmb_draw_fullscreen_thumbnails(
/* Title text */
if (menu_ticker_smooth)
{
char title_buf[255];
char title_buf[NAME_MAX_LENGTH];
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
int title_x = 0;
unsigned ticker_x_offset = 0;
@ -6447,8 +6447,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
math_matrix_4x4 mymat;
unsigned i;
char msg[1024];
char title_msg[255];
char title_truncated[255];
char title_msg[NAME_MAX_LENGTH];
char title_truncated[NAME_MAX_LENGTH];
gfx_thumbnail_shadow_t thumbnail_shadow;
size_t selection = 0;
size_t percent_width = 0;
@ -7137,7 +7137,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
{
gfx_animation_ctx_ticker_t ticker;
gfx_animation_ctx_ticker_smooth_t ticker_smooth;
char tmp[255];
char tmp[NAME_MAX_LENGTH];
size_t tmp_len = (video_width - xmb->margins_title_left - xmb->icon_size - title_header_max_width);
unsigned ticker_x_offset = 0;
bool use_smooth_ticker = settings->bools.menu_ticker_smooth;

View File

@ -264,7 +264,7 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
{
size_t i;
char icon_path[PATH_MAX_LENGTH];
char icon_directory[PATH_MAX_LENGTH];
char icon_directory[DIR_MAX_LENGTH];
bool rgba_supported = video_driver_supports_rgba();
core_info_list_t *core_info_list = NULL;

View File

@ -491,7 +491,7 @@ static int filebrowser_parse(
dir_list_append(str_list, "/private/var", NULL, true, false, false, false);
if (str_list->size <= 0)
{
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
fill_pathname_application_dir(dir, sizeof(dir));
if (string_ends_with(full_path, "/") && !string_ends_with(dir, "/"))
strlcat(dir, "/", sizeof(dir));
@ -1679,7 +1679,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
* to the displaylist */
if (core_is_pending)
{
char entry_alt_text[256];
char entry_alt_text[NAME_MAX_LENGTH];
size_t _len = strlcpy(entry_alt_text, detect_core_str,
sizeof(entry_alt_text));
entry_alt_text[ _len] = ' ';
@ -1784,8 +1784,8 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
static unsigned menu_displaylist_parse_system_info(file_list_t *list)
{
char entry[256];
char tmp[128];
char entry[NAME_MAX_LENGTH];
unsigned count = 0;
/* RetroArch Version */
@ -2369,7 +2369,7 @@ static int menu_displaylist_parse_playlist(
}
else if (!string_is_empty(info_path))
{
char lpl_basename[256];
char lpl_basename[NAME_MAX_LENGTH];
fill_pathname_base(lpl_basename, info_path, sizeof(lpl_basename));
path_remove_extension(lpl_basename);
menu_driver_set_thumbnail_system(
@ -2406,7 +2406,7 @@ static int menu_displaylist_parse_playlist(
for (i = 0; i < list_size; i++)
{
char menu_entry_label[256];
char menu_entry_label[NAME_MAX_LENGTH];
const struct playlist_entry *entry = NULL;
const char *entry_path = NULL;
bool entry_valid = true;
@ -3483,7 +3483,7 @@ static int menu_displaylist_parse_horizontal_list(
playlist_t *playlist = NULL;
if (!string_is_empty(item->path))
{
char lpl_basename[256];
char lpl_basename[NAME_MAX_LENGTH];
char path_playlist[PATH_MAX_LENGTH];
const char *dir_playlist = settings->paths.directory_playlist;
@ -4404,7 +4404,7 @@ static unsigned menu_displaylist_parse_cores(
menu_displaylist_info_t *info)
{
size_t i, list_size;
char out_dir[PATH_MAX_LENGTH];
char out_dir[DIR_MAX_LENGTH];
struct string_list *str_list = NULL;
unsigned count = 0;
const char *path = info->path;
@ -4568,7 +4568,7 @@ static unsigned menu_displaylist_parse_cores(
if (type == FILE_TYPE_CORE)
{
char core_path[PATH_MAX_LENGTH];
char display_name[256];
char display_name[NAME_MAX_LENGTH];
display_name[0] = '\0';
fill_pathname_join_special(core_path, dir, path, sizeof(core_path));
@ -4878,7 +4878,7 @@ static unsigned menu_displaylist_parse_pl_thumbnail_download_list(
for (i = 0; i < str_list->size; i++)
{
char path_base[PATH_MAX_LENGTH];
char path_base[NAME_MAX_LENGTH];
const char *path;
if (str_list->elems[i].attr.i == FILE_TYPE_DIRECTORY)
@ -4913,8 +4913,8 @@ static unsigned menu_displaylist_parse_content_information(
menu_handle_t *menu, settings_t *settings, file_list_t *info_list)
{
char tmp[8192];
char core_name[256];
char content_label[256];
char core_name[NAME_MAX_LENGTH];
char content_label[NAME_MAX_LENGTH];
playlist_t *playlist = playlist_get_cached();
unsigned idx = menu->rpl_entry_selection_ptr;
const struct playlist_entry *entry = NULL;
@ -5549,7 +5549,7 @@ static int menu_displaylist_parse_input_select_reserved_device_list(
file_list_t *info_list, const char *info_path,
settings_t *settings)
{
char device_label[256];
char device_label[NAME_MAX_LENGTH];
const char *val_disabled = NULL;
enum msg_hash_enums enum_idx = (enum msg_hash_enums)atoi(info_path);
struct menu_state *menu_st = menu_state_get_ptr();
@ -5823,7 +5823,7 @@ static int menu_displaylist_parse_input_description_list(
* this button */
if (!string_is_empty(input_desc_btn))
{
char input_description[256];
char input_description[NAME_MAX_LENGTH];
/* > Up to RARCH_FIRST_CUSTOM_BIND, inputs
* are buttons - description can be used
* directly
@ -5974,7 +5974,7 @@ static int menu_displaylist_parse_input_description_kbd_list(
/* Loop over keyboard keys */
for (i = 0; i < RARCH_MAX_KEYS; i++)
{
char input_description[256];
char input_description[NAME_MAX_LENGTH];
unsigned key_id = key_descriptors[i].key;
const char *key_label = key_descriptors[i].desc;
@ -6445,7 +6445,7 @@ static int menu_displaylist_parse_disc_info(file_list_t *info_list,
for (i = 0; list && i < list->size; i++)
{
char drive[2];
char drive_string[256] = {0};
char drive_string[NAME_MAX_LENGTH] = {0};
size_t pos = snprintf(drive_string, sizeof(drive_string),
msg_drive_number, i + 1);
pos += snprintf(drive_string + pos,
@ -6822,8 +6822,8 @@ unsigned menu_displaylist_build_list(
{
case DISPLAYLIST_OPTIONS_OVERRIDES:
{
char config_directory[PATH_MAX_LENGTH];
char content_dir_name[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char override_path[PATH_MAX_LENGTH];
runloop_state_t *runloop_st = runloop_state_get_ptr();
rarch_system_info_t *sys_info = &runloop_st->system;
@ -7797,7 +7797,7 @@ unsigned menu_displaylist_build_list(
for (p = 0; p < max_users; p++)
{
char val_s[256], val_d[16];
char val_s[NAME_MAX_LENGTH], val_d[16];
snprintf(val_s, sizeof(val_s),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS),
p+1);
@ -8143,7 +8143,7 @@ unsigned menu_displaylist_build_list(
if (net_ifinfo_new(&interfaces))
{
size_t i;
char buf[768];
char buf[1024];
const char *msg_intf = msg_hash_to_str(MSG_INTERFACE);
size_t _len = strlcpy(buf, msg_intf, sizeof(buf));
@ -8351,7 +8351,7 @@ unsigned menu_displaylist_build_list(
{
for (i = 0; i < size; i++)
{
char val_d[256], str[256];
char val_d[NAME_MAX_LENGTH], str[NAME_MAX_LENGTH];
/* If there is exact refresh rate available, use it */
if (video_list[i].refreshrate_float > 0.0f)
snprintf(str, sizeof(str), "%dx%d (%.3f Hz)%s%s",
@ -12326,7 +12326,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.system))
{
char system[256];
char system[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(system, "System: ", sizeof(system));
strlcpy(system + _len, cd_info.system, sizeof(system) - _len);
@ -12341,7 +12341,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.serial))
{
char serial[256];
char serial[NAME_MAX_LENGTH];
size_t _len = strlcpy(serial,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_SERIAL),
sizeof(serial));
@ -12358,7 +12358,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.version))
{
char version[256];
char version[NAME_MAX_LENGTH];
/* TODO/FIXME - localize */
size_t _len = strlcpy(version, "Version: ", sizeof(version));
strlcpy(version + _len, cd_info.version, sizeof(version) - _len);
@ -12373,7 +12373,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
if (!string_is_empty(cd_info.release_date))
{
char release_date[256];
char release_date[NAME_MAX_LENGTH];
/* TODO/FIXME - Localize */
size_t _len = strlcpy(release_date, "Release Date: ",
sizeof(release_date));
@ -15413,7 +15413,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
if (setting->get_string_representation)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
strlcpy(setting->value.target.string, tok, setting->size);
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15479,7 +15479,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.integer = val;
setting->get_string_representation(setting,
@ -15557,7 +15557,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max + half_step; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.fraction = i;
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15632,7 +15632,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.unsigned_integer = val;
setting->get_string_representation(setting,
@ -15809,7 +15809,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.integer = val;
setting->get_string_representation(setting,
@ -15886,7 +15886,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.fraction = i;
setting->get_string_representation(setting,
val_s, sizeof(val_s));
@ -15960,7 +15960,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
int val = (int)i;
*setting->value.target.unsigned_integer = val;
setting->get_string_representation(setting,

View File

@ -367,7 +367,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation)
{
bool path_enabled;
char newpath[255];
char newpath[NAME_MAX_LENGTH];
const char *path = NULL;
const char *entry_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
@ -2979,7 +2979,7 @@ static bool menu_shader_manager_save_preset_internal(
}
else
{
char basedir[PATH_MAX_LENGTH];
char basedir[DIR_MAX_LENGTH];
for (i = 0; i < num_target_dirs; i++)
{
@ -3040,7 +3040,7 @@ bool menu_shader_manager_save_preset(const struct video_shader *shader,
const char *dir_menu_config,
bool apply)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
const char *preset_dirs[3] = {0};
settings_t *settings = config_get_ptr();
@ -3074,8 +3074,8 @@ static bool menu_shader_manager_operate_auto_preset(
const char *dir_menu_config,
enum auto_shader_type type, bool apply)
{
char old_presets_directory[PATH_MAX_LENGTH];
char config_directory[PATH_MAX_LENGTH];
char old_presets_directory[DIR_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
@ -7177,7 +7177,7 @@ static int generic_menu_iterate(
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE)))
{
char current_sublabel[255];
char current_sublabel[NAME_MAX_LENGTH];
menu_driver_get_current_menu_sublabel(
menu_st,
current_sublabel, sizeof(current_sublabel));
@ -7718,7 +7718,7 @@ int generic_menu_entry_action(
{
char current_label[128];
char current_value[128];
char title_name[255];
char title_name[NAME_MAX_LENGTH];
char speak_string[512];
speak_string[0] = '\0';

View File

@ -28,6 +28,7 @@
#include <retro_common_api.h>
#include <formats/image.h>
#include <queues/task_queue.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
@ -431,10 +432,9 @@ typedef struct
enum rarch_shader_type preset_type;
enum rarch_shader_type pass_type;
char preset_dir[PATH_MAX_LENGTH];
char pass_dir[DIR_MAX_LENGTH];
char preset_dir[DIR_MAX_LENGTH];
char preset_file_name[PATH_MAX_LENGTH];
char pass_dir[PATH_MAX_LENGTH];
char pass_file_name[PATH_MAX_LENGTH];
} last_shader_selection;
#endif
@ -443,7 +443,7 @@ typedef struct
* loaded via the menu file browser */
struct
{
char directory[PATH_MAX_LENGTH];
char directory[DIR_MAX_LENGTH];
char file_name[PATH_MAX_LENGTH];
} last_start_content;
@ -523,7 +523,7 @@ struct menu_state
char pending_selection[PATH_MAX_LENGTH];
/* Storage container for current menu datetime
* representation string */
char datetime_cache[255];
char datetime_cache[NAME_MAX_LENGTH];
/* Filled with current content path when a core calls
* RETRO_ENVIRONMENT_SHUTDOWN. Value is required in
* generic_menu_entry_action(), and must be cached

View File

@ -21,6 +21,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include <lists/file_list.h>
@ -113,11 +114,11 @@ typedef struct menu_entry
uint8_t setting_type;
uint8_t flags;
char sublabel[MENU_SUBLABEL_MAX_LENGTH];
char path[255];
char label[255];
char rich_label[255];
char value[255];
char password_value[255];
char path[NAME_MAX_LENGTH];
char label[NAME_MAX_LENGTH];
char rich_label[NAME_MAX_LENGTH];
char value[NAME_MAX_LENGTH];
char password_value[NAME_MAX_LENGTH];
} menu_entry_t;
typedef struct menu_file_list_cbs

View File

@ -9517,7 +9517,7 @@ static bool setting_append_list_input_player_options(
* 2 is the length of '99'; we don't need more users than that.
*/
static char buffer[MAX_USERS][13+2+1];
static char group_label[MAX_USERS][255];
static char group_label[MAX_USERS][NAME_MAX_LENGTH];
unsigned i, j;
rarch_setting_group_info_t group_info;
rarch_setting_group_info_t subgroup_info;
@ -15976,8 +15976,8 @@ static bool setting_append_list(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_USER_BINDS);
for (user = 0; user < MAX_USERS; user++)
{
static char binds_list[MAX_USERS][255];
static char binds_label[MAX_USERS][255];
static char binds_list[MAX_USERS][NAME_MAX_LENGTH];
static char binds_label[MAX_USERS][NAME_MAX_LENGTH];
unsigned user_value = user + 1;
size_t _len = snprintf(binds_list[user], sizeof(binds_list[user]), "%d", user_value);
strlcpy(binds_list[user] + _len, "_input_binds_list", sizeof(binds_list[user]) - _len);

View File

@ -706,7 +706,7 @@ static void webdav_do_update(bool success, webdav_cb_state_t *webdav_cb_st)
static bool webdav_update(const char *path, RFILE *rfile, cloud_sync_complete_handler_t cb, void *user_data)
{
webdav_cb_state_t *webdav_cb_st = (webdav_cb_state_t*)calloc(1, sizeof(webdav_cb_state_t));
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
/* TODO: if !settings->bools.cloud_sync_destructive, should move to deleted/ first */
@ -824,7 +824,7 @@ static bool webdav_delete(const char *path, cloud_sync_complete_handler_t cb, vo
}
else
{
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
size_t _len = strlcpy(dir, "deleted/", sizeof(dir));
fill_pathname_basedir(dir + _len, path, sizeof(dir) - _len);
webdav_ensure_dir(dir, webdav_do_backup, webdav_cb_st);

View File

@ -323,7 +323,7 @@ static bool connmanctl_connect_ssid(
{
unsigned i;
char netid[160];
char settings_dir[PATH_MAX_LENGTH];
char settings_dir[DIR_MAX_LENGTH];
char settings_path[PATH_MAX_LENGTH];
bool success = false;
connman_t *connman = (connman_t*)data;

View File

@ -1334,7 +1334,7 @@ bool playlist_push(playlist_t *playlist,
if (string_is_empty(core_name))
{
static char base_path[255] = {0};
static char base_path[NAME_MAX_LENGTH] = {0};
fill_pathname_base(base_path, real_core_path, sizeof(base_path));
path_remove_extension(base_path);

View File

@ -153,7 +153,7 @@ typedef struct
bool fuzzy_archive_match;
bool autofix_paths;
char path[PATH_MAX_LENGTH];
char base_content_directory[PATH_MAX_LENGTH];
char base_content_directory[DIR_MAX_LENGTH];
} playlist_config_t;
/* Convenience function: copies specified playlist

View File

@ -2,6 +2,7 @@
#define _RECORD_DRIVER_H
#include <boolean.h>
#include <retro_miscellaneous.h>
enum ffemu_pix_format
{
@ -121,10 +122,10 @@ struct recording
unsigned width;
unsigned height;
char path[8192];
char config[8192];
char output_dir[8192];
char config_dir[8192];
char path[PATH_MAX_LENGTH];
char config[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
char config_dir[DIR_MAX_LENGTH];
bool enable;
bool streaming_enable;

View File

@ -320,9 +320,9 @@ struct rarch_state
char path_config_append_file[PATH_MAX_LENGTH];
char path_config_override_file[PATH_MAX_LENGTH];
char path_core_options_file[PATH_MAX_LENGTH];
char dir_system[PATH_MAX_LENGTH];
char dir_savefile[PATH_MAX_LENGTH];
char dir_savestate[PATH_MAX_LENGTH];
char dir_system[DIR_MAX_LENGTH];
char dir_savefile[DIR_MAX_LENGTH];
char dir_savestate[DIR_MAX_LENGTH];
};
/* Forward declarations */
@ -2165,7 +2165,7 @@ struct string_list *dir_list_new_special(const char *input_dir,
bool show_hidden_files)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
char ext_shaders[255];
char ext_shaders[256];
#endif
char ext_name[16];
const char *exts = NULL;
@ -6162,7 +6162,7 @@ static void retroarch_print_features(void)
static void retroarch_print_version(void)
{
char str[255];
char str[256];
str[0] = '\0';
frontend_driver_attach_console();

View File

@ -5,6 +5,7 @@
#include <boolean.h>
#include <retro_inline.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -183,7 +184,7 @@ typedef struct rarch_system_info
unsigned rotation;
unsigned core_requested_rotation;
unsigned performance_level;
char valid_extensions[255];
char valid_extensions[256];
bool load_no_content;
bool supports_vfs;
} rarch_system_info_t;
@ -294,7 +295,7 @@ typedef struct global
} console;
char error_string[255];
char error_string[NAME_MAX_LENGTH];
uint8_t flags;
} global_t;
@ -343,7 +344,7 @@ typedef struct content_state
uint8_t flags;
char companion_ui_crc32[32];
char pending_subsystem_ident[255];
char pending_subsystem_ident[NAME_MAX_LENGTH];
char pending_rom_crc_path[PATH_MAX_LENGTH];
char companion_ui_db_name[PATH_MAX_LENGTH];
} content_state_t;

View File

@ -460,9 +460,9 @@ static bool runloop_environ_cb_get_system_info(unsigned cmd, void *data)
* the pointers are const char *
* (if we don't free them, we get a memory leak) */
if (!string_is_empty(subsys_info->desc))
free((char *)subsys_info->desc);
free((char*)subsys_info->desc);
if (!string_is_empty(subsys_info->ident))
free((char *)subsys_info->ident);
free((char*)subsys_info->ident);
subsys_info->desc = strdup(info[i].desc);
subsys_info->ident = strdup(info[i].ident);
subsys_info->id = info[i].id;
@ -478,11 +478,11 @@ static bool runloop_environ_cb_get_system_info(unsigned cmd, void *data)
* the pointers are const char *
* (if we don't free them, we get a memory leak) */
if (!string_is_empty(subsys_rom_info[j].desc))
free((char *)
free((char*)
subsys_rom_info[j].desc);
if (!string_is_empty(
subsys_rom_info[j].valid_extensions))
free((char *)
free((char*)
subsys_rom_info[j].valid_extensions);
subsys_rom_info[j].desc =
strdup(info[i].roms[j].desc);
@ -1080,7 +1080,7 @@ static bool validate_per_core_options(char *s,
size_t len, bool mkdir,
const char *core_name, const char *game_name)
{
char config_directory[PATH_MAX_LENGTH];
char config_directory[DIR_MAX_LENGTH];
config_directory[0] = '\0';
if ( (!s)
@ -1147,7 +1147,7 @@ static bool validate_game_specific_options(char **output)
static bool validate_folder_options(
char *s, size_t len, bool mkdir)
{
char folder_name[PATH_MAX_LENGTH];
char folder_name[DIR_MAX_LENGTH];
runloop_state_t *runloop_st = &runloop_state;
const char *core_name = runloop_st->system.info.library_name;
const char *game_path = path_get(RARCH_PATH_BASENAME);
@ -5184,12 +5184,12 @@ void core_options_reset(void)
void core_options_flush(void)
{
size_t _len;
char msg[256];
runloop_state_t *runloop_st = &runloop_state;
core_option_manager_t *coreopts = runloop_st->core_options;
const char *path_core_options = path_get(RARCH_PATH_CORE_OPTIONS);
const char *core_options_file = NULL;
bool success = false;
char msg[256];
msg[0] = '\0';
@ -7921,11 +7921,11 @@ void runloop_path_set_redirect(settings_t *settings,
const char *old_savefile_dir,
const char *old_savestate_dir)
{
char content_dir_name[PATH_MAX_LENGTH];
char new_savefile_dir[PATH_MAX_LENGTH];
char new_savestate_dir[PATH_MAX_LENGTH];
char intermediate_savefile_dir[PATH_MAX_LENGTH];
char intermediate_savestate_dir[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
char new_savefile_dir[DIR_MAX_LENGTH];
char new_savestate_dir[DIR_MAX_LENGTH];
char intermediate_savefile_dir[DIR_MAX_LENGTH];
char intermediate_savestate_dir[DIR_MAX_LENGTH];
runloop_state_t *runloop_st = &runloop_state;
struct retro_system_info *sysinfo = &runloop_st->system.info;
bool sort_savefiles_enable = settings->bools.sort_savefiles_enable;

View File

@ -282,8 +282,8 @@ struct runloop
#endif
char runtime_content_path[PATH_MAX_LENGTH];
char runtime_core_path[PATH_MAX_LENGTH];
char savefile_dir[PATH_MAX_LENGTH];
char savestate_dir[PATH_MAX_LENGTH];
char savefile_dir[DIR_MAX_LENGTH];
char savestate_dir[DIR_MAX_LENGTH];
struct
{

View File

@ -229,9 +229,9 @@ runtime_log_t *runtime_log_init(
const char *dir_playlist,
bool log_per_core)
{
char log_file_dir[DIR_MAX_LENGTH];
char content_name[PATH_MAX_LENGTH];
char core_name[PATH_MAX_LENGTH];
char log_file_dir[PATH_MAX_LENGTH];
char log_file_path[PATH_MAX_LENGTH];
char tmp_buf[PATH_MAX_LENGTH];
bool supports_no_game = false;

View File

@ -6,6 +6,7 @@
#include <retro_timers.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../input/input_driver.h"
#include "../menu/menu_driver.h"
@ -145,7 +146,7 @@ core_info_t* steam_find_core_info_for_dlc(const char* name)
for (i = 0; core_info_list->count > i; i++)
{
char core_info_name[256];
char core_info_name[NAME_MAX_LENGTH];
core_info_t *core_info = core_info_get(core_info_list, i);
/* Find the opening parenthesis for the core name */
char *start = strchr(core_info->display_name, '(');

View File

@ -834,7 +834,7 @@ bool input_autoconfigure_connect(
if (driver_valid)
{
char dir_driver_autoconfig[PATH_MAX_LENGTH];
char dir_driver_autoconfig[DIR_MAX_LENGTH];
/* Generate driver-specific autoconfig directory */
fill_pathname_join_special(dir_driver_autoconfig,
dir_autoconfig,

View File

@ -320,7 +320,7 @@ static struct string_list *task_cloud_sync_directory_map(void)
if (!list)
{
union string_list_elem_attr attr = {0};
char dir[PATH_MAX_LENGTH];
char dir[DIR_MAX_LENGTH];
list = string_list_new();
if (settings->bools.cloud_sync_sync_configs)
@ -478,9 +478,9 @@ static void task_cloud_sync_backup_file(struct item_file *file)
{
struct tm tm_;
size_t len;
char backup_dir[PATH_MAX_LENGTH];
char new_dir[DIR_MAX_LENGTH];
char backup_dir[DIR_MAX_LENGTH];
char new_path[PATH_MAX_LENGTH];
char new_dir[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
const char *path_dir_core_assets = settings->paths.directory_core_assets;
time_t cur_time = time(NULL);
@ -533,14 +533,14 @@ static void task_cloud_sync_fetch_cb(void *user_data, const char *path, bool suc
static void task_cloud_sync_fetch_server_file(task_cloud_sync_state_t *sync_state)
{
size_t i;
char filename[PATH_MAX_LENGTH];
char directory[DIR_MAX_LENGTH];
struct string_list *dirlist = task_cloud_sync_directory_map();
struct item_file *server_file = &sync_state->server_manifest->list[sync_state->server_idx];
const char *key = CS_FILE_KEY(server_file);
const char *path = strchr(key, PATH_DEFAULT_SLASH_C()) + 1;
char directory[PATH_MAX_LENGTH];
char filename[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
size_t i;
/* we're just fetching a file the server has, we can update this now */
task_cloud_sync_add_to_updated_manifest(sync_state, key, CS_FILE_HASH(server_file), true);

View File

@ -531,7 +531,7 @@ static bool content_file_list_set_info(
* extended path info to cores */
if (!string_is_empty(path))
{
char dir [PATH_MAX_LENGTH];
char dir [DIR_MAX_LENGTH];
char name[NAME_MAX_LENGTH];
const char *archive_delim = NULL;
const char *ext = NULL;
@ -1032,7 +1032,7 @@ static bool content_file_load(
{
wchar_t wnew_path[MAX_PATH];
/* Fallback to a file copy into an accessible directory */
char new_basedir[PATH_MAX_LENGTH];
char new_basedir[DIR_MAX_LENGTH];
char new_path[PATH_MAX_LENGTH];
RARCH_LOG("[Content]: Core does not support VFS"

View File

@ -946,7 +946,7 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
const char *core_name = NULL;
retro_task_t *task = NULL;
core_backup_handle_t *backup_handle = NULL;
char task_title[256];
char task_title[128];
char core_path[PATH_MAX_LENGTH];
core_path[0] = '\0';

View File

@ -150,8 +150,8 @@ typedef struct update_single_core_handle
size_t auto_backup_history_size;
enum update_single_core_status status;
char path_core[PATH_MAX_LENGTH];
char path_dir_libretro[PATH_MAX_LENGTH];
char path_dir_core_assets[PATH_MAX_LENGTH];
char path_dir_libretro[DIR_MAX_LENGTH];
char path_dir_core_assets[DIR_MAX_LENGTH];
bool auto_backup;
} update_single_core_handle_t;
#endif
@ -572,7 +572,7 @@ void cb_http_task_core_updater_download(
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
file_transfer_t *transf = (file_transfer_t*)user_data;
core_updater_download_handle_t *download_handle = NULL;
char output_dir[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
if (!data || !transf)
goto finish;

View File

@ -1157,7 +1157,7 @@ int cue_find_track(const char *cue_path, bool first,
intfstream_info_t info;
char tmp_token[MAX_TOKEN_LEN];
char last_file[PATH_MAX_LENGTH];
char cue_dir[PATH_MAX_LENGTH];
char cue_dir[DIR_MAX_LENGTH];
intfstream_t *fd = NULL;
int64_t last_index = -1;
int64_t cand_index = -1;
@ -1291,7 +1291,7 @@ bool cue_next_file(intfstream_t *fd,
const char *cue_path, char *s, uint64_t len)
{
char tmp_token[MAX_TOKEN_LEN];
char cue_dir[PATH_MAX_LENGTH];
char cue_dir[DIR_MAX_LENGTH];
cue_dir[0] = '\0';
fill_pathname_basedir(cue_dir, cue_path, sizeof(cue_dir));
@ -1373,7 +1373,7 @@ int gdi_find_track(const char *gdi_path, bool first,
if (!(mode == 0 && size == 2352))
{
char last_file[PATH_MAX_LENGTH];
char gdi_dir[PATH_MAX_LENGTH];
char gdi_dir[DIR_MAX_LENGTH];
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join_special(last_file,
@ -1432,7 +1432,7 @@ bool gdi_next_file(intfstream_t *fd, const char *gdi_path,
/* File name */
if (task_database_cue_get_token(fd, tmp_token, sizeof(tmp_token)) > 0)
{
char gdi_dir[PATH_MAX_LENGTH];
char gdi_dir[DIR_MAX_LENGTH];
fill_pathname_basedir(gdi_dir, gdi_path, sizeof(gdi_dir));
fill_pathname_join_special(path, gdi_dir, tmp_token, (size_t)max_len);

View File

@ -43,7 +43,7 @@ static int file_decompressed_subdir(const char *name,
uint32_t crc32, struct archive_extract_userdata *userdata)
{
size_t _len;
char path_dir[PATH_MAX_LENGTH];
char path_dir[DIR_MAX_LENGTH];
char path[PATH_MAX_LENGTH];
size_t name_len = strlen(name);
char last_char = name[name_len - 1];

View File

@ -21,6 +21,7 @@
#include <file/file_path.h>
#include <net/net_compat.h>
#include <retro_timers.h>
#include <retro_miscellaneous.h>
#ifdef RARCH_INTERNAL
#include "../gfx/video_display_server.h"
@ -40,7 +41,7 @@ enum http_status_enum
struct http_transfer_info
{
int progress;
char url[255];
char url[NAME_MAX_LENGTH];
};
struct http_handle
@ -54,8 +55,8 @@ struct http_handle
} connection;
unsigned status;
bool error;
char connection_elem[255];
char connection_url[255];
char connection_elem[NAME_MAX_LENGTH];
char connection_url[NAME_MAX_LENGTH];
};
typedef struct http_transfer_info http_transfer_info_t;
@ -462,7 +463,7 @@ void* task_push_http_transfer_file(const char* url, bool mute,
{
size_t len;
const char *s = NULL;
char tmp[255] = "";
char tmp[NAME_MAX_LENGTH] = "";
retro_task_t *t = NULL;
if (string_is_empty(url))

View File

@ -137,7 +137,7 @@ static bool get_thumbnail_paths(
char *path, size_t path_size,
char *url, size_t url_size)
{
char content_dir[PATH_MAX_LENGTH];
char content_dir[DIR_MAX_LENGTH];
char tmp_buf[PATH_MAX_LENGTH];
size_t raw_url_len = sizeof(char) * 8192;
char *raw_url = NULL;
@ -226,7 +226,7 @@ void cb_http_task_download_pl_thumbnail(
retro_task_t *task, void *task_data,
void *user_data, const char *err)
{
char output_dir[PATH_MAX_LENGTH];
char output_dir[DIR_MAX_LENGTH];
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
file_transfer_t *transf = (file_transfer_t*)user_data;
pl_thumb_handle_t *pl_thumb = NULL;

View File

@ -281,7 +281,7 @@ static bool screenshot_dump(
}
else
{
char new_screenshot_dir[PATH_MAX_LENGTH];
char new_screenshot_dir[DIR_MAX_LENGTH];
if (!string_is_empty(screenshot_dir))
{
@ -292,7 +292,7 @@ static bool screenshot_dump(
if (settings->bools.sort_screenshots_by_content_enable &&
!string_is_empty(content_dir))
{
char content_dir_name[PATH_MAX_LENGTH];
char content_dir_name[DIR_MAX_LENGTH];
fill_pathname_parent_dir_name(content_dir_name,
content_dir, sizeof(content_dir_name));
fill_pathname_join_special(

View File

@ -11,6 +11,7 @@ extern "C" {
#endif
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../../../gfx/video_display_server.h"
#include "../../../input/input_driver.h"
@ -1316,7 +1317,7 @@ QWidget *VideoPage::widget()
{
for (i = 0; i < size; i++)
{
char val_d[256], str[256];
char val_d[NAME_MAX_LENGTH], str[NAME_MAX_LENGTH];
snprintf(str, sizeof(str), "%dx%d (%d Hz)", list[i].width, list[i].height, list[i].refreshrate);
snprintf(val_d, sizeof(val_d), "%d", i);

View File

@ -32,6 +32,7 @@ extern "C" {
#include "../../../config.h"
#endif
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "../../../configuration.h"
@ -503,7 +504,7 @@ void UIntComboBox::populate(double min, double max)
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
unsigned val = (unsigned)i;
*m_setting->value.target.unsigned_integer = val;
@ -640,7 +641,7 @@ UIntRadioButton::UIntRadioButton(msg_hash_enums enum_idx, unsigned value, QWidge
,m_target(m_setting->value.target.unsigned_integer)
,m_value(value)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
unsigned orig_value = *m_setting->value.target.unsigned_integer;
*m_setting->value.target.unsigned_integer = value;
@ -701,7 +702,7 @@ UIntRadioButtons::UIntRadioButtons(rarch_setting_t *setting, QWidget *parent) :
{
for (i = min; i <= max; i += step)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
*setting->value.target.unsigned_integer = i;
@ -983,7 +984,7 @@ BindButton::BindButton(rarch_setting_t *setting, QWidget *parent) :
QPushButton(parent)
,m_setting(setting)
{
char val_s[256];
char val_s[NAME_MAX_LENGTH];
setting->get_string_representation(setting, val_s, sizeof(val_s));

View File

@ -42,8 +42,8 @@ void uwp_fill_installed_core_packages(struct string_list *list);
extern const struct rarch_key_map rarch_key_map_uwp[];
extern char uwp_dir_install[PATH_MAX_LENGTH];
extern char uwp_dir_data[PATH_MAX_LENGTH];
extern char uwp_dir_install[DIR_MAX_LENGTH];
extern char uwp_dir_data[DIR_MAX_LENGTH];
extern char uwp_device_family[128];

View File

@ -54,8 +54,8 @@ using namespace Windows::Graphics::Display;
using namespace Windows::Devices::Enumeration;
using namespace Windows::Storage;
char uwp_dir_install[PATH_MAX_LENGTH] = { 0 };
char uwp_dir_data[PATH_MAX_LENGTH] = { 0 };
char uwp_dir_install[DIR_MAX_LENGTH] = { 0 };
char uwp_dir_data[DIR_MAX_LENGTH] = { 0 };
char uwp_device_family[128] = { 0 };
char win32_cpu_model_name[128] = { 0 };

View File

@ -454,7 +454,7 @@ void rarch_log_file_init(
const char *log_dir
)
{
char log_directory[PATH_MAX_LENGTH];
char log_directory[DIR_MAX_LENGTH];
char log_file_path[PATH_MAX_LENGTH];
verbosity_state_t *g_verbosity = &main_verbosity_st;
static bool log_file_created = false;