mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Replace some more trivial strlcat calls
This commit is contained in:
parent
e7f3432e48
commit
88bc26da4e
@ -3614,6 +3614,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
bool render_frame = true;
|
||||
retro_time_t new_time;
|
||||
video_frame_info_t video_info;
|
||||
size_t buf_pos = 1;
|
||||
video_driver_state_t *video_st= &video_driver_st;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
const enum retro_pixel_format
|
||||
@ -3733,7 +3734,6 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
video_info.fps_update_interval;
|
||||
unsigned memory_update_interval =
|
||||
video_info.memory_update_interval;
|
||||
size_t buf_pos = 1;
|
||||
/* set this to 1 to avoid an offset issue */
|
||||
unsigned write_index =
|
||||
video_st->frame_time_count++ &
|
||||
@ -3752,7 +3752,13 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
{
|
||||
char frames_text[64];
|
||||
if (status_text[buf_pos-1] != '\0')
|
||||
strlcat(status_text, " || ", sizeof(status_text));
|
||||
{
|
||||
status_text[buf_pos ] = ' ';
|
||||
status_text[buf_pos+1] = '|';
|
||||
status_text[buf_pos+2] = '|';
|
||||
status_text[buf_pos+3] = ' ';
|
||||
status_text[buf_pos+4] = '\0';
|
||||
}
|
||||
snprintf(frames_text,
|
||||
sizeof(frames_text),
|
||||
"%s: %" PRIu64, msg_hash_to_str(MSG_FRAMES),
|
||||
@ -3775,8 +3781,14 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
mem, sizeof(mem), "MEM: %.2f/%.2fMB", last_used_memory / (1024.0f * 1024.0f),
|
||||
last_total_memory / (1024.0f * 1024.0f));
|
||||
if (status_text[buf_pos-1] != '\0')
|
||||
strlcat(status_text, " || ", sizeof(status_text));
|
||||
strlcat(status_text, mem, sizeof(status_text));
|
||||
{
|
||||
status_text[buf_pos ] = ' ';
|
||||
status_text[buf_pos+1] = '|';
|
||||
status_text[buf_pos+2] = '|';
|
||||
status_text[buf_pos+3] = ' ';
|
||||
status_text[buf_pos+4] = '\0';
|
||||
}
|
||||
buf_pos = strlcat(status_text, mem, sizeof(status_text));
|
||||
}
|
||||
|
||||
if ((video_st->frame_count % fps_update_interval) == 0)
|
||||
@ -3790,9 +3802,12 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if (!string_is_empty(status_text))
|
||||
{
|
||||
video_st->window_title_len += strlcat(video_st->window_title,
|
||||
" || ", sizeof(video_st->window_title));
|
||||
video_st->window_title_len += strlcat(video_st->window_title,
|
||||
video_st->window_title[video_st->window_title_len ] = ' ';
|
||||
video_st->window_title[video_st->window_title_len+1] = '|';
|
||||
video_st->window_title[video_st->window_title_len+2] = '|';
|
||||
video_st->window_title[video_st->window_title_len+3] = ' ';
|
||||
video_st->window_title[video_st->window_title_len+4] = '\0';
|
||||
video_st->window_title_len = strlcat(video_st->window_title,
|
||||
status_text, sizeof(video_st->window_title));
|
||||
}
|
||||
|
||||
@ -3810,7 +3825,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
sizeof(video_st->window_title));
|
||||
|
||||
if (video_info.fps_show)
|
||||
strlcpy(status_text,
|
||||
buf_pos = strlcpy(status_text,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
sizeof(status_text));
|
||||
|
||||
@ -3847,14 +3862,17 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
* message at the end */
|
||||
if (!string_is_empty(status_text))
|
||||
{
|
||||
strlcat(status_text,
|
||||
" || ", sizeof(status_text));
|
||||
strlcat(status_text,
|
||||
status_text[buf_pos ] = ' ';
|
||||
status_text[buf_pos+1] = '|';
|
||||
status_text[buf_pos+2] = '|';
|
||||
status_text[buf_pos+3] = ' ';
|
||||
status_text[buf_pos+4] = '\0';
|
||||
buf_pos = strlcat(status_text,
|
||||
runloop_st->core_status_msg.str,
|
||||
sizeof(status_text));
|
||||
}
|
||||
else
|
||||
strlcpy(status_text,
|
||||
buf_pos = strlcpy(status_text,
|
||||
runloop_st->core_status_msg.str,
|
||||
sizeof(status_text));
|
||||
}
|
||||
|
@ -2901,10 +2901,13 @@ static void update_dynamic_theme_path(rgui_t *rgui, const char *theme_dir)
|
||||
|
||||
if (rgui->is_playlist && !string_is_empty(rgui->menu_title))
|
||||
{
|
||||
fill_pathname_join(rgui->theme_dynamic_path, theme_dir,
|
||||
size_t len = fill_pathname_join(rgui->theme_dynamic_path, theme_dir,
|
||||
rgui->menu_title, sizeof(rgui->theme_dynamic_path));
|
||||
strlcat(rgui->theme_dynamic_path, FILE_PATH_CONFIG_EXTENSION,
|
||||
sizeof(rgui->theme_dynamic_path));
|
||||
rgui->theme_dynamic_path[len ] = '.';
|
||||
rgui->theme_dynamic_path[len+1] = 'c';
|
||||
rgui->theme_dynamic_path[len+2] = 'f';
|
||||
rgui->theme_dynamic_path[len+3] = 'g';
|
||||
rgui->theme_dynamic_path[len+4] = '\0';
|
||||
|
||||
use_playlist_theme = path_is_valid(rgui->theme_dynamic_path);
|
||||
}
|
||||
|
@ -1088,6 +1088,7 @@ static void xmb_render_messagebox_internal(
|
||||
static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
size_t len = 0;
|
||||
char *tmp = string_replace_substring(xmb->title_name, "/", " ");
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *dir_dynamic_wallpapers = settings->paths.directory_dynamic_wallpapers;
|
||||
@ -1099,16 +1100,20 @@ static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
fill_pathname_join(
|
||||
len = fill_pathname_join(
|
||||
path,
|
||||
dir_dynamic_wallpapers,
|
||||
tmp,
|
||||
sizeof(path));
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
strlcat(path, FILE_PATH_PNG_EXTENSION, sizeof(path));
|
||||
|
||||
|
||||
path[len ] = '.';
|
||||
path[len+1] = 'p';
|
||||
path[len+2] = 'n';
|
||||
path[len+3] = 'g';
|
||||
path[len+4] = '\0';
|
||||
|
||||
if (!path_is_valid(path))
|
||||
fill_pathname_application_special(path, sizeof(path),
|
||||
APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_BG);
|
||||
@ -2293,6 +2298,7 @@ static void xmb_context_reset_horizontal_list(
|
||||
if (string_ends_with_size(path, ".lpl",
|
||||
strlen(path), STRLEN_CONST(".lpl")))
|
||||
{
|
||||
size_t len;
|
||||
struct texture_image ti;
|
||||
char sysname[PATH_MAX_LENGTH];
|
||||
char texturepath[PATH_MAX_LENGTH];
|
||||
@ -2304,18 +2310,25 @@ static void xmb_context_reset_horizontal_list(
|
||||
fill_pathname_base(sysname, path, sizeof(sysname));
|
||||
path_remove_extension(sysname);
|
||||
|
||||
fill_pathname_join(texturepath, iconpath, sysname,
|
||||
len = fill_pathname_join(texturepath, iconpath, sysname,
|
||||
sizeof(texturepath));
|
||||
strlcat(texturepath, FILE_PATH_PNG_EXTENSION, sizeof(texturepath));
|
||||
texturepath[len ] = '.';
|
||||
texturepath[len+1] = 'p';
|
||||
texturepath[len+2] = 'n';
|
||||
texturepath[len+3] = 'g';
|
||||
texturepath[len+4] = '\0';
|
||||
|
||||
/* If the playlist icon doesn't exist return default */
|
||||
|
||||
if (!path_is_valid(texturepath))
|
||||
{
|
||||
fill_pathname_join(texturepath, iconpath, "default",
|
||||
len = fill_pathname_join(texturepath, iconpath, "default",
|
||||
sizeof(texturepath));
|
||||
strlcat(texturepath, FILE_PATH_PNG_EXTENSION,
|
||||
sizeof(texturepath));
|
||||
texturepath[len ] = '.';
|
||||
texturepath[len+1] = 'p';
|
||||
texturepath[len+2] = 'n';
|
||||
texturepath[len+3] = 'g';
|
||||
texturepath[len+4] = '\0';
|
||||
}
|
||||
|
||||
ti.width = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user