mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(libretro SDK) Start using MAX_PATH_LENGTH too
This commit is contained in:
parent
90076c5fad
commit
33cb810636
@ -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)
|
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;
|
config_file_t *sub_conf = NULL;
|
||||||
char *path = extract_value(line, false);
|
char *path = extract_value(line, false);
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -767,7 +767,7 @@ void config_set_path(config_file_t *conf, const char *entry, const char *val)
|
|||||||
#if defined(RARCH_CONSOLE)
|
#if defined(RARCH_CONSOLE)
|
||||||
config_set_string(conf, entry, val);
|
config_set_string(conf, entry, val);
|
||||||
#else
|
#else
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX_LENGTH];
|
||||||
fill_pathname_abbreviate_special(buf, val, sizeof(buf));
|
fill_pathname_abbreviate_special(buf, val, sizeof(buf));
|
||||||
config_set_string(conf, entry, buf);
|
config_set_string(conf, entry, buf);
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,15 +45,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some platforms do not set this value.
|
#include <retro_miscellaneous.h>
|
||||||
* 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
|
|
||||||
|
|
||||||
static int qstrcmp_plain(const void *a_, const void *b_)
|
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,
|
struct string_list *dir_list_new(const char *dir,
|
||||||
const char *ext, bool include_dirs)
|
const char *ext, bool include_dirs)
|
||||||
{
|
{
|
||||||
char path_buf[PATH_MAX];
|
char path_buf[PATH_MAX_LENGTH];
|
||||||
struct string_list *ext_list, *list;
|
struct string_list *ext_list, *list;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
@ -241,7 +233,7 @@ struct string_list *dir_list_new(const char *dir,
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char file_path[PATH_MAX];
|
char file_path[PATH_MAX_LENGTH];
|
||||||
const char *name = ffd.cFileName;
|
const char *name = ffd.cFileName;
|
||||||
const char *file_ext = path_get_extension(name);
|
const char *file_ext = path_get_extension(name);
|
||||||
bool is_dir = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
bool is_dir = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
||||||
@ -273,7 +265,7 @@ error:
|
|||||||
while ((entry = readdir(directory)))
|
while ((entry = readdir(directory)))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char file_path[PATH_MAX];
|
char file_path[PATH_MAX_LENGTH];
|
||||||
const char *name = entry->d_name;
|
const char *name = entry->d_name;
|
||||||
const char *file_ext = path_get_extension(name);
|
const char *file_ext = path_get_extension(name);
|
||||||
bool is_dir = false;
|
bool is_dir = false;
|
||||||
|
@ -156,7 +156,7 @@ bool path_file_exists(const char *path)
|
|||||||
void fill_pathname(char *out_path, const char *in_path,
|
void fill_pathname(char *out_path, const char *in_path,
|
||||||
const char *replace, size_t size)
|
const char *replace, size_t size)
|
||||||
{
|
{
|
||||||
char tmp_path[PATH_MAX];
|
char tmp_path[PATH_MAX_LENGTH];
|
||||||
char *tok;
|
char *tok;
|
||||||
|
|
||||||
rarch_assert(strlcpy(tmp_path, in_path,
|
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)
|
void path_resolve_realpath(char *buf, size_t size)
|
||||||
{
|
{
|
||||||
#ifndef RARCH_CONSOLE
|
#ifndef RARCH_CONSOLE
|
||||||
char tmp[PATH_MAX];
|
char tmp[PATH_MAX_LENGTH];
|
||||||
strlcpy(tmp, buf, sizeof(tmp));
|
strlcpy(tmp, buf, sizeof(tmp));
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!_fullpath(buf, tmp, size))
|
if (!_fullpath(buf, tmp, size))
|
||||||
strlcpy(buf, tmp, size);
|
strlcpy(buf, tmp, size);
|
||||||
#else
|
#else
|
||||||
rarch_assert(size >= PATH_MAX);
|
rarch_assert(size >= PATH_MAX_LENGTH);
|
||||||
|
|
||||||
/* NOTE: realpath() expects at least PATH_MAX bytes in buf.
|
/* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf.
|
||||||
* Technically, PATH_MAX needn't be defined, but we rely on it anyways.
|
* Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways.
|
||||||
* POSIX 2008 can automatically allocate for you,
|
* POSIX 2008 can automatically allocate for you,
|
||||||
* but don't rely on that. */
|
* but don't rely on that. */
|
||||||
if (!realpath(tmp, buf))
|
if (!realpath(tmp, buf))
|
||||||
@ -469,7 +469,7 @@ void fill_pathname_expand_special(char *out_path,
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char application_dir[PATH_MAX];
|
char application_dir[PATH_MAX_LENGTH];
|
||||||
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
||||||
path_basedir(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,
|
void fill_short_pathname_representation(char* out_rep,
|
||||||
const char *in_path, size_t size)
|
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), "",
|
fill_pathname(path_short, path_basename(in_path), "",
|
||||||
sizeof(path_short));
|
sizeof(path_short));
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ void fill_pathname_abbreviate_special(char *out_path,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
const char *home = getenv("HOME");
|
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));
|
fill_pathname_application_path(application_dir, sizeof(application_dir));
|
||||||
path_basedir(application_dir);
|
path_basedir(application_dir);
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ void fill_pathname_application_path(char *buf, size_t size)
|
|||||||
#else
|
#else
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
char link_path[PATH_MAX];
|
char link_path[PATH_MAX_LENGTH];
|
||||||
/* Linux, BSD and Solaris paths. Not standardized. */
|
/* Linux, BSD and Solaris paths. Not standardized. */
|
||||||
static const char *exts[] = { "exe", "file", "path/a.out" };
|
static const char *exts[] = { "exe", "file", "path/a.out" };
|
||||||
for (i = 0; i < ARRAY_SIZE(exts); i++)
|
for (i = 0; i < ARRAY_SIZE(exts); i++)
|
||||||
|
@ -169,7 +169,7 @@ bool string_list_find_elem_prefix(const struct string_list *list,
|
|||||||
const char *prefix, const char *elem)
|
const char *prefix, const char *elem)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
char prefixed[PATH_MAX];
|
char prefixed[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
if (!list)
|
if (!list)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user