Start using MAX_PATH_LENGTH - relying on MAX_PATH for 360 can cause

problems because it's defined at '260' and thus too small for some
strings
This commit is contained in:
twinaphex 2015-01-07 20:42:36 +01:00
parent ef89a7a318
commit 90076c5fad
32 changed files with 203 additions and 201 deletions

View File

@ -56,7 +56,7 @@ typedef struct video4linux
uint32_t *buffer_output;
bool ready;
char dev_name[PATH_MAX];
char dev_name[PATH_MAX_LENGTH];
} video4linux_t;
static void process_image(video4linux_t *v4l,

View File

@ -164,7 +164,7 @@ static ssize_t read_content_file(const char *path, void **buf)
static void dump_to_file_desperate(const void *data,
size_t size, unsigned type)
{
char path[PATH_MAX], timebuf[PATH_MAX];
char path[PATH_MAX_LENGTH], timebuf[PATH_MAX_LENGTH];
time_t time_;
#if defined(_WIN32) && !defined(_XBOX)
const char *base = getenv("APPDATA");
@ -415,7 +415,7 @@ static bool load_content(const struct retro_subsystem_info *special,
{
if (need_fullpath && path_contains_compressed_file(path))
{
char new_path[PATH_MAX], new_basedir[PATH_MAX];
char new_path[PATH_MAX_LENGTH], new_basedir[PATH_MAX_LENGTH];
union string_list_elem_attr attributes;
RARCH_LOG("Compressed file in case of need_fullpath."
@ -566,7 +566,7 @@ bool init_content_file(void)
if (ext && !strcasecmp(ext, "zip"))
{
char temporary_content[PATH_MAX];
char temporary_content[PATH_MAX_LENGTH];
strlcpy(temporary_content, content->elems[i].data,
sizeof(temporary_content));

View File

@ -122,7 +122,7 @@ core_info_list_t *core_info_list_new(const char *modules_path)
for (i = 0; i < contents->size; i++)
{
char info_path_base[PATH_MAX], info_path[PATH_MAX];
char info_path_base[PATH_MAX_LENGTH], info_path[PATH_MAX_LENGTH];
core_info[i].path = strdup(contents->elems[i].data);
if (!core_info[i].path)
@ -456,7 +456,7 @@ void core_info_list_update_missing_firmware(core_info_list_t *core_info_list,
const char *core, const char *systemdir)
{
size_t i;
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
core_info_t *info = NULL;
if (!core_info_list || !core)
@ -481,7 +481,7 @@ void core_info_list_get_missing_firmware(core_info_list_t *core_info_list,
const core_info_firmware_t **firmware, size_t *num_firmware)
{
size_t i;
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
core_info_t *info = NULL;
if (!core_info_list || !core)

View File

@ -20,6 +20,7 @@
#include <file/dir_list.h>
#include <compat/posix_string.h>
#include <compat/strl.h>
#include <retro_miscellaneous.h>
struct core_option
{
@ -32,7 +33,7 @@ struct core_option
struct core_option_manager
{
config_file_t *conf;
char conf_path[PATH_MAX];
char conf_path[PATH_MAX_LENGTH];
struct core_option *opts;
size_t size;

View File

@ -161,7 +161,7 @@ static SRes ConvertUtf16toCharString(const uint16_t *s, char *outstring)
res = Utf16_To_Char(&buf, s, 0);
if (res == SZ_OK)
strncpy(outstring,(const char *)buf.data,PATH_MAX);
strncpy(outstring, (const char *)buf.data, PATH_MAX_LENGTH);
Buf_Free(&buf, &g_Alloc);
return res;
@ -242,7 +242,7 @@ int read_7zip_file(const char * archive_path,
}
}
SzArEx_GetFileNameUtf16(&db, i, temp);
char infile[PATH_MAX];
char infile[PATH_MAX_LENGTH];
res = ConvertUtf16toCharString(temp,infile);
uint64_t filesize = f->Size;
@ -400,7 +400,7 @@ struct string_list *compressed_7zip_file_list_new(const char *path,
}
}
SzArEx_GetFileNameUtf16(&db, i, temp);
char infile[PATH_MAX];
char infile[PATH_MAX_LENGTH];
res = ConvertUtf16toCharString(temp, infile);
const char *file_ext = path_get_extension(infile);

View File

@ -70,12 +70,12 @@ int read_zip_file(const char * archive_path,
{
/* Get info about current file. */
unz_file_info file_info;
char filename[ PATH_MAX ];
char filename[PATH_MAX_LENGTH];
if ( unzGetCurrentFileInfo(
zipfile,
&file_info,
filename,
PATH_MAX,
PATH_MAX_LENGTH,
NULL, 0, NULL, 0 ) != UNZ_OK )
{
RARCH_ERR("Could not read file info in ZIP %s.\n",
@ -224,12 +224,12 @@ struct string_list *compressed_zip_file_list_new(const char *path,
{
/* Get info about current file. */
unz_file_info file_info;
char filename[ PATH_MAX ];
char filename[PATH_MAX_LENGTH];
if ( unzGetCurrentFileInfo(
zipfile,
&file_info,
filename,
PATH_MAX,
PATH_MAX_LENGTH,
NULL, 0, NULL, 0 ) != UNZ_OK )
{
RARCH_ERR("Could not read file info in ZIP %s.\n", path);

View File

@ -549,7 +549,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
(const struct retro_variable*)data;
const char *options_path = g_settings.core_options_path;
char buf[PATH_MAX];
char buf[PATH_MAX_LENGTH];
if (!*options_path && *g_extern.config_path)
{
fill_pathname_resolve_relative(buf, g_extern.config_path,

View File

@ -281,7 +281,7 @@ bool zlib_parse_file(const char *file, zlib_file_cb file_cb, void *userdata)
uint32_t checksum, csize, size, offset;
unsigned cmode, namelength, extralength, commentlength,
offsetNL, offsetEL;
char filename[PATH_MAX] = {0};
char filename[PATH_MAX_LENGTH] = {0};
const uint8_t *cdata = NULL;
uint32_t signature = read_le(directory + 0, 4);
@ -297,7 +297,7 @@ bool zlib_parse_file(const char *file, zlib_file_cb file_cb, void *userdata)
extralength = read_le(directory + 30, 2);
commentlength = read_le(directory + 32, 2);
if (namelength >= PATH_MAX)
if (namelength >= PATH_MAX_LENGTH)
GOTO_END_ERROR();
memcpy(filename, directory + 46, namelength);
@ -344,7 +344,7 @@ static bool zip_extract_cb(const char *name, const uint8_t *cdata,
const char *ext = path_get_extension(name);
if (ext && string_list_find_elem(data->ext, ext))
{
char new_path[PATH_MAX];
char new_path[PATH_MAX_LENGTH];
if (data->extraction_directory)
fill_pathname_join(new_path, data->extraction_directory,

View File

@ -99,7 +99,7 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
const char *path, const char *menu_label,
char *deferred_path, size_t sizeof_deferred_path)
{
char new_core_path[PATH_MAX];
char new_core_path[PATH_MAX_LENGTH];
const core_info_t *info = NULL;
size_t supported = 0;

150
general.h
View File

@ -195,25 +195,25 @@ enum sound_mode_enums
struct defaults
{
char menu_config_dir[PATH_MAX];
char config_path[PATH_MAX];
char core_path[PATH_MAX];
char autoconfig_dir[PATH_MAX];
char audio_filter_dir[PATH_MAX];
char video_filter_dir[PATH_MAX];
char assets_dir[PATH_MAX];
char core_dir[PATH_MAX];
char core_info_dir[PATH_MAX];
char overlay_dir[PATH_MAX];
char port_dir[PATH_MAX];
char shader_dir[PATH_MAX];
char savestate_dir[PATH_MAX];
char resampler_dir[PATH_MAX];
char sram_dir[PATH_MAX];
char screenshot_dir[PATH_MAX];
char system_dir[PATH_MAX];
char playlist_dir[PATH_MAX];
char content_history_dir[PATH_MAX];
char menu_config_dir[PATH_MAX_LENGTH];
char config_path[PATH_MAX_LENGTH];
char core_path[PATH_MAX_LENGTH];
char autoconfig_dir[PATH_MAX_LENGTH];
char audio_filter_dir[PATH_MAX_LENGTH];
char video_filter_dir[PATH_MAX_LENGTH];
char assets_dir[PATH_MAX_LENGTH];
char core_dir[PATH_MAX_LENGTH];
char core_info_dir[PATH_MAX_LENGTH];
char overlay_dir[PATH_MAX_LENGTH];
char port_dir[PATH_MAX_LENGTH];
char shader_dir[PATH_MAX_LENGTH];
char savestate_dir[PATH_MAX_LENGTH];
char resampler_dir[PATH_MAX_LENGTH];
char sram_dir[PATH_MAX_LENGTH];
char screenshot_dir[PATH_MAX_LENGTH];
char system_dir[PATH_MAX_LENGTH];
char playlist_dir[PATH_MAX_LENGTH];
char content_history_dir[PATH_MAX_LENGTH];
struct
{
@ -258,17 +258,17 @@ struct settings
unsigned aspect_ratio_idx;
unsigned rotation;
char shader_path[PATH_MAX];
char shader_path[PATH_MAX_LENGTH];
bool shader_enable;
char softfilter_plugin[PATH_MAX];
char softfilter_plugin[PATH_MAX_LENGTH];
float refresh_rate;
bool threaded;
char filter_dir[PATH_MAX];
char shader_dir[PATH_MAX];
char filter_dir[PATH_MAX_LENGTH];
char shader_dir[PATH_MAX_LENGTH];
char font_path[PATH_MAX];
char font_path[PATH_MAX_LENGTH];
float font_size;
bool font_enable;
float msg_pos_x;
@ -315,7 +315,7 @@ struct settings
struct
{
char driver[32];
char device[PATH_MAX];
char device[PATH_MAX_LENGTH];
bool allow;
unsigned width;
unsigned height;
@ -341,12 +341,12 @@ struct settings
bool enable;
unsigned out_rate;
unsigned block_frames;
char device[PATH_MAX];
char device[PATH_MAX_LENGTH];
unsigned latency;
bool sync;
char dsp_plugin[PATH_MAX];
char filter_dir[PATH_MAX];
char dsp_plugin[PATH_MAX_LENGTH];
char filter_dir[PATH_MAX_LENGTH];
bool rate_control;
float rate_control_delta;
@ -386,11 +386,11 @@ struct settings
unsigned turbo_duty_cycle;
bool overlay_enable;
char overlay[PATH_MAX];
char overlay[PATH_MAX_LENGTH];
float overlay_opacity;
float overlay_scale;
char autoconfig_dir[PATH_MAX];
char autoconfig_dir[PATH_MAX_LENGTH];
bool autoconfig_descriptor_label_show;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
@ -403,25 +403,25 @@ struct settings
int state_slot;
char core_options_path[PATH_MAX];
char content_history_path[PATH_MAX];
char content_history_directory[PATH_MAX];
char core_options_path[PATH_MAX_LENGTH];
char content_history_path[PATH_MAX_LENGTH];
char content_history_directory[PATH_MAX_LENGTH];
unsigned content_history_size;
char libretro[PATH_MAX];
char libretro_directory[PATH_MAX];
char libretro[PATH_MAX_LENGTH];
char libretro_directory[PATH_MAX_LENGTH];
unsigned libretro_log_level;
char libretro_info_path[PATH_MAX];
char content_database[PATH_MAX];
char cheat_database[PATH_MAX];
char cheat_settings_path[PATH_MAX];
char libretro_info_path[PATH_MAX_LENGTH];
char content_database[PATH_MAX_LENGTH];
char cheat_database[PATH_MAX_LENGTH];
char cheat_settings_path[PATH_MAX_LENGTH];
char resampler_directory[PATH_MAX];
char screenshot_directory[PATH_MAX];
char system_directory[PATH_MAX];
char resampler_directory[PATH_MAX_LENGTH];
char screenshot_directory[PATH_MAX_LENGTH];
char system_directory[PATH_MAX_LENGTH];
char extraction_directory[PATH_MAX];
char playlist_directory[PATH_MAX];
char extraction_directory[PATH_MAX_LENGTH];
char playlist_directory[PATH_MAX_LENGTH];
bool history_list_enable;
bool rewind_enable;
@ -444,11 +444,11 @@ struct settings
uint16_t network_cmd_port;
bool stdin_cmd_enable;
char content_directory[PATH_MAX];
char assets_directory[PATH_MAX];
char menu_config_directory[PATH_MAX];
char content_directory[PATH_MAX_LENGTH];
char assets_directory[PATH_MAX_LENGTH];
char menu_config_directory[PATH_MAX_LENGTH];
#if defined(HAVE_MENU)
char menu_content_directory[PATH_MAX];
char menu_content_directory[PATH_MAX_LENGTH];
bool menu_show_start_screen;
#endif
bool fps_show;
@ -497,9 +497,9 @@ struct global
uint32_t content_crc;
char gb_rom_path[PATH_MAX];
char bsx_rom_path[PATH_MAX];
char sufami_rom_path[2][PATH_MAX];
char gb_rom_path[PATH_MAX_LENGTH];
char bsx_rom_path[PATH_MAX_LENGTH];
char sufami_rom_path[2][PATH_MAX_LENGTH];
bool has_set_input_descriptors;
bool has_set_save_path;
bool has_set_state_path;
@ -515,43 +515,43 @@ struct global
bool has_set_netplay_ip_port;
/* Config associated with global "default" config. */
char config_path[PATH_MAX];
char append_config_path[PATH_MAX];
char input_config_path[PATH_MAX];
char config_path[PATH_MAX_LENGTH];
char append_config_path[PATH_MAX_LENGTH];
char input_config_path[PATH_MAX_LENGTH];
#ifdef HAVE_FILE_LOGGER
char default_log_file[PATH_MAX];
char default_log_file[PATH_MAX_LENGTH];
#endif
char basename[PATH_MAX];
char fullpath[PATH_MAX];
char basename[PATH_MAX_LENGTH];
char fullpath[PATH_MAX_LENGTH];
/* A list of save types and associated paths for all content. */
struct string_list *savefiles;
/* For --subsystem content. */
char subsystem[PATH_MAX];
char subsystem[PATH_MAX_LENGTH];
struct string_list *subsystem_fullpaths;
char savefile_name[PATH_MAX];
char savestate_name[PATH_MAX];
char cheatfile_name[PATH_MAX];
char savefile_name[PATH_MAX_LENGTH];
char savestate_name[PATH_MAX_LENGTH];
char cheatfile_name[PATH_MAX_LENGTH];
/* Used on reentrancy to use a savestate dir. */
char savefile_dir[PATH_MAX];
char savestate_dir[PATH_MAX];
char savefile_dir[PATH_MAX_LENGTH];
char savestate_dir[PATH_MAX_LENGTH];
#ifdef HAVE_OVERLAY
char overlay_dir[PATH_MAX];
char overlay_dir[PATH_MAX_LENGTH];
#endif
bool block_patch;
bool ups_pref;
bool bps_pref;
bool ips_pref;
char ups_name[PATH_MAX];
char bps_name[PATH_MAX];
char ips_name[PATH_MAX];
char ups_name[PATH_MAX_LENGTH];
char bps_name[PATH_MAX_LENGTH];
char ips_name[PATH_MAX_LENGTH];
struct
{
@ -580,7 +580,7 @@ struct global
bool no_content;
const char *input_desc_btn[MAX_USERS][RARCH_FIRST_META_KEY];
char valid_extensions[PATH_MAX];
char valid_extensions[PATH_MAX_LENGTH];
retro_keyboard_event_t key_event;
@ -674,12 +674,12 @@ struct global
struct
{
bsv_movie_t *movie;
char movie_path[PATH_MAX];
char movie_path[PATH_MAX_LENGTH];
bool movie_playback;
bool eof_exit;
/* Immediate playback/recording. */
char movie_start_path[PATH_MAX];
char movie_start_path[PATH_MAX_LENGTH];
bool movie_start_recording;
bool movie_start_playback;
bool movie_end;
@ -711,7 +711,7 @@ struct global
#ifdef HAVE_NETPLAY
/* Netplay. */
char netplay_server[PATH_MAX];
char netplay_server[PATH_MAX_LENGTH];
bool netplay_enable;
bool netplay_is_client;
bool netplay_is_spectate;
@ -720,8 +720,8 @@ struct global
#endif
/* Recording. */
char record_path[PATH_MAX];
char record_config[PATH_MAX];
char record_path[PATH_MAX_LENGTH];
char record_config[PATH_MAX_LENGTH];
bool recording_enable;
unsigned record_width;
unsigned record_height;
@ -806,14 +806,14 @@ struct global
bool main_is_init;
bool content_is_init;
bool error_in_init;
char error_string[PATH_MAX];
char error_string[PATH_MAX_LENGTH];
jmp_buf error_sjlj_context;
bool libretro_no_content;
bool libretro_dummy;
/* Config file associated with per-core configs. */
char core_specific_config_path[PATH_MAX];
char core_specific_config_path[PATH_MAX_LENGTH];
retro_keyboard_event_t frontend_key_event;
};

View File

@ -102,7 +102,7 @@ struct gfx_shader_pass
{
struct
{
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
struct
{
char *vertex; /* Dynamically allocated. Must be free'd. */
@ -121,7 +121,7 @@ struct gfx_shader_pass
struct gfx_shader_lut
{
char id[64];
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
unsigned filter;
enum gfx_wrap_type wrap;
bool mipmap;
@ -147,7 +147,7 @@ struct gfx_shader
unsigned variables;
struct state_tracker_uniform_info variable[GFX_MAX_VARIABLES];
char script_path[PATH_MAX];
char script_path[PATH_MAX_LENGTH];
char *script; /* Dynamically allocated. Must be free'd. Only used by XML. */
char script_class[512];
};

View File

@ -129,11 +129,11 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
snprintf(overlay_desc_image_key, sizeof(overlay_desc_image_key),
"overlay%u_desc%u_overlay", ol_idx, desc_idx);
char image_path[PATH_MAX];
char image_path[PATH_MAX_LENGTH];
if (config_get_path(conf, overlay_desc_image_key,
image_path, sizeof(image_path)))
{
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
fill_pathname_resolve_relative(path, ol->overlay_path,
image_path, sizeof(path));
@ -290,8 +290,8 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
size_t i;
char overlay_path_key[64];
char overlay_name_key[64];
char overlay_path[PATH_MAX];
char overlay_resolved_path[PATH_MAX];
char overlay_path[PATH_MAX_LENGTH];
char overlay_resolved_path[PATH_MAX_LENGTH];
snprintf(overlay_path_key, sizeof(overlay_path_key),
"overlay%u_overlay", idx);

View File

@ -236,11 +236,12 @@ static bool parport_joypad_init(void)
for (i = 0; i < MAX_USERS; i++)
{
char path[PATH_MAX_LENGTH];
struct parport_joypad *pad = &parport_pads[i];
pad->fd = -1;
pad->ident = g_settings.input.device_names[i];
char path[PATH_MAX];
snprintf(path, sizeof(path), "/dev/parport%u", i);
if (parport_joypad_init_pad(path, pad))

View File

@ -57,8 +57,8 @@
* set this value explicitly in platform specific headers.
*/
#ifndef PATH_MAX
#define PATH_MAX 4096
#ifndef PATH_MAX_LENGTH
#define PATH_MAX_LENGTH 4096
#endif
#ifndef max

View File

@ -41,8 +41,8 @@ static int menu_message_toggle(unsigned action)
static int menu_info_screen_iterate(unsigned action)
{
char msg[PATH_MAX];
char needle[PATH_MAX];
char msg[PATH_MAX_LENGTH];
char needle[PATH_MAX_LENGTH];
unsigned info_type = 0;
rarch_setting_t *current_setting = NULL;
file_list_t *list = (file_list_t*)driver.menu->menu_list->selection_buf;
@ -95,7 +95,7 @@ static int menu_info_screen_iterate(unsigned action)
static int menu_start_screen_iterate(unsigned action)
{
unsigned i;
char msg[PATH_MAX * 2];
char msg[PATH_MAX_LENGTH * 2];
if (!driver.menu)
return 0;
@ -237,7 +237,7 @@ static int mouse_post_iterate(menu_file_list_cbs_t *cbs, const char *path,
static int menu_viewport_iterate(unsigned action)
{
int stride_x = 1, stride_y = 1;
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
struct retro_game_geometry *geom = NULL;
const char *base_msg = NULL;
const char *label = NULL;
@ -421,7 +421,7 @@ static void menu_common_load_content(void)
static int menu_archive_open(void)
{
char cat_path[PATH_MAX];
char cat_path[PATH_MAX_LENGTH];
const char *menu_path = NULL;
const char *menu_label = NULL;
const char* path = NULL;
@ -492,7 +492,7 @@ static int menu_archive_load(void)
static int menu_load_or_open_zip_iterate(unsigned action)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Opening compressed file\n"
" \n"

View File

@ -36,7 +36,7 @@ typedef struct glui_handle
unsigned margin;
unsigned term_width;
unsigned term_height;
char box_message[PATH_MAX];
char box_message[PATH_MAX_LENGTH];
GLuint bg;
} glui_handle_t;
@ -265,8 +265,8 @@ static void glui_frame(void)
{
unsigned x, y;
size_t i;
char title[PATH_MAX], title_buf[PATH_MAX],
title_msg[PATH_MAX];
char title[PATH_MAX_LENGTH], title_buf[PATH_MAX_LENGTH],
title_msg[PATH_MAX_LENGTH];
const char *dir = NULL;
const char *label = NULL;
unsigned menu_type = 0;
@ -350,9 +350,9 @@ static void glui_frame(void)
for (i = driver.menu->begin; i < end; i++, y += glui->line_height)
{
char message[PATH_MAX], type_str[PATH_MAX],
entry_title_buf[PATH_MAX], type_str_buf[PATH_MAX],
path_buf[PATH_MAX];
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
@ -400,7 +400,7 @@ static void glui_frame(void)
if (driver.menu->keyboard.display)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
const char *str = *driver.menu->keyboard.buffer;
if (!str)
str = "";
@ -538,7 +538,7 @@ static GLuint glui_png_texture_load(const char* file_name)
static void glui_context_reset(void *data)
{
char bgpath[PATH_MAX];
char bgpath[PATH_MAX_LENGTH];
glui_handle_t *glui = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
gl_t *gl = (gl_t*)driver_video_resolve(NULL);

View File

@ -324,7 +324,7 @@ static void lakka_draw_subitems(lakka_handle_t *lakka, int i, int j)
if (i && (k == 1 || k == 2))
{
char slot[PATH_MAX];
char slot[PATH_MAX_LENGTH];
if (g_settings.state_slot == -1)
snprintf(slot, sizeof(slot), "%d (auto)", g_settings.state_slot);
@ -341,7 +341,7 @@ static void lakka_draw_subitems(lakka_handle_t *lakka, int i, int j)
if (subitem->setting)
{
char val[PATH_MAX];
char val[PATH_MAX_LENGTH];
setting_data_get_string_representation(subitem->setting, val,
sizeof(val));
@ -884,7 +884,7 @@ static void lakka_settings_context_reset(void)
static void lakka_context_reset(void *data)
{
int i, j, k;
char mediapath[PATH_MAX], themepath[PATH_MAX], iconpath[PATH_MAX], fontpath[PATH_MAX];
char mediapath[PATH_MAX_LENGTH], themepath[PATH_MAX_LENGTH], iconpath[PATH_MAX_LENGTH], fontpath[PATH_MAX_LENGTH];
lakka_handle_t *lakka = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
gl_t *gl = NULL;
@ -952,7 +952,7 @@ static void lakka_context_reset(void *data)
for (i = 1; i < lakka->num_categories; i++)
{
char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX];
char core_id[PATH_MAX_LENGTH], texturepath[PATH_MAX_LENGTH], content_texturepath[PATH_MAX_LENGTH];
menu_category_t *category = (menu_category_t*)&lakka->categories[i];
core_info_t *info = NULL;
core_info_list_t *info_list = NULL;

View File

@ -386,9 +386,9 @@ static void rgui_render(void)
for (i = driver.menu->begin; i < end; i++, y += FONT_HEIGHT_STRIDE)
{
char message[PATH_MAX], type_str[PATH_MAX],
entry_title_buf[PATH_MAX], type_str_buf[PATH_MAX],
path_buf[PATH_MAX];
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
@ -439,7 +439,7 @@ static void rgui_render(void)
if (driver.menu->keyboard.display)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
const char *str = *driver.menu->keyboard.buffer;
if (!str)
str = "";

View File

@ -206,9 +206,9 @@ static void rmenu_render(void)
for (i = begin; i < end; i++, j++)
{
char message[PATH_MAX], type_str[PATH_MAX],
entry_title_buf[PATH_MAX], type_str_buf[PATH_MAX],
path_buf[PATH_MAX];
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
@ -272,7 +272,7 @@ void rmenu_set_texture(void *data)
static void rmenu_context_reset(void *data)
{
char menu_bg[PATH_MAX];
char menu_bg[PATH_MAX_LENGTH];
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)

View File

@ -122,7 +122,7 @@ CREATE_CLASS(CRetroArchMain, L"RetroArchMain");
CRetroArch app;
wchar_t strw_buffer[PATH_MAX];
wchar_t strw_buffer[PATH_MAX_LENGTH];
/* Register custom classes */
HRESULT CRetroArch::RegisterXuiClasses (void)
@ -146,7 +146,7 @@ HRESULT CRetroArchMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
GetChildById(L"XuiTxtTitle", &m_menutitle);
GetChildById(L"XuiTxtBottom", &m_menutitlebottom);
char str[PATH_MAX];
char str[PATH_MAX_LENGTH];
snprintf(str, sizeof(str), "%s - %s", PACKAGE_VERSION, g_extern.title_buf);
mbstowcs(strw_buffer, str, sizeof(strw_buffer) / sizeof(wchar_t));
XuiTextElementSetText(m_menutitlebottom, strw_buffer);
@ -412,9 +412,9 @@ static void rmenu_xui_render(void)
for (i = begin; i < end; i++/*, y += FONT_HEIGHT_STRIDE */)
{
char message[PATH_MAX], type_str[PATH_MAX],
entry_title_buf[PATH_MAX], type_str_buf[PATH_MAX],
path_buf[PATH_MAX];
char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH],
entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH],
path_buf[PATH_MAX_LENGTH];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
bool selected = false;
@ -493,7 +493,7 @@ static void rmenu_xui_list_insert(void *data,
const char *path, const char *, size_t list_size)
{
(void)data;
wchar_t buf[PATH_MAX];
wchar_t buf[PATH_MAX_LENGTH];
XuiListInsertItems(m_menulist, list_size, 1);
mbstowcs(buf, path, sizeof(buf) / sizeof(wchar_t));

View File

@ -74,7 +74,7 @@ enum
struct xmb_texture_item
{
GLuint id;
char path[PATH_MAX];
char path[PATH_MAX_LENGTH];
};
typedef struct xmb_handle
@ -89,8 +89,8 @@ typedef struct xmb_handle
int depth;
int old_depth;
char icon_dir[4];
char box_message[PATH_MAX];
char title[PATH_MAX];
char box_message[PATH_MAX_LENGTH];
char title[PATH_MAX_LENGTH];
struct xmb_texture_item textures[XMB_TEXTURE_LAST];
int icon_size;
float x;
@ -791,7 +791,7 @@ static void xmb_draw_items(file_list_t *list, file_list_t *stack,
for (i = 0; i < end; i++)
{
char val_buf[PATH_MAX], path_buf[PATH_MAX];
char val_buf[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH];
char name[256], value[256];
const char *path = NULL, *entry_label = NULL;
unsigned type = 0, w = 0;
@ -1000,7 +1000,7 @@ static void xmb_frame(void)
if (driver.menu->keyboard.display)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
const char *str = *driver.menu->keyboard.buffer;
if (!str)
str = "";
@ -1162,10 +1162,10 @@ static bool xmb_font_init_first(const gl_font_renderer_t **font_driver,
static void xmb_context_reset(void *data)
{
int i, k;
char bgpath[PATH_MAX];
char mediapath[PATH_MAX], themepath[PATH_MAX], iconpath[PATH_MAX],
fontpath[PATH_MAX], core_id[PATH_MAX], texturepath[PATH_MAX],
content_texturepath[PATH_MAX];
char bgpath[PATH_MAX_LENGTH];
char mediapath[PATH_MAX_LENGTH], themepath[PATH_MAX_LENGTH], iconpath[PATH_MAX_LENGTH],
fontpath[PATH_MAX_LENGTH], core_id[PATH_MAX_LENGTH], texturepath[PATH_MAX_LENGTH],
content_texturepath[PATH_MAX_LENGTH];
gl_t *gl = NULL;
xmb_handle_t *xmb = NULL;
@ -1417,12 +1417,12 @@ static void xmb_list_cache(bool horizontal, unsigned action)
size_t stack_size = driver.menu->menu_list->menu_stack->size;
if (driver.menu->cat_selection_ptr == 0)
{
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Main Menu", PATH_MAX);
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Main Menu", PATH_MAX_LENGTH);
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTINGS;
}
else
{
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Horizontal Menu", PATH_MAX);
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label, "Horizontal Menu", PATH_MAX_LENGTH);
driver.menu->menu_list->menu_stack->list[stack_size-1].type = MENU_SETTING_HORIZONTAL_MENU;
}
}

View File

@ -88,8 +88,8 @@ static void push_to_history_playlist(void)
if (*g_extern.fullpath)
{
char tmp[PATH_MAX];
char str[PATH_MAX];
char tmp[PATH_MAX_LENGTH];
char str[PATH_MAX_LENGTH];
fill_pathname_base(tmp, g_extern.fullpath, sizeof(tmp));
snprintf(str, sizeof(str), "INFO - Loading %s ...", tmp);
@ -120,7 +120,7 @@ bool load_menu_content(void)
if (!(main_load_content(0, NULL, NULL, menu_environment_get,
driver.frontend_ctx->process_args)))
{
char name[PATH_MAX], msg[PATH_MAX];
char name[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
fill_pathname_base(name, g_extern.fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);

View File

@ -85,13 +85,13 @@ typedef struct
bool push_start_screen;
bool defer_core;
char deferred_path[PATH_MAX];
char deferred_path[PATH_MAX_LENGTH];
/* This buffer can be used to display generic OK messages to the user.
* Fill it and call
* menu_list_push(driver.menu->menu_stack, "", "message", 0, 0);
*/
char message_contents[PATH_MAX];
char message_contents[PATH_MAX_LENGTH];
/* Quick jumping indices with L/R.
* Rebuilt when parsing directory. */
@ -99,8 +99,8 @@ typedef struct
unsigned scroll_indices_size;
unsigned scroll_accel;
char default_glslp[PATH_MAX];
char default_cgp[PATH_MAX];
char default_glslp[PATH_MAX_LENGTH];
char default_cgp[PATH_MAX_LENGTH];
const uint8_t *font;
bool alloc_font;

View File

@ -442,7 +442,7 @@ int menu_entries_parse_list(file_list_t *list, file_list_t *menu_list,
for (i = 0; i < list_size; i++)
{
char core_path[PATH_MAX], display_name[PATH_MAX];
char core_path[PATH_MAX_LENGTH], display_name[PATH_MAX_LENGTH];
const char *path = NULL;
menu_list_get_at_offset(list, i, &path, NULL, &type);

View File

@ -331,7 +331,7 @@ static int action_ok_cheat_file_load(const char *path,
const char *label, unsigned type, size_t idx)
{
const char *menu_path = NULL;
char cheat_path[PATH_MAX];
char cheat_path[PATH_MAX_LENGTH];
if (!driver.menu)
return -1;
@ -359,7 +359,7 @@ static int action_ok_shader_preset_load(const char *path,
const char *label, unsigned type, size_t idx)
{
const char *menu_path = NULL;
char shader_path[PATH_MAX];
char shader_path[PATH_MAX_LENGTH];
if (!driver.menu)
return -1;
@ -506,7 +506,7 @@ static int action_ok_directory_push(const char *path,
{
const char *menu_path = NULL;
const char *menu_label = NULL;
char cat_path[PATH_MAX];
char cat_path[PATH_MAX_LENGTH];
if (!driver.menu)
return -1;
@ -532,7 +532,7 @@ static int action_ok_config_load(const char *path,
const char *label, unsigned type, size_t idx)
{
const char *menu_path = NULL;
char config[PATH_MAX];
char config[PATH_MAX_LENGTH];
if (!driver.menu)
return -1;
@ -556,7 +556,7 @@ static int action_ok_disk_image_append(const char *path,
const char *label, unsigned type, size_t idx)
{
const char *menu_path = NULL;
char image[PATH_MAX];
char image[PATH_MAX_LENGTH];
if (!driver.menu)
return -1;
@ -1590,7 +1590,7 @@ static int deferred_push_core_information(void *data, void *userdata,
if (info->data)
{
char tmp[PATH_MAX];
char tmp[PATH_MAX_LENGTH];
snprintf(tmp, sizeof(tmp), "Core name: %s",
info->core_name ? info->core_name : "");
@ -2163,7 +2163,7 @@ static int deferred_push_history_list(void *data, void *userdata,
for (i = 0; i < list_size; i++)
{
char fill_buf[PATH_MAX];
char fill_buf[PATH_MAX_LENGTH];
const char *core_name = NULL;
content_playlist_get_index(g_defaults.history, i,
@ -2172,7 +2172,7 @@ static int deferred_push_history_list(void *data, void *userdata,
if (path)
{
char path_short[PATH_MAX];
char path_short[PATH_MAX_LENGTH];
fill_short_pathname_representation(path_short,path,sizeof(path_short));
snprintf(fill_buf,sizeof(fill_buf),"%s (%s)",
path_short,core_name);
@ -2400,7 +2400,7 @@ static int deferred_push_detect_core_list(void *data, void *userdata,
static int deferred_push_default(void *data, void *userdata,
const char *path, const char *label, unsigned type)
{
char ext_buf[PATH_MAX];
char ext_buf[PATH_MAX_LENGTH];
const char *exts = NULL;
file_list_t *list = (file_list_t*)data;
file_list_t *menu_list = (file_list_t*)userdata;

View File

@ -321,7 +321,7 @@ bool menu_custom_bind_keyboard_cb(void *data, unsigned code)
int menu_input_bind_iterate(void *data)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
menu_handle_t *menu = (menu_handle_t*)data;
struct menu_bind_state binds = menu->binds;
@ -361,7 +361,7 @@ int menu_input_bind_iterate(void *data)
int menu_input_bind_iterate_keyboard(void *data)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
int64_t current;
int timeout = 0;
bool timed_out = false;

View File

@ -22,7 +22,7 @@
void menu_shader_manager_init(void *data)
{
char cgp_path[PATH_MAX];
char cgp_path[PATH_MAX_LENGTH];
struct gfx_shader *shader = NULL;
config_file_t *conf = NULL;
const char *config_path = NULL;
@ -146,7 +146,7 @@ void menu_shader_manager_set_preset(struct gfx_shader *shader,
void menu_shader_manager_save_preset(
const char *basename, bool apply)
{
char buffer[PATH_MAX], config_directory[PATH_MAX], cgp_path[PATH_MAX];
char buffer[PATH_MAX_LENGTH], config_directory[PATH_MAX_LENGTH], cgp_path[PATH_MAX_LENGTH];
unsigned d, type = RARCH_SHADER_NONE;
config_file_t *conf = NULL;
bool ret = false;

View File

@ -71,7 +71,7 @@
long read_compressed_file(const char * path, void **buf,
const char* optional_filename)
{
char archive_path[PATH_MAX], *archive_found = NULL;
char archive_path[PATH_MAX_LENGTH], *archive_found = NULL;
/* Safety check.
* If optional_filename and optional_filename exists, we simply return 0,

View File

@ -59,7 +59,7 @@
static bool take_screenshot_viewport(void)
{
char screenshot_path[PATH_MAX];
char screenshot_path[PATH_MAX_LENGTH];
const char *screenshot_dir = NULL;
uint8_t *buffer = NULL;
bool retval = false;
@ -102,7 +102,7 @@ done:
static bool take_screenshot_raw(void)
{
char screenshot_path[PATH_MAX];
char screenshot_path[PATH_MAX_LENGTH];
const void *data = g_extern.frame_cache.data;
unsigned width = g_extern.frame_cache.width;
unsigned height = g_extern.frame_cache.height;
@ -1190,7 +1190,7 @@ static void init_movie(void)
}
else if (g_extern.bsv.movie_start_recording)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
snprintf(msg, sizeof(msg), "Starting movie record to \"%s\".",
g_extern.bsv.movie_start_path);
@ -1322,7 +1322,7 @@ static void deinit_autosave(void)
static void set_savestate_auto_index(void)
{
char state_dir[PATH_MAX], state_base[PATH_MAX];
char state_dir[PATH_MAX_LENGTH], state_base[PATH_MAX_LENGTH];
size_t i;
struct string_list *dir_list = NULL;
unsigned max_idx = 0;
@ -1347,7 +1347,7 @@ static void set_savestate_auto_index(void)
for (i = 0; i < dir_list->size; i++)
{
char elem_base[PATH_MAX];
char elem_base[PATH_MAX_LENGTH];
const char *dir_elem = dir_list->elems[i].data;
fill_pathname_base(elem_base, dir_elem, sizeof(elem_base));
@ -1398,7 +1398,7 @@ static void rarch_init_savefile_paths(void)
for (j = 0; j < info->roms[i].num_memory; j++)
{
union string_list_elem_attr attr;
char path[PATH_MAX], ext[32];
char path[PATH_MAX_LENGTH], ext[32];
const struct retro_subsystem_memory_info *mem =
(const struct retro_subsystem_memory_info*)
&info->roms[i].memory[j];
@ -1438,7 +1438,7 @@ static void rarch_init_savefile_paths(void)
}
else
{
char savefile_name_rtc[PATH_MAX];
char savefile_name_rtc[PATH_MAX_LENGTH];
union string_list_elem_attr attr;
attr.i = RETRO_MEMORY_SAVE_RAM;
@ -1474,7 +1474,7 @@ static void fill_pathnames(void)
static void load_auto_state(void)
{
char savestate_name_auto[PATH_MAX];
char savestate_name_auto[PATH_MAX_LENGTH];
#ifdef HAVE_NETPLAY
if (g_extern.netplay_enable && !g_extern.netplay_is_spectate)
@ -1489,7 +1489,7 @@ static void load_auto_state(void)
if (path_file_exists(savestate_name_auto))
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
bool ret = load_state(savestate_name_auto);
RARCH_LOG("Found auto savestate in: %s\n", savestate_name_auto);
@ -1503,7 +1503,7 @@ static void load_auto_state(void)
static bool save_auto_state(void)
{
char savestate_name_auto[PATH_MAX];
char savestate_name_auto[PATH_MAX_LENGTH];
if (!g_settings.savestate_auto_save || g_extern.libretro_dummy ||
g_extern.libretro_no_content)
@ -1557,7 +1557,7 @@ static void rarch_save_state(const char *path,
static void main_state(unsigned cmd)
{
char path[PATH_MAX], msg[PATH_MAX];
char path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
if (g_settings.state_slot > 0)
snprintf(path, sizeof(path), "%s%d",
@ -1585,7 +1585,7 @@ static void main_state(unsigned cmd)
void rarch_disk_control_append_image(const char *path)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
unsigned new_idx;
const struct retro_disk_control_callback *control =
(const struct retro_disk_control_callback*)&g_extern.system.disk_control;
@ -1626,7 +1626,7 @@ void rarch_disk_control_append_image(const char *path)
void rarch_disk_control_set_eject(bool new_state, bool print_log)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
const struct retro_disk_control_callback *control =
(const struct retro_disk_control_callback*)&g_extern.system.disk_control;
bool error = false;
@ -1664,7 +1664,7 @@ void rarch_disk_control_set_eject(bool new_state, bool print_log)
void rarch_disk_control_set_index(unsigned next_idx)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
unsigned num_disks;
const struct retro_disk_control_callback *control =
(const struct retro_disk_control_callback*)&g_extern.system.disk_control;
@ -2073,8 +2073,8 @@ void rarch_main_set_state(unsigned cmd)
static bool save_core_config(void)
{
bool ret = false;
char config_dir[PATH_MAX], config_name[PATH_MAX],
config_path[PATH_MAX], msg[PATH_MAX];
char config_dir[PATH_MAX_LENGTH], config_name[PATH_MAX_LENGTH],
config_path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
bool found_path = false;
*config_dir = '\0';

View File

@ -39,7 +39,7 @@
**/
static void set_volume(float gain)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
g_settings.audio.volume += gain;
g_settings.audio.volume = max(g_settings.audio.volume, -80.0f);
@ -149,7 +149,7 @@ static void check_fast_forward_button(bool fastforward_pressed,
**/
static void check_stateslots(bool pressed_increase, bool pressed_decrease)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
/* Save state slots */
if (pressed_increase)
@ -279,7 +279,7 @@ static void check_slowmotion(bool pressed)
static bool check_movie_init(void)
{
char path[PATH_MAX], msg[PATH_MAX];
char path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
bool ret = true;
if (g_extern.bsv.movie)
@ -360,7 +360,7 @@ static bool check_movie(void)
static void check_shader_dir(bool pressed_next, bool pressed_prev)
{
char msg[PATH_MAX];
char msg[PATH_MAX_LENGTH];
const char *shader = NULL, *ext = NULL;
enum rarch_shader_type type = RARCH_SHADER_NONE;

View File

@ -158,8 +158,8 @@ end:
bool screenshot_dump(const char *folder, const void *frame,
unsigned width, unsigned height, int pitch, bool bgr24)
{
char filename[PATH_MAX];
char shotname[PATH_MAX];
char filename[PATH_MAX_LENGTH];
char shotname[PATH_MAX_LENGTH];
#ifdef HAVE_ZLIB_DEFLATE
#define IMG_EXT "png"

View File

@ -644,9 +644,9 @@ static config_file_t *open_default_config_file(void)
config_file_t *conf = NULL;
#if defined(_WIN32) && !defined(_XBOX)
char conf_path[PATH_MAX];
char conf_path[PATH_MAX_LENGTH];
char app_path[PATH_MAX];
char app_path[PATH_MAX_LENGTH];
fill_pathname_application_path(app_path, sizeof(app_path));
fill_pathname_resolve_relative(conf_path, app_path,
"retroarch.cfg", sizeof(conf_path));
@ -694,7 +694,7 @@ static config_file_t *open_default_config_file(void)
strlcpy(g_extern.config_path, conf_path,
sizeof(g_extern.config_path));
#elif defined(OSX)
char conf_path[PATH_MAX];
char conf_path[PATH_MAX_LENGTH];
const char *home = getenv("HOME");
if (!home)
@ -734,7 +734,7 @@ static config_file_t *open_default_config_file(void)
strlcpy(g_extern.config_path, conf_path, sizeof(g_extern.config_path));
#elif !defined(__CELLOS_LV2__) && !defined(_XBOX)
char conf_path[PATH_MAX];
char conf_path[PATH_MAX_LENGTH];
const char *xdg = getenv("XDG_CONFIG_HOME");
const char *home = getenv("HOME");
@ -782,7 +782,7 @@ static config_file_t *open_default_config_file(void)
".config/retroarch/retroarch.cfg", sizeof(conf_path));
#endif
char basedir[PATH_MAX];
char basedir[PATH_MAX_LENGTH];
fill_pathname_basedir(basedir, conf_path, sizeof(basedir));
if (path_mkdir(basedir))
@ -794,7 +794,7 @@ static config_file_t *open_default_config_file(void)
#define GLOBAL_CONFIG_DIR "/etc"
#endif
#endif
char skeleton_conf[PATH_MAX];
char skeleton_conf[PATH_MAX_LENGTH];
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR,
"retroarch.cfg", sizeof(skeleton_conf));
conf = config_file_new(skeleton_conf);
@ -855,8 +855,8 @@ static void config_file_dump_all(config_file_t *conf)
static bool config_load_file(const char *path, bool set_defaults)
{
unsigned i;
char *save, tmp_str[PATH_MAX];
char tmp_append_path[PATH_MAX]; /* Don't destroy append_config_path. */
char *save, tmp_str[PATH_MAX_LENGTH];
char tmp_append_path[PATH_MAX_LENGTH]; /* Don't destroy append_config_path. */
const char *extra_path;
unsigned msg_color = 0;
config_file_t *conf = NULL;
@ -1320,7 +1320,7 @@ static void config_load_core_specific(void)
if (g_settings.core_specific_config)
{
char tmp[PATH_MAX];
char tmp[PATH_MAX_LENGTH];
strlcpy(tmp, g_settings.libretro, sizeof(tmp));
RARCH_LOG("Loading core-specific config from: %s.\n",
g_extern.core_specific_config_path);