fill_str_dated_filename: add size_t return value

This commit is contained in:
LibretroAdmin 2022-08-04 17:18:32 +02:00
parent 0c21a92581
commit 2e5df6a973
2 changed files with 14 additions and 9 deletions

View File

@ -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)

View File

@ -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);
/**