diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 1624f9f2d8..734e7a573b 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -517,8 +517,10 @@ size_t fill_dated_filename(char *out_filename, * * E.g.: * out_filename = "RetroArch-{year}{month}{day}-{Hour}{Minute}{Second}.{@ext}" + * + * @return Length of the string copied into @out_path **/ -void fill_str_dated_filename(char *out_filename, +size_t fill_str_dated_filename(char *out_filename, const char *in_str, const char *ext, size_t size) { char format[NAME_MAX_LENGTH]; @@ -531,14 +533,11 @@ void fill_str_dated_filename(char *out_filename, if (string_is_empty(ext)) { strftime(format, sizeof(format), "-%y%m%d-%H%M%S", &tm_); - strlcat(out_filename, format, size); - } - else - { - strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", &tm_); - strlcat(out_filename, format, size); - strlcat(out_filename, ext, size); + return strlcat(out_filename, format, size); } + strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", &tm_); + strlcat(out_filename, format, size); + return strlcat(out_filename, ext, size); } /** @@ -830,6 +829,8 @@ end: * Both @path and @base are assumed to be absolute paths without "." or "..". * * E.g. path /a/b/e/f.cg with base /a/b/c/d/ turns into ../../e/f.cg + * + * @return Length of the string copied into @out **/ size_t path_relative_to(char *out, const char *path, const char *base, size_t size) diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index eefed8d310..cbc89a8abd 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -225,6 +225,8 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks); * Both @path and @base are assumed to be absolute paths without "." or "..". * * E.g. path /a/b/e/f.cgp with base /a/b/c/d/ turns into ../../e/f.cgp + * + * @return Length of the string copied into @out **/ size_t path_relative_to(char *out, const char *path, const char *base, size_t size); @@ -311,8 +313,10 @@ size_t fill_dated_filename(char *out_filename, * - Calls string_is_empty() * - Calls strftime * - Calls strlcat at least 2x + * + * @return Length of the string copied into @out_path **/ -void fill_str_dated_filename(char *out_filename, +size_t fill_str_dated_filename(char *out_filename, const char *in_str, const char *ext, size_t size); /**