mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 04:44:02 +00:00
Change function signature of fill_pathname_parent_dir
This commit is contained in:
parent
d94cc3af72
commit
c492e46d96
@ -451,17 +451,18 @@ void fill_pathname_basedir(char *s, const char *in_path, size_t len)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* fill_pathname_parent_dir_name:
|
* fill_pathname_parent_dir_name:
|
||||||
* @s : output directory
|
* @s : output string
|
||||||
* @in_dir : input directory
|
* @in_dir : input directory
|
||||||
* @len : size of output directory
|
* @len : size of @s
|
||||||
*
|
*
|
||||||
* Copies only the parent directory name of @in_dir into @s.
|
* Copies only the parent directory name of @in_dir into @s.
|
||||||
* The two buffers must not overlap. Removes trailing '/'.
|
* The two buffers must not overlap. Removes trailing '/'.
|
||||||
*
|
*
|
||||||
* @return true on success, false if a slash was not found in the path.
|
* @return Length of the string copied into @s
|
||||||
**/
|
**/
|
||||||
bool fill_pathname_parent_dir_name(char *s, const char *in_dir, size_t len)
|
size_t fill_pathname_parent_dir_name(char *s, const char *in_dir, size_t len)
|
||||||
{
|
{
|
||||||
|
size_t _len = 0;
|
||||||
char *tmp = strdup(in_dir);
|
char *tmp = strdup(in_dir);
|
||||||
const char *slash = strrchr(tmp, '/');
|
const char *slash = strrchr(tmp, '/');
|
||||||
const char *backslash = strrchr(tmp, '\\');
|
const char *backslash = strrchr(tmp, '\\');
|
||||||
@ -493,15 +494,13 @@ bool fill_pathname_parent_dir_name(char *s, const char *in_dir, size_t len)
|
|||||||
{
|
{
|
||||||
/* If path starts with an slash, eliminate it. */
|
/* If path starts with an slash, eliminate it. */
|
||||||
if (path_is_absolute(in_dir))
|
if (path_is_absolute(in_dir))
|
||||||
strlcpy(s, in_dir + 1, len);
|
_len = strlcpy(s, in_dir + 1, len);
|
||||||
else
|
else
|
||||||
strlcpy(s, in_dir, len);
|
_len = strlcpy(s, in_dir, len);
|
||||||
free(tmp);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return false;
|
return _len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,9 +408,9 @@ void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* fill_pathname_parent_dir_name:
|
* fill_pathname_parent_dir_name:
|
||||||
* @out_dir : output directory
|
* @s : output string
|
||||||
* @in_dir : input directory
|
* @in_dir : input directory
|
||||||
* @size : size of output directory
|
* @len : size of @s
|
||||||
*
|
*
|
||||||
* Copies only the parent directory name of @in_dir into @out_dir.
|
* Copies only the parent directory name of @in_dir into @out_dir.
|
||||||
* The two buffers must not overlap. Removes trailing '/'.
|
* The two buffers must not overlap. Removes trailing '/'.
|
||||||
@ -420,10 +420,10 @@ void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
|
|||||||
* - Calls find_last_slash() x times
|
* - Calls find_last_slash() x times
|
||||||
* - Can call strlcpy
|
* - Can call strlcpy
|
||||||
*
|
*
|
||||||
* @return true on success, false if a slash was not found in the path.
|
* @return Length of the string copied into @s
|
||||||
**/
|
**/
|
||||||
bool fill_pathname_parent_dir_name(char *out_dir,
|
size_t fill_pathname_parent_dir_name(char *s,
|
||||||
const char *in_dir, size_t size);
|
const char *in_dir, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill_pathname_parent_dir:
|
* fill_pathname_parent_dir:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user