(libretro SDK) Start using MAX_PATH_LENGTH too

This commit is contained in:
twinaphex 2015-01-07 20:45:34 +01:00
parent 90076c5fad
commit 33cb810636
4 changed files with 16 additions and 24 deletions

View File

@ -186,7 +186,7 @@ static void add_include_list(config_file_t *conf, const char *path)
static void add_sub_conf(config_file_t *conf, char *line)
{
char real_path[PATH_MAX];
char real_path[PATH_MAX_LENGTH];
config_file_t *sub_conf = NULL;
char *path = extract_value(line, false);
if (!path)
@ -767,7 +767,7 @@ void config_set_path(config_file_t *conf, const char *entry, const char *val)
#if defined(RARCH_CONSOLE)
config_set_string(conf, entry, val);
#else
char buf[PATH_MAX];
char buf[PATH_MAX_LENGTH];
fill_pathname_abbreviate_special(buf, val, sizeof(buf));
config_set_string(conf, entry, buf);
#endif

View File

@ -45,15 +45,7 @@
#include <unistd.h>
#endif
/* Some platforms do not set this value.
* Just assume a value. It's usually 4KiB.
* Platforms with a known value (like Win32)
* set this value explicitly in platform specific headers.
*/
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#include <retro_miscellaneous.h>
static int qstrcmp_plain(const void *a_, const void *b_)
{
@ -212,7 +204,7 @@ static int parse_dir_entry(const char *name, char *file_path,
struct string_list *dir_list_new(const char *dir,
const char *ext, bool include_dirs)
{
char path_buf[PATH_MAX];
char path_buf[PATH_MAX_LENGTH];
struct string_list *ext_list, *list;
#ifdef _WIN32
WIN32_FIND_DATA ffd;
@ -241,7 +233,7 @@ struct string_list *dir_list_new(const char *dir,
do
{
int ret = 0;
char file_path[PATH_MAX];
char file_path[PATH_MAX_LENGTH];
const char *name = ffd.cFileName;
const char *file_ext = path_get_extension(name);
bool is_dir = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
@ -273,7 +265,7 @@ error:
while ((entry = readdir(directory)))
{
int ret = 0;
char file_path[PATH_MAX];
char file_path[PATH_MAX_LENGTH];
const char *name = entry->d_name;
const char *file_ext = path_get_extension(name);
bool is_dir = false;

View File

@ -156,7 +156,7 @@ bool path_file_exists(const char *path)
void fill_pathname(char *out_path, const char *in_path,
const char *replace, size_t size)
{
char tmp_path[PATH_MAX];
char tmp_path[PATH_MAX_LENGTH];
char *tok;
rarch_assert(strlcpy(tmp_path, in_path,
@ -327,17 +327,17 @@ bool path_is_absolute(const char *path)
void path_resolve_realpath(char *buf, size_t size)
{
#ifndef RARCH_CONSOLE
char tmp[PATH_MAX];
char tmp[PATH_MAX_LENGTH];
strlcpy(tmp, buf, sizeof(tmp));
#ifdef _WIN32
if (!_fullpath(buf, tmp, size))
strlcpy(buf, tmp, size);
#else
rarch_assert(size >= PATH_MAX);
rarch_assert(size >= PATH_MAX_LENGTH);
/* NOTE: realpath() expects at least PATH_MAX bytes in buf.
* Technically, PATH_MAX needn't be defined, but we rely on it anyways.
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
@ -469,7 +469,7 @@ void fill_pathname_expand_special(char *out_path,
#endif
)
{
char application_dir[PATH_MAX];
char application_dir[PATH_MAX_LENGTH];
fill_pathname_application_path(application_dir, sizeof(application_dir));
path_basedir(application_dir);
@ -488,7 +488,7 @@ void fill_pathname_expand_special(char *out_path,
void fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size)
{
char path_short[PATH_MAX], *last_hash = NULL;
char path_short[PATH_MAX_LENGTH], *last_hash = NULL;
fill_pathname(path_short, path_basename(in_path), "",
sizeof(path_short));
@ -517,7 +517,7 @@ void fill_pathname_abbreviate_special(char *out_path,
unsigned i;
const char *home = getenv("HOME");
char application_dir[PATH_MAX];
char application_dir[PATH_MAX_LENGTH];
fill_pathname_application_path(application_dir, sizeof(application_dir));
path_basedir(application_dir);
@ -594,7 +594,7 @@ void fill_pathname_application_path(char *buf, size_t size)
#else
*buf = '\0';
pid_t pid = getpid();
char link_path[PATH_MAX];
char link_path[PATH_MAX_LENGTH];
/* Linux, BSD and Solaris paths. Not standardized. */
static const char *exts[] = { "exe", "file", "path/a.out" };
for (i = 0; i < ARRAY_SIZE(exts); i++)

View File

@ -169,7 +169,7 @@ bool string_list_find_elem_prefix(const struct string_list *list,
const char *prefix, const char *elem)
{
size_t i;
char prefixed[PATH_MAX];
char prefixed[PATH_MAX_LENGTH];
if (!list)
return false;