mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Start using STRLCAT_CONST_INCR and STRLCPY_CONST
This commit is contained in:
parent
76f4cf5cc5
commit
3b057d9605
@ -35,74 +35,74 @@ 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;
|
||||
|
||||
string_add_bracket_open(s, len);
|
||||
string_add_single_quote(s, len);
|
||||
STRLCPY_CONST(s, "{'");
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DATABASE_QUERY_ENTRY:
|
||||
strlcat(s, "name", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "name", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_PUBLISHER:
|
||||
strlcat(s, "publisher", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "publisher", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_DEVELOPER:
|
||||
strlcat(s, "developer", len);
|
||||
add_glob = true;
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "developer", len);
|
||||
add_glob = true;
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ORIGIN:
|
||||
strlcat(s, "origin", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "origin", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_FRANCHISE:
|
||||
strlcat(s, "franchise", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "franchise", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RATING:
|
||||
strlcat(s, "esrb_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "esrb_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_BBFC_RATING:
|
||||
strlcat(s, "bbfc_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "bbfc_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ELSPA_RATING:
|
||||
strlcat(s, "elspa_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "elspa_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ESRB_RATING:
|
||||
strlcat(s, "esrb_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "esrb_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_PEGI_RATING:
|
||||
strlcat(s, "pegi_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "pegi_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_CERO_RATING:
|
||||
strlcat(s, "cero_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "cero_rating", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_ENHANCEMENT_HW:
|
||||
strlcat(s, "enhancement_hw", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "enhancement_hw", len);
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_EDGE_MAGAZINE_RATING:
|
||||
strlcat(s, "edge_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "edge_rating", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_EDGE_MAGAZINE_ISSUE:
|
||||
strlcat(s, "edge_issue", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "edge_issue", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_FAMITSU_MAGAZINE_RATING:
|
||||
strlcat(s, "famitsu_rating", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "famitsu_rating", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RELEASEDATE_MONTH:
|
||||
strlcat(s, "releasemonth", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "releasemonth", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_RELEASEDATE_YEAR:
|
||||
strlcat(s, "releaseyear", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "releaseyear", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_ENTRY_MAX_USERS:
|
||||
strlcat(s, "users", len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "users", len);
|
||||
add_quotes = false;
|
||||
break;
|
||||
case DATABASE_QUERY_NONE:
|
||||
@ -110,19 +110,26 @@ int database_info_build_query_enum(char *s, size_t len,
|
||||
break;
|
||||
}
|
||||
|
||||
string_add_single_quote(s, len);
|
||||
string_add_colon(s, len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "':", len);
|
||||
if (add_glob)
|
||||
string_add_glob_open(s, len);
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "glob('*", len);
|
||||
}
|
||||
if (add_quotes)
|
||||
string_add_quote(s, len);
|
||||
strlcat(s, path, len);
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "\"", len);
|
||||
}
|
||||
buf_pos = strlcat(s, path, len);
|
||||
if (add_glob)
|
||||
string_add_glob_close(s, len);
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "*')", len);
|
||||
}
|
||||
if (add_quotes)
|
||||
string_add_quote(s, len);
|
||||
{
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "\"", len);
|
||||
}
|
||||
|
||||
string_add_bracket_close(s, len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "{'", len);
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("query: %s\n", s);
|
||||
|
@ -144,11 +144,12 @@ int system_property_get(const char *command,
|
||||
char buffer[PATH_MAX_LENGTH] = {0};
|
||||
char cmd[PATH_MAX_LENGTH] = {0};
|
||||
char *curpos = NULL;
|
||||
size_t copied = strlcpy(cmd, command, sizeof(cmd));
|
||||
size_t buf_pos = strlcpy(cmd, command, sizeof(cmd));
|
||||
|
||||
string_add_space_fast(cmd, copied);
|
||||
cmd[buf_pos] = ' ';
|
||||
cmd[buf_pos+1] = '\0';
|
||||
|
||||
copied = strlcat(cmd, args, sizeof(cmd));
|
||||
buf_pos = strlcat(cmd, args, sizeof(cmd));
|
||||
|
||||
pipe = popen(cmd, "r");
|
||||
|
||||
@ -1693,17 +1694,17 @@ static void frontend_unix_get_env(int *argc,
|
||||
|
||||
if (xdg)
|
||||
{
|
||||
size_t copied = strlcpy(base_path, xdg, sizeof(base_path));
|
||||
string_add_backslash_fast(base_path, copied);
|
||||
copied = strlcat(base_path, "retroarch", sizeof(base_path));
|
||||
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));
|
||||
}
|
||||
else if (home)
|
||||
{
|
||||
size_t copied = strlcpy(base_path, home, sizeof(base_path));
|
||||
string_add_backslash_fast(base_path, copied);
|
||||
copied = strlcat(base_path, ".config", sizeof(base_path));
|
||||
string_add_backslash_fast(base_path, copied);
|
||||
copied = strlcat(base_path, "retroarch", sizeof(base_path));
|
||||
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));
|
||||
}
|
||||
else
|
||||
strlcpy(base_path, "retroarch", sizeof(base_path));
|
||||
|
@ -70,7 +70,7 @@ static std::string build_stage_source(
|
||||
|
||||
expected[0] = '\0';
|
||||
|
||||
string_add_alpha_14_fast(expected, "#pragma stage ", 0);
|
||||
STRLCPY_CONST(expected, "#pragma stage ");
|
||||
strlcat(expected, stage, sizeof(expected));
|
||||
|
||||
active = strcmp(expected, line) == 0;
|
||||
|
@ -571,21 +571,21 @@ 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 copied;
|
||||
size_t buf_pos;
|
||||
|
||||
texture[0] = texture_size[0] = input_size[0] = tex_coord[0] = '\0';
|
||||
|
||||
copied = strlcpy(texture, base, sizeof(texture));
|
||||
string_add_alpha_7_fast(texture, "Texture", copied);
|
||||
buf_pos = strlcpy(texture, base, sizeof(texture));
|
||||
STRLCAT_CONST_INCR(texture, buf_pos, "Texture", sizeof(texture));
|
||||
|
||||
copied = strlcpy(texture_size, base, sizeof(texture_size));
|
||||
string_add_alpha_11_fast(texture_size, "TextureSize", copied);
|
||||
buf_pos = strlcpy(texture_size, base, sizeof(texture_size));
|
||||
STRLCAT_CONST_INCR(texture_size, buf_pos, "TextureSize", sizeof(texture_size));
|
||||
|
||||
copied = strlcpy(input_size, base, sizeof(input_size));
|
||||
string_add_alpha_9_fast(input_size, "InputSize", copied);
|
||||
buf_pos = strlcpy(input_size, base, sizeof(input_size));
|
||||
STRLCAT_CONST_INCR(input_size, buf_pos, "InputSize", sizeof(input_size));
|
||||
|
||||
copied = strlcpy(tex_coord, base, sizeof(tex_coord));
|
||||
string_add_alpha_8_fast(tex_coord, "TexCoord", copied);
|
||||
buf_pos = strlcpy(tex_coord, base, sizeof(tex_coord));
|
||||
STRLCAT_CONST_INCR(tex_coord, buf_pos, "TexCoord", sizeof(tex_coord));
|
||||
|
||||
if (frame->texture < 0)
|
||||
frame->texture = gl_glsl_get_uniform(glsl, prog, texture);
|
||||
|
@ -341,7 +341,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
char id_mipmap[64];
|
||||
bool mipmap = false;
|
||||
bool smooth = false;
|
||||
size_t written = 0;
|
||||
size_t buf_pos = 0;
|
||||
|
||||
id_filter[0] = id_wrap[0] = wrap_mode[0] = id_mipmap[0] = '\0';
|
||||
|
||||
@ -358,21 +358,21 @@ static bool video_shader_parse_textures(config_file_t *conf,
|
||||
strlcpy(shader->lut[shader->luts].id, id,
|
||||
sizeof(shader->lut[shader->luts].id));
|
||||
|
||||
written = strlcpy(id_filter, id, sizeof(id_filter));
|
||||
string_add_alpha_7_fast(id_filter, "_linear", written);
|
||||
buf_pos = strlcpy(id_filter, id, sizeof(id_filter));
|
||||
STRLCAT_CONST_INCR(id_filter, buf_pos, "_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;
|
||||
|
||||
written = strlcpy(id_wrap, id, sizeof(id_wrap));
|
||||
string_add_alpha_10_fast(id_wrap, "_wrap_mode", written);
|
||||
buf_pos = strlcpy(id_wrap, id, sizeof(id_wrap));
|
||||
STRLCAT_CONST_INCR(id_wrap, buf_pos, "_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);
|
||||
|
||||
written = strlcpy(id_mipmap, id, sizeof(id_mipmap));
|
||||
string_add_alpha_7_fast(id_mipmap, "_mipmap", written);
|
||||
buf_pos = strlcpy(id_mipmap, id, sizeof(id_mipmap));
|
||||
STRLCAT_CONST_INCR(id_mipmap, buf_pos, "_mipmap", sizeof(id_mipmap));
|
||||
if (config_get_bool(conf, id_mipmap, &mipmap))
|
||||
shader->lut[shader->luts].mipmap = mipmap;
|
||||
else
|
||||
@ -1106,31 +1106,31 @@ void video_shader_write_conf_preset(config_file_t *conf,
|
||||
|
||||
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
|
||||
{
|
||||
size_t written;
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
written = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
string_add_alpha_7_fast(key, "_linear", written);
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_linear", sizeof(key));
|
||||
config_set_bool(conf, key,
|
||||
shader->lut[i].filter == RARCH_FILTER_LINEAR);
|
||||
}
|
||||
|
||||
{
|
||||
size_t written;
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
written = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
string_add_alpha_10_fast(key, "_wrap_mode", written);
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_wrap_mode", sizeof(key));
|
||||
config_set_string(conf, key,
|
||||
wrap_mode_to_str(shader->lut[i].wrap));
|
||||
}
|
||||
|
||||
{
|
||||
size_t written;
|
||||
size_t buf_pos;
|
||||
char key[128];
|
||||
key[0] = '\0';
|
||||
written = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
string_add_alpha_7_fast(key, "_mipmap", written);
|
||||
buf_pos = strlcpy(key, shader->lut[i].id, sizeof(key));
|
||||
STRLCAT_CONST_INCR(key, buf_pos, "_mipmap", sizeof(key));
|
||||
config_set_bool(conf, key,
|
||||
shader->lut[i].mipmap);
|
||||
}
|
||||
|
@ -1302,8 +1302,9 @@ 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 copied = strlcpy(s,resolved_bundle_dir_buf, len);
|
||||
string_add_backslash_fast(s, copied);
|
||||
size_t buf_pos = strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
||||
s[buf_pos] = '/';
|
||||
s[buf_pos+1] = '\0';
|
||||
}
|
||||
}
|
||||
#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 string_add_pair_open(s, size) strlcat((s), " (", (size))
|
||||
#define string_add_pair_close(s, size) strlcat((s), ")", (size))
|
||||
#define string_add_bracket_open(s, size) strlcat((s), "{", (size))
|
||||
#define string_add_bracket_close(s, size) strlcat((s), "}", (size))
|
||||
#define string_add_single_quote(s, size) strlcat((s), "'", (size))
|
||||
#define string_add_quote(s, size) strlcat((s), "\"", (size))
|
||||
#define string_add_colon(s, size) strlcat((s), ":", (size))
|
||||
#define string_add_glob_open(s, size) strlcat((s), "glob('*", (size))
|
||||
#define string_add_glob_close(s, size) strlcat((s), "*')", (size))
|
||||
|
||||
#define STRLCPY_CONST(buf, str) \
|
||||
do { size_t i; for (i = 0; i < sizeof(str); i++) (buf)[i] = (str)[i]; } while (0)
|
||||
|
||||
@ -69,102 +59,6 @@ static INLINE bool string_is_equal(const char *a, const char *b)
|
||||
STRLCAT_CONST(buf, strlcpy_ret, str, buf_size); \
|
||||
(strlcpy_ret) += STRLEN_CONST((str))
|
||||
|
||||
#define string_add_alpha_fast(s, alpha, size) \
|
||||
(s)[(size)] = (alpha); \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_alpha_2_fast(s, str, size) \
|
||||
string_add_alpha_fast(s, str[0], size); \
|
||||
string_add_alpha_fast(s, str[1], size+1)
|
||||
|
||||
#define string_add_alpha_3_fast(s, str, size) \
|
||||
string_add_alpha_2_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[2], size+2)
|
||||
|
||||
#define string_add_alpha_4_fast(s, str, size) \
|
||||
string_add_alpha_3_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[3], size+3)
|
||||
|
||||
#define string_add_alpha_5_fast(s, str, size) \
|
||||
string_add_alpha_4_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[4], size+4)
|
||||
|
||||
#define string_add_alpha_6_fast(s, str, size) \
|
||||
string_add_alpha_5_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[5], size+5)
|
||||
|
||||
#define string_add_alpha_7_fast(s, str, size) \
|
||||
string_add_alpha_6_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[6], size+6)
|
||||
|
||||
#define string_add_alpha_8_fast(s, str, size) \
|
||||
string_add_alpha_7_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[7], size+7)
|
||||
|
||||
#define string_add_alpha_9_fast(s, str, size) \
|
||||
string_add_alpha_8_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[8], size+8)
|
||||
|
||||
#define string_add_alpha_10_fast(s, str, size) \
|
||||
string_add_alpha_9_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[9], size+9)
|
||||
|
||||
#define string_add_alpha_11_fast(s, str, size) \
|
||||
string_add_alpha_10_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[10], size+10)
|
||||
|
||||
#define string_add_alpha_12_fast(s, str, size) \
|
||||
string_add_alpha_11_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[11], size+11)
|
||||
|
||||
#define string_add_alpha_13_fast(s, str, size) \
|
||||
string_add_alpha_12_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[12], size+12)
|
||||
|
||||
#define string_add_alpha_14_fast(s, str, size) \
|
||||
string_add_alpha_13_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[13], size+13)
|
||||
|
||||
#define string_add_alpha_15_fast(s, str, size) \
|
||||
string_add_alpha_14_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[14], size+14)
|
||||
|
||||
#define string_add_alpha_16_fast(s, str, size) \
|
||||
string_add_alpha_15_fast(s, str, size); \
|
||||
string_add_alpha_fast(s, str[15], size+15)
|
||||
|
||||
#define string_add_backslash_fast(s, size) \
|
||||
(s)[(size)] = '/'; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_colon_fast(s, size) \
|
||||
(s)[(size)] = ':'; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_star_fast(s, size) \
|
||||
(s)[(size)] = '*'; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_dot_fast(s, size) \
|
||||
(s)[(size)] = '.'; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_space_fast(s, size) \
|
||||
(s)[(size)] = ' '; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_vertical_bar_fast(s, size) \
|
||||
(s)[(size)] = '|'; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_pair_open_fast(s, size) \
|
||||
(s)[(size)] = '('; \
|
||||
(s)[(size)+1] = '\0'
|
||||
|
||||
#define string_add_pair_close_fast(s, size) \
|
||||
(s)[(size)] = ')'; \
|
||||
(s)[(size)+1] = '\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)
|
||||
|
||||
|
@ -142,7 +142,7 @@ void net_http_urlencode(char **dest, const char *source)
|
||||
void net_http_urlencode_full(char *dest,
|
||||
const char *source, size_t size)
|
||||
{
|
||||
size_t copied = 0;
|
||||
size_t buf_pos = 0;
|
||||
char *tmp = NULL;
|
||||
char url_domain[PATH_MAX_LENGTH] = {0};
|
||||
char url_path[PATH_MAX_LENGTH] = {0};
|
||||
@ -167,9 +167,10 @@ void net_http_urlencode_full(char *dest,
|
||||
|
||||
tmp = NULL;
|
||||
net_http_urlencode(&tmp, url_path);
|
||||
copied = strlcpy(dest, url_domain, size);
|
||||
string_add_backslash_fast(dest, copied);
|
||||
copied = strlcat(dest, tmp, size);
|
||||
buf_pos = strlcpy(dest, url_domain, size);
|
||||
dest[buf_pos] = '/';
|
||||
dest[buf_pos+1] = '\0';
|
||||
buf_pos = strlcat(dest, tmp, size);
|
||||
free (tmp);
|
||||
}
|
||||
|
||||
@ -307,7 +308,7 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
||||
|
||||
if (strchr(conn->scan, (char) ':'))
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
url_dup = strdup(conn->scan);
|
||||
domain_port = strtok(url_dup, ":");
|
||||
domain_port2 = strtok(NULL, ":");
|
||||
@ -318,7 +319,7 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
||||
if (url_port)
|
||||
conn->port = atoi(url_port);
|
||||
|
||||
copied = strlcpy(new_domain, domain_port, sizeof(new_domain));
|
||||
buf_pos = strlcpy(new_domain, domain_port, sizeof(new_domain));
|
||||
free(url_dup);
|
||||
|
||||
if (uri)
|
||||
@ -327,7 +328,8 @@ struct http_connection_t *net_http_connection_new(const char *url,
|
||||
strlcat(new_domain, uri, sizeof(new_domain));
|
||||
else
|
||||
{
|
||||
string_add_backslash_fast(new_domain, copied);
|
||||
new_domain[buf_pos] = '/';
|
||||
new_domain[buf_pos+1] = '\0';
|
||||
strlcat(new_domain, strchr(uri, (char)'/') + sizeof(char),
|
||||
sizeof(new_domain));
|
||||
}
|
||||
|
@ -1155,17 +1155,18 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
|
||||
if (name[path_len - 1] != '\\')
|
||||
path_buf[copied++] = '\\';
|
||||
|
||||
string_add_alpha_fast(path_buf, '*', copied);
|
||||
path_buf[copied] = '*';
|
||||
path_buf[copied+1] = '\0';
|
||||
|
||||
#if defined(LEGACY_WIN32)
|
||||
path_local = utf8_to_local_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFile(path_local, &rdir->entry);
|
||||
path_local = utf8_to_local_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFile(path_local, &rdir->entry);
|
||||
|
||||
if (path_local)
|
||||
free(path_local);
|
||||
#else
|
||||
path_wide = utf8_to_utf16_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFileW(path_wide, &rdir->entry);
|
||||
path_wide = utf8_to_utf16_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFileW(path_wide, &rdir->entry);
|
||||
|
||||
if (path_wide)
|
||||
free(path_wide);
|
||||
|
@ -4904,11 +4904,11 @@ void netplay_refresh_rooms_menu(file_list_t *list)
|
||||
|
||||
if (*netplay_room_list[i].country)
|
||||
{
|
||||
size_t copied = 0;
|
||||
string_add_alpha_fast(country, '(', copied);
|
||||
copied = strlcat(country, netplay_room_list[i].country,
|
||||
size_t buf_pos = STRLEN_CONST("(");
|
||||
STRLCPY_CONST(country, "(");
|
||||
buf_pos = strlcat(country, netplay_room_list[i].country,
|
||||
sizeof(country));
|
||||
string_add_alpha_fast(country, ')', copied);
|
||||
STRLCAT_CONST_INCR(country, buf_pos, ")", sizeof(country));
|
||||
}
|
||||
|
||||
/* Uncomment this to debug mismatched room parameters*/
|
||||
|
@ -61,11 +61,13 @@
|
||||
|
||||
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);
|
||||
|
||||
string_add_alpha_9_fast(s, "License: ", 0);
|
||||
STRLCPY_CONST(s, "License: ");
|
||||
buf_pos = STRLEN_CONST("License: ");
|
||||
|
||||
if (core_list)
|
||||
{
|
||||
@ -78,18 +80,18 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
|
||||
if (core_list->list[j].licenses_list)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
tmp[0] = '\0';
|
||||
tmp[0] = '\0';
|
||||
|
||||
string_list_join_concat(tmp, sizeof(tmp),
|
||||
core_list->list[j].licenses_list, ", ");
|
||||
strlcat(s, tmp, len);
|
||||
buf_pos = strlcat(s, tmp, len);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string_add_alpha_3_fast(s, "N/A", 9);
|
||||
STRLCAT_CONST(s, buf_pos, "N/A", len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -996,7 +998,7 @@ static int action_bind_sublabel_playlist_entry(
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t written;
|
||||
size_t buf_pos;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
@ -1021,9 +1023,9 @@ static int action_bind_sublabel_playlist_entry(
|
||||
return 0;
|
||||
|
||||
/* Add core name */
|
||||
written = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
|
||||
string_add_alpha_fast(s, ' ', written);
|
||||
written = strlcat(s, entry->core_name, len);
|
||||
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);
|
||||
|
||||
/* Get runtime info *if* required runtime log is enabled
|
||||
* *and* this is a valid playlist type */
|
||||
|
@ -293,19 +293,19 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
|
||||
if (list_path)
|
||||
{
|
||||
char elem0_path[255];
|
||||
size_t written;
|
||||
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);
|
||||
written = strlcpy(s, text, len);
|
||||
s[written ] = '\n';
|
||||
buf_pos = strlcpy(s, text, len);
|
||||
s[buf_pos ] = '\n';
|
||||
|
||||
if (!string_is_empty(elem0_path))
|
||||
{
|
||||
string_add_alpha_2_fast(s, "- ", written);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, "- ", len);
|
||||
strlcat(s, path_basename(elem0_path), len);
|
||||
}
|
||||
}
|
||||
@ -342,8 +342,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 written = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
|
||||
string_add_space_fast(s, written);
|
||||
size_t buf_pos = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " ", len);
|
||||
strlcat(s, path, len);
|
||||
return 0;
|
||||
}
|
||||
@ -377,7 +377,7 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
{
|
||||
char elem0[255];
|
||||
char elem1[255];
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
struct string_list *list_label = string_split(label, "|");
|
||||
|
||||
elem0[0] = elem1[0] = '\0';
|
||||
@ -393,11 +393,11 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
string_list_free(list_label);
|
||||
}
|
||||
|
||||
copied = strlcpy(s, elem0, len);
|
||||
buf_pos = strlcpy(s, elem0, len);
|
||||
|
||||
if (!string_is_empty(elem1))
|
||||
{
|
||||
string_add_alpha_3_fast(s, " - ", copied);
|
||||
STRLCAT_CONST_INCR(s, buf_pos, " - ", len);
|
||||
strlcat(s, elem1, len);
|
||||
}
|
||||
}
|
||||
|
@ -1156,7 +1156,7 @@ 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 copied;
|
||||
size_t buf_pos;
|
||||
/* This controls the main background color */
|
||||
menu_display_ctx_clearcolor_t clearcolor;
|
||||
|
||||
@ -1635,13 +1635,13 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
/* Title */
|
||||
usable_width = width - (mui->margin * 2) - title_margin;
|
||||
|
||||
copied = strlcpy(menu_title, mui->menu_title, sizeof(menu_title));
|
||||
buf_pos = strlcpy(menu_title, mui->menu_title, sizeof(menu_title));
|
||||
|
||||
if (materialui_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
||||
{
|
||||
string_add_alpha_2_fast(menu_title, " (", copied);
|
||||
copied = strlcat(menu_title, title_msg, sizeof(menu_title));
|
||||
string_add_alpha_fast(menu_title, ')', copied);
|
||||
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));
|
||||
}
|
||||
|
||||
if (use_smooth_ticker)
|
||||
|
@ -574,17 +574,17 @@ static void ozone_context_reset(void *data, bool is_threaded)
|
||||
/* Textures init */
|
||||
for (i = 0; i < OZONE_TEXTURE_LAST; i++)
|
||||
{
|
||||
size_t copied;
|
||||
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())
|
||||
copied = strlcpy(filename, discord_get_own_avatar(), sizeof(filename));
|
||||
buf_pos = strlcpy(filename, discord_get_own_avatar(), sizeof(filename));
|
||||
else
|
||||
#endif
|
||||
copied = strlcpy(filename, OZONE_TEXTURES_FILES[i], sizeof(filename));
|
||||
buf_pos = strlcpy(filename, OZONE_TEXTURES_FILES[i], sizeof(filename));
|
||||
|
||||
string_add_alpha_4_fast(filename, ".png", copied);
|
||||
STRLCAT_CONST_INCR(filename, buf_pos, ".png", sizeof(filename));
|
||||
|
||||
#if 0
|
||||
if (i == OZONE_TEXTURE_DISCORD_OWN_AVATAR && discord_avatar_is_ready())
|
||||
@ -612,13 +612,13 @@ static void ozone_context_reset(void *data, bool is_threaded)
|
||||
/* Sidebar textures */
|
||||
for (i = 0; i < OZONE_TAB_TEXTURE_LAST; i++)
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
|
||||
filename[0] = '\0';
|
||||
copied = strlcpy(filename,
|
||||
buf_pos = strlcpy(filename,
|
||||
OZONE_TAB_TEXTURES_FILES[i], sizeof(filename));
|
||||
string_add_alpha_4_fast(filename, ".png", copied);
|
||||
STRLCAT_CONST_INCR(filename, buf_pos, ".png", sizeof(filename));
|
||||
|
||||
if (!menu_display_reset_textures_list(filename, ozone->tab_path, &ozone->tab_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR, NULL, NULL))
|
||||
{
|
||||
|
@ -1402,9 +1402,9 @@ bool menu_animation_ticker(menu_animation_ctx_ticker_t *ticker)
|
||||
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t copied = utf8cpy(ticker->s,
|
||||
size_t buf_pos = utf8cpy(ticker->s,
|
||||
PATH_MAX_LENGTH, ticker->str, ticker->len - 3);
|
||||
string_add_alpha_3_fast(ticker->s, "...", copied);
|
||||
STRLCAT_CONST_INCR(ticker->s, buf_pos, "...", ticker->len);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1500,7 +1500,7 @@ bool menu_animation_ticker_smooth_fw(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
* and add '...' suffix */
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
unsigned num_chars = 0;
|
||||
unsigned suffix_len = 3;
|
||||
unsigned suffix_width = suffix_len * glyph_width;
|
||||
@ -1513,8 +1513,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 */
|
||||
copied = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
string_add_alpha_3_fast(ticker->dst_str, "...", copied);
|
||||
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);
|
||||
|
||||
if (ticker->dst_str_width)
|
||||
*ticker->dst_str_width = (num_chars * glyph_width) + suffix_width;
|
||||
@ -1682,7 +1682,7 @@ bool menu_animation_ticker_smooth(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
* and add '...' suffix */
|
||||
if (!ticker->selected)
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
unsigned text_width;
|
||||
unsigned current_width = 0;
|
||||
unsigned num_chars = 0;
|
||||
@ -1714,8 +1714,8 @@ bool menu_animation_ticker_smooth(menu_animation_ctx_ticker_smooth_t *ticker)
|
||||
}
|
||||
|
||||
/* Copy string segment + add suffix */
|
||||
copied = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
|
||||
string_add_alpha_3_fast(ticker->dst_str, "...", copied);
|
||||
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);
|
||||
|
||||
if (ticker->dst_str_width)
|
||||
*ticker->dst_str_width = current_width + (3 * period_width);
|
||||
|
@ -625,59 +625,55 @@ static unsigned menu_displaylist_parse_system_info(menu_displaylist_info_t *info
|
||||
|
||||
if (frontend->get_powerstate)
|
||||
{
|
||||
size_t copied = 0;
|
||||
int seconds = 0, percent = 0;
|
||||
size_t buf_pos = 0;
|
||||
int seconds = 0, percent = 0;
|
||||
enum frontend_powerstate state =
|
||||
frontend->get_powerstate(&seconds, &percent);
|
||||
|
||||
tmp2[0] = '\0';
|
||||
|
||||
if (percent != 0)
|
||||
snprintf(tmp2, sizeof(tmp2), "%d%%", percent);
|
||||
buf_pos = snprintf(tmp2, sizeof(tmp2), "%d%%", percent);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case FRONTEND_POWERSTATE_NONE:
|
||||
string_add_space_fast (tmp2, copied );
|
||||
copied = strlcat(tmp2,
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " ", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_NO_SOURCE:
|
||||
string_add_space_fast (tmp2, copied );
|
||||
string_add_pair_open_fast (tmp2, copied+1);
|
||||
copied = strlcat(tmp2,
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_NO_SOURCE),
|
||||
sizeof(tmp2));
|
||||
string_add_pair_close_fast(tmp2, copied );
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_CHARGING:
|
||||
string_add_space_fast (tmp2, copied );
|
||||
string_add_pair_open_fast (tmp2, copied+1);
|
||||
copied = strlcat(tmp2,
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGING),
|
||||
sizeof(tmp2));
|
||||
string_add_pair_close_fast(tmp2, copied );
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_CHARGED:
|
||||
string_add_space_fast (tmp2, copied );
|
||||
string_add_pair_open_fast (tmp2, copied+1);
|
||||
copied = strlcat(tmp2,
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED),
|
||||
sizeof(tmp2));
|
||||
string_add_pair_close_fast(tmp2, copied );
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
break;
|
||||
case FRONTEND_POWERSTATE_ON_POWER_SOURCE:
|
||||
string_add_space_fast (tmp2, copied );
|
||||
string_add_pair_open_fast (tmp2, copied+1);
|
||||
copied = strlcat(tmp2,
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, " (", sizeof(tmp2));
|
||||
buf_pos = strlcat(tmp2,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING),
|
||||
sizeof(tmp2));
|
||||
string_add_pair_close_fast(tmp2, copied );
|
||||
STRLCAT_CONST_INCR(tmp2, buf_pos, ")", sizeof(tmp2));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3009,7 +3005,7 @@ 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));
|
||||
string_add_alpha_2_fast(tmp, ": ", n);
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, content_label, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
@ -3031,7 +3027,7 @@ 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));
|
||||
string_add_alpha_2_fast(tmp, ": ", n);
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, content_path, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
@ -3054,7 +3050,7 @@ 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));
|
||||
string_add_alpha_2_fast(tmp, ": ", n);
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, core_name, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
@ -3089,7 +3085,7 @@ 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));
|
||||
string_add_alpha_2_fast(tmp, ": ", n);
|
||||
STRLCAT_CONST_INCR(tmp, n, ": ", sizeof(tmp));
|
||||
n = strlcat(tmp, db_name_no_ext, sizeof(tmp));
|
||||
tmp[n ] = '\0';
|
||||
|
||||
|
@ -1177,12 +1177,21 @@ int menu_entries_get_core_title(char *s, size_t len)
|
||||
#else
|
||||
const char *extra_version = "";
|
||||
#endif
|
||||
size_t copied = strlcpy(s, PACKAGE_VERSION, len);
|
||||
copied = strlcat(s, extra_version, len);
|
||||
string_add_alpha_3_fast(s, " - ", copied);
|
||||
copied = strlcat(s, core_name, len);
|
||||
string_add_alpha_fast(s, ' ', copied);
|
||||
copied = strlcat(s, core_version, len);
|
||||
size_t buf_pos = 0;
|
||||
STRLCPY_CONST(s, PACKAGE_VERSION);
|
||||
buf_pos += STRLEN_CONST(PACKAGE_VERSION);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3909,11 +3918,12 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
|
||||
|
||||
for (j = 0; j < content_get_subsystem_rom_id(); j++)
|
||||
{
|
||||
size_t copied = strlcat(rom_buff,
|
||||
size_t buf_pos = strlcat(rom_buff,
|
||||
path_basename(content_get_subsystem_rom(j)), sizeof(rom_buff));
|
||||
if (j != content_get_subsystem_rom_id() - 1)
|
||||
{
|
||||
string_add_alpha_fast(rom_buff, '|', copied);
|
||||
STRLCAT_CONST_INCR(rom_buff, buf_pos,
|
||||
"|", sizeof(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)
|
||||
{
|
||||
string_add_alpha_3_fast(s, "...", 0);
|
||||
STRLCPY_CONST(s, "...");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
{
|
||||
string_add_alpha_4_fast(path_data->system, "MAME", 0);
|
||||
STRLCPY_CONST(path_data->system, "MAME");
|
||||
}
|
||||
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" */
|
||||
string_add_alpha_11_fast(
|
||||
STRLCPY_CONST(
|
||||
path_data->content_core_name,
|
||||
"imageviewer", 0);
|
||||
"imageviewer");
|
||||
|
||||
/* Set database name (arbitrarily) to "_images_"
|
||||
* (required for compatibility with menu_thumbnail_update_path(),
|
||||
* but not actually used...) */
|
||||
string_add_alpha_8_fast(path_data->content_db_name,
|
||||
"_images_", 0);
|
||||
STRLCPY_CONST(path_data->content_db_name,
|
||||
"_images_");
|
||||
|
||||
/* Redundant error check */
|
||||
if (string_is_empty(path_data->content_path))
|
||||
@ -517,8 +517,7 @@ bool menu_thumbnail_set_content_playlist(menu_thumbnail_path_data_t *path_data,
|
||||
* so filter any input starting with 'MAME...' */
|
||||
if (strncmp(db_name, "MAME", 4) == 0)
|
||||
{
|
||||
string_add_alpha_4_fast(
|
||||
path_data->content_db_name, "MAME", 0);
|
||||
STRLCPY_CONST(path_data->content_db_name, "MAME");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2237,7 +2237,7 @@ 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 written;
|
||||
size_t buf_pos;
|
||||
char fullpath[PATH_MAX_LENGTH];
|
||||
|
||||
if (!badge)
|
||||
@ -2246,8 +2246,8 @@ static void menu_widgets_get_badge_texture(menu_texture_item *tex, const char *b
|
||||
return;
|
||||
}
|
||||
|
||||
written = strlcpy(badge_file, badge, sizeof(badge_file));
|
||||
string_add_alpha_4_fast(badge_file, ".png", written);
|
||||
buf_pos = strlcpy(badge_file, badge, sizeof(badge_file));
|
||||
STRLCAT_CONST_INCR(badge_file, buf_pos, ".png", sizeof(badge_file));
|
||||
fill_pathname_application_special(fullpath,
|
||||
PATH_MAX_LENGTH * sizeof(char),
|
||||
APPLICATION_SPECIAL_DIRECTORY_THUMBNAILS_CHEEVOS_BADGES);
|
||||
|
37
retroarch.c
37
retroarch.c
@ -4152,7 +4152,7 @@ static bool command_event_save_config(
|
||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||
config_path);
|
||||
|
||||
string_add_alpha_9_fast(log, "[config] ", 0);
|
||||
STRLCPY_CONST(log, "[config]");
|
||||
strlcat(log, s, sizeof(log));
|
||||
RARCH_LOG("%s\n", log);
|
||||
return true;
|
||||
@ -4164,7 +4164,7 @@ static bool command_event_save_config(
|
||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||
str);
|
||||
|
||||
string_add_alpha_9_fast(log, "[config] ", 0);
|
||||
STRLCPY_CONST(log, "[config]");
|
||||
strlcat(log, s, sizeof(log));
|
||||
RARCH_ERR("%s\n", log);
|
||||
}
|
||||
@ -4227,8 +4227,8 @@ static bool command_event_save_core_config(void)
|
||||
/* In case of collision, find an alternative name. */
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
size_t copied = 0;
|
||||
char tmp[64] = {0};
|
||||
size_t buf_pos = 0;
|
||||
char tmp[64] = {0};
|
||||
|
||||
fill_pathname_base_noext(
|
||||
config_name,
|
||||
@ -4239,11 +4239,11 @@ static bool command_event_save_core_config(void)
|
||||
config_size);
|
||||
|
||||
if (i)
|
||||
copied = snprintf(tmp, sizeof(tmp), "-%u", i);
|
||||
|
||||
string_add_alpha_4_fast(tmp, ".cfg", copied);
|
||||
buf_pos = snprintf(tmp, sizeof(tmp), "-%u", i);
|
||||
|
||||
STRLCAT_CONST_INCR(tmp, buf_pos, ".cfg", sizeof(tmp));
|
||||
strlcat(config_path, tmp, config_size);
|
||||
|
||||
if (!path_is_valid(config_path))
|
||||
{
|
||||
found_path = true;
|
||||
@ -10416,7 +10416,7 @@ static void bsv_movie_deinit(void)
|
||||
static bool runloop_check_movie_init(void)
|
||||
{
|
||||
char msg[16384], path[8192];
|
||||
size_t copied;
|
||||
size_t buf_pos = 0;
|
||||
settings_t *settings = configuration_settings;
|
||||
|
||||
msg[0] = path[0] = '\0';
|
||||
@ -10424,13 +10424,13 @@ static bool runloop_check_movie_init(void)
|
||||
configuration_set_uint(settings, settings->uints.rewind_granularity, 1);
|
||||
|
||||
if (settings->ints.state_slot > 0)
|
||||
copied = snprintf(path, sizeof(path), "%s%d",
|
||||
buf_pos = snprintf(path, sizeof(path), "%s%d",
|
||||
bsv_movie_state.movie_path,
|
||||
settings->ints.state_slot);
|
||||
else
|
||||
copied = strlcpy(path, bsv_movie_state.movie_path, sizeof(path));
|
||||
buf_pos = strlcpy(path, bsv_movie_state.movie_path, sizeof(path));
|
||||
|
||||
string_add_alpha_4_fast(path, ".bsv", copied);
|
||||
STRLCAT_CONST_INCR(path, buf_pos, ".bsv", sizeof(path));
|
||||
|
||||
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
@ -19134,15 +19134,12 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if (video_info.fps_show)
|
||||
{
|
||||
size_t copied = snprintf(
|
||||
size_t buf_pos = snprintf(
|
||||
video_info.fps_text, sizeof(video_info.fps_text),
|
||||
"FPS: %6.2f", last_fps);
|
||||
if (video_info.framecount_show)
|
||||
{
|
||||
string_add_space_fast(video_info.fps_text, copied);
|
||||
string_add_vertical_bar_fast(video_info.fps_text, copied+1);
|
||||
string_add_vertical_bar_fast(video_info.fps_text, copied+2);
|
||||
string_add_space_fast(video_info.fps_text, copied+3);
|
||||
STRLCAT_CONST_INCR(video_info.fps_text, buf_pos, " || ", sizeof(video_info.fps_text));
|
||||
}
|
||||
}
|
||||
|
||||
@ -19158,18 +19155,18 @@ static void video_driver_frame(const void *data, unsigned width,
|
||||
|
||||
if ((video_driver_frame_count % video_info.fps_update_interval) == 0)
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
|
||||
last_fps = TIME_TO_FPS(curr_time, new_time,
|
||||
video_info.fps_update_interval);
|
||||
|
||||
copied = strlcpy(video_driver_window_title,
|
||||
buf_pos = strlcpy(video_driver_window_title,
|
||||
title, sizeof(video_driver_window_title));
|
||||
|
||||
if (!string_is_empty(video_info.fps_text))
|
||||
{
|
||||
string_add_alpha_4_fast(video_driver_window_title,
|
||||
" || ", copied);
|
||||
STRLCAT_CONST_INCR(video_driver_window_title, buf_pos,
|
||||
" || ", sizeof(video_driver_window_title));
|
||||
strlcat(video_driver_window_title,
|
||||
video_info.fps_text, sizeof(video_driver_window_title));
|
||||
}
|
||||
|
@ -235,9 +235,9 @@ 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 written = strlcpy(
|
||||
size_t buf_pos = strlcpy(
|
||||
msg, autoconfig_str, sizeof(msg));
|
||||
string_add_alpha_12_fast(msg, " configured.", written);
|
||||
STRLCAT_CONST_INCR(msg, buf_pos, " configured.", sizeof(msg));
|
||||
|
||||
if (!remote_is_bound)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ static void* task_push_http_transfer_generic(
|
||||
{
|
||||
task_finder_data_t find_data;
|
||||
char tmp[255];
|
||||
size_t copied = 0;
|
||||
size_t buf_pos = 0;
|
||||
const char *s = NULL;
|
||||
retro_task_t *t = NULL;
|
||||
http_handle_t *http = NULL;
|
||||
@ -300,10 +300,10 @@ static void* task_push_http_transfer_generic(
|
||||
else
|
||||
s = url;
|
||||
|
||||
copied = strlcpy(tmp,
|
||||
buf_pos = strlcpy(tmp,
|
||||
msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
|
||||
|
||||
string_add_alpha_fast(tmp, ' ', copied);
|
||||
STRLCAT_CONST_INCR(tmp, buf_pos, " ", sizeof(tmp));
|
||||
|
||||
if (strstr(s, ".index"))
|
||||
strlcat(tmp, msg_hash_to_str(MSG_INDEX_FILE), sizeof(tmp));
|
||||
|
@ -81,7 +81,7 @@ static bool get_thumbnail_paths(
|
||||
char *path, size_t path_size,
|
||||
char *url, size_t url_size)
|
||||
{
|
||||
size_t copied;
|
||||
size_t buf_pos;
|
||||
const char *system = NULL;
|
||||
const char *db_name = NULL;
|
||||
const char *img_name = NULL;
|
||||
@ -144,12 +144,12 @@ static bool get_thumbnail_paths(
|
||||
return false;
|
||||
|
||||
/* Generate remote path */
|
||||
copied = strlcpy(raw_url, file_path_str(FILE_PATH_CORE_THUMBNAILS_URL), sizeof(raw_url));
|
||||
string_add_alpha_fast(raw_url, '/', copied);
|
||||
copied = strlcat(raw_url, system_name, sizeof(raw_url));
|
||||
string_add_alpha_fast(raw_url, '/', copied);
|
||||
copied = strlcat(raw_url, sub_dir, sizeof(raw_url));
|
||||
string_add_alpha_fast(raw_url, '/', copied);
|
||||
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));
|
||||
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 copied = strlcpy(state->filename,
|
||||
size_t buf_pos = strlcpy(state->filename,
|
||||
name_base, sizeof(state->filename));
|
||||
string_add_alpha_4_fast(state->filename, ".png", copied);
|
||||
STRLCAT_CONST_INCR(state->filename, buf_pos, ".png", sizeof(state->filename));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -289,9 +289,9 @@ static bool screenshot_dump(
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t copied = strlcpy(state->shotname, path_basename(name_base),
|
||||
size_t buf_pos = strlcpy(state->shotname, path_basename(name_base),
|
||||
sizeof(state->shotname));
|
||||
string_add_alpha_4_fast(state->shotname, ".png", copied);
|
||||
STRLCAT_CONST_INCR(state->shotname, buf_pos, ".png", sizeof(state->shotname));
|
||||
}
|
||||
|
||||
if ( string_is_empty(screenshot_dir) ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user