diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 1742f7afa3..0358f6f2e8 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -910,7 +910,7 @@ void fill_pathname_resolve_relative(char *out_path, * Deprecated. Use fill_pathname_join_special() instead * if you can ensure @dir and @out_path won't overlap. * - * @return The length of @out_path (NOT @size) + * @return Length of the string copied into @out_path **/ size_t fill_pathname_join(char *out_path, const char *dir, const char *path, size_t size) @@ -938,7 +938,7 @@ size_t fill_pathname_join(char *out_path, * Makes sure not to get two consecutive slashes * between directory and path. * - * @return The length of @out_path (NOT @size) + * @return Length of the string copied into @out_path **/ size_t fill_pathname_join_special(char *out_path, const char *dir, const char *path, size_t size) @@ -1208,8 +1208,10 @@ static int get_pathname_num_slashes(const char *in_path) * If lengths of abbreviated and relative paths are the same, * the relative path will be used * @in_path can be an absolute, relative or abbreviated path + * + * @return Length of the string copied into @out_path **/ -void fill_pathname_abbreviated_or_relative(char *out_path, +size_t fill_pathname_abbreviated_or_relative(char *out_path, const char *in_refpath, const char *in_path, size_t size) { char in_path_conformed[PATH_MAX_LENGTH]; @@ -1254,9 +1256,8 @@ void fill_pathname_abbreviated_or_relative(char *out_path, /* Use the shortest path, preferring the relative path*/ if ( get_pathname_num_slashes(relative_path) <= get_pathname_num_slashes(abbreviated_path)) - retro_assert(strlcpy(out_path, relative_path, size) < size); - else - retro_assert(strlcpy(out_path, abbreviated_path, size) < size); + return strlcpy(out_path, relative_path, size); + return strlcpy(out_path, abbreviated_path, size); } /** diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 77ff1bda33..914dbf836f 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -457,7 +457,7 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath, * Deprecated. Use fill_pathname_join_special() instead * if you can ensure @dir != @out_path * - * @return The length of @out_path (NOT @size) + * @return Length of the string copied into @out_path **/ size_t fill_pathname_join(char *out_path, const char *dir, const char *path, size_t size); @@ -483,7 +483,7 @@ size_t fill_pathname_join(char *out_path, const char *dir, * - calls find_last_slash() * - calls strlcat * - * @return The length of @out_path (NOT @size) + * @return Length of the string copied into @out_path **/ size_t fill_pathname_join_special(char *out_path, const char *dir, const char *path, size_t size); @@ -527,8 +527,10 @@ void fill_pathname_abbreviate_special(char *out_path, * If lengths of abbreviated and relative paths are the same, * the relative path will be used * @in_path can be an absolute, relative or abbreviated path + * + * @return Length of the string copied into @out_path **/ -void fill_pathname_abbreviated_or_relative(char *out_path, +size_t fill_pathname_abbreviated_or_relative(char *out_path, const char *in_refpath, const char *in_path, size_t size); /**