mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 04:21:13 +00:00
Go back to plain strlcpy/strlcat - probably best to look at
opportunities to reduce these calls vs. replacing them with unsafe macros
This commit is contained in:
parent
21a2ba3f79
commit
b94b9e2adb
11
core_info.c
11
core_info.c
@ -58,7 +58,6 @@ static void core_info_list_resolve_all_extensions(
|
||||
core_info_list_t *core_info_list)
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t buf_pos = 0;
|
||||
size_t all_ext_len = 0;
|
||||
char *all_ext = NULL;
|
||||
|
||||
@ -83,17 +82,15 @@ static void core_info_list_resolve_all_extensions(
|
||||
if (!core_info_list->list[i].supported_extensions)
|
||||
continue;
|
||||
|
||||
buf_pos = strlcat(core_info_list->all_ext,
|
||||
strlcat(core_info_list->all_ext,
|
||||
core_info_list->list[i].supported_extensions, all_ext_len);
|
||||
STRLCAT_CONST(core_info_list->all_ext, buf_pos, "|", all_ext_len);
|
||||
buf_pos++;
|
||||
strlcat(core_info_list->all_ext, "|", all_ext_len);
|
||||
}
|
||||
#ifdef HAVE_7ZIP
|
||||
STRLCAT_CONST(core_info_list->all_ext, buf_pos,"7z|", all_ext_len);
|
||||
buf_pos += 3;
|
||||
strlcat(core_info_list->all_ext, "7z|", all_ext_len);
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB
|
||||
STRLCAT_CONST(core_info_list->all_ext, buf_pos, "zip|", all_ext_len);
|
||||
strlcat(core_info_list->all_ext, "zip|", all_ext_len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -35,74 +35,73 @@ int database_info_build_query_enum(char *s, size_t len,
|
||||
enum database_query_type type,
|
||||
const char *path)
|
||||
{
|
||||
size_t buf_pos = 2;
|
||||
bool add_quotes = true;
|
||||
bool add_glob = false;
|
||||
|
||||
STRLCPY_CONST(s, "{'");
|
||||
strlcpy(s, "{'", len);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DATABASE_QUERY_ENTRY:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "name", len);
|
||||
strlcat(s, "name", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_PUBLISHER:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "publisher", len);
|
||||
strlcat(s, "publisher", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_DEVELOPER:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "developer", len);
|
||||
strlcat(s, "developer", len);
|
||||
add_glob = true;
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ORIGIN:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "origin", len);
|
||||
strlcat(s, "origin", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_FRANCHISE:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "franchise", len);
|
||||
strlcat(s, "franchise", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "esrb_rating", len);
|
||||
strlcat(s, "esrb_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_BBFC_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "bbfc_rating", len);
|
||||
strlcat(s, "bbfc_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ELSPA_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "elspa_rating", len);
|
||||
strlcat(s, "elspa_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ESRB_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "esrb_rating", len);
|
||||
strlcat(s, "esrb_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_PEGI_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "pegi_rating", len);
|
||||
strlcat(s, "pegi_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_CERO_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "cero_rating", len);
|
||||
strlcat(s, "cero_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ENHANCEMENT_HW:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "enhancement_hw", len);
|
||||
strlcat(s, "enhancement_hw", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_EDGE_MAGAZINE_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "edge_rating", len);
|
||||
strlcat(s, "edge_rating", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_EDGE_MAGAZINE_ISSUE:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "edge_issue", len);
|
||||
strlcat(s, "edge_issue", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_FAMITSU_MAGAZINE_RATING:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "famitsu_rating", len);
|
||||
strlcat(s, "famitsu_rating", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RELEASEDATE_MONTH:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "releasemonth", len);
|
||||
strlcat(s, "releasemonth", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RELEASEDATE_YEAR:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "releaseyear", len);
|
||||
strlcat(s, "releaseyear", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_MAX_USERS:
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "users", len);
|
||||
strlcat(s, "users", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_NONE:
|
||||
@ -110,26 +109,18 @@ int database_info_build_query_enum(char *s, size_t len,
|
||||
break;
|
||||
}
|
||||
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "':", len);
|
||||
strlcat(s, "':", len);
|
||||
if (add_glob)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "glob('*", len);
|
||||
}
|
||||
strlcat(s, "glob('*", len);
|
||||
if (add_quotes)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "\"", len);
|
||||
}
|
||||
buf_pos = strlcat(s, path, len);
|
||||
strlcat(s, "\"", len);
|
||||
strlcat(s, path, len);
|
||||
if (add_glob)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "*')", len);
|
||||
}
|
||||
strlcat(s, "*')", len);
|
||||
if (add_quotes)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "\"", len);
|
||||
}
|
||||
strlcat(s, "\"", len);
|
||||
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "{'", len);
|
||||
strlcat(s, "{'", len);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("query: %s\n", s);
|
||||
|
@ -1694,17 +1694,13 @@ static void frontend_unix_get_env(int *argc,
|
||||
|
||||
if (xdg)
|
||||
{
|
||||
size_t buf_pos = strlcpy(base_path, xdg, sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, "/", sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, "retroarch", sizeof(base_path));
|
||||
strlcpy(base_path, xdg, sizeof(base_path));
|
||||
strlcat(base_path, "/retroarch", sizeof(base_path));
|
||||
}
|
||||
else if (home)
|
||||
{
|
||||
size_t buf_pos = strlcpy(base_path, home, sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, "/", sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, ".config", sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, "/", sizeof(base_path));
|
||||
STRLCAT_CONST_INCR(base_path, buf_pos, "retroarch", sizeof(base_path));
|
||||
strlcpy(base_path, home, sizeof(base_path));
|
||||
strlcat(base_path, "/.config/retroarch", sizeof(base_path));
|
||||
}
|
||||
else
|
||||
strlcpy(base_path, "retroarch", sizeof(base_path));
|
||||
|
@ -70,7 +70,7 @@ static std::string build_stage_source(
|
||||
|
||||
expected[0] = '\0';
|
||||
|
||||
STRLCPY_CONST(expected, "#pragma stage ");
|
||||
strlcpy(expected, "#pragma stage ", sizeof(expected));
|
||||
strlcat(expected, stage, sizeof(expected));
|
||||
|
||||
active = strcmp(expected, line) == 0;
|
||||
|
@ -571,21 +571,17 @@ static void gl_glsl_find_uniforms_frame(glsl_shader_data_t *glsl,
|
||||
char texture_size[64];
|
||||
char input_size[64];
|
||||
char tex_coord[64];
|
||||
size_t buf_pos;
|
||||
|
||||
texture[0] = texture_size[0] = input_size[0] = tex_coord[0] = '\0';
|
||||
|
||||
buf_pos = strlcpy(texture, base, sizeof(texture));
|
||||
STRLCAT_CONST_INCR(texture, buf_pos, "Texture", sizeof(texture));
|
||||
|
||||
buf_pos = strlcpy(texture_size, base, sizeof(texture_size));
|
||||
STRLCAT_CONST_INCR(texture_size, buf_pos, "TextureSize", sizeof(texture_size));
|
||||
|
||||
buf_pos = strlcpy(input_size, base, sizeof(input_size));
|
||||
STRLCAT_CONST_INCR(input_size, buf_pos, "InputSize", sizeof(input_size));
|
||||
|
||||
buf_pos = strlcpy(tex_coord, base, sizeof(tex_coord));
|
||||
STRLCAT_CONST_INCR(tex_coord, buf_pos, "TexCoord", sizeof(tex_coord));
|
||||
strlcpy(texture, base, sizeof(texture));
|
||||
strlcat(texture, "Texture", sizeof(texture));
|
||||
strlcpy(texture_size, base, sizeof(texture_size));
|
||||
strlcat(texture_size, "TextureSize", sizeof(texture_size));
|
||||
strlcpy(input_size, base, sizeof(input_size));
|
||||
strlcat(input_size, "InputSize", sizeof(input_size));
|
||||
strlcpy(tex_coord, base, sizeof(tex_coord));
|
||||
strlcat(tex_coord, "TexCoord", sizeof(tex_coord));
|
||||
|
||||
if (frame->texture < 0)
|
||||
frame->texture = gl_glsl_get_uniform(glsl, prog, texture);
|
||||
|
@ -341,7 +341,6 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
char id_mipmap[64];
|
||||
bool mipmap = false;
|
||||
bool smooth = false;
|
||||
size_t buf_pos = 0;
|
||||
|
||||
id_filter[0] = id_wrap[0] = wrap_mode[0] = id_mipmap[0] = '\0';
|
||||
|
||||
@ -358,21 +357,21 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
strlcpy(shader->lut[shader->luts].id, id,
|
||||
sizeof(shader->lut[shader->luts].id));
|
||||
|
||||
buf_pos = strlcpy(id_filter, id, sizeof(id_filter));
|
||||
STRLCAT_CONST_INCR(id_filter, buf_pos, "_linear", sizeof(id_filter));
|
||||
strlcpy(id_filter, id, sizeof(id_filter));
|
||||
strlcat(id_filter, "_linear", sizeof(id_filter));
|
||||
if (config_get_bool(conf, id_filter, &smooth))
|
||||
shader->lut[shader->luts].filter = smooth ?
|
||||
RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
|
||||
else
|
||||
shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;
|
||||
|
||||
buf_pos = strlcpy(id_wrap, id, sizeof(id_wrap));
|
||||
STRLCAT_CONST_INCR(id_wrap, buf_pos, "_wrap_mode", sizeof(id_wrap));
|
||||
strlcpy(id_wrap, id, sizeof(id_wrap));
|
||||
strlcat(id_wrap, "_wrap_mode", sizeof(id_wrap));
|
||||
if (config_get_array(conf, id_wrap, wrap_mode, sizeof(wrap_mode)))
|
||||
shader->lut[shader->luts].wrap = wrap_str_to_mode(wrap_mode);
|
||||
|
||||
buf_pos = strlcpy(id_mipmap, id, sizeof(id_mipmap));
|
||||
STRLCAT_CONST_INCR(id_mipmap, buf_pos, "_mipmap", sizeof(id_mipmap));
|
||||
strlcpy(id_mipmap, id, sizeof(id_mipmap));
|
||||
strlcat(id_mipmap, "_mipmap", sizeof(id_mipmap));
|
||||
if (config_get_bool(conf, id_mipmap, &mipmap))
|
||||
shader->lut[shader->luts].mipmap = mipmap;
|
||||
else
|
||||
@ -1106,31 +1105,28 @@ void video_shader_write_conf_preset(config_file_t *conf,
|
||||
|
||||
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
|
||||
{
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_linear", sizeof(key));
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_linear", sizeof(key));
|
||||
config_set_bool(conf, key,
|
||||
shader->lut[i].filter == RARCH_FILTER_LINEAR);
|
||||
}
|
||||
|
||||
{
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_wrap_mode", sizeof(key));
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_wrap_mode", sizeof(key));
|
||||
config_set_string(conf, key,
|
||||
wrap_mode_to_str(shader->lut[i].wrap));
|
||||
}
|
||||
|
||||
{
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_mipmap", sizeof(key));
|
||||
strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
strlcat(key, "_mipmap", sizeof(key));
|
||||
config_set_bool(conf, key,
|
||||
shader->lut[i].mipmap);
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ size_t path_relative_to(char *out,
|
||||
out[0] = '\0';
|
||||
for (i = 0; trimmed_base[i]; i++)
|
||||
if (trimmed_base[i] == path_default_slash_c())
|
||||
STRLCAT_CONST_INCR(out, written, ".." path_default_slash(), size);
|
||||
strlcat(out, ".." path_default_slash(), size);
|
||||
|
||||
return strlcat(out, trimmed_path, size);
|
||||
}
|
||||
@ -1293,9 +1293,8 @@ void fill_pathname_application_path(char *s, size_t len)
|
||||
char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
|
||||
if (realpath(s, resolved_bundle_dir_buf))
|
||||
{
|
||||
size_t buf_pos = strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
||||
s[buf_pos] = '/';
|
||||
s[buf_pos+1] = '\0';
|
||||
strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
||||
strlcat(s, "/", len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -49,16 +49,6 @@ static INLINE bool string_is_equal(const char *a, const char *b)
|
||||
|
||||
#define string_is_not_equal(a, b) !string_is_equal((a), (b))
|
||||
|
||||
#define STRLCPY_CONST(buf, str) \
|
||||
do { size_t i; for (i = 0; i < sizeof(str); i++) (buf)[i] = (str)[i]; } while (0)
|
||||
|
||||
#define STRLCAT_CONST(buf, strlcpy_ret, str, buf_size) \
|
||||
STRLCPY_CONST((buf) + MIN((strlcpy_ret), (buf_size)-1 - STRLEN_CONST((str))), (str))
|
||||
|
||||
#define STRLCAT_CONST_INCR(buf, strlcpy_ret, str, buf_size) \
|
||||
do { STRLCAT_CONST(buf, strlcpy_ret, str, buf_size); \
|
||||
(strlcpy_ret) += STRLEN_CONST((str)); } while(0)
|
||||
|
||||
#define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0)
|
||||
#define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0)
|
||||
|
||||
|
@ -4904,11 +4904,10 @@ void netplay_refresh_rooms_menu(file_list_t *list)
|
||||
|
||||
if (*netplay_room_list[i].country)
|
||||
{
|
||||
size_t buf_pos = STRLEN_CONST("(");
|
||||
STRLCPY_CONST(country, "(");
|
||||
buf_pos = strlcat(country, netplay_room_list[i].country,
|
||||
strlcpy(country, "(", sizeof(country));
|
||||
strlcat(country, netplay_room_list[i].country,
|
||||
sizeof(country));
|
||||
STRLCAT_CONST_INCR(country, buf_pos, ")", sizeof(country));
|
||||
strlcat(country, ")", sizeof(country));
|
||||
}
|
||||
|
||||
/* Uncomment this to debug mismatched room parameters*/
|
||||
|
@ -61,13 +61,11 @@
|
||||
|
||||
static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len)
|
||||
{
|
||||
size_t buf_pos = 0;
|
||||
core_info_list_t *core_list = NULL;
|
||||
|
||||
core_info_get_list(&core_list);
|
||||
|
||||
STRLCPY_CONST(s, "License: ");
|
||||
buf_pos = STRLEN_CONST("License: ");
|
||||
strlcpy(s, "License: ", len);
|
||||
|
||||
if (core_list)
|
||||
{
|
||||
@ -84,14 +82,14 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
|
||||
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_list->list[j].licenses_list, ", ");
|
||||
buf_pos = strlcat(s, tmp, len);
|
||||
strlcat(s, tmp, len);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STRLCAT_CONST(s, buf_pos, "N/A", len);
|
||||
strlcat(s, "N/A", len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -998,7 +996,6 @@ static int action_bind_sublabel_playlist_entry(
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t buf_pos;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
@ -1023,9 +1020,9 @@ static int action_bind_sublabel_playlist_entry(
|
||||
return 0;
|
||||
|
||||
/* Add core name */
|
||||
buf_pos = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " ", len);
|
||||
buf_pos = strlcat(s, entry->core_name, len);
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
|
||||
strlcat(s, " ", len);
|
||||
strlcat(s, entry->core_name, len);
|
||||
|
||||
/* Get runtime info *if* required runtime log is enabled
|
||||
* *and* this is a valid playlist type */
|
||||
|
@ -293,19 +293,17 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
|
||||
if (list_path)
|
||||
{
|
||||
char elem0_path[255];
|
||||
size_t buf_pos;
|
||||
|
||||
elem0_path[0] = '\0';
|
||||
|
||||
if (list_path->size > 0)
|
||||
strlcpy(elem0_path, list_path->elems[0].data, sizeof(elem0_path));
|
||||
string_list_free(list_path);
|
||||
buf_pos = strlcpy(s, text, len);
|
||||
s[buf_pos ] = '\n';
|
||||
strlcpy(s, text, len);
|
||||
|
||||
if (!string_is_empty(elem0_path))
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "- ", len);
|
||||
strlcat(s, "- ", len);
|
||||
strlcat(s, path_basename(elem0_path), len);
|
||||
}
|
||||
}
|
||||
@ -342,8 +340,8 @@ default_title_generic_macro(action_get_title_list_rdb_entry_database_info,MENU_E
|
||||
static int action_get_title_default(const char *path, const char *label,
|
||||
unsigned menu_type, char *s, size_t len)
|
||||
{
|
||||
size_t buf_pos = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " ", len);
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
|
||||
strlcat(s, " ", len);
|
||||
strlcat(s, path, len);
|
||||
return 0;
|
||||
}
|
||||
@ -377,7 +375,6 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
{
|
||||
char elem0[255];
|
||||
char elem1[255];
|
||||
size_t buf_pos;
|
||||
struct string_list *list_label = string_split(label, "|");
|
||||
|
||||
elem0[0] = elem1[0] = '\0';
|
||||
@ -393,11 +390,11 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
string_list_free(list_label);
|
||||
}
|
||||
|
||||
buf_pos = strlcpy(s, elem0, len);
|
||||
strlcpy(s, elem0, len);
|
||||
|
||||
if (!string_is_empty(elem1))
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " - ", len);
|
||||
strlcat(s, " - ", len);
|
||||
strlcat(s, elem1, len);
|
||||
}
|
||||
}
|
||||
|
@ -1156,7 +1156,6 @@ static void materialui_draw_bg(menu_display_ctx_draw_t *draw,
|
||||
and the menu list */
|
||||
static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
size_t buf_pos;
|
||||
/* This controls the main background color */
|
||||
menu_display_ctx_clearcolor_t clearcolor;
|
||||
|
||||
@ -1635,13 +1634,13 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
/* Title */
|
||||
usable_width = width - (mui->margin * 2) - title_margin;
|
||||
|
||||
buf_pos = strlcpy(menu_title, mui->menu_title, sizeof(menu_title));
|
||||
strlcpy(menu_title, mui->menu_title, sizeof(menu_title));
|
||||
|
||||
if (materialui_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
||||
{
|
||||
STRLCAT_CONST_INCR(menu_title, buf_pos, " (", sizeof(menu_title));
|
||||
buf_pos = strlcat(menu_title, title_msg, sizeof(menu_title));
|
||||
STRLCAT_CONST_INCR(menu_title, buf_pos, ")", sizeof(menu_title));
|
||||
strlcat(menu_title, " (", sizeof(menu_title));
|
||||
strlcat(menu_title, title_msg, sizeof(menu_title));
|
||||
strlcat(menu_title, ")", sizeof(menu_title));
|
||||
}
|
||||
|
||||
if (use_smooth_ticker)
|
||||
|
@ -574,17 +574,16 @@ static void ozone_context_reset(void *data, bool is_threaded)
|
||||
/* Textures init */
|
||||
for (i = 0; i < OZONE_TEXTURE_LAST; i++)
|
||||
{
|
||||
size_t buf_pos;
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
filename[0] = '\0';
|
||||
#if 0
|
||||
if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready())
|
||||
buf_pos = strlcpy(filename, discord_get_own_avatar(), sizeof(filename));
|
||||
strlcpy(filename, discord_get_own_avatar(), sizeof(filename));
|
||||
else
|
||||
#endif
|
||||
buf_pos = strlcpy(filename, OZONE_TEXTURES_FILES[i], sizeof(filename));
|
||||
strlcpy(filename, OZONE_TEXTURES_FILES[i], sizeof(filename));
|
||||
|
||||
STRLCAT_CONST_INCR(filename, buf_pos, ".png", sizeof(filename));
|
||||
strlcat(filename, ".png", sizeof(filename));
|
||||
|
||||
#if 0
|
||||
if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready())
|
||||
@ -612,13 +611,12 @@ static void ozone_context_reset(void *data, bool is_threaded)
|
||||
/* Sidebar textures */
|
||||
for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++)
|
||||
{
|
||||
size_t buf_pos;
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
|
||||
filename[0] = '\0';
|
||||
buf_pos = strlcpy(filename,
|
||||
strlcpy(filename,
|
||||
OZONE_TAB_TEXTURES_FILES[i], sizeof(filename));
|
||||
STRLCAT_CONST_INCR(filename, buf_pos, ".png", sizeof(filename));
|
||||
strlcat(filename, ".png", sizeof(filename));
|
||||
|
||||
if (!menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR, NULL, NULL))
|
||||
{
|
||||
|
@ -972,7 +972,6 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||
|| (string_is_equal(entry.label, "loadstate"))
|
||||
|| (string_is_equal(entry.label, "savestate"))))
|
||||
{
|
||||
size_t buf_pos = 0;
|
||||
size_t path_size = 8204 * sizeof(char);
|
||||
char *path = (char*)malloc(path_size);
|
||||
global_t *global = global_get_ptr();
|
||||
@ -984,16 +983,16 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||
int state_slot = settings->ints.state_slot;
|
||||
|
||||
if (state_slot > 0)
|
||||
buf_pos = snprintf(path, path_size, "%s%d",
|
||||
snprintf(path, path_size, "%s%d",
|
||||
global->name.savestate, state_slot);
|
||||
else if (state_slot < 0)
|
||||
buf_pos = fill_pathname_join_delim(path,
|
||||
fill_pathname_join_delim(path,
|
||||
global->name.savestate, "auto", '.', path_size);
|
||||
else
|
||||
buf_pos = strlcpy(path, global->name.savestate, path_size);
|
||||
strlcpy(path, global->name.savestate, path_size);
|
||||
}
|
||||
|
||||
STRLCAT_CONST_INCR(path, buf_pos, ".png", path_size);
|
||||
strlcat(path, ".png", path_size);
|
||||
|
||||
if (path_is_valid(path))
|
||||
{
|
||||
|
@ -1402,9 +1402,9 @@ bool menu_animation_ticker(menu_animation_ctx_ticker_t *ticker)
|
||||
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t buf_pos = utf8cpy(ticker->s,
|
||||
utf8cpy(ticker->s,
|
||||
PATH_MAX_LENGTH, ticker->str, ticker->len - 3);
|
||||
STRLCAT_CONST_INCR(ticker->s, buf_pos, "...", ticker->len);
|
||||
strlcat(ticker->s, "...", ticker->len);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1500,7 +1500,6 @@ bool menu_animation_ticker_smooth_fw(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
* and add '...' suffix */
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t buf_pos;
|
||||
unsigned num_chars = 0;
|
||||
unsigned suffix_len = 3;
|
||||
unsigned suffix_width = suffix_len * glyph_width;
|
||||
@ -1513,8 +1512,8 @@ bool menu_animation_ticker_smooth_fw(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
num_chars = (ticker->field_width - suffix_width) / glyph_width;
|
||||
|
||||
/* Copy string segment + add suffix */
|
||||
buf_pos = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
STRLCAT_CONST_INCR(ticker->dst_str, buf_pos, "...", ticker->dst_str_len);
|
||||
utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
strlcat(ticker->dst_str, "...", ticker->dst_str_len);
|
||||
|
||||
if (ticker->dst_str_width)
|
||||
*ticker->dst_str_width = (num_chars * glyph_width) + suffix_width;
|
||||
@ -1682,7 +1681,6 @@ bool menu_animation_ticker_smooth(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
* and add '...' suffix */
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t buf_pos;
|
||||
unsigned text_width;
|
||||
unsigned current_width = 0;
|
||||
unsigned num_chars = 0;
|
||||
@ -1714,8 +1712,8 @@ bool menu_animation_ticker_smooth(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
}
|
||||
|
||||
/* Copy string segment + add suffix */
|
||||
buf_pos = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
STRLCAT_CONST_INCR(ticker->dst_str, buf_pos, "...", ticker->dst_str_len);
|
||||
utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
strlcat(ticker->dst_str, "...", ticker->dst_str_len);
|
||||
|
||||
if (ticker->dst_str_width)
|
||||
*ticker->dst_str_width = current_width + (3 * period_width);
|
||||
|
@ -603,7 +603,6 @@ static unsigned menu_displaylist_parse_system_info(menu_displaylist_info_t *info
|
||||
|
||||
if (frontend->get_powerstate)
|
||||
{
|
||||
size_t buf_pos = 0;
|
||||
int seconds = 0, percent = 0;
|
||||
enum frontend_powerstate state =
|
||||
frontend->get_powerstate(&seconds, &percent);
|
||||
@ -611,47 +610,47 @@ static unsigned menu_displaylist_parse_system_info(menu_displaylist_info_t *info
|
||||
tmp2[0] = '\0';
|
||||
|
||||
if (percent != 0)
|
||||
buf_pos = snprintf(tmp2, sizeof(tmp2), "%d%%", percent);
|
||||
snprintf(tmp2, sizeof(tmp2), "%d%%", percent);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case FRONTEND_POWERSTATE_NONE:
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " ", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
strlcat(tmp2, " ", sizeof(tmp2));
|
||||
strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_NO_SOURCE:
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
strlcat(tmp2, " (", sizeof(tmp2));
|
||||
strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE),
|
||||
sizeof(tmp2));
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
strlcat(tmp2, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_CHARGING:
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
strlcat(tmp2, " (", sizeof(tmp2));
|
||||
strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING),
|
||||
sizeof(tmp2));
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
strlcat(tmp2, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_CHARGED:
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
strlcat(tmp2, " (", sizeof(tmp2));
|
||||
strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED),
|
||||
sizeof(tmp2));
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
strlcat(tmp2, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_ON_POWER_SOURCE:
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
strlcat(tmp2, " (", sizeof(tmp2));
|
||||
strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING),
|
||||
sizeof(tmp2));
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
strlcat(tmp2, ")", sizeof(tmp2));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2983,9 +2982,8 @@ static unsigned menu_displaylist_parse_content_information(
|
||||
tmp[0] = '\0';
|
||||
|
||||
n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL), sizeof(tmp));
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, content_label, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
/* Silence gcc compiler warning
|
||||
* (getting so sick of these...) */
|
||||
@ -3005,9 +3003,8 @@ static unsigned menu_displaylist_parse_content_information(
|
||||
tmp[0] = '\0';
|
||||
|
||||
n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH), sizeof(tmp));
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, content_path, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
/* Silence gcc compiler warning
|
||||
* (getting so sick of these...) */
|
||||
@ -3028,9 +3025,8 @@ static unsigned menu_displaylist_parse_content_information(
|
||||
tmp[0] = '\0';
|
||||
|
||||
n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME), sizeof(tmp));
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, core_name, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
/* Silence gcc compiler warning
|
||||
* (getting so sick of these...) */
|
||||
@ -3063,9 +3059,8 @@ static unsigned menu_displaylist_parse_content_information(
|
||||
tmp[0] = '\0';
|
||||
|
||||
n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE), sizeof(tmp));
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, db_name_no_ext, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
/* Silence gcc compiler warning
|
||||
* (getting so sick of these...) */
|
||||
|
@ -1177,20 +1177,16 @@ int menu_entries_get_core_title(char *s, size_t len)
|
||||
#else
|
||||
const char *extra_version = "";
|
||||
#endif
|
||||
size_t buf_pos = 0;
|
||||
STRLCPY_CONST(s, PACKAGE_VERSION);
|
||||
buf_pos += STRLEN_CONST(PACKAGE_VERSION);
|
||||
strlcpy(s, PACKAGE_VERSION, len);
|
||||
if (!string_is_empty(extra_version))
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, extra_version, len);
|
||||
}
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " - ", len);
|
||||
buf_pos = strlcat(s, core_name, len);
|
||||
strlcat(s, extra_version, len);
|
||||
strlcat(s, " - ", len);
|
||||
strlcat(s, core_name, len);
|
||||
if (!string_is_empty(core_version))
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " (", len);
|
||||
buf_pos = strlcat(s, core_version, len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, ")", len);
|
||||
strlcat(s, " (", len);
|
||||
strlcat(s, core_version, len);
|
||||
strlcat(s, ")", len);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3918,13 +3914,10 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
|
||||
|
||||
for (j = 0; j < content_get_subsystem_rom_id(); j++)
|
||||
{
|
||||
size_t buf_pos = strlcat(rom_buff,
|
||||
strlcat(rom_buff,
|
||||
path_basename(content_get_subsystem_rom(j)), sizeof(rom_buff));
|
||||
if (j != content_get_subsystem_rom_id() - 1)
|
||||
{
|
||||
STRLCAT_CONST_INCR(rom_buff, buf_pos,
|
||||
"|", sizeof(rom_buff));
|
||||
}
|
||||
strlcat(rom_buff, "|", sizeof(rom_buff));
|
||||
}
|
||||
|
||||
if (!string_is_empty(rom_buff))
|
||||
|
@ -1054,7 +1054,7 @@ int setting_generic_action_start_default(rarch_setting_t *setting)
|
||||
static void setting_get_string_representation_default(rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
{
|
||||
STRLCPY_CONST(s, "...");
|
||||
strlcpy(s, "...", len);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +253,7 @@ bool menu_thumbnail_set_system(menu_thumbnail_path_data_t *path_data, const char
|
||||
* so filter any input starting with 'MAME...' */
|
||||
if (strncmp(system, "MAME", 4) == 0)
|
||||
{
|
||||
STRLCPY_CONST(path_data->system, "MAME");
|
||||
strlcpy(path_data->system, "MAME", sizeof(path_data->system));
|
||||
}
|
||||
else
|
||||
strlcpy(path_data->system, system, sizeof(path_data->system));
|
||||
@ -414,15 +414,15 @@ bool menu_thumbnail_set_content_image(
|
||||
img_dir, img_name, sizeof(path_data->content_path));
|
||||
|
||||
/* Set core name to "imageviewer" */
|
||||
STRLCPY_CONST(
|
||||
strlcpy(
|
||||
path_data->content_core_name,
|
||||
"imageviewer");
|
||||
"imageviewer", sizeof(path_data->content_core_name));
|
||||
|
||||
/* Set database name (arbitrarily) to "_images_"
|
||||
* (required for compatibility with menu_thumbnail_update_path(),
|
||||
* but not actually used...) */
|
||||
STRLCPY_CONST(path_data->content_db_name,
|
||||
"_images_");
|
||||
strlcpy(path_data->content_db_name,
|
||||
"_images_", sizeof(path_data->content_db_name));
|
||||
|
||||
/* Redundant error check */
|
||||
if (string_is_empty(path_data->content_path))
|
||||
@ -516,9 +516,7 @@ bool menu_thumbnail_set_content_playlist(menu_thumbnail_path_data_t *path_data,
|
||||
/* Hack: There is only one MAME thumbnail repo,
|
||||
* so filter any input starting with 'MAME...' */
|
||||
if (strncmp(db_name, "MAME", 4) == 0)
|
||||
{
|
||||
STRLCPY_CONST(path_data->content_db_name, "MAME");
|
||||
}
|
||||
strlcpy(path_data->content_db_name, "MAME", sizeof(path_data->content_db_name));
|
||||
else
|
||||
{
|
||||
char *db_name_no_ext = NULL;
|
||||
|
@ -2240,7 +2240,6 @@ static void menu_widgets_start_achievement_notification()
|
||||
static void menu_widgets_get_badge_texture(menu_texture_item *tex, const char *badge)
|
||||
{
|
||||
char badge_file[16];
|
||||
size_t buf_pos;
|
||||
char fullpath[PATH_MAX_LENGTH];
|
||||
|
||||
if (!badge)
|
||||
@ -2249,8 +2248,8 @@ static void menu_widgets_get_badge_texture(menu_texture_item *tex, const char *b
|
||||
return;
|
||||
}
|
||||
|
||||
buf_pos = strlcpy(badge_file, badge, sizeof(badge_file));
|
||||
STRLCAT_CONST_INCR(badge_file, buf_pos, ".png", sizeof(badge_file));
|
||||
strlcpy(badge_file, badge, sizeof(badge_file));
|
||||
strlcat(badge_file, ".png", sizeof(badge_file));
|
||||
fill_pathname_application_special(fullpath,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES);
|
||||
|
154
retroarch.c
154
retroarch.c
@ -4228,7 +4228,7 @@ static bool command_event_save_config(
|
||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||
config_path);
|
||||
|
||||
STRLCPY_CONST(log, "[config]");
|
||||
strlcpy(log, "[config]", sizeof(log));
|
||||
strlcat(log, s, sizeof(log));
|
||||
RARCH_LOG("%s\n", log);
|
||||
return true;
|
||||
@ -4240,7 +4240,7 @@ static bool command_event_save_config(
|
||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||
str);
|
||||
|
||||
STRLCPY_CONST(log, "[config]");
|
||||
strlcpy(log, "[config]", sizeof(log));
|
||||
strlcat(log, s, sizeof(log));
|
||||
RARCH_ERR("%s\n", log);
|
||||
}
|
||||
@ -4303,7 +4303,6 @@ static bool command_event_save_core_config(void)
|
||||
/* In case of collision, find an alternative name. */
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
size_t buf_pos = 0;
|
||||
char tmp[64] = {0};
|
||||
|
||||
fill_pathname_base_noext(
|
||||
@ -4315,9 +4314,9 @@ static bool command_event_save_core_config(void)
|
||||
config_size);
|
||||
|
||||
if (i)
|
||||
buf_pos = snprintf(tmp, sizeof(tmp), "-%u", i);
|
||||
snprintf(tmp, sizeof(tmp), "-%u", i);
|
||||
|
||||
STRLCAT_CONST_INCR(tmp, buf_pos, ".cfg", sizeof(tmp));
|
||||
strlcat(tmp, ".cfg", sizeof(tmp));
|
||||
strlcat(config_path, tmp, config_size);
|
||||
|
||||
if (!path_is_valid(config_path))
|
||||
@ -10492,7 +10491,6 @@ static void bsv_movie_deinit(void)
|
||||
static bool runloop_check_movie_init(void)
|
||||
{
|
||||
char msg[16384], path[8192];
|
||||
size_t buf_pos = 0;
|
||||
settings_t *settings = configuration_settings;
|
||||
|
||||
msg[0] = path[0] = '\0';
|
||||
@ -10500,13 +10498,13 @@ static bool runloop_check_movie_init(void)
|
||||
configuration_set_uint(settings, settings->uints.rewind_granularity, 1);
|
||||
|
||||
if (settings->ints.state_slot > 0)
|
||||
buf_pos = snprintf(path, sizeof(path), "%s%d",
|
||||
snprintf(path, sizeof(path), "%s%d",
|
||||
bsv_movie_state.movie_path,
|
||||
settings->ints.state_slot);
|
||||
else
|
||||
buf_pos = strlcpy(path, bsv_movie_state.movie_path, sizeof(path));
|
||||
strlcpy(path, bsv_movie_state.movie_path, sizeof(path));
|
||||
|
||||
STRLCAT_CONST_INCR(path, buf_pos, ".bsv", sizeof(path));
|
||||
strlcat(path, ".bsv", sizeof(path));
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
@ -19220,9 +19218,7 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
{
|
||||
char frames_text[64];
|
||||
if (video_info.fps_text[buf_pos-1] != '\0')
|
||||
{
|
||||
STRLCAT_CONST_INCR(video_info.fps_text, buf_pos, " || ", sizeof(video_info.fps_text));
|
||||
}
|
||||
strlcat(video_info.fps_text, " || ", sizeof(video_info.fps_text));
|
||||
snprintf(frames_text,
|
||||
sizeof(frames_text),
|
||||
"%s: %" PRIu64, msg_hash_to_str(MSG_FRAMES),
|
||||
@ -19241,9 +19237,7 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
mem, sizeof(mem), "MEM: %.2f/%.2fMB", mem_bytes_used / (1024.0f * 1024.0f),
|
||||
mem_bytes_total / (1024.0f * 1024.0f));
|
||||
if (video_info.fps_text[buf_pos-1] != '\0')
|
||||
{
|
||||
STRLCAT_CONST_INCR(video_info.fps_text, buf_pos, " || ", sizeof(video_info.fps_text));
|
||||
}
|
||||
strlcat(video_info.fps_text, " || ", sizeof(video_info.fps_text));
|
||||
strlcat(video_info.fps_text, mem, sizeof(video_info.fps_text));
|
||||
}
|
||||
|
||||
@ -19257,7 +19251,7 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if (!string_is_empty(video_info.fps_text))
|
||||
{
|
||||
STRLCAT_CONST_INCR(video_driver_window_title, buf_pos,
|
||||
strlcat(video_driver_window_title,
|
||||
" || ", sizeof(video_driver_window_title));
|
||||
strlcat(video_driver_window_title,
|
||||
video_info.fps_text, sizeof(video_driver_window_title));
|
||||
@ -21754,22 +21748,20 @@ static retro_time_t rarch_core_runtime_tick(void)
|
||||
}
|
||||
|
||||
#define _PSUPP_BUF(buf, var, name, desc) \
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, " ", sizeof(buf)); \
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, name, sizeof(buf)); \
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, ":\n\t\t", sizeof(buf)); \
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, desc, sizeof(buf)); \
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, ": ", sizeof(buf)); \
|
||||
buf_pos = strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf)); \
|
||||
buf[buf_pos ] = '\0'
|
||||
strlcat(buf, " ", sizeof(buf)); \
|
||||
strlcat(buf, name, sizeof(buf)); \
|
||||
strlcat(buf, ":\n\t\t", sizeof(buf)); \
|
||||
strlcat(buf, desc, sizeof(buf)); \
|
||||
strlcat(buf, ": ", sizeof(buf)); \
|
||||
strlcat(buf, var ? "yes\n" : "no\n", sizeof(buf))
|
||||
|
||||
static void retroarch_print_features(void)
|
||||
{
|
||||
char buf[2048];
|
||||
size_t buf_pos = 0;
|
||||
buf[0] = '\0';
|
||||
frontend_driver_attach_console();
|
||||
|
||||
STRLCAT_CONST_INCR(buf, buf_pos, "\nFeatures:\n", sizeof(buf));
|
||||
strlcat(buf, "\nFeatures:\n", sizeof(buf));
|
||||
|
||||
_PSUPP_BUF(buf, SUPPORTS_LIBRETRODB, "LibretroDB", "LibretroDB support");
|
||||
_PSUPP_BUF(buf, SUPPORTS_COMMAND, "Command", "Command interface support");
|
||||
@ -22084,9 +22076,9 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
|
||||
/* Copy the args into a buffer so launch arguments can be reused */
|
||||
for (i = 0; i < (unsigned)argc; i++)
|
||||
{
|
||||
size_t buf_pos = strlcat(launch_arguments,
|
||||
strlcat(launch_arguments,
|
||||
argv[i], sizeof(launch_arguments));
|
||||
STRLCAT_CONST(launch_arguments, buf_pos, " ",
|
||||
strlcat(launch_arguments, " ",
|
||||
sizeof(launch_arguments));
|
||||
}
|
||||
string_trim_whitespace_left(launch_arguments);
|
||||
@ -22813,38 +22805,24 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
RARCH_LOG_OUTPUT(str_output);
|
||||
}
|
||||
{
|
||||
size_t buf_pos;
|
||||
char str_output[256];
|
||||
char str[128];
|
||||
str[0] = str_output[0] = '\0';
|
||||
|
||||
retroarch_get_capabilities(RARCH_CAPABILITIES_CPU, str, sizeof(str));
|
||||
|
||||
buf_pos = strlcat(str_output, msg_hash_to_str(MSG_CAPABILITIES),
|
||||
strlcat(str_output, msg_hash_to_str(MSG_CAPABILITIES),
|
||||
sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, ": ", sizeof(str_output));
|
||||
buf_pos = strlcat(str_output, str, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, "\n", sizeof(str_output));
|
||||
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, FILE_PATH_LOG_INFO, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, " Built: ", sizeof(str_output));
|
||||
buf_pos = strlcat(str_output, __DATE__, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, "\n", sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, FILE_PATH_LOG_INFO, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, " Version: ", sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, PACKAGE_VERSION, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, "\n", sizeof(str_output));
|
||||
|
||||
strlcat(str_output, ": ", sizeof(str_output));
|
||||
strlcat(str_output, str, sizeof(str_output));
|
||||
strlcat(str_output, "\n"FILE_PATH_LOG_INFO " Built: " __DATE__ "\n" FILE_PATH_LOG_INFO " Version: " PACKAGE_VERSION "\n", sizeof(str_output));
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, FILE_PATH_LOG_INFO, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, " Git: ", sizeof(str_output));
|
||||
buf_pos = strlcat(str_output, retroarch_git_version,sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, "\n", sizeof(str_output));
|
||||
strlcat(str_output, FILE_PATH_LOG_INFO " Git: ", sizeof(str_output));
|
||||
strlcat(str_output, retroarch_git_version, sizeof(str_output));
|
||||
strlcat(str_output, "\n", sizeof(str_output));
|
||||
#endif
|
||||
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, FILE_PATH_LOG_INFO, sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, " ", sizeof(str_output));
|
||||
STRLCAT_CONST_INCR(str_output, buf_pos, "=================================================\n", sizeof(str_output));
|
||||
strlcat(str_output, FILE_PATH_LOG_INFO " =================================================\n", sizeof(str_output));
|
||||
RARCH_LOG_OUTPUT(str_output);
|
||||
}
|
||||
}
|
||||
@ -23974,86 +23952,46 @@ int retroarch_get_capabilities(enum rarch_capabilities type,
|
||||
{
|
||||
case RARCH_CAPABILITIES_CPU:
|
||||
{
|
||||
unsigned buf_pos = strlen(s);
|
||||
uint64_t cpu = cpu_features_get();
|
||||
|
||||
if (cpu & RETRO_SIMD_MMX)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " MMX", len);
|
||||
}
|
||||
strlcat(s, " MMX", len);
|
||||
if (cpu & RETRO_SIMD_MMXEXT)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " MMXEXT", len);
|
||||
}
|
||||
strlcat(s, " MMXEXT", len);
|
||||
if (cpu & RETRO_SIMD_SSE)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSE", len);
|
||||
}
|
||||
strlcat(s, " SSE", len);
|
||||
if (cpu & RETRO_SIMD_SSE2)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSE2", len);
|
||||
}
|
||||
strlcat(s, " SSE2", len);
|
||||
if (cpu & RETRO_SIMD_SSE3)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSE3", len);
|
||||
}
|
||||
strlcat(s, " SSE3", len);
|
||||
if (cpu & RETRO_SIMD_SSSE3)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSSE3", len);
|
||||
}
|
||||
strlcat(s, " SSSE3", len);
|
||||
if (cpu & RETRO_SIMD_SSE4)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSE4", len);
|
||||
}
|
||||
strlcat(s, " SSE4", len);
|
||||
if (cpu & RETRO_SIMD_SSE42)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " SSE4.2", len);
|
||||
}
|
||||
strlcat(s, " SSE4.2", len);
|
||||
if (cpu & RETRO_SIMD_AES)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " AES", len);
|
||||
}
|
||||
strlcat(s, " AES", len);
|
||||
if (cpu & RETRO_SIMD_AVX)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " AVX", len);
|
||||
}
|
||||
strlcat(s, " AVX", len);
|
||||
if (cpu & RETRO_SIMD_AVX2)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " AVX2", len);
|
||||
}
|
||||
strlcat(s, " AVX2", len);
|
||||
if (cpu & RETRO_SIMD_NEON)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " NEON", len);
|
||||
}
|
||||
strlcat(s, " NEON", len);
|
||||
if (cpu & RETRO_SIMD_VFPV3)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " VFPv3", len);
|
||||
}
|
||||
strlcat(s, " VFPv3", len);
|
||||
if (cpu & RETRO_SIMD_VFPV4)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " VFPv4", len);
|
||||
}
|
||||
strlcat(s, " VFPv4", len);
|
||||
if (cpu & RETRO_SIMD_VMX)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " VMX", len);
|
||||
}
|
||||
strlcat(s, " VMX", len);
|
||||
if (cpu & RETRO_SIMD_VMX128)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " VMX128", len);
|
||||
}
|
||||
strlcat(s, " VMX128", len);
|
||||
if (cpu & RETRO_SIMD_VFPU)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " VFPU", len);
|
||||
}
|
||||
strlcat(s, " VFPU", len);
|
||||
if (cpu & RETRO_SIMD_PS)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " PS", len);
|
||||
}
|
||||
strlcat(s, " PS", len);
|
||||
if (cpu & RETRO_SIMD_ASIMD)
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " ASIMD", len);
|
||||
}
|
||||
s[buf_pos++] = '\0';
|
||||
strlcat(s, " ASIMD", len);
|
||||
}
|
||||
break;
|
||||
case RARCH_CAPABILITIES_COMPILER:
|
||||
|
@ -273,7 +273,6 @@ runtime_log_t *runtime_log_init(const char *content_path,
|
||||
char log_file_dir[PATH_MAX_LENGTH];
|
||||
char log_file_path[PATH_MAX_LENGTH];
|
||||
char tmp_buf[PATH_MAX_LENGTH];
|
||||
size_t buf_pos = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
core_info_list_t *core_info = NULL;
|
||||
runtime_log_t *runtime_log = NULL;
|
||||
@ -411,8 +410,8 @@ runtime_log_t *runtime_log_init(const char *content_path,
|
||||
return NULL;
|
||||
|
||||
/* Build final log file path */
|
||||
buf_pos = fill_pathname_join(log_file_path, log_file_dir, content_name, sizeof(log_file_path));
|
||||
STRLCAT_CONST_INCR(log_file_path, buf_pos, ".lrtl", sizeof(log_file_path));
|
||||
fill_pathname_join(log_file_path, log_file_dir, content_name, sizeof(log_file_path));
|
||||
strlcat(log_file_path, ".lrtl", sizeof(log_file_path));
|
||||
|
||||
if (string_is_empty(log_file_path))
|
||||
return NULL;
|
||||
|
@ -235,9 +235,8 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
|
||||
static bool remote_is_bound = false;
|
||||
const char *autoconfig_str = (string_is_empty(display_name) &&
|
||||
!string_is_empty(params->name)) ? params->name : (!string_is_empty(display_name) ? display_name : "N/A");
|
||||
size_t buf_pos = strlcpy(
|
||||
msg, autoconfig_str, sizeof(msg));
|
||||
STRLCAT_CONST_INCR(msg, buf_pos, " configured.", sizeof(msg));
|
||||
strlcpy(msg, autoconfig_str, sizeof(msg));
|
||||
strlcat(msg, " configured.", sizeof(msg));
|
||||
|
||||
if (!remote_is_bound)
|
||||
{
|
||||
|
@ -251,7 +251,6 @@ static void* task_push_http_transfer_generic(
|
||||
{
|
||||
task_finder_data_t find_data;
|
||||
char tmp[255];
|
||||
size_t buf_pos = 0;
|
||||
const char *s = NULL;
|
||||
retro_task_t *t = NULL;
|
||||
http_handle_t *http = NULL;
|
||||
@ -300,10 +299,9 @@ static void* task_push_http_transfer_generic(
|
||||
else
|
||||
s = url;
|
||||
|
||||
buf_pos = strlcpy(tmp,
|
||||
strlcpy(tmp,
|
||||
msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
|
||||
|
||||
STRLCAT_CONST_INCR(tmp, buf_pos, " ", sizeof(tmp));
|
||||
strlcat(tmp, " ", sizeof(tmp));
|
||||
|
||||
if (strstr(s, ".index"))
|
||||
strlcat(tmp, msg_hash_to_str(MSG_INDEX_FILE), sizeof(tmp));
|
||||
|
@ -81,7 +81,6 @@ static bool get_thumbnail_paths(
|
||||
char *path, size_t path_size,
|
||||
char *url, size_t url_size)
|
||||
{
|
||||
size_t buf_pos;
|
||||
const char *system = NULL;
|
||||
const char *db_name = NULL;
|
||||
const char *img_name = NULL;
|
||||
@ -144,12 +143,12 @@ static bool get_thumbnail_paths(
|
||||
return false;
|
||||
|
||||
/* Generate remote path */
|
||||
buf_pos = strlcpy(raw_url, file_path_str(FILE_PATH_CORE_THUMBNAILS_URL), sizeof(raw_url));
|
||||
STRLCAT_CONST_INCR(raw_url, buf_pos, "/", sizeof(raw_url));
|
||||
buf_pos = strlcat(raw_url, system_name, sizeof(raw_url));
|
||||
STRLCAT_CONST_INCR(raw_url, buf_pos, "/", sizeof(raw_url));
|
||||
buf_pos = strlcat(raw_url, sub_dir, sizeof(raw_url));
|
||||
STRLCAT_CONST_INCR(raw_url, buf_pos, "/", sizeof(raw_url));
|
||||
strlcpy(raw_url, file_path_str(FILE_PATH_CORE_THUMBNAILS_URL), sizeof(raw_url));
|
||||
strlcat(raw_url, "/", sizeof(raw_url));
|
||||
strlcat(raw_url, system_name, sizeof(raw_url));
|
||||
strlcat(raw_url, "/", sizeof(raw_url));
|
||||
strlcat(raw_url, sub_dir, sizeof(raw_url));
|
||||
strlcat(raw_url, "/", sizeof(raw_url));
|
||||
strlcat(raw_url, img_name, sizeof(raw_url));
|
||||
|
||||
if (string_is_empty(raw_url))
|
||||
|
@ -261,9 +261,9 @@ static bool screenshot_dump(
|
||||
{
|
||||
if (savestate)
|
||||
{
|
||||
size_t buf_pos = strlcpy(state->filename,
|
||||
strlcpy(state->filename,
|
||||
name_base, sizeof(state->filename));
|
||||
STRLCAT_CONST_INCR(state->filename, buf_pos, ".png", sizeof(state->filename));
|
||||
strlcat(state->filename, ".png", sizeof(state->filename));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -289,9 +289,9 @@ static bool screenshot_dump(
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t buf_pos = strlcpy(state->shotname, path_basename(name_base),
|
||||
strlcpy(state->shotname, path_basename(name_base),
|
||||
sizeof(state->shotname));
|
||||
STRLCAT_CONST_INCR(state->shotname, buf_pos, ".png", sizeof(state->shotname));
|
||||
strlcat(state->shotname, ".png", sizeof(state->shotname));
|
||||
}
|
||||
|
||||
if ( string_is_empty(screenshot_dir) ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user