mirror of
https://github.com/libretro/RetroArch
synced 2025-02-14 15:39:59 +00:00
Turn some functions to returntype size_t
This commit is contained in:
parent
955eeed31a
commit
fb338b90bf
32
playlist.c
32
playlist.c
@ -136,33 +136,33 @@ void playlist_set_cached_external(playlist_t* pl)
|
||||
|
||||
/* Convenience function: copies specified playlist
|
||||
* path to specified playlist configuration object */
|
||||
void playlist_config_set_path(playlist_config_t *config, const char *path)
|
||||
size_t playlist_config_set_path(playlist_config_t *config, const char *path)
|
||||
{
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
if (!string_is_empty(path))
|
||||
strlcpy(config->path, path, sizeof(config->path));
|
||||
else
|
||||
if (config)
|
||||
{
|
||||
if (!string_is_empty(path))
|
||||
return strlcpy(config->path, path, sizeof(config->path));
|
||||
config->path[0] = '\0';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convenience function: copies base content directory
|
||||
* path to specified playlist configuration object.
|
||||
* Also sets autofix_paths boolean, depending on base
|
||||
* content directory value */
|
||||
void playlist_config_set_base_content_directory(
|
||||
size_t playlist_config_set_base_content_directory(
|
||||
playlist_config_t* config, const char* path)
|
||||
{
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
config->autofix_paths = !string_is_empty(path);
|
||||
if (config->autofix_paths)
|
||||
strlcpy(config->base_content_directory, path,
|
||||
sizeof(config->base_content_directory));
|
||||
else
|
||||
if (config)
|
||||
{
|
||||
config->autofix_paths = !string_is_empty(path);
|
||||
if (config->autofix_paths)
|
||||
return strlcpy(config->base_content_directory, path,
|
||||
sizeof(config->base_content_directory));
|
||||
config->base_content_directory[0] = '\0';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,11 +158,11 @@ typedef struct
|
||||
|
||||
/* Convenience function: copies specified playlist
|
||||
* path to specified playlist configuration object */
|
||||
void playlist_config_set_path(playlist_config_t *config, const char *path);
|
||||
size_t playlist_config_set_path(playlist_config_t *config, const char *path);
|
||||
|
||||
/* Convenience function: copies base content directory
|
||||
* path to specified playlist configuration object */
|
||||
void playlist_config_set_base_content_directory(playlist_config_t* config, const char* path);
|
||||
size_t playlist_config_set_base_content_directory(playlist_config_t* config, const char* path);
|
||||
|
||||
/* Creates a copy of the specified playlist configuration.
|
||||
* Returns false in the event of an error */
|
||||
|
@ -487,29 +487,19 @@ static void runtime_log_get_runtime_hms(runtime_log_t *runtime_log,
|
||||
}
|
||||
|
||||
/* Gets runtime as a pre-formatted string */
|
||||
void runtime_log_get_runtime_str(runtime_log_t *runtime_log,
|
||||
size_t runtime_log_get_runtime_str(runtime_log_t *runtime_log,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t _len = strlcpy(s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME),
|
||||
len);
|
||||
s[_len ] = ' ';
|
||||
if (runtime_log)
|
||||
snprintf(s + _len + 1, len - _len - 1, "%02u:%02u:%02u",
|
||||
_len += snprintf(s + _len, len - _len, " %02u:%02u:%02u",
|
||||
runtime_log->runtime.hours, runtime_log->runtime.minutes,
|
||||
runtime_log->runtime.seconds);
|
||||
else
|
||||
{
|
||||
s[_len+1] = '0';
|
||||
s[_len+2] = '0';
|
||||
s[_len+3] = ':';
|
||||
s[_len+4] = '0';
|
||||
s[_len+5] = '0';
|
||||
s[_len+6] = ':';
|
||||
s[_len+7] = '0';
|
||||
s[_len+8] = '0';
|
||||
s[_len+9] = '\0';
|
||||
}
|
||||
_len += strlcpy(s + _len, " 00:00:00", len - _len);
|
||||
return _len;
|
||||
}
|
||||
|
||||
/* Gets last played entry values */
|
||||
|
@ -96,7 +96,7 @@ void runtime_log_reset(runtime_log_t *runtime_log);
|
||||
* cleaner to have a symmetrical set/get interface) */
|
||||
|
||||
/* Gets runtime as a pre-formatted string */
|
||||
void runtime_log_get_runtime_str(runtime_log_t *runtime_log, char *str, size_t len);
|
||||
size_t runtime_log_get_runtime_str(runtime_log_t *runtime_log, char *s, size_t len);
|
||||
|
||||
/* Gets last played entry values */
|
||||
void runtime_log_get_last_played(runtime_log_t *runtime_log,
|
||||
|
Loading…
x
Reference in New Issue
Block a user