- Safer code - use strlcpy where possible instead of manual character

assignments for strings longer than 2 chars
- Use strlcpy concatenation instead of strlcat
- Make sure that what remains of iteration of the '_len' variable
for manual char assignment
is done in a safer way so mistakes are less possible
This commit is contained in:
libretroadmin 2023-06-20 16:33:55 +02:00
parent 2cebb07201
commit bdc398d79f
41 changed files with 696 additions and 895 deletions

View File

@ -171,13 +171,9 @@ bool cheat_manager_save(
strlcpy(cheats_file, path, sizeof(cheats_file)); strlcpy(cheats_file, path, sizeof(cheats_file));
else else
{ {
size_t len = fill_pathname_join_special(cheats_file, size_t len = fill_pathname_join_special(cheats_file, cheat_database,
cheat_database, path, sizeof(cheats_file)); path, sizeof(cheats_file));
cheats_file[len ] = '.'; strlcpy(cheats_file + len, ".cht", sizeof(cheats_file) - len);
cheats_file[len+1] = 'c';
cheats_file[len+2] = 'h';
cheats_file[len+3] = 't';
cheats_file[len+4] = '\0';
} }
if (!overwrite) if (!overwrite)

View File

@ -417,11 +417,11 @@ bool command_get_config_param(command_t *cmd, const char* arg)
#endif #endif
/* TODO: query any string */ /* TODO: query any string */
strlcpy(reply, "GET_CONFIG_PARAM ", sizeof(reply)); _len = strlcpy(reply, "GET_CONFIG_PARAM ", sizeof(reply));
_len = strlcat(reply, arg, sizeof(reply)); _len += strlcpy(reply + _len, arg, sizeof(reply) - _len);
reply[_len ] = ' '; reply[ _len] = ' ';
reply[_len+1] = '\0'; reply[++_len] = '\0';
strlcat(reply, value, sizeof(reply)); _len = strlcpy(reply + _len, value, sizeof(reply) - _len);
cmd->replier(cmd, reply, strlen(reply)); cmd->replier(cmd, reply, strlen(reply));
return true; return true;
} }
@ -821,8 +821,8 @@ bool command_version(command_t *cmd, const char* arg)
{ {
char reply[256]; char reply[256];
size_t _len = strlcpy(reply, PACKAGE_VERSION, sizeof(reply)); size_t _len = strlcpy(reply, PACKAGE_VERSION, sizeof(reply));
reply[_len ] = '\n'; reply[ _len] = '\n';
reply[_len+1] = '\0'; reply[++_len] = '\0';
cmd->replier(cmd, reply, strlen(reply)); cmd->replier(cmd, reply, strlen(reply));
return true; return true;
@ -1771,8 +1771,8 @@ bool command_event_save_core_config(
{ {
size_t _len = strlcpy(tmp, config_path, sizeof(tmp)); size_t _len = strlcpy(tmp, config_path, sizeof(tmp));
if (i) if (i)
snprintf(tmp + _len, sizeof(tmp) - _len, "-%u", i); _len += snprintf(tmp + _len, sizeof(tmp) - _len, "-%u", i);
strlcat(tmp, ".cfg", sizeof(tmp)); strlcpy(tmp + _len, ".cfg", sizeof(tmp) - _len);
if (!path_is_valid(tmp)) if (!path_is_valid(tmp))
{ {

View File

@ -4197,9 +4197,8 @@ bool config_load_override(void *data)
size_t _len = strlcpy(tmp_path, size_t _len = strlcpy(tmp_path,
path_get(RARCH_PATH_CONFIG_OVERRIDE), path_get(RARCH_PATH_CONFIG_OVERRIDE),
sizeof(tmp_path)); sizeof(tmp_path));
tmp_path[_len ] = '|'; tmp_path[ _len] = '|';
tmp_path[_len+1] = '\0'; tmp_path[++_len] = '\0';
_len += 1;
strlcpy(tmp_path + _len, core_path, sizeof(tmp_path) - _len); strlcpy(tmp_path + _len, core_path, sizeof(tmp_path) - _len);
RARCH_LOG("[Overrides]: Core-specific overrides stacking on top of previous overrides.\n"); RARCH_LOG("[Overrides]: Core-specific overrides stacking on top of previous overrides.\n");
} }
@ -4228,9 +4227,8 @@ bool config_load_override(void *data)
size_t _len = strlcpy(tmp_path, size_t _len = strlcpy(tmp_path,
path_get(RARCH_PATH_CONFIG_OVERRIDE), path_get(RARCH_PATH_CONFIG_OVERRIDE),
sizeof(tmp_path)); sizeof(tmp_path));
tmp_path[_len ] = '|'; tmp_path[ _len] = '|';
tmp_path[_len+1] = '\0'; tmp_path[++_len] = '\0';
_len += 1;
strlcpy(tmp_path + _len, content_path, sizeof(tmp_path) - _len); strlcpy(tmp_path + _len, content_path, sizeof(tmp_path) - _len);
RARCH_LOG("[Overrides]: Content dir-specific overrides stacking on top of previous overrides.\n"); RARCH_LOG("[Overrides]: Content dir-specific overrides stacking on top of previous overrides.\n");
} }
@ -4257,9 +4255,8 @@ bool config_load_override(void *data)
size_t _len = strlcpy(tmp_path, size_t _len = strlcpy(tmp_path,
path_get(RARCH_PATH_CONFIG_OVERRIDE), path_get(RARCH_PATH_CONFIG_OVERRIDE),
sizeof(tmp_path)); sizeof(tmp_path));
tmp_path[_len ] = '|'; tmp_path[ _len] = '|';
tmp_path[_len+1] = '\0'; tmp_path[++_len] = '\0';
_len += 1;
strlcpy(tmp_path + _len, game_path, sizeof(tmp_path) - _len); strlcpy(tmp_path + _len, game_path, sizeof(tmp_path) - _len);
RARCH_LOG("[Overrides]: Game-specific overrides stacking on top of previous overrides.\n"); RARCH_LOG("[Overrides]: Game-specific overrides stacking on top of previous overrides.\n");
} }
@ -4603,11 +4600,7 @@ static void save_keybind_joykey(config_file_t *conf,
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, size_t len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key)); base, '_', sizeof(key));
key[len ] = '_'; strlcpy(key + len, "_btn", sizeof(key) - len);
key[len+1] = 'b';
key[len+2] = 't';
key[len+3] = 'n';
key[len+4] = '\0';
if (bind->joykey == NO_BTN) if (bind->joykey == NO_BTN)
{ {
@ -4627,12 +4620,7 @@ static void save_keybind_axis(config_file_t *conf,
{ {
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key)); size_t len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
key[len ] = '_'; strlcpy(key + len, "_axis", sizeof(key) - len);
key[len+1] = 'a';
key[len+2] = 'x';
key[len+3] = 'i';
key[len+4] = 's';
key[len+5] = '\0';
if (bind->joyaxis == AXIS_NONE) if (bind->joyaxis == AXIS_NONE)
{ {
@ -4667,12 +4655,7 @@ static void save_keybind_mbutton(config_file_t *conf,
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, size_t len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key)); base, '_', sizeof(key));
key[len ] = '_'; strlcpy(key + len, "_mbtn", sizeof(key) - len);
key[len+1] = 'm';
key[len+2] = 'b';
key[len+3] = 't';
key[len+4] = 'n';
key[len+5] = '\0';
switch (bind->mbutton) switch (bind->mbutton)
{ {
@ -4922,11 +4905,7 @@ bool config_save_autoconf_profile(const
else else
len = fill_pathname_join_special(autoconf_file, autoconf_dir, len = fill_pathname_join_special(autoconf_file, autoconf_dir,
sanitised_name, sizeof(autoconf_file)); sanitised_name, sizeof(autoconf_file));
autoconf_file[len ] = '.'; strlcpy(autoconf_file + len, ".cfg", sizeof(autoconf_file) - len);
autoconf_file[len+1] = 'c';
autoconf_file[len+2] = 'f';
autoconf_file[len+3] = 'g';
autoconf_file[len+4] = '\0';
/* Open config file */ /* Open config file */
if ( !(conf = config_file_new_from_path_to_string(autoconf_file)) if ( !(conf = config_file_new_from_path_to_string(autoconf_file))
@ -5654,23 +5633,11 @@ bool input_remapping_load_file(void *data, const char *path)
_len = strlcpy(prefix, "input_player", sizeof(prefix)); _len = strlcpy(prefix, "input_player", sizeof(prefix));
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len); strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
_len = strlcpy(s1, prefix, sizeof(s1)); _len = strlcpy(s1, prefix, sizeof(s1));
s1[_len ] = '_'; strlcpy(s1 + _len, "_btn", sizeof(s1) - _len);
s1[_len+1] = 'b';
s1[_len+2] = 't';
s1[_len+3] = 'n';
s1[_len+4] = '\0';
_len = strlcpy(s2, prefix, sizeof(s2)); _len = strlcpy(s2, prefix, sizeof(s2));
s2[_len ] = '_'; strlcpy(s2 + _len, "_key", sizeof(s2) - _len);
s2[_len+1] = 'k';
s2[_len+2] = 'e';
s2[_len+3] = 'y';
s2[_len+4] = '\0';
_len = strlcpy(s3, prefix, sizeof(s3)); _len = strlcpy(s3, prefix, sizeof(s3));
s3[_len ] = '_'; strlcpy(s3 + _len, "_stk", sizeof(s3) - _len);
s3[_len+1] = 's';
s3[_len+2] = 't';
s3[_len+3] = 'k';
s3[_len+4] = '\0';
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 8; j++) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
{ {
@ -5832,23 +5799,11 @@ bool input_remapping_save_file(const char *path)
_len = strlcpy(prefix, "input_player", sizeof(prefix)); _len = strlcpy(prefix, "input_player", sizeof(prefix));
strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len); strlcpy(prefix + _len, formatted_number, sizeof(prefix) - _len);
_len = strlcpy(s1, prefix, sizeof(s1)); _len = strlcpy(s1, prefix, sizeof(s1));
s1[_len ] = '_'; strlcpy(s1 + _len, "_btn", sizeof(s1) - _len);
s1[_len+1] = 'b';
s1[_len+2] = 't';
s1[_len+3] = 'n';
s1[_len+4] = '\0';
_len = strlcpy(s2, prefix, sizeof(s2)); _len = strlcpy(s2, prefix, sizeof(s2));
s2[_len ] = '_'; strlcpy(s2 + _len, "_key", sizeof(s2) - _len);
s2[_len+1] = 'k';
s2[_len+2] = 'e';
s2[_len+3] = 'y';
s2[_len+4] = '\0';
_len = strlcpy(s3, prefix, sizeof(s3)); _len = strlcpy(s3, prefix, sizeof(s3));
s3[_len ] = '_'; strlcpy(s3 + _len, "_stk", sizeof(s3) - _len);
s3[_len+1] = 's';
s3[_len+2] = 't';
s3[_len+3] = 'k';
s3[_len+4] = '\0';
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++) for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
{ {

View File

@ -1489,11 +1489,9 @@ static bool core_info_path_is_locked(
len = strlcpy(lock_filename, core_file_name, len = strlcpy(lock_filename, core_file_name,
sizeof(lock_filename)); sizeof(lock_filename));
lock_filename[len ] = '.'; strlcpy(lock_filename + len,
lock_filename[len+1] = 'l'; ".lck",
lock_filename[len+2] = 'c'; sizeof(lock_filename) - len);
lock_filename[len+3] = 'k';
lock_filename[len+4] = '\0';
hash = core_info_hash_string(lock_filename); hash = core_info_hash_string(lock_filename);
@ -1522,12 +1520,9 @@ static bool core_info_path_is_standalone_exempt(
len = strlcpy(exempt_filename, core_file_name, len = strlcpy(exempt_filename, core_file_name,
sizeof(exempt_filename)); sizeof(exempt_filename));
exempt_filename[len ] = '.'; strlcpy(exempt_filename + len,
exempt_filename[len+1] = 'l'; ".lsae",
exempt_filename[len+2] = 's'; sizeof(exempt_filename) - len);
exempt_filename[len+3] = 'a';
exempt_filename[len+4] = 'e';
exempt_filename[len+5] = '\0';
hash = core_info_hash_string(exempt_filename); hash = core_info_hash_string(exempt_filename);
@ -2889,7 +2884,7 @@ static bool core_info_update_core_aux_file(const char *path, bool create)
* core info list this is *not* thread safe */ * core info list this is *not* thread safe */
bool core_info_set_core_lock(const char *core_path, bool lock) bool core_info_set_core_lock(const char *core_path, bool lock)
{ {
size_t len; size_t _len;
core_info_t *core_info = NULL; core_info_t *core_info = NULL;
char lock_file_path[PATH_MAX_LENGTH]; char lock_file_path[PATH_MAX_LENGTH];
@ -2908,13 +2903,11 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
return false; return false;
/* Get lock file path */ /* Get lock file path */
len = strlcpy( _len = strlcpy(lock_file_path, core_info->path,
lock_file_path, core_info->path, sizeof(lock_file_path)); sizeof(lock_file_path));
lock_file_path[len ] = '.'; strlcpy(lock_file_path + _len,
lock_file_path[len+1] = 'l'; ".lck",
lock_file_path[len+2] = 'c'; sizeof(lock_file_path) - _len);
lock_file_path[len+3] = 'k';
lock_file_path[len+4] = '\0';
/* Create or delete lock file, as required */ /* Create or delete lock file, as required */
if (!core_info_update_core_aux_file(lock_file_path, lock)) if (!core_info_update_core_aux_file(lock_file_path, lock))
@ -2938,7 +2931,7 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
* must be checked externally */ * must be checked externally */
bool core_info_get_core_lock(const char *core_path, bool validate_path) bool core_info_get_core_lock(const char *core_path, bool validate_path)
{ {
size_t len; size_t _len;
core_info_t *core_info = NULL; core_info_t *core_info = NULL;
const char *core_file_path = NULL; const char *core_file_path = NULL;
bool is_locked = false; bool is_locked = false;
@ -2969,14 +2962,11 @@ bool core_info_get_core_lock(const char *core_path, bool validate_path)
return false; return false;
/* Get lock file path */ /* Get lock file path */
len = strlcpy( _len = strlcpy(lock_file_path, core_file_path,
lock_file_path, core_file_path,
sizeof(lock_file_path)); sizeof(lock_file_path));
lock_file_path[len ] = '.'; strlcpy(lock_file_path + _len,
lock_file_path[len+1] = 'l'; ".lck",
lock_file_path[len+2] = 'c'; sizeof(lock_file_path) - _len);
lock_file_path[len+3] = 'k';
lock_file_path[len+4] = '\0';
/* Check whether lock file exists */ /* Check whether lock file exists */
is_locked = path_is_valid(lock_file_path); is_locked = path_is_valid(lock_file_path);
@ -3018,12 +3008,9 @@ bool core_info_set_core_standalone_exempt(const char *core_path, bool exempt)
/* Get 'standalone exempt' file path */ /* Get 'standalone exempt' file path */
_len = strlcpy(exempt_file_path, core_info->path, _len = strlcpy(exempt_file_path, core_info->path,
sizeof(exempt_file_path)); sizeof(exempt_file_path));
exempt_file_path[_len ] = '.'; strlcpy(exempt_file_path + _len,
exempt_file_path[_len+1] = 'l'; ".lsae",
exempt_file_path[_len+2] = 's'; sizeof(exempt_file_path) - _len);
exempt_file_path[_len+3] = 'a';
exempt_file_path[_len+4] = 'e';
exempt_file_path[_len+5] = '\0';
/* Create or delete 'standalone exempt' file, as required */ /* Create or delete 'standalone exempt' file, as required */
if (core_info_update_core_aux_file(exempt_file_path, exempt)) if (core_info_update_core_aux_file(exempt_file_path, exempt))
@ -3059,15 +3046,11 @@ bool core_info_get_core_standalone_exempt(const char *core_path)
return false; return false;
/* Get 'standalone exempt' file path */ /* Get 'standalone exempt' file path */
_len = strlcpy( _len = strlcpy(exempt_file_path, core_info->path,
exempt_file_path, core_info->path,
sizeof(exempt_file_path)); sizeof(exempt_file_path));
exempt_file_path[_len ] = '.'; strlcpy(exempt_file_path + _len,
exempt_file_path[_len+1] = 'l'; ".lsae",
exempt_file_path[_len+2] = 's'; sizeof(exempt_file_path) - _len);
exempt_file_path[_len+3] = 'a';
exempt_file_path[_len+4] = 'e';
exempt_file_path[_len+5] = '\0';
/* Check whether 'standalone exempt' file exists */ /* Check whether 'standalone exempt' file exists */
if (path_is_valid(exempt_file_path)) if (path_is_valid(exempt_file_path))

View File

@ -1190,7 +1190,6 @@ core_option_manager_t *core_option_manager_new(
const char *category_key = opt->opts[size].category_key; const char *category_key = opt->opts[size].category_key;
char address[256]; char address[256];
/* Address string is nominally: /* Address string is nominally:
* <category_key><delim><tag><option_key> * <category_key><delim><tag><option_key>
* ...where <tag> is prepended to the option * ...where <tag> is prepended to the option
@ -1198,17 +1197,18 @@ core_option_manager_t *core_option_manager_new(
* collisions */ * collisions */
if (string_is_empty(category_key)) if (string_is_empty(category_key))
{ {
address[0] = '#'; size_t _len = 0;
address[1] = '\0'; address[ _len] = '#';
strlcat(address, option_def->key, sizeof(address)); address[++_len] = '\0';
strlcpy(address + _len, option_def->key, sizeof(address) - _len);
} }
else else
{ {
size_t _len = strlcpy(address, category_key, sizeof(address)); size_t _len = strlcpy(address, category_key, sizeof(address));
address[_len ] = ':'; address[ _len] = ':';
address[_len+1] = '#'; address[++_len] = '#';
address[_len+2] = '\0'; address[++_len] = '\0';
strlcat(address, option_def->key, sizeof(address)); strlcpy(address + _len, option_def->key, sizeof(address) - _len);
} }
if (!nested_list_add_item(opt->option_map, if (!nested_list_add_item(opt->option_map,

View File

@ -634,10 +634,10 @@ bool disk_control_append_image(
/* Display log */ /* Display log */
_len = strlcpy(msg, msg_hash_to_str(MSG_APPENDED_DISK), sizeof(msg)); _len = strlcpy(msg, msg_hash_to_str(MSG_APPENDED_DISK), sizeof(msg));
msg[_len ] = ':'; msg[ _len] = ':';
msg[_len+1] = ' '; msg[++_len] = ' ';
msg[_len+2] = '\0'; msg[++_len] = '\0';
strlcat(msg, image_filename, sizeof(msg)); strlcpy(msg + _len, image_filename, sizeof(msg) - _len);
RARCH_LOG("[Disc]: %s\n", msg); RARCH_LOG("[Disc]: %s\n", msg);
/* This message should always be displayed, since /* This message should always be displayed, since
@ -664,10 +664,10 @@ error:
_len = strlcpy(msg, _len = strlcpy(msg,
msg_hash_to_str(MSG_FAILED_TO_APPEND_DISK), sizeof(msg)); msg_hash_to_str(MSG_FAILED_TO_APPEND_DISK), sizeof(msg));
msg[_len ] = ':'; msg[ _len] = ':';
msg[_len+1] = ' '; msg[++_len] = ' ';
msg[_len+2] = '\0'; msg[++_len] = '\0';
strlcat(msg, image_filename, sizeof(msg)); strlcpy(msg + _len, image_filename, sizeof(msg) - _len);
runloop_msg_queue_push( runloop_msg_queue_push(
msg, 0, 180, msg, 0, 180,

View File

@ -271,12 +271,9 @@ bool disk_index_file_init(
len = fill_pathname_join_special( len = fill_pathname_join_special(
disk_index_file_path, disk_index_file_dir, disk_index_file_path, disk_index_file_dir,
content_name, sizeof(disk_index_file_path)); content_name, sizeof(disk_index_file_path));
disk_index_file_path[len ] = '.'; strlcpy(disk_index_file_path + len,
disk_index_file_path[len+1] = 'l'; ".ldci",
disk_index_file_path[len+2] = 'd'; sizeof(disk_index_file_path) - len);
disk_index_file_path[len+3] = 'c';
disk_index_file_path[len+4] = 'i';
disk_index_file_path[len+5] = '\0';
if (string_is_empty(disk_index_file_path)) if (string_is_empty(disk_index_file_path))
goto error; goto error;

View File

@ -449,8 +449,8 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content)
if (hddMountStatus == HDD_MOUNT_STATUS_OK) if (hddMountStatus == HDD_MOUNT_STATUS_OK)
{ {
size_t _len = strlcpy(hdd, mountString, sizeof(hdd)); size_t _len = strlcpy(hdd, mountString, sizeof(hdd));
hdd[_len ] = '/'; hdd[ _len] = '/';
hdd[_len+1] = '\0'; hdd[ ++_len] = '\0';
menu_entries_append(list, menu_entries_append(list,
hdd, hdd,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),

View File

@ -2125,9 +2125,8 @@ static void win32_localize_menu(HMENU menu)
new_label2 = new_label_text; new_label2 = new_label_text;
_len = strlcpy(new_label_text, new_label, _len = strlcpy(new_label_text, new_label,
buf_size); buf_size);
new_label_text[_len ] = '\t'; new_label_text[ _len] = '\t';
new_label_text[_len+1] = '\0'; new_label_text[++_len] = '\0';
_len += 1;
strlcpy(new_label_text + _len, meta_key_name, buf_size - _len); strlcpy(new_label_text + _len, meta_key_name, buf_size - _len);
/* Make first character of shortcut name uppercase */ /* Make first character of shortcut name uppercase */
new_label_text[len1 + 1] = toupper(new_label_text[len1 + 1]); new_label_text[len1 + 1] = toupper(new_label_text[len1 + 1]);

View File

@ -735,8 +735,8 @@ const char *x11_display_server_get_output_options(void *data)
_len = strlcat(s, info->name, sizeof(s)); _len = strlcat(s, info->name, sizeof(s));
if ((i+1) < res->noutput) if ((i+1) < res->noutput)
{ {
s[_len ] = '|'; s[ _len] = '|';
s[_len+1] = '\0'; s[++_len] = '\0';
} }
} }

View File

@ -841,12 +841,9 @@ static const char *ctr_texture_path(unsigned id)
_len = strlcpy(texture_path, _len = strlcpy(texture_path,
state_path, sizeof(texture_path)); state_path, sizeof(texture_path));
texture_path[_len ] = '.'; strlcpy(texture_path + _len,
texture_path[_len+1] = 'p'; ".png",
texture_path[_len+2] = 'n'; sizeof(texture_path) - _len);
texture_path[_len+3] = 'g';
texture_path[_len+4] = '\0';
return path_basename_nocompression(texture_path); return path_basename_nocompression(texture_path);
} }
default: default:

View File

@ -1117,18 +1117,18 @@ static void *gl1_init(const video_info_t *video,
{ {
char device_str[128]; char device_str[128];
size_t len = 0;
device_str[0] = '\0'; device_str[0] = '\0';
if (!string_is_empty(vendor)) if (!string_is_empty(vendor))
{ {
size_t len = strlcpy(device_str, vendor, sizeof(device_str)); len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' '; device_str[ len] = ' ';
device_str[len+1] = '\0'; device_str[++len] = '\0';
} }
if (!string_is_empty(renderer)) if (!string_is_empty(renderer))
strlcat(device_str, renderer, sizeof(device_str)); strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str); video_driver_set_gpu_device_string(device_str);

View File

@ -4323,18 +4323,18 @@ static void *gl2_init(const video_info_t *video,
{ {
char device_str[128]; char device_str[128];
size_t len = 0;
device_str[0] = '\0'; device_str[0] = '\0';
if (!string_is_empty(vendor)) if (!string_is_empty(vendor))
{ {
size_t len = strlcpy(device_str, vendor, sizeof(device_str)); len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' '; device_str[ len] = ' ';
device_str[len+1] = '\0'; device_str[++len] = '\0';
} }
if (!string_is_empty(renderer)) if (!string_is_empty(renderer))
strlcat(device_str, renderer, sizeof(device_str)); strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str); video_driver_set_gpu_device_string(device_str);

View File

@ -1877,9 +1877,9 @@ static void *gl3_init(const video_info_t *video,
{ {
char device_str[128]; char device_str[128];
size_t len = strlcpy(device_str, vendor, sizeof(device_str)); size_t len = strlcpy(device_str, vendor, sizeof(device_str));
device_str[len ] = ' '; device_str[ len] = ' ';
device_str[len+1] = '\0'; device_str[++len] = '\0';
strlcat(device_str, renderer, sizeof(device_str)); strlcpy(device_str + len, renderer, sizeof(device_str) - len);
video_driver_set_gpu_device_string(device_str); video_driver_set_gpu_device_string(device_str);
video_driver_set_gpu_api_version_string(version); video_driver_set_gpu_api_version_string(version);

View File

@ -1438,10 +1438,10 @@ bool gfx_animation_ticker(gfx_animation_ctx_ticker_t *ticker)
{ {
size_t len = utf8cpy(ticker->s, size_t len = utf8cpy(ticker->s,
PATH_MAX_LENGTH, ticker->str, ticker->len - 3); PATH_MAX_LENGTH, ticker->str, ticker->len - 3);
ticker->s[len ] = '.'; ticker->s[ len] = '.';
ticker->s[len+1] = '.'; ticker->s[++len] = '.';
ticker->s[len+2] = '.'; ticker->s[++len] = '.';
ticker->s[len+3] = '\0'; ticker->s[++len] = '\0';
return false; return false;
} }
@ -1545,13 +1545,12 @@ static bool gfx_animation_ticker_smooth_fw(
/* Determine number of characters to copy */ /* Determine number of characters to copy */
num_chars = (ticker->field_width - suffix_width) / glyph_width; num_chars = (ticker->field_width - suffix_width) / glyph_width;
/* Copy string segment + add suffix */ /* Copy string segment + add suffix */
_len = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars); _len = utf8cpy(ticker->dst_str, ticker->dst_str_len, ticker->src_str, num_chars);
ticker->dst_str[_len ] = '.'; ticker->dst_str[ _len] = '.';
ticker->dst_str[_len+1] = '.'; ticker->dst_str[++_len] = '.';
ticker->dst_str[_len+2] = '.'; ticker->dst_str[++_len] = '.';
ticker->dst_str[_len+3] = '\0'; ticker->dst_str[++_len] = '\0';
if (ticker->dst_str_width) if (ticker->dst_str_width)
*ticker->dst_str_width = (num_chars * glyph_width) + suffix_width; *ticker->dst_str_width = (num_chars * glyph_width) + suffix_width;
@ -1757,10 +1756,10 @@ bool gfx_animation_ticker_smooth(gfx_animation_ctx_ticker_smooth_t *ticker)
/* Copy string segment + add suffix */ /* Copy string segment + add suffix */
_len = utf8cpy(ticker->dst_str, ticker->dst_str_len, _len = utf8cpy(ticker->dst_str, ticker->dst_str_len,
ticker->src_str, num_chars); ticker->src_str, num_chars);
ticker->dst_str[_len ] = '.'; ticker->dst_str[ _len] = '.';
ticker->dst_str[_len+1] = '.'; ticker->dst_str[++_len] = '.';
ticker->dst_str[_len+2] = '.'; ticker->dst_str[++_len] = '.';
ticker->dst_str[_len+3] = '\0'; ticker->dst_str[++_len] = '\0';
if (ticker->dst_str_width) if (ticker->dst_str_width)
*ticker->dst_str_width = current_width + (3 * period_width); *ticker->dst_str_width = current_width + (3 * period_width);

View File

@ -390,7 +390,8 @@ bool gfx_widget_start_load_content_animation(void)
/* If content was found in playlist but the entry /* If content was found in playlist but the entry
* did not have a db_name, use playlist name itself * did not have a db_name, use playlist name itself
* as the system name */ * as the system name */
if (playlist_entry_found && !has_system) if ( playlist_entry_found
&& !has_system)
{ {
const char *playlist_path = playlist_get_conf_path(playlist); const char *playlist_path = playlist_get_conf_path(playlist);
@ -451,11 +452,9 @@ bool gfx_widget_start_load_content_animation(void)
{ {
size_t len = strlcpy(state->icon_file, state->system_name, size_t len = strlcpy(state->icon_file, state->system_name,
sizeof(state->icon_file)); sizeof(state->icon_file));
state->icon_file[len] = '.'; strlcpy(state->icon_file + len,
state->icon_file[len+1] = 'p'; ".png",
state->icon_file[len+2] = 'n'; sizeof(state->icon_file) - len);
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join_special(icon_path, fill_pathname_join_special(icon_path,
state->icon_directory, state->icon_file, state->icon_directory, state->icon_file,
@ -480,16 +479,14 @@ bool gfx_widget_start_load_content_animation(void)
(databases_list->size == 1)) (databases_list->size == 1))
core_db_name = databases_list->elems[0].data; core_db_name = databases_list->elems[0].data;
if (!string_is_empty(core_db_name) && if ( !string_is_empty(core_db_name)
!string_is_equal(core_db_name, state->system_name)) && !string_is_equal(core_db_name, state->system_name))
{ {
size_t len = strlcpy(state->icon_file, core_db_name, size_t len = strlcpy(state->icon_file, core_db_name,
sizeof(state->icon_file)); sizeof(state->icon_file));
state->icon_file[len] = '.'; strlcpy(state->icon_file + len,
state->icon_file[len+1] = 'p'; ".png",
state->icon_file[len+2] = 'n'; sizeof(state->icon_file) - len);
state->icon_file[len+3] = 'g';
state->icon_file[len+4] = '\0';
fill_pathname_join_special(icon_path, fill_pathname_join_special(icon_path,
state->icon_directory, state->icon_file, state->icon_directory, state->icon_file,

View File

@ -566,47 +566,47 @@ bool input_driver_button_combo(
switch (mode) switch (mode)
{ {
case INPUT_COMBO_DOWN_Y_L_R: case INPUT_COMBO_DOWN_Y_L_R:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_DOWN) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_DOWN)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_Y) && && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_Y)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L) && && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R))
return true; return true;
break; break;
case INPUT_COMBO_L3_R3: case INPUT_COMBO_L3_R3:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L3) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L3)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R3)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R3))
return true; return true;
break; break;
case INPUT_COMBO_L1_R1_START_SELECT: case INPUT_COMBO_L1_R1_START_SELECT:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R) && && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START) && && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return true; return true;
break; break;
case INPUT_COMBO_START_SELECT: case INPUT_COMBO_START_SELECT:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return true; return true;
break; break;
case INPUT_COMBO_L3_R: case INPUT_COMBO_L3_R:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L3) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L3)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R))
return true; return true;
break; break;
case INPUT_COMBO_L_R: case INPUT_COMBO_L_R:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R))
return true; return true;
break; break;
case INPUT_COMBO_DOWN_SELECT: case INPUT_COMBO_DOWN_SELECT:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_DOWN) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_DOWN)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return true; return true;
break; break;
case INPUT_COMBO_L2_R2: case INPUT_COMBO_L2_R2:
if (BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L2) && if ( BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_L2)
BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R2)) && BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_R2))
return true; return true;
break; break;
case INPUT_COMBO_HOLD_START: case INPUT_COMBO_HOLD_START:
@ -1263,9 +1263,9 @@ static int16_t input_state_device(
} }
/* Don't allow turbo for D-pad. */ /* Don't allow turbo for D-pad. */
if ( (id < RETRO_DEVICE_ID_JOYPAD_UP) || if ( (id < RETRO_DEVICE_ID_JOYPAD_UP)
( (id > RETRO_DEVICE_ID_JOYPAD_RIGHT) && || ( (id > RETRO_DEVICE_ID_JOYPAD_RIGHT)
(id <= RETRO_DEVICE_ID_JOYPAD_R3))) && (id <= RETRO_DEVICE_ID_JOYPAD_R3)))
{ {
/* /*
* Apply turbo button if activated. * Apply turbo button if activated.
@ -1314,8 +1314,8 @@ static int16_t input_state_device(
/* Avoid detecting buttons being held as multiple toggles */ /* Avoid detecting buttons being held as multiple toggles */
if (!res) if (!res)
input_st->turbo_btns.turbo_pressed[port] &= ~(1 << id); input_st->turbo_btns.turbo_pressed[port] &= ~(1 << id);
else if (!(input_st->turbo_btns.turbo_pressed[port] & (1 << id)) && else if (!(input_st->turbo_btns.turbo_pressed[port] & (1 << id))
turbo_mode == INPUT_TURBO_MODE_SINGLEBUTTON) && turbo_mode == INPUT_TURBO_MODE_SINGLEBUTTON)
{ {
uint16_t enable_new; uint16_t enable_new;
input_st->turbo_btns.turbo_pressed[port] |= 1 << id; input_st->turbo_btns.turbo_pressed[port] |= 1 << id;
@ -1433,7 +1433,7 @@ static int16_t input_state_device(
if (settings->uints.input_remap_ids[port][offset] != offset) if (settings->uints.input_remap_ids[port][offset] != offset)
reset_state = true; reset_state = true;
else if (settings->uints.input_remap_ids[port][offset+1] != (offset+1)) else if (settings->uints.input_remap_ids[port][offset + 1] != (offset+1))
reset_state = true; reset_state = true;
} }
@ -1444,14 +1444,14 @@ static int16_t input_state_device(
res = ret; res = ret;
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (input_st->overlay_ptr && if ( (input_st->overlay_ptr)
(input_st->overlay_ptr->flags & INPUT_OVERLAY_ALIVE) && && (input_st->overlay_ptr->flags & INPUT_OVERLAY_ALIVE)
(port == 0) && && (port == 0)
(idx != RETRO_DEVICE_INDEX_ANALOG_BUTTON) && && (idx != RETRO_DEVICE_INDEX_ANALOG_BUTTON)
!(((input_analog_dpad_mode == ANALOG_DPAD_LSTICK) && && !(((input_analog_dpad_mode == ANALOG_DPAD_LSTICK)
(idx == RETRO_DEVICE_INDEX_ANALOG_LEFT)) || && (idx == RETRO_DEVICE_INDEX_ANALOG_LEFT))
((input_analog_dpad_mode == ANALOG_DPAD_RSTICK) && || ((input_analog_dpad_mode == ANALOG_DPAD_RSTICK)
(idx == RETRO_DEVICE_INDEX_ANALOG_RIGHT)))) && (idx == RETRO_DEVICE_INDEX_ANALOG_RIGHT))))
{ {
input_overlay_state_t *ol_state = input_overlay_state_t *ol_state =
&input_st->overlay_ptr->overlay_state; &input_st->overlay_ptr->overlay_state;
@ -1615,8 +1615,8 @@ static int16_t input_state_internal(
input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED, input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED,
mapped_port, device, idx, id); mapped_port, device, idx, id);
if ((device == RETRO_DEVICE_ANALOG) && if ( (device == RETRO_DEVICE_ANALOG)
(ret == 0)) && (ret == 0))
{ {
if (input_st->libretro_input_binds[mapped_port]) if (input_st->libretro_input_binds[mapped_port])
{ {
@ -3071,13 +3071,7 @@ void input_config_get_bind_string_joykey(
{ {
size_t len = fill_pathname_join_delim(buf, prefix, size_t len = fill_pathname_join_delim(buf, prefix,
bind->joykey_label, ' ', size); bind->joykey_label, ' ', size);
buf[len ] = ' '; strlcpy(buf + len, " (hat)", size - len);
buf[len+1] = '(';
buf[len+2] = 'h';
buf[len+3] = 'a';
buf[len+4] = 't';
buf[len+5] = ')';
buf[len+6] = '\0';
} }
else else
{ {
@ -3114,13 +3108,7 @@ void input_config_get_bind_string_joykey(
{ {
size_t len = fill_pathname_join_delim(buf, prefix, size_t len = fill_pathname_join_delim(buf, prefix,
bind->joykey_label, ' ', size); bind->joykey_label, ' ', size);
buf[len ] = ' '; strlcpy(buf + len, " (btn)", size - len);
buf[len+1] = '(';
buf[len+2] = 'b';
buf[len+3] = 't';
buf[len+4] = 'n';
buf[len+5] = ')';
buf[len+6] = '\0';
} }
else else
snprintf(buf, size, "%s%u (%s)", prefix, (unsigned)bind->joykey, snprintf(buf, size, "%s%u (%s)", prefix, (unsigned)bind->joykey,
@ -3139,14 +3127,7 @@ void input_config_get_bind_string_joyaxis(
{ {
size_t len = fill_pathname_join_delim(buf, prefix, size_t len = fill_pathname_join_delim(buf, prefix,
bind->joyaxis_label, ' ', size); bind->joyaxis_label, ' ', size);
buf[len ] = ' '; strlcpy(buf + len, " (axis)", size - len);
buf[len+1] = '(';
buf[len+2] = 'a';
buf[len+3] = 'x';
buf[len+4] = 'i';
buf[len+5] = 's';
buf[len+6] = ')';
buf[len+7] = '\0';
} }
else else
{ {
@ -3205,6 +3186,7 @@ static unsigned get_kr_utf8( int c1,int c2,int c3)
/* utf8 korean composition */ /* utf8 korean composition */
static unsigned get_kr_composition( char* pcur, char* padd) static unsigned get_kr_composition( char* pcur, char* padd)
{ {
size_t _len;
static char cc1[] = {"ㄱㄱㄲ ㄷㄷㄸ ㅂㅂㅃ ㅅㅅㅆ ㅈㅈㅉ"}; static char cc1[] = {"ㄱㄱㄲ ㄷㄷㄸ ㅂㅂㅃ ㅅㅅㅆ ㅈㅈㅉ"};
static char cc2[] = {"ㅗㅏㅘ ㅗㅐㅙ ㅗㅣㅚ ㅜㅓㅝ ㅜㅔㅞ ㅜㅣㅟ ㅡㅣㅢ"}; static char cc2[] = {"ㅗㅏㅘ ㅗㅐㅙ ㅗㅣㅚ ㅜㅓㅝ ㅜㅔㅞ ㅜㅣㅟ ㅡㅣㅢ"};
static char cc3[] = {"ㄱㄱㄲ ㄱㅅㄳ ㄴㅈㄵ ㄴㅎㄶ ㄹㄱㄺ ㄹㅁㄻ ㄹㅂㄼ ㄹㅅㄽ ㄹㅌㄾ ㄹㅍㄿ ㄹㅎㅀ ㅂㅅㅄ ㅅㅅㅆ"}; static char cc3[] = {"ㄱㄱㄲ ㄱㅅㄳ ㄴㅈㄵ ㄴㅎㄶ ㄹㄱㄺ ㄹㅁㄻ ㄹㅂㄼ ㄹㅅㄽ ㄹㅌㄾ ㄹㅍㄿ ㄹㅎㅀ ㅂㅅㅄ ㅅㅅㅆ"};
@ -3231,8 +3213,8 @@ static unsigned get_kr_composition( char* pcur, char* padd)
return ret; return ret;
/* single element composition */ /* single element composition */
strlcpy(utf8, pcur, sizeof(utf8)); _len = strlcpy(utf8, pcur, sizeof(utf8));
strlcat(utf8, padd, sizeof(utf8)); strlcpy(utf8 + _len, padd, sizeof(utf8) - _len);
if ((tmp2 = strstr(cc1, utf8))) if ((tmp2 = strstr(cc1, utf8)))
{ {
@ -3290,7 +3272,8 @@ static unsigned get_kr_composition( char* pcur, char* padd)
strlcpy(utf8, s1 + (19 + c2) * 3, 4); strlcpy(utf8, s1 + (19 + c2) * 3, 4);
utf8[3] = 0; utf8[3] = 0;
strlcat(utf8, padd, sizeof(utf8)); strlcat(utf8, padd, sizeof(utf8));
if (!(tmp2 = strstr(cc2, utf8)) || tmp2 >= cc2 + sizeof(cc2) - 10) if ( !(tmp2 = strstr(cc2, utf8))
|| (tmp2 >= cc2 + sizeof(cc2) - 10))
return ret; return ret;
strlcpy(utf8, tmp2 + 6, 4); strlcpy(utf8, tmp2 + 6, 4);
utf8[3] = 0; utf8[3] = 0;
@ -5600,9 +5583,9 @@ void input_driver_poll(void)
} }
#endif #endif
remap_valid = remap_valid =
(current_button_value == 1) && (current_button_value == 1)
(j != remap_button) && && (j != remap_button)
(remap_button != RARCH_UNMAPPED); && (remap_button != RARCH_UNMAPPED);
#ifdef HAVE_ACCESSIBILITY #ifdef HAVE_ACCESSIBILITY
/* gamepad override */ /* gamepad override */

View File

@ -387,8 +387,8 @@ void fill_pathname_slash(char *path, size_t size)
/* Try to preserve slash type. */ /* Try to preserve slash type. */
if (last_slash != (path + path_len - 1)) if (last_slash != (path + path_len - 1))
{ {
path[path_len] = last_slash[0]; path[ path_len] = last_slash[0];
path[path_len+1] = '\0'; path[++path_len] = '\0';
} }
} }
@ -1002,14 +1002,14 @@ size_t fill_pathname_join_special(char *out_path,
/* Try to preserve slash type. */ /* Try to preserve slash type. */
if (last_slash != (out_path + len - 1)) if (last_slash != (out_path + len - 1))
{ {
out_path[len] = last_slash[0]; out_path[ len] = last_slash[0];
out_path[len+1] = '\0'; out_path[++len] = '\0';
} }
} }
else else
{ {
out_path[len] = PATH_DEFAULT_SLASH_C(); out_path[ len] = PATH_DEFAULT_SLASH_C();
out_path[len+1] = '\0'; out_path[++len] = '\0';
} }
} }
@ -1362,8 +1362,8 @@ void fill_pathname_application_path(char *s, size_t len)
if (realpath(s, resolved_bundle_dir_buf)) if (realpath(s, resolved_bundle_dir_buf))
{ {
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1); size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);
s[_len ] = '/'; s[ _len] = '/';
s[_len+1] = '\0'; s[++_len] = '\0';
} }
} }
#endif #endif

View File

@ -1039,11 +1039,9 @@ bool manual_content_scan_get_task_config(
task_config->database_name, task_config->database_name,
task_config->system_name, task_config->system_name,
sizeof(task_config->database_name)); sizeof(task_config->database_name));
task_config->database_name[len ] = '.'; strlcpy(task_config->database_name + len,
task_config->database_name[len+1] = 'l'; ".lpl",
task_config->database_name[len+2] = 'p'; sizeof(task_config->database_name) - len);
task_config->database_name[len+3] = 'l';
task_config->database_name[len+4] = '\0';
/* ...which can in turn be used to generate the /* ...which can in turn be used to generate the
* playlist path */ * playlist path */
@ -1274,8 +1272,8 @@ static bool manual_content_scan_get_playlist_content_path(
if (filter_exts || (archive_list->size == 1)) if (filter_exts || (archive_list->size == 1))
{ {
/* Build path to file inside archive */ /* Build path to file inside archive */
s[_len ] = '#'; s[ _len] = '#';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, archive_file, len); strlcat(s, archive_file, len);
} }

View File

@ -859,15 +859,15 @@ static void menu_action_setting_disp_set_label_input_desc(
if (remap_idx < RARCH_FIRST_CUSTOM_BIND) { } if (remap_idx < RARCH_FIRST_CUSTOM_BIND) { }
else if (remap_idx % 2 == 0) else if (remap_idx % 2 == 0)
{ {
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '+'; s[++_len] = '+';
s[_len+2] = '\0'; s[++_len] = '\0';
} }
else else
{ {
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '-'; s[++_len] = '-';
s[_len+2] = '\0'; s[++_len] = '\0';
} }
return; return;
} }

View File

@ -83,10 +83,9 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
core_info->licenses_list, ", "); core_info->licenses_list, ", ");
_len = strlcpy(s, _len = strlcpy(s,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 2;
strlcpy(s + _len, tmp, len - _len); strlcpy(s + _len, tmp, len - _len);
} }
else else
@ -94,10 +93,9 @@ static int menu_action_sublabel_file_browser_core(file_list_t *list, unsigned ty
/* No license found - set to N/A */ /* No license found - set to N/A */
_len = strlcpy(s, _len = strlcpy(s,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 2;
strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len); strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len);
} }
@ -1660,8 +1658,8 @@ static int action_bind_sublabel_netplay_room(file_list_t *list,
buf[0 ] = '('; buf[0 ] = '(';
buf[1 ] = '\0'; buf[1 ] = '\0';
_len = strlcat(buf, room->subsystem_name, sizeof(buf)); _len = strlcat(buf, room->subsystem_name, sizeof(buf));
buf[_len ] = ')'; buf[ _len] = ')';
buf[_len+1] = '\0'; buf[++_len] = '\0';
} }
strlcat(s, buf, len); strlcat(s, buf, len);
@ -1704,12 +1702,12 @@ static int action_bind_sublabel_netplay_kick_client(file_list_t *list,
{ {
size_t _len = strlcpy(buf, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATUS), size_t _len = strlcpy(buf, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_STATUS),
sizeof(buf)); sizeof(buf));
buf[_len ] = ':'; buf[ _len] = ':';
buf[_len+1] = ' '; buf[++_len] = ' ';
buf[_len+2] = '\0'; buf[++_len] = '\0';
_len = strlcat(buf, status, sizeof(buf)); _len += strlcpy(buf + _len, status, sizeof(buf) - _len);
buf[_len ] = '\n'; buf[ _len] = '\n';
buf[_len+1] = '\0'; buf[++_len] = '\0';
strlcat(s, buf, len); strlcat(s, buf, len);
} }
@ -1851,9 +1849,8 @@ static int action_bind_sublabel_playlist_entry(
/* Add core name */ /* Add core name */
_len = strlcpy(s, _len = strlcpy(s,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
_len += 1;
strlcpy(s + _len, entry->core_name, len - _len); strlcpy(s + _len, entry->core_name, len - _len);
/* Get runtime info *if* required runtime log is enabled /* Get runtime info *if* required runtime log is enabled
@ -1985,20 +1982,20 @@ static int action_bind_sublabel_core_updater_entry(
entry->licenses_list, ", "); entry->licenses_list, ", ");
_len = strlcpy(s, _len = strlcpy(s,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
strlcat(s, tmp, len); strlcpy(s + _len, tmp, len - _len);
} }
else else
{ {
/* No license found - set to N/A */ /* No license found - set to N/A */
_len = strlcpy(s, _len = strlcpy(s,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
strlcat(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len); strlcpy(s + _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len - _len);
} }
return 1; return 1;
} }
@ -2020,15 +2017,15 @@ static int action_bind_sublabel_core_backup_entry(
/* Add crc string */ /* Add crc string */
if (string_is_empty(crc)) if (string_is_empty(crc))
{ {
s[_len ] = '0'; s[ _len] = '0';
s[_len+1] = '0'; s[++_len] = '0';
s[_len+2] = '0'; s[++_len] = '0';
s[_len+3] = '0'; s[++_len] = '0';
s[_len+4] = '0'; s[++_len] = '0';
s[_len+5] = '0'; s[++_len] = '0';
s[_len+6] = '0'; s[++_len] = '0';
s[_len+7] = '0'; s[++_len] = '0';
s[_len+8] = '\0'; s[++_len] = '\0';
} }
else else
strlcpy(s + _len, crc, len - _len); strlcpy(s + _len, crc, len - _len);

View File

@ -72,10 +72,9 @@
_len = strlcpy(s, title, len); \ _len = strlcpy(s, title, len); \
if (!string_is_empty(path)) \ if (!string_is_empty(path)) \
{ \ { \
s[_len ] = ':'; \ s[ _len] = ':'; \
s[_len+1] = ' '; \ s[++_len] = ' '; \
s[_len+2] = '\0'; \ s[++_len] = '\0'; \
_len += 2; \
strlcpy(s + _len, path, len - _len); \ strlcpy(s + _len, path, len - _len); \
} \ } \
return 1; \ return 1; \
@ -112,13 +111,10 @@ static void action_get_title_fill_path_search_filter_default(
const char *title = msg_hash_to_str(lbl); const char *title = msg_hash_to_str(lbl);
if (!string_is_empty(title)) if (!string_is_empty(title))
_len = strlcpy(s, title, len); _len = strlcpy(s, title, len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
if (!string_is_empty(path)) if (!string_is_empty(path))
{
_len += 2;
strlcpy(s + _len, path, len - _len); strlcpy(s + _len, path, len - _len);
}
menu_entries_search_append_terms_string(s, len); menu_entries_search_append_terms_string(s, len);
} }
@ -428,15 +424,14 @@ static int action_get_title_deferred_core_backup_list(
return 0; return 0;
_len = strlcpy(s, prefix, len); _len = strlcpy(s, prefix, len);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 2;
/* Search for specified core /* Search for specified core
* > If core is found, add display name */ * > If core is found, add display name */
if (core_info_find(core_path, &core_info) && if ( core_info_find(core_path, &core_info)
core_info->display_name) && core_info->display_name)
strlcpy(s + _len, core_info->display_name, len - _len); strlcpy(s + _len, core_info->display_name, len - _len);
else else
{ {
@ -508,11 +503,10 @@ static int action_get_core_information_steam_list(
char *s, size_t len) char *s, size_t len)
{ {
size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFORMATION), len); size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFORMATION), len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '-'; s[++_len] = '-';
s[_len+2] = ' '; s[++_len] = ' ';
s[_len+3] = '\0'; s[++_len] = '\0';
_len += 3;
strlcpy(s + _len, path, len - _len); strlcpy(s + _len, path, len - _len);
return 1; return 1;
} }
@ -823,10 +817,9 @@ static int action_get_title_generic(char *s, size_t len,
if (!string_is_empty(elem0_path)) if (!string_is_empty(elem0_path))
{ {
path_remove_extension(elem0_path); path_remove_extension(elem0_path);
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 2;
strlcpy(s + _len, path_basename(elem0_path), len - _len); strlcpy(s + _len, path_basename(elem0_path), len - _len);
} }
return 0; return 0;
@ -860,9 +853,8 @@ static int action_get_sideload_core_list(const char *path, const char *label,
unsigned menu_type, char *s, size_t len) unsigned menu_type, char *s, size_t len)
{ {
size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST), len); size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST), len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
_len += 2;
if (!string_is_empty(path)) if (!string_is_empty(path))
strlcpy(s + _len, path, len - _len); strlcpy(s + _len, path, len - _len);
return 0; return 0;
@ -875,10 +867,9 @@ static int action_get_title_default(const char *path, const char *label,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
if (!string_is_empty(path)) if (!string_is_empty(path))
{ {
s[_len ] = ':'; s[ _len] = ':';
s[_len+1] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 2;
strlcpy(s + _len, path, len - _len); strlcpy(s + _len, path, len - _len);
} }
@ -949,11 +940,10 @@ static int action_get_title_group_settings(const char *path, const char *label,
_len = strlcpy(s, elem0, len); _len = strlcpy(s, elem0, len);
if (!string_is_empty(elem1)) if (!string_is_empty(elem1))
{ {
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '-'; s[++_len] = '-';
s[_len+2] = ' '; s[++_len] = ' ';
s[_len+2] = '\0'; s[++_len] = '\0';
_len += 3;
strlcpy(s + _len, elem1, len - _len); strlcpy(s + _len, elem1, len - _len);
} }
} }

View File

@ -7181,9 +7181,8 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
/* Draw message box */ /* Draw message box */
_len = strlcpy(msg, label, sizeof(msg)); _len = strlcpy(msg, label, sizeof(msg));
msg[_len ] = '\n'; msg[ _len] = '\n';
msg[_len+1] = '\0'; msg[++_len] = '\0';
_len += 1;
strlcpy(msg + _len, strlcpy(msg + _len,
str, str,
sizeof(msg) - _len); sizeof(msg) - _len);
@ -7527,9 +7526,8 @@ static void materialui_status_bar_init(
_len = strlcpy(mui->status_bar.runtime_fallback_str, _len = strlcpy(mui->status_bar.runtime_fallback_str,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME),
sizeof(mui->status_bar.runtime_fallback_str)); sizeof(mui->status_bar.runtime_fallback_str));
mui->status_bar.runtime_fallback_str[_len ] = ' '; mui->status_bar.runtime_fallback_str[ _len] = ' ';
mui->status_bar.runtime_fallback_str[_len+1] = '\0'; mui->status_bar.runtime_fallback_str[++_len] = '\0';
_len += 1;
strlcpy(mui->status_bar.runtime_fallback_str + _len, strlcpy(mui->status_bar.runtime_fallback_str + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED),
sizeof(mui->status_bar.runtime_fallback_str) - _len); sizeof(mui->status_bar.runtime_fallback_str) - _len);
@ -7538,9 +7536,8 @@ static void materialui_status_bar_init(
msg_hash_to_str( msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
sizeof(mui->status_bar.last_played_fallback_str)); sizeof(mui->status_bar.last_played_fallback_str));
mui->status_bar.last_played_fallback_str[_len ] = ' '; mui->status_bar.last_played_fallback_str[ _len] = ' ';
mui->status_bar.last_played_fallback_str[_len+1] = '\0'; mui->status_bar.last_played_fallback_str[++_len] = '\0';
_len += 1;
strlcpy(mui->status_bar.last_played_fallback_str + _len, strlcpy(mui->status_bar.last_played_fallback_str + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED),
sizeof(mui->status_bar.last_played_fallback_str) - _len sizeof(mui->status_bar.last_played_fallback_str) - _len

View File

@ -4146,9 +4146,8 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
_len = strlcpy(ozone->selection_core_name, _len = strlcpy(ozone->selection_core_name,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE),
sizeof(ozone->selection_core_name)); sizeof(ozone->selection_core_name));
ozone->selection_core_name[_len ] = ' '; ozone->selection_core_name[ _len] = ' ';
ozone->selection_core_name[_len+1] = '\0'; ozone->selection_core_name[++_len] = '\0';
_len += 1;
strlcpy(ozone->selection_core_name + _len, core_label, sizeof(ozone->selection_core_name) - _len); strlcpy(ozone->selection_core_name + _len, core_label, sizeof(ozone->selection_core_name) - _len);
if (!scroll_content_metadata) if (!scroll_content_metadata)
@ -4197,18 +4196,16 @@ static void ozone_update_content_metadata(ozone_handle_t *ozone)
strlcpy(ozone->selection_playtime, strlcpy(ozone->selection_playtime,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME),
sizeof(ozone->selection_playtime)); sizeof(ozone->selection_playtime));
ozone->selection_playtime[_len ] = ' '; ozone->selection_playtime[ _len] = ' ';
ozone->selection_playtime[_len+1] = '\0'; ozone->selection_playtime[++_len] = '\0';
_len += 1;
strlcpy(ozone->selection_playtime + _len, disabled_str, sizeof(ozone->selection_playtime) - _len); strlcpy(ozone->selection_playtime + _len, disabled_str, sizeof(ozone->selection_playtime) - _len);
_len = _len =
strlcpy(ozone->selection_lastplayed, strlcpy(ozone->selection_lastplayed,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
sizeof(ozone->selection_lastplayed)); sizeof(ozone->selection_lastplayed));
ozone->selection_lastplayed[_len ] = ' '; ozone->selection_lastplayed[ _len] = ' ';
ozone->selection_lastplayed[_len+1] = '\0'; ozone->selection_lastplayed[++_len] = '\0';
_len += 1;
strlcpy(ozone->selection_lastplayed + _len, disabled_str, sizeof(ozone->selection_lastplayed) - _len); strlcpy(ozone->selection_lastplayed + _len, disabled_str, sizeof(ozone->selection_lastplayed) - _len);
} }
@ -4888,7 +4885,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
if (string_ends_with_size(path, ".lpl", strlen(path), STRLEN_CONST(".lpl"))) if (string_ends_with_size(path, ".lpl", strlen(path), STRLEN_CONST(".lpl")))
{ {
size_t len, _len; size_t len;
struct texture_image ti; struct texture_image ti;
char sysname[PATH_MAX_LENGTH]; char sysname[PATH_MAX_LENGTH];
char texturepath[PATH_MAX_LENGTH]; char texturepath[PATH_MAX_LENGTH];
@ -4897,22 +4894,21 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
/* Add current node to playlist database name map */ /* Add current node to playlist database name map */
RHMAP_SET_STR(ozone->playlist_db_node_map, path, node); RHMAP_SET_STR(ozone->playlist_db_node_map, path, node);
_len = fill_pathname_base( len = fill_pathname_base(
sysname, path, sizeof(sysname)); sysname, path, sizeof(sysname));
/* Manually strip the extension (and dot) from sysname */ /* Manually strip the extension (and dot) from sysname */
sysname[_len-4] = sysname[len-4] =
sysname[_len-3] = sysname[len-3] =
sysname[_len-2] = sysname[len-2] =
sysname[_len-1] = '\0'; sysname[len-1] = '\0';
_len = _len-4;
len = fill_pathname_join_special(texturepath, len = fill_pathname_join_special(texturepath,
ozone->icons_path, sysname, ozone->icons_path, sysname,
sizeof(texturepath)); sizeof(texturepath));
texturepath[len] = '.'; texturepath[ len] = '.';
texturepath[len+1] = 'p'; texturepath[++len] = 'p';
texturepath[len+2] = 'n'; texturepath[++len] = 'n';
texturepath[len+3] = 'g'; texturepath[++len] = 'g';
texturepath[len+4] = '\0'; texturepath[++len] = '\0';
/* If the playlist icon doesn't exist, return default */ /* If the playlist icon doesn't exist, return default */
if (!path_is_valid(texturepath)) if (!path_is_valid(texturepath))
@ -4920,11 +4916,11 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
len = fill_pathname_join_special( len = fill_pathname_join_special(
texturepath, ozone->icons_path, "default", texturepath, ozone->icons_path, "default",
sizeof(texturepath)); sizeof(texturepath));
texturepath[len] = '.'; texturepath[ len] = '.';
texturepath[len+1] = 'p'; texturepath[++len] = 'p';
texturepath[len+2] = 'n'; texturepath[++len] = 'n';
texturepath[len+3] = 'g'; texturepath[++len] = 'g';
texturepath[len+4] = '\0'; texturepath[++len] = '\0';
} }
ti.width = 0; ti.width = 0;
@ -4944,20 +4940,7 @@ static void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
image_texture_free(&ti); image_texture_free(&ti);
} }
/* Manually append '-content.png' to end of sysname string */ strlcat(sysname, "-content.png", sizeof(sysname));
sysname[_len ] = '-';
sysname[_len+1 ] = 'c';
sysname[_len+2 ] = 'o';
sysname[_len+3 ] = 'n';
sysname[_len+4 ] = 't';
sysname[_len+5 ] = 'e';
sysname[_len+6 ] = 'n';
sysname[_len+7 ] = 't';
sysname[_len+8 ] = '.';
sysname[_len+9 ] = 'p';
sysname[_len+10] = 'n';
sysname[_len+11] = 'g';
sysname[_len+12] = '\0';
/* Assemble new icon path */ /* Assemble new icon path */
fill_pathname_join_special( fill_pathname_join_special(
content_texturepath, ozone->icons_path, sysname, content_texturepath, ozone->icons_path, sysname,

View File

@ -3038,12 +3038,11 @@ static void rgui_update_dynamic_theme_path(
{ {
size_t len = fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir, size_t len = fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir,
rgui->menu_title, sizeof(rgui->theme_dynamic_path)); rgui->menu_title, sizeof(rgui->theme_dynamic_path));
rgui->theme_dynamic_path[len ] = '.'; rgui->theme_dynamic_path[ len] = '.';
rgui->theme_dynamic_path[len+1] = 'c'; rgui->theme_dynamic_path[++len] = 'c';
rgui->theme_dynamic_path[len+2] = 'f'; rgui->theme_dynamic_path[++len] = 'f';
rgui->theme_dynamic_path[len+3] = 'g'; rgui->theme_dynamic_path[++len] = 'g';
rgui->theme_dynamic_path[len+4] = '\0'; rgui->theme_dynamic_path[++len] = '\0';
use_playlist_theme = path_is_valid(rgui->theme_dynamic_path); use_playlist_theme = path_is_valid(rgui->theme_dynamic_path);
} }
@ -4663,9 +4662,8 @@ static void rgui_render_osk(
* fallback to old style 'message box' implementation */ * fallback to old style 'message box' implementation */
char msg[255]; char msg[255];
size_t _len = strlcpy(msg, input_label, sizeof(msg)); size_t _len = strlcpy(msg, input_label, sizeof(msg));
msg[_len ] = '\n'; msg[ _len] = '\n';
msg[_len+1] = '\0'; msg[++_len] = '\0';
_len += 1;
strlcpy(msg + _len, strlcpy(msg + _len,
input_str, input_str,
sizeof(msg) - _len); sizeof(msg) - _len);

View File

@ -1132,15 +1132,15 @@ static char* xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
free(tmp); free(tmp);
} }
path[len ] = '.'; path[ len] = '.';
path[len+1] = 'p'; path[++len] = 'p';
path[len+2] = 'n'; path[++len] = 'n';
path[len+3] = 'g'; path[++len] = 'g';
path[len+4] = '\0'; path[++len] = '\0';
/* Do not update wallpaper in "Load Content" playlists */ /* Do not update wallpaper in "Load Content" playlists */
if ((xmb->categories_selection_ptr == 0 && depth > 4) || if ( (xmb->categories_selection_ptr == 0 && depth > 4)
(xmb->categories_selection_ptr > xmb->system_tab_end && depth > 1)) || (xmb->categories_selection_ptr > xmb->system_tab_end && depth > 1))
return strdup(xmb->bg_file_path); return strdup(xmb->bg_file_path);
if (!path_is_valid(path)) if (!path_is_valid(path))
@ -2449,7 +2449,7 @@ static void xmb_context_reset_horizontal_list(
if (string_ends_with_size(path, ".lpl", if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl"))) strlen(path), STRLEN_CONST(".lpl")))
{ {
size_t len, _len; size_t len;
struct texture_image ti; struct texture_image ti;
char sysname[PATH_MAX_LENGTH]; char sysname[PATH_MAX_LENGTH];
char texturepath[PATH_MAX_LENGTH]; char texturepath[PATH_MAX_LENGTH];
@ -2459,22 +2459,21 @@ static void xmb_context_reset_horizontal_list(
/* Add current node to playlist database name map */ /* Add current node to playlist database name map */
RHMAP_SET_STR(xmb->playlist_db_node_map, path, node); RHMAP_SET_STR(xmb->playlist_db_node_map, path, node);
_len = fill_pathname_base( len = fill_pathname_base(
sysname, path, sizeof(sysname)); sysname, path, sizeof(sysname));
/* Manually strip the extension (and dot) from sysname */ /* Manually strip the extension (and dot) from sysname */
sysname[_len-4] = sysname[len-4] =
sysname[_len-3] = sysname[len-3] =
sysname[_len-2] = sysname[len-2] =
sysname[_len-1] = '\0'; sysname[len-1] = '\0';
_len = _len-4;
len = fill_pathname_join_special( len = fill_pathname_join_special(
texturepath, iconpath, sysname, texturepath, iconpath, sysname,
sizeof(texturepath)); sizeof(texturepath));
texturepath[len ] = '.'; texturepath[ len] = '.';
texturepath[len+1] = 'p'; texturepath[++len] = 'p';
texturepath[len+2] = 'n'; texturepath[++len] = 'n';
texturepath[len+3] = 'g'; texturepath[++len] = 'g';
texturepath[len+4] = '\0'; texturepath[++len] = '\0';
/* If the playlist icon doesn't exist return default */ /* If the playlist icon doesn't exist return default */
@ -2482,11 +2481,11 @@ static void xmb_context_reset_horizontal_list(
{ {
len = fill_pathname_join_special(texturepath, iconpath, "default", len = fill_pathname_join_special(texturepath, iconpath, "default",
sizeof(texturepath)); sizeof(texturepath));
texturepath[len ] = '.'; texturepath[ len] = '.';
texturepath[len+1] = 'p'; texturepath[++len] = 'p';
texturepath[len+2] = 'n'; texturepath[++len] = 'n';
texturepath[len+3] = 'g'; texturepath[++len] = 'g';
texturepath[len+4] = '\0'; texturepath[++len] = '\0';
} }
ti.width = 0; ti.width = 0;
@ -2506,20 +2505,7 @@ static void xmb_context_reset_horizontal_list(
image_texture_free(&ti); image_texture_free(&ti);
} }
/* Manually append '-content.png' to end of sysname string */ strlcat(sysname, "-content.png", sizeof(sysname));
sysname[_len ] = '-';
sysname[_len+1 ] = 'c';
sysname[_len+2 ] = 'o';
sysname[_len+3 ] = 'n';
sysname[_len+4 ] = 't';
sysname[_len+5 ] = 'e';
sysname[_len+6 ] = 'n';
sysname[_len+7 ] = 't';
sysname[_len+8 ] = '.';
sysname[_len+9 ] = 'p';
sysname[_len+10] = 'n';
sysname[_len+11] = 'g';
sysname[_len+12] = '\0';
/* Assemble new icon path */ /* Assemble new icon path */
fill_pathname_join_special(content_texturepath, iconpath, sysname, fill_pathname_join_special(content_texturepath, iconpath, sysname,
sizeof(content_texturepath)); sizeof(content_texturepath));
@ -6360,9 +6346,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
const char *str = menu_input_dialog_get_buffer(); const char *str = menu_input_dialog_get_buffer();
const char *label = menu_st->input_dialog_kb_label; const char *label = menu_st->input_dialog_kb_label;
size_t _len = strlcpy(msg, label, sizeof(msg)); size_t _len = strlcpy(msg, label, sizeof(msg));
msg[_len ] = '\n'; msg[ _len] = '\n';
msg[_len+1] = '\0'; msg[++_len] = '\0';
_len += 1;
strlcpy(msg + _len, strlcpy(msg + _len,
str, str,
sizeof(msg) - _len); sizeof(msg) - _len);

View File

@ -118,8 +118,8 @@ static void contentless_cores_init_info_entries(
{ {
core_info_t *core_info = core_info_get(core_info_list, i); core_info_t *core_info = core_info_get(core_info_list, i);
if (core_info && if ( core_info
core_info->supports_no_game) && core_info->supports_no_game)
{ {
char licenses_str[MENU_SUBLABEL_MAX_LENGTH]; char licenses_str[MENU_SUBLABEL_MAX_LENGTH];
contentless_core_info_entry_t *entry = contentless_core_info_entry_t *entry =
@ -127,9 +127,9 @@ static void contentless_cores_init_info_entries(
size_t _len = strlcpy(licenses_str, size_t _len = strlcpy(licenses_str,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES),
sizeof(licenses_str)); sizeof(licenses_str));
licenses_str[_len ] = ':'; licenses_str[ _len] = ':';
licenses_str[_len+1] = ' '; licenses_str[++_len] = ' ';
licenses_str[_len+2] = '\0'; licenses_str[++_len] = '\0';
/* Populate licences string */ /* Populate licences string */
if (core_info->licenses_list) if (core_info->licenses_list)
@ -164,10 +164,10 @@ void menu_contentless_cores_set_runtime(const char *core_id,
{ {
contentless_core_info_entry_t *info_entry = NULL; contentless_core_info_entry_t *info_entry = NULL;
if (!contentless_cores_state || if ( !contentless_cores_state
!contentless_cores_state->info_entries || || !contentless_cores_state->info_entries
!runtime_info || || !runtime_info
string_is_empty(core_id)) || string_is_empty(core_id))
return; return;
info_entry = RHMAP_GET_STR(contentless_cores_state->info_entries, core_id); info_entry = RHMAP_GET_STR(contentless_cores_state->info_entries, core_id);
@ -200,9 +200,9 @@ void menu_contentless_cores_get_info(const char *core_id,
if (!info) if (!info)
return; return;
if (!contentless_cores_state || if ( !contentless_cores_state
!contentless_cores_state->info_entries || || !contentless_cores_state->info_entries
string_is_empty(core_id)) || string_is_empty(core_id))
*info = NULL; *info = NULL;
*info = RHMAP_GET_STR(contentless_cores_state->info_entries, core_id); *info = RHMAP_GET_STR(contentless_cores_state->info_entries, core_id);
@ -261,11 +261,11 @@ static void contentless_cores_unload_icons(contentless_cores_state_t *state)
static void contentless_cores_load_icons(contentless_cores_state_t *state) static void contentless_cores_load_icons(contentless_cores_state_t *state)
{ {
size_t i;
char icon_path[PATH_MAX_LENGTH];
char icon_directory[PATH_MAX_LENGTH];
bool rgba_supported = video_driver_supports_rgba(); bool rgba_supported = video_driver_supports_rgba();
core_info_list_t *core_info_list = NULL; core_info_list_t *core_info_list = NULL;
char icon_directory[PATH_MAX_LENGTH];
char icon_path[PATH_MAX_LENGTH];
size_t i;
if (!state) if (!state)
return; return;
@ -320,25 +320,24 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
/* Icon name is the first entry in the core /* Icon name is the first entry in the core
* info database list */ * info database list */
if (core_info && if ( core_info
core_info->supports_no_game && && core_info->supports_no_game
core_info->databases_list && && core_info->databases_list
(core_info->databases_list->size > 0)) && (core_info->databases_list->size > 0))
{ {
size_t len;
const char *icon_name = const char *icon_name =
core_info->databases_list->elems[0].data; core_info->databases_list->elems[0].data;
struct texture_image ti = {0}; struct texture_image ti = {0};
ti.supports_rgba = rgba_supported; size_t len = fill_pathname_join_special(
len = fill_pathname_join_special(
icon_path, icon_directory, icon_path, icon_directory,
icon_name, sizeof(icon_path)); icon_name, sizeof(icon_path));
icon_path[len ] = '.'; icon_path[ len] = '.';
icon_path[len+1] = 'p'; icon_path[++len] = 'p';
icon_path[len+2] = 'n'; icon_path[++len] = 'n';
icon_path[len+3] = 'g'; icon_path[++len] = 'g';
icon_path[len+4] = '\0'; icon_path[++len] = '\0';
ti.supports_rgba = rgba_supported;
if (!path_is_valid(icon_path)) if (!path_is_valid(icon_path))
continue; continue;
@ -367,34 +366,25 @@ uintptr_t menu_contentless_cores_get_entry_icon(const char *core_id)
{ {
contentless_cores_state_t *state = contentless_cores_state; contentless_cores_state_t *state = contentless_cores_state;
uintptr_t *icon = NULL; uintptr_t *icon = NULL;
if ( !state
if (!state || || !state->icons_enabled
!state->icons_enabled || || !state->icons
!state->icons || || string_is_empty(core_id))
string_is_empty(core_id))
return 0; return 0;
if ((icon = RHMAP_GET_STR(state->icons->system, core_id)))
icon = RHMAP_GET_STR(state->icons->system, core_id);
if (icon)
return *icon; return *icon;
return state->icons->fallback; return state->icons->fallback;
} }
void menu_contentless_cores_context_init(void) void menu_contentless_cores_context_init(void)
{ {
if (!contentless_cores_state) if (contentless_cores_state)
return;
contentless_cores_load_icons(contentless_cores_state); contentless_cores_load_icons(contentless_cores_state);
} }
void menu_contentless_cores_context_deinit(void) void menu_contentless_cores_context_deinit(void)
{ {
if (!contentless_cores_state) if (contentless_cores_state)
return;
contentless_cores_unload_icons(contentless_cores_state); contentless_cores_unload_icons(contentless_cores_state);
} }
@ -422,8 +412,8 @@ unsigned menu_displaylist_contentless_cores(file_list_t *list, settings_t *setti
if (core_info_list) if (core_info_list)
{ {
size_t menu_index = 0;
size_t i; size_t i;
size_t menu_index = 0;
/* Sort cores alphabetically */ /* Sort cores alphabetically */
core_info_qsort(core_info_list, CORE_INFO_LIST_SORT_DISPLAY_NAME); core_info_qsort(core_info_list, CORE_INFO_LIST_SORT_DISPLAY_NAME);
@ -432,29 +422,31 @@ unsigned menu_displaylist_contentless_cores(file_list_t *list, settings_t *setti
for (i = 0; i < core_info_list->count; i++) for (i = 0; i < core_info_list->count; i++)
{ {
core_info_t *core_info = core_info_get(core_info_list, i); core_info_t *core_info = core_info_get(core_info_list, i);
bool core_valid = false;
if (core_info) if (core_info)
{ {
switch (core_display_type) switch (core_display_type)
{ {
case MENU_CONTENTLESS_CORES_DISPLAY_ALL: case MENU_CONTENTLESS_CORES_DISPLAY_ALL:
core_valid = core_info->supports_no_game; if (!( core_info->supports_no_game))
continue;
break; break;
case MENU_CONTENTLESS_CORES_DISPLAY_SINGLE_PURPOSE: case MENU_CONTENTLESS_CORES_DISPLAY_SINGLE_PURPOSE:
core_valid = core_info->supports_no_game && if (!( core_info->supports_no_game
core_info->single_purpose; && core_info->single_purpose))
continue;
break; break;
case MENU_CONTENTLESS_CORES_DISPLAY_CUSTOM: case MENU_CONTENTLESS_CORES_DISPLAY_CUSTOM:
core_valid = core_info->supports_no_game && if (!( core_info->supports_no_game
!core_info->is_standalone_exempt; && !core_info->is_standalone_exempt))
continue;
break; break;
default: default:
break; break;
} }
if (core_valid && /* Valid core if we have reached here */
menu_entries_append(list, if (menu_entries_append(list,
core_info->path, core_info->path,
core_info->core_file_id.str, core_info->core_file_id.str,
MENU_ENUM_LABEL_CONTENTLESS_CORE, MENU_ENUM_LABEL_CONTENTLESS_CORE,
@ -486,8 +478,8 @@ unsigned menu_displaylist_contentless_cores(file_list_t *list, settings_t *setti
contentless_cores_load_icons(contentless_cores_state); contentless_cores_load_icons(contentless_cores_state);
} }
if ((count == 0) && if ( (count == 0)
menu_entries_append(list, && menu_entries_append(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORES_AVAILABLE),
msg_hash_to_str(MENU_ENUM_LABEL_NO_CORES_AVAILABLE), msg_hash_to_str(MENU_ENUM_LABEL_NO_CORES_AVAILABLE),
MENU_ENUM_LABEL_NO_CORES_AVAILABLE, MENU_ENUM_LABEL_NO_CORES_AVAILABLE,

View File

@ -562,10 +562,9 @@ static int menu_displaylist_parse_core_info(
_len = strlcpy(tmp, _len = strlcpy(tmp,
msg_hash_to_str(info_list[i].msg), msg_hash_to_str(info_list[i].msg),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, info_list[i].name, sizeof(tmp) - _len); strlcpy(tmp + _len, info_list[i].name, sizeof(tmp) - _len);
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_ENUM_LABEL_CORE_INFO_ENTRY,
@ -579,9 +578,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_CATEGORIES),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->categories_list, ", "); core_info->categories_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -594,9 +593,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_AUTHORS),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->authors_list, ", "); core_info->authors_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -609,9 +608,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_PERMISSIONS),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->permissions_list, ", "); core_info->permissions_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -624,9 +623,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->licenses_list, ", "); core_info->licenses_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -640,9 +639,9 @@ static int menu_displaylist_parse_core_info(
msg_hash_to_str( msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS), MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->supported_extensions_list, ", "); core_info->supported_extensions_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -655,9 +654,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
string_list_join_concat(tmp, sizeof(tmp), string_list_join_concat(tmp, sizeof(tmp),
core_info->required_hw_api_list, ", "); core_info->required_hw_api_list, ", ");
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
@ -693,10 +692,9 @@ static int menu_displaylist_parse_core_info(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, savestate_support, sizeof(tmp) - _len); strlcpy(tmp + _len, savestate_support, sizeof(tmp) - _len);
} }
@ -731,9 +729,9 @@ static int menu_displaylist_parse_core_info(
size_t len = strlcpy(tmp, size_t len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE),
sizeof(tmp)); sizeof(tmp));
tmp[len ] = ':'; tmp[ len] = ':';
tmp[len+1] = ' '; tmp[++len] = ' ';
tmp[len+2] = '\0'; tmp[++len] = '\0';
if (menu_entries_append(list, tmp, "", if (menu_entries_append(list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL)) MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))
count++; count++;
@ -1538,13 +1536,13 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
char entry_alt_text[256]; char entry_alt_text[256];
size_t _len = strlcpy(entry_alt_text, detect_core_str, size_t _len = strlcpy(entry_alt_text, detect_core_str,
sizeof(entry_alt_text)); sizeof(entry_alt_text));
entry_alt_text[_len ] = ' '; entry_alt_text[ _len] = ' ';
entry_alt_text[++_len] = '('; entry_alt_text[++_len] = '(';
entry_alt_text[++_len] = '\0'; entry_alt_text[++_len] = '\0';
_len += strlcpy(entry_alt_text + _len, _len += strlcpy(entry_alt_text + _len,
pending_core_name, pending_core_name,
sizeof(entry_alt_text) - _len); sizeof(entry_alt_text) - _len);
entry_alt_text[_len ] = ')'; entry_alt_text[ _len] = ')';
entry_alt_text[++_len] = '\0'; entry_alt_text[++_len] = '\0';
menu_entries_prepend(info->list, pending_core_path, menu_entries_prepend(info->list, pending_core_path,
@ -2329,10 +2327,9 @@ static int create_string_list_rdb_entry_string(
string_list_deinitialize(&str_list); string_list_deinitialize(&str_list);
_len = strlcpy(tmp, desc, sizeof(tmp)); _len = strlcpy(tmp, desc, sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, actual_string, sizeof(tmp) - _len); strlcpy(tmp + _len, actual_string, sizeof(tmp) - _len);
menu_entries_append(list, tmp, output_label, menu_entries_append(list, tmp, output_label,
enum_idx, enum_idx,
@ -2378,10 +2375,9 @@ static int create_string_list_rdb_entry_int(
string_list_deinitialize(&str_list); string_list_deinitialize(&str_list);
_len = strlcpy(tmp, desc, sizeof(tmp)); _len = strlcpy(tmp, desc, sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, str, sizeof(tmp) - _len); strlcpy(tmp + _len, str, sizeof(tmp) - _len);
menu_entries_append(list, tmp, output_label, menu_entries_append(list, tmp, output_label,
enum_idx, enum_idx,
@ -2529,10 +2525,9 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, db_info_entry->name, sizeof(tmp) - _len); strlcpy(tmp + _len, db_info_entry->name, sizeof(tmp) - _len);
menu_entries_append(info->list, tmp, menu_entries_append(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_NAME), msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_NAME),
@ -2545,9 +2540,9 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_DESCRIPTION),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
strlcpy(tmp + _len, db_info_entry->description, sizeof(tmp) - _len); strlcpy(tmp + _len, db_info_entry->description, sizeof(tmp) - _len);
menu_entries_append(info->list, tmp, menu_entries_append(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_DESCRIPTION), msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_DESCRIPTION),
@ -2560,10 +2555,9 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_GENRE),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, db_info_entry->genre, sizeof(tmp) - _len); strlcpy(tmp + _len, db_info_entry->genre, sizeof(tmp) - _len);
menu_entries_append(info->list, tmp, menu_entries_append(info->list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_GENRE), msg_hash_to_str(MENU_ENUM_LABEL_RDB_ENTRY_GENRE),
@ -4783,10 +4777,9 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, db_name_no_ext, sizeof(tmp) - _len); strlcpy(tmp + _len, db_name_no_ext, sizeof(tmp) - _len);
if (menu_entries_append(info_list, tmp, if (menu_entries_append(info_list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_DATABASE), msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_DATABASE),
@ -4805,10 +4798,9 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, !string_is_empty(content_label) strlcpy(tmp + _len, !string_is_empty(content_label)
? content_label ? content_label
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@ -4823,10 +4815,9 @@ static unsigned menu_displaylist_parse_content_information(
_len = strlcpy(tmp, _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, !string_is_empty(content_path) strlcpy(tmp + _len, !string_is_empty(content_path)
? content_path ? content_path
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
@ -4845,10 +4836,9 @@ static unsigned menu_displaylist_parse_content_information(
size_t _len = strlcpy(tmp, size_t _len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME),
sizeof(tmp)); sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\0'; tmp[++_len] = '\0';
_len += 2;
strlcpy(tmp + _len, core_name, sizeof(tmp) - _len); strlcpy(tmp + _len, core_name, sizeof(tmp) - _len);
if (menu_entries_append(info_list, tmp, if (menu_entries_append(info_list, tmp,
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_CORE_NAME), msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_CORE_NAME),
@ -4912,11 +4902,10 @@ static unsigned menu_displaylist_parse_content_information(
const char *cheevos_hash_str = const char *cheevos_hash_str =
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH);
size_t _len = strlcpy(tmp, cheevos_hash_str, sizeof(tmp)); size_t _len = strlcpy(tmp, cheevos_hash_str, sizeof(tmp));
tmp[_len ] = ':'; tmp[ _len] = ':';
tmp[_len+1] = ' '; tmp[++_len] = ' ';
tmp[_len+2] = '\n'; tmp[++_len] = '\n';
tmp[_len+3] = '\0'; tmp[++_len] = '\0';
_len += 3;
strlcpy(tmp + _len, rcheevos_get_hash(), sizeof(tmp) - _len); strlcpy(tmp + _len, rcheevos_get_hash(), sizeof(tmp) - _len);
if (menu_entries_append(info_list, tmp, cheevos_hash_str, if (menu_entries_append(info_list, tmp, cheevos_hash_str,
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH, MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH,
@ -5457,12 +5446,12 @@ static int menu_displaylist_parse_input_description_list(
sizeof(input_description)); sizeof(input_description));
if (i >= RARCH_FIRST_CUSTOM_BIND) if (i >= RARCH_FIRST_CUSTOM_BIND)
{ {
input_description [_len ] = ' '; input_description [ _len] = ' ';
if ((i % 2) == 0) if ((i % 2) == 0)
input_description[_len+1] = '+'; input_description[++_len] = '+';
else else
input_description[_len+1] = '-'; input_description[++_len] = '-';
input_description [_len+2] = '\0'; input_description [++_len] = '\0';
} }
if (string_is_empty(input_description)) if (string_is_empty(input_description))
@ -6133,28 +6122,30 @@ static unsigned menu_displaylist_populate_subsystem(
{ {
/* TODO/FIXME - Localize string */ /* TODO/FIXME - Localize string */
size_t _len = strlcpy(s, "Load", sizeof(s)); size_t _len = strlcpy(s, "Load", sizeof(s));
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
_len = strlcat(s, subsystem->desc, sizeof(s)); _len += strlcpy(s + _len, subsystem->desc, sizeof(s) - _len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, star_char, sizeof(s)); _len += strlcpy(s + _len, star_char, sizeof(s) - _len);
#ifdef HAVE_RGUI
/* If using RGUI with sublabels disabled, add the /* If using RGUI with sublabels disabled, add the
* appropriate text to the menu entry itself... */ * appropriate text to the menu entry itself... */
if (is_rgui && !menu_show_sublabels) if (is_rgui && !menu_show_sublabels)
{ {
strlcat(s, " [", sizeof(s)); _len += strlcpy(s + _len, " [", sizeof(s) - _len);
/* TODO/FIXME - Localize */ /* TODO/FIXME - Localize */
_len = strlcat(s, "Current Content:", sizeof(s)); _len += strlcpy(s + _len, "Current Content:", sizeof(s) - _len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
_len = strlcat(s, _len += strlcpy(s + _len,
subsystem->roms[content_get_subsystem_rom_id()].desc, subsystem->roms[content_get_subsystem_rom_id()].desc,
sizeof(s)); sizeof(s) - _len);
s[_len ] = ']'; s[ _len] = ']';
s[_len+1] = '\0'; s[++_len] = '\0';
} }
#endif
if (menu_entries_append(list, if (menu_entries_append(list,
s, s,
@ -6167,35 +6158,35 @@ static unsigned menu_displaylist_populate_subsystem(
{ {
/* TODO/FIXME - Localize string */ /* TODO/FIXME - Localize string */
size_t _len = strlcpy(s, "Start", sizeof(s)); size_t _len = strlcpy(s, "Start", sizeof(s));
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
_len = strlcat(s, subsystem->desc, sizeof(s)); _len += strlcpy(s + _len, subsystem->desc, sizeof(s) - _len);
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, star_char, sizeof(s)); _len += strlcpy(s + _len, star_char, sizeof(s) - _len);
/* If using RGUI with sublabels disabled, add the /* If using RGUI with sublabels disabled, add the
* appropriate text to the menu entry itself... */ * appropriate text to the menu entry itself... */
if (is_rgui && !menu_show_sublabels) if (is_rgui && !menu_show_sublabels)
{ {
size_t _len2 = 0;
unsigned j = 0; unsigned j = 0;
char rom_buff[PATH_MAX_LENGTH]; char rom_buff[PATH_MAX_LENGTH];
rom_buff[0] = '\0';
for (j = 0; j < content_get_subsystem_rom_id(); j++) for (j = 0; j < content_get_subsystem_rom_id(); j++)
{ {
strlcat(rom_buff, _len2 += strlcpy(rom_buff + _len2,
path_basename(content_get_subsystem_rom(j)), path_basename(content_get_subsystem_rom(j)),
sizeof(rom_buff)); sizeof(rom_buff) - _len2);
if (j != content_get_subsystem_rom_id() - 1) if (j != content_get_subsystem_rom_id() - 1)
strlcat(rom_buff, "|", sizeof(rom_buff)); _len2 += strlcpy(rom_buff + _len2, "|", sizeof(rom_buff) - _len2);
} }
if (!string_is_empty(rom_buff)) if (!string_is_empty(rom_buff))
{ {
strlcat(s, " [", sizeof(s)); _len += strlcpy(s + _len, " [", sizeof(s) - _len);
strlcat(s, rom_buff, sizeof(s)); _len += strlcpy(s + _len, rom_buff, sizeof(s) - _len);
strlcat(s, "]", sizeof(s)); _len += strlcpy(s + _len, "]", sizeof(s) - _len);
} }
} }
@ -6211,9 +6202,9 @@ static unsigned menu_displaylist_populate_subsystem(
{ {
/* TODO/FIXME - Localize */ /* TODO/FIXME - Localize */
size_t _len = strlcpy(s, "Load", sizeof(s)); size_t _len = strlcpy(s, "Load", sizeof(s));
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, subsystem->desc, sizeof(s)); _len += strlcpy(s + _len, subsystem->desc, sizeof(s) - _len);
/* If using RGUI with sublabels disabled, add the /* If using RGUI with sublabels disabled, add the
* appropriate text to the menu entry itself... */ * appropriate text to the menu entry itself... */
@ -6224,12 +6215,13 @@ static unsigned menu_displaylist_populate_subsystem(
* anyway), but no harm in being safe... */ * anyway), but no harm in being safe... */
if (subsystem->num_roms > 0) if (subsystem->num_roms > 0)
{ {
strlcat(s, " [", sizeof(s)); _len += strlcpy(s + _len, " [", sizeof(s) - _len);
/* TODO/FIXME - Localize */ /* TODO/FIXME - Localize */
strlcat(s, "Current Content:", sizeof(s)); _len += strlcpy(s + _len, "Current Content:", sizeof(s) - _len);
strlcat(s, " ", sizeof(s)); _len += strlcpy(s + _len, " ", sizeof(s) - _len);
strlcat(s, subsystem->roms[0].desc, sizeof(s)); _len += strlcpy(s + _len, subsystem->roms[0].desc,
strlcat(s, "]", sizeof(s)); sizeof(s) - _len);
_len += strlcpy(s + _len, "]", sizeof(s) - _len);
} }
} }
@ -7777,7 +7769,6 @@ unsigned menu_displaylist_build_list(
{ {
unsigned i; unsigned i;
size_t _len;
char cheat_label[128]; char cheat_label[128];
char on_string[32]; char on_string[32];
char off_string[32]; char off_string[32];
@ -7785,6 +7776,7 @@ unsigned menu_displaylist_build_list(
bool search_active = search_terms && (search_terms->size > 0); bool search_active = search_terms && (search_terms->size > 0);
unsigned num_cheats = cheat_manager_get_size(); unsigned num_cheats = cheat_manager_get_size();
unsigned num_cheats_shown = 0; unsigned num_cheats_shown = 0;
size_t _len = 0;
on_string[0] = '\0'; on_string[0] = '\0';
off_string[0] = '\0'; off_string[0] = '\0';
@ -7795,16 +7787,18 @@ unsigned menu_displaylist_build_list(
{ {
/* On/off key strings may be required, /* On/off key strings may be required,
* so populate them... */ * so populate them... */
on_string [0] = '.'; on_string [ _len] = '.';
on_string [1] = '\0'; on_string [++_len] = '\0';
off_string[0] = '.'; strlcpy(on_string + _len,
off_string[1] = '\0';
strlcat(on_string,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
sizeof(on_string)); sizeof(on_string) - _len);
strlcat(off_string, _len = 0;
off_string[ _len] = '.';
off_string[++_len] = '\0';
strlcpy(off_string + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
sizeof(off_string)); sizeof(off_string) - _len);
_len = 0;
} }
else else
{ {
@ -11485,9 +11479,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
size_t _len = strlcpy(desc_label, size_t _len = strlcpy(desc_label,
msg_hash_to_str(keyptr->enum_idx), msg_hash_to_str(keyptr->enum_idx),
sizeof(desc_label)); sizeof(desc_label));
desc_label[_len ] = ' '; desc_label[ _len] = ' ';
desc_label[_len+1] = '\0'; desc_label[++_len] = '\0';
_len += 1;
strlcpy(desc_label + _len, descriptor, sizeof(desc_label) - _len); strlcpy(desc_label + _len, descriptor, sizeof(desc_label) - _len);
strlcpy(descriptor, desc_label, sizeof(descriptor)); strlcpy(descriptor, desc_label, sizeof(descriptor));
} }
@ -11538,9 +11531,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
size_t _len = strlcpy(desc_label, size_t _len = strlcpy(desc_label,
msg_hash_to_str(keyptr->enum_idx), msg_hash_to_str(keyptr->enum_idx),
sizeof(desc_label)); sizeof(desc_label));
desc_label[_len ] = ' '; desc_label[ _len] = ' ';
desc_label[_len+1] = '\0'; desc_label[++_len] = '\0';
_len += 1;
strlcpy(desc_label + _len, descriptor, sizeof(desc_label) - _len); strlcpy(desc_label + _len, descriptor, sizeof(desc_label) - _len);
strlcpy(descriptor, desc_label, sizeof(descriptor)); strlcpy(descriptor, desc_label, sizeof(descriptor));
} }
@ -12438,9 +12430,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
count++; count++;
_len2 = strlcpy(buf, buf_tmp, sizeof(buf)); _len2 = strlcpy(buf, buf_tmp, sizeof(buf));
buf[_len2 ] = ' '; buf[ _len2] = ' ';
buf[_len2+1] = '\0'; buf[++_len2] = '\0';
_len2 += 1;
strlcpy(buf + _len2, val_filter, sizeof(buf) - _len2); strlcpy(buf + _len2, val_filter, sizeof(buf) - _len2);
if (menu_entries_append(info->list, buf, shdr_filter_pass, if (menu_entries_append(info->list, buf, shdr_filter_pass,
MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS, MENU_ENUM_LABEL_VIDEO_SHADER_FILTER_PASS,
@ -12448,9 +12439,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
count++; count++;
_len2 = strlcpy(buf, buf_tmp, sizeof(buf)); _len2 = strlcpy(buf, buf_tmp, sizeof(buf));
buf[_len2 ] = ' '; buf[ _len2] = ' ';
buf[_len2+1] = '\0'; buf[++_len2] = '\0';
_len2 += 1;
strlcpy(buf + _len2, val_scale, sizeof(buf) - _len2); strlcpy(buf + _len2, val_scale, sizeof(buf) - _len2);
if (menu_entries_append(info->list, buf, shdr_scale_pass, if (menu_entries_append(info->list, buf, shdr_scale_pass,
MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS, MENU_ENUM_LABEL_VIDEO_SHADER_SCALE_PASS,

View File

@ -4539,7 +4539,7 @@ void menu_entries_get_core_title(char *s, size_t len)
: ""; : "";
size_t _len = strlcpy(s, PACKAGE_VERSION, len); size_t _len = strlcpy(s, PACKAGE_VERSION, len);
#if defined(_MSC_VER) #if defined(_MSC_VER)
_len = strlcat(s, msvc_vercode_to_str(_MSC_VER), len); _len += strlcpy(s + _len, msvc_vercode_to_str(_MSC_VER), len - _len);
#endif #endif
if (!string_is_empty(core_version)) if (!string_is_empty(core_version))
@ -7561,16 +7561,18 @@ int generic_menu_entry_action(
{ {
size_t _len = strlcpy(speak_string, size_t _len = strlcpy(speak_string,
title_name, sizeof(speak_string)); title_name, sizeof(speak_string));
speak_string[_len ] = ' '; speak_string[ _len] = ' ';
speak_string[_len+1] = '\0'; speak_string[++_len] = '\0';
_len = strlcat(speak_string, _len += strlcpy(speak_string + _len,
current_label, sizeof(speak_string)); current_label,
sizeof(speak_string) - _len);
if (!string_is_equal(current_value, "...")) if (!string_is_equal(current_value, "..."))
{ {
speak_string[_len ] = ' '; speak_string[ _len] = ' ';
speak_string[_len+1] = '\0'; speak_string[++_len] = '\0';
strlcat(speak_string, current_value, strlcpy(speak_string + _len,
sizeof(speak_string)); current_value,
sizeof(speak_string) - _len);
} }
} }
else else
@ -7579,10 +7581,11 @@ int generic_menu_entry_action(
current_label, sizeof(speak_string)); current_label, sizeof(speak_string));
if (!string_is_equal(current_value, "...")) if (!string_is_equal(current_value, "..."))
{ {
speak_string[_len ] = ' '; speak_string[ _len] = ' ';
speak_string[_len+1] = '\0'; speak_string[++_len] = '\0';
strlcat(speak_string, current_value, strlcpy(speak_string + _len,
sizeof(speak_string)); current_value,
sizeof(speak_string) - _len);
} }
} }

View File

@ -1051,11 +1051,10 @@ static void setting_get_string_representation_int_gpu_index(rarch_setting_t *set
size_t _len = snprintf(s, len, "%d", *setting->value.target.integer); size_t _len = snprintf(s, len, "%d", *setting->value.target.integer);
if (list && (*setting->value.target.integer < (int)list->size) && !string_is_empty(list->elems[*setting->value.target.integer].data)) if (list && (*setting->value.target.integer < (int)list->size) && !string_is_empty(list->elems[*setting->value.target.integer].data))
{ {
s[_len ] = ' '; s[ _len] = ' ';
s[_len+1] = '-'; s[++_len] = '-';
s[_len+2] = ' '; s[++_len] = ' ';
s[_len+3] = '\0'; s[++_len] = '\0';
_len += 3;
strlcpy(s + _len, list->elems[*setting->value.target.integer].data, len - _len); strlcpy(s + _len, list->elems[*setting->value.target.integer].data, len - _len);
} }
} }
@ -9157,8 +9156,8 @@ static bool setting_append_list_input_player_options(
if (!string_is_empty(buffer[user])) if (!string_is_empty(buffer[user]))
{ {
size_t _len = strlcpy(label, buffer[user], sizeof(label)); size_t _len = strlcpy(label, buffer[user], sizeof(label));
label[_len ] = ' '; label[ _len] = ' ';
label[_len+1] = '\0'; label[++_len] = '\0';
} }
else else
label[0] = '\0'; label[0] = '\0';

View File

@ -5431,21 +5431,12 @@ static void retroarch_parse_input_libretro_path(const char *path)
if (!string_ends_with_size(tmp_path, "_libretro", if (!string_ends_with_size(tmp_path, "_libretro",
strlen(tmp_path), STRLEN_CONST("_libretro"))) strlen(tmp_path), STRLEN_CONST("_libretro")))
{ strlcpy(tmp_path + _len,
tmp_path[_len ] = '_'; "_libretro",
tmp_path[_len+1] = 'l'; sizeof(tmp_path) - _len);
tmp_path[_len+2] = 'i';
tmp_path[_len+3] = 'b';
tmp_path[_len+4] = 'r';
tmp_path[_len+5] = 'e';
tmp_path[_len+6] = 't';
tmp_path[_len+7] = 'r';
tmp_path[_len+8] = 'o';
tmp_path[_len+9] = '\0';
}
if (!core_info_find(tmp_path, &core_info) || if ( !core_info_find(tmp_path, &core_info)
string_is_empty(core_info->path)) || string_is_empty(core_info->path))
goto end; goto end;
core_path = core_info->path; core_path = core_info->path;
@ -6367,8 +6358,8 @@ bool retroarch_main_init(int argc, char *argv[])
strlcat(str_output, FILE_PATH_LOG_INFO " CPU Model Name: ", strlcat(str_output, FILE_PATH_LOG_INFO " CPU Model Name: ",
sizeof(str_output)); sizeof(str_output));
_len = strlcat(str_output, cpu_model, sizeof(str_output)); _len = strlcat(str_output, cpu_model, sizeof(str_output));
str_output[_len ] = '\n'; str_output[ _len] = '\n';
str_output[_len+1] = '\0'; str_output[++_len] = '\0';
} }
RARCH_LOG_OUTPUT("%s", str_output); RARCH_LOG_OUTPUT("%s", str_output);

View File

@ -4104,11 +4104,9 @@ static bool runloop_path_init_subsystem(runloop_state_t *runloop_st)
size_t len = strlcpy(runloop_st->name.savefile, size_t len = strlcpy(runloop_st->name.savefile,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savefile)); sizeof(runloop_st->name.savefile));
runloop_st->name.savefile[len ] = '.'; strlcpy(runloop_st->name.savefile + len,
runloop_st->name.savefile[len+1] = 's'; ".srm",
runloop_st->name.savefile[len+2] = 'r'; sizeof(runloop_st->name.savefile) - len);
runloop_st->name.savefile[len+3] = 'm';
runloop_st->name.savefile[len+4] = '\0';
} }
if (path_is_directory(runloop_st->name.savefile)) if (path_is_directory(runloop_st->name.savefile))
@ -4572,16 +4570,16 @@ bool runloop_event_init_core(
video_st->title_buf, video_st->title_buf,
msg_hash_to_str(MSG_PROGRAM), msg_hash_to_str(MSG_PROGRAM),
sizeof(video_st->title_buf)); sizeof(video_st->title_buf));
video_st->title_buf[len ] = ' '; video_st->title_buf[ len] = ' ';
video_st->title_buf[len+1] = '\0'; video_st->title_buf[++len] = '\0';
len = strlcat(video_st->title_buf, len += strlcpy(video_st->title_buf + len,
sys_info->info.library_name, sys_info->info.library_name,
sizeof(video_st->title_buf)); sizeof(video_st->title_buf) - len);
video_st->title_buf[len ] = ' '; video_st->title_buf[ len] = ' ';
video_st->title_buf[len+1] = '\0'; video_st->title_buf[++len] = '\0';
strlcat(video_st->title_buf, strlcpy(video_st->title_buf + len,
sys_info->info.library_version, sys_info->info.library_version,
sizeof(video_st->title_buf)); sizeof(video_st->title_buf) - len);
strlcpy(sys_info->valid_extensions, strlcpy(sys_info->valid_extensions,
sys_info->info.valid_extensions ? sys_info->info.valid_extensions ?
@ -4760,11 +4758,9 @@ void runloop_path_fill_names(void)
size_t len = strlcpy(runloop_st->name.ups, size_t len = strlcpy(runloop_st->name.ups,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ups)); sizeof(runloop_st->name.ups));
runloop_st->name.ups[len ] = '.'; strlcpy(runloop_st->name.ups + len,
runloop_st->name.ups[len+1] = 'u'; ".ups",
runloop_st->name.ups[len+2] = 'p'; sizeof(runloop_st->name.ups) - len);
runloop_st->name.ups[len+3] = 's';
runloop_st->name.ups[len+4] = '\0';
} }
if (string_is_empty(runloop_st->name.bps)) if (string_is_empty(runloop_st->name.bps))
@ -4772,11 +4768,9 @@ void runloop_path_fill_names(void)
size_t len = strlcpy(runloop_st->name.bps, size_t len = strlcpy(runloop_st->name.bps,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.bps)); sizeof(runloop_st->name.bps));
runloop_st->name.bps[len ] = '.'; strlcpy(runloop_st->name.bps + len,
runloop_st->name.bps[len+1] = 'b'; ".bps",
runloop_st->name.bps[len+2] = 'p'; sizeof(runloop_st->name.bps) - len);
runloop_st->name.bps[len+3] = 's';
runloop_st->name.bps[len+4] = '\0';
} }
if (string_is_empty(runloop_st->name.ips)) if (string_is_empty(runloop_st->name.ips))
@ -4784,11 +4778,9 @@ void runloop_path_fill_names(void)
size_t len = strlcpy(runloop_st->name.ips, size_t len = strlcpy(runloop_st->name.ips,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.ips)); sizeof(runloop_st->name.ips));
runloop_st->name.ips[len ] = '.'; strlcpy(runloop_st->name.ips + len,
runloop_st->name.ips[len+1] = 'i'; ".ips",
runloop_st->name.ips[len+2] = 'p'; sizeof(runloop_st->name.ips) - len);
runloop_st->name.ips[len+3] = 's';
runloop_st->name.ips[len+4] = '\0';
} }
} }
@ -7805,11 +7797,9 @@ void runloop_path_set_names(void)
size_t len = strlcpy(runloop_st->name.savefile, size_t len = strlcpy(runloop_st->name.savefile,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savefile)); sizeof(runloop_st->name.savefile));
runloop_st->name.savefile[len ] = '.'; strlcpy(runloop_st->name.savefile + len,
runloop_st->name.savefile[len+1] = 's'; ".srm",
runloop_st->name.savefile[len+2] = 'r'; sizeof(runloop_st->name.savefile) - len);
runloop_st->name.savefile[len+3] = 'm';
runloop_st->name.savefile[len+4] = '\0';
} }
if (!retroarch_override_setting_is_set( if (!retroarch_override_setting_is_set(
@ -7819,13 +7809,9 @@ void runloop_path_set_names(void)
runloop_st->name.savestate, runloop_st->name.savestate,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.savestate)); sizeof(runloop_st->name.savestate));
runloop_st->name.savestate[len ] = '.'; strlcpy(runloop_st->name.savestate + len,
runloop_st->name.savestate[len+1] = 's'; ".state",
runloop_st->name.savestate[len+2] = 't'; sizeof(runloop_st->name.savestate) - len);
runloop_st->name.savestate[len+3] = 'a';
runloop_st->name.savestate[len+4] = 't';
runloop_st->name.savestate[len+5] = 'e';
runloop_st->name.savestate[len+6] = '\0';
} }
#ifdef HAVE_BSV_MOVIE #ifdef HAVE_BSV_MOVIE
@ -7836,14 +7822,9 @@ void runloop_path_set_names(void)
runloop_st->name.replay, runloop_st->name.replay,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.replay)); sizeof(runloop_st->name.replay));
runloop_st->name.replay[len ] = '.'; strlcpy(runloop_st->name.replay + len,
runloop_st->name.replay[len+1] = 'r'; ".replay",
runloop_st->name.replay[len+2] = 'e'; sizeof(runloop_st->name.replay) - len);
runloop_st->name.replay[len+3] = 'p';
runloop_st->name.replay[len+4] = 'l';
runloop_st->name.replay[len+5] = 'a';
runloop_st->name.replay[len+6] = 'y';
runloop_st->name.replay[len+7] = '\0';
} }
#endif #endif
@ -7854,11 +7835,9 @@ void runloop_path_set_names(void)
runloop_st->name.cheatfile, runloop_st->name.cheatfile,
runloop_st->runtime_content_path_basename, runloop_st->runtime_content_path_basename,
sizeof(runloop_st->name.cheatfile)); sizeof(runloop_st->name.cheatfile));
runloop_st->name.cheatfile[len ] = '.'; strlcpy(runloop_st->name.cheatfile + len,
runloop_st->name.cheatfile[len+1] = 'c'; ".cht",
runloop_st->name.cheatfile[len+2] = 'h'; sizeof(runloop_st->name.cheatfile) - len);
runloop_st->name.cheatfile[len+3] = 't';
runloop_st->name.cheatfile[len+4] = '\0';
} }
#endif #endif
} }

View File

@ -779,8 +779,8 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
struct tm time_info; struct tm time_info;
runtime_log_get_last_played_time(runtime_log, &time_info); runtime_log_get_last_played_time(runtime_log, &time_info);
strftime_am_pm(tmp, sizeof(tmp), format_str, &time_info); strftime_am_pm(tmp, sizeof(tmp), format_str, &time_info);
str[_len ] = ' '; str[ _len] = ' ';
str[_len+1] = '\0'; str[++_len] = '\0';
strlcat(str, tmp, len); strlcat(str, tmp, len);
return; return;
} }
@ -1038,8 +1038,8 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
msg_hash_to_str( msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER), MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER),
sizeof(tmp)); sizeof(tmp));
str[_len ] = ' '; str[ _len] = ' ';
str[_len+1] = '\0'; str[++_len] = '\0';
strlcat(str, tmp, len); strlcat(str, tmp, len);
return; return;
case PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS: case PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS:

View File

@ -161,11 +161,9 @@ static void task_cdrom_dump_handler(retro_task_t *task)
_len = strlcpy(cue_filename, _len = strlcpy(cue_filename,
state->title, sizeof(cue_filename)); state->title, sizeof(cue_filename));
cue_filename[_len ] = '.'; strlcpy(cue_filename + _len,
cue_filename[_len+1] = 'c'; ".cue",
cue_filename[_len+2] = 'u'; sizeof(cue_filename) - _len);
cue_filename[_len+3] = 'e';
cue_filename[_len+4] = '\0';
fill_pathname_join_special(output_file, fill_pathname_join_special(output_file,
directory_core_assets, cue_filename, sizeof(output_file)); directory_core_assets, cue_filename, sizeof(output_file));

View File

@ -1082,11 +1082,11 @@ static int task_database_iterate_serial_lookup(
if (!serial_buf) if (!serial_buf)
return 1; return 1;
strlcpy(query, "{'serial': b'", sizeof(query)); _len = strlcpy(query, "{'serial': b'", sizeof(query));
_len = strlcat(query, serial_buf, sizeof(query)); _len += strlcpy(query + _len, serial_buf, sizeof(query) - _len);
query[_len ] = '\''; query[ _len] = '\'';
query[_len+1] = '}'; query[++_len] = '}';
query[_len+2] = '\0'; query[++_len] = '\0';
database_info_list_iterate_new(db_state, query); database_info_list_iterate_new(db_state, query);
free(serial_buf); free(serial_buf);

View File

@ -519,68 +519,68 @@ int detect_gc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
switch (region_id) switch (region_id)
{ {
case 'E': case 'E':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'U'; s[++_len] = 'U';
s[_len+2] = 'S'; s[++_len] = 'S';
s[_len+3] = 'A'; s[++_len] = 'A';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'J': case 'J':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'J'; s[++_len] = 'J';
s[_len+2] = 'P'; s[++_len] = 'P';
s[_len+3] = 'N'; s[++_len] = 'N';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'P': /** NYI: P can also be P-UKV, P-AUS **/ case 'P': /** NYI: P can also be P-UKV, P-AUS **/
case 'X': /** NYI: X can also be X-UKV, X-EUU **/ case 'X': /** NYI: X can also be X-UKV, X-EUU **/
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'E'; s[++_len] = 'E';
s[_len+2] = 'U'; s[++_len] = 'U';
s[_len+3] = 'R'; s[++_len] = 'R';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'Y': case 'Y':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'F'; s[++_len] = 'F';
s[_len+2] = 'A'; s[++_len] = 'A';
s[_len+3] = 'H'; s[++_len] = 'H';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'D': case 'D':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'N'; s[++_len] = 'N';
s[_len+2] = 'O'; s[++_len] = 'O';
s[_len+3] = 'E'; s[++_len] = 'E';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'S': case 'S':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'E'; s[++_len] = 'E';
s[_len+2] = 'S'; s[++_len] = 'S';
s[_len+3] = 'P'; s[++_len] = 'P';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'F': case 'F':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'F'; s[++_len] = 'F';
s[_len+2] = 'R'; s[++_len] = 'R';
s[_len+3] = 'A'; s[++_len] = 'A';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'I': case 'I':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'I'; s[++_len] = 'I';
s[_len+2] = 'T'; s[++_len] = 'T';
s[_len+3] = 'A'; s[++_len] = 'A';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
case 'H': case 'H':
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = 'H'; s[++_len] = 'H';
s[_len+2] = 'O'; s[++_len] = 'O';
s[_len+3] = 'L'; s[++_len] = 'L';
s[_len+4] = '\0'; s[++_len] = '\0';
return true; return true;
default: default:
break; break;
@ -653,10 +653,10 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(lgame_id, pre_game_id, index); strncpy(lgame_id, pre_game_id, index);
lgame_id[index] = '\0'; lgame_id[index] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '5'; s[++_len] = '5';
s[_len+2] = '0'; s[++_len] = '0';
s[_len+3] = '\0'; s[++_len] = '\0';
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }
@ -679,10 +679,10 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(lgame_id, &pre_game_id[3], 4); strncpy(lgame_id, &pre_game_id[3], 4);
lgame_id[4] = '\0'; lgame_id[4] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '5'; s[++_len] = '5';
s[_len+2] = '0'; s[++_len] = '0';
s[_len+3] = '\0'; s[++_len] = '\0';
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }
@ -781,10 +781,10 @@ int detect_sat_game(intfstream_t *fd, char *s, size_t len, const char *filename)
} }
strlcat(s, lgame_id, len); strlcat(s, lgame_id, len);
_len = strlcat(s, rgame_id, len); _len = strlcat(s, rgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '5'; s[++_len] = '5';
s[_len+2] = '0'; s[++_len] = '0';
s[_len+3] = '\0'; s[++_len] = '\0';
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
case 'J': case 'J':
@ -851,9 +851,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &raw_game_id[index + 1], length - 1); strncpy(rgame_id, &raw_game_id[index + 1], length - 1);
rgame_id[length - 1] = '\0'; rgame_id[length - 1] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id, len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }
@ -869,9 +869,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &raw_game_id[length - 2], length - 1); strncpy(rgame_id, &raw_game_id[length - 2], length - 1);
rgame_id[length - 1] = '\0'; rgame_id[length - 1] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id, len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }
@ -882,9 +882,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &raw_game_id[1], length - 1); strncpy(rgame_id, &raw_game_id[1], length - 1);
rgame_id[length - 1] = '\0'; rgame_id[length - 1] = '\0';
_len = strlcpy(pre_game_id, lgame_id, sizeof(pre_game_id)); _len = strlcpy(pre_game_id, lgame_id, sizeof(pre_game_id));
pre_game_id[_len ] = '-'; pre_game_id[ _len] = '-';
pre_game_id[_len+1] = '\0'; pre_game_id[++_len] = '\0';
strlcat(pre_game_id, rgame_id, sizeof(pre_game_id)); strlcpy(pre_game_id + _len, rgame_id, sizeof(pre_game_id) - _len);
total_hyphens_recalc = string_count_occurrences_single_character(pre_game_id, '-'); total_hyphens_recalc = string_count_occurrences_single_character(pre_game_id, '-');
if (total_hyphens_recalc >= 2) if (total_hyphens_recalc >= 2)
@ -899,9 +899,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &pre_game_id[length_recalc - 2], length_recalc - 1); strncpy(rgame_id, &pre_game_id[length_recalc - 2], length_recalc - 1);
rgame_id[length_recalc - 1] = '\0'; rgame_id[length_recalc - 1] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id, len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
} }
else else
@ -919,9 +919,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &pre_game_id[length_recalc - 2], length_recalc - 1); strncpy(rgame_id, &pre_game_id[length_recalc - 2], length_recalc - 1);
rgame_id[length_recalc - 1] = '\0'; rgame_id[length_recalc - 1] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id ,len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
} }
return true; return true;
@ -941,9 +941,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &raw_game_id[length - 4], length - 3); strncpy(rgame_id, &raw_game_id[length - 4], length - 3);
rgame_id[length - 3] = '\0'; rgame_id[length - 3] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id, len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }
@ -976,9 +976,9 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
strncpy(rgame_id, &raw_game_id[length - 2], length - 1); strncpy(rgame_id, &raw_game_id[length - 2], length - 1);
rgame_id[length - 1] = '\0'; rgame_id[length - 1] = '\0';
_len = strlcat(s, lgame_id, len); _len = strlcat(s, lgame_id, len);
s[_len ] = '-'; s[ _len] = '-';
s[_len+1] = '\0'; s[++_len] = '\0';
strlcat(s, rgame_id, len); strlcpy(s + _len, rgame_id, len - _len);
cue_append_multi_disc_suffix(s, filename); cue_append_multi_disc_suffix(s, filename);
return true; return true;
} }

View File

@ -378,9 +378,8 @@ void* task_push_http_transfer_file(const char* url, bool mute,
s = url; s = url;
len = strlcpy(tmp, msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp)); len = strlcpy(tmp, msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
tmp[len ] = ' '; tmp[ len] = ' ';
tmp[len+1] = '\0'; tmp[++len] = '\0';
len += 1;
if (string_ends_with_size(s, ".index", if (string_ends_with_size(s, ".index",
strlen(s), STRLEN_CONST(".index"))) strlen(s), STRLEN_CONST(".index")))

View File

@ -824,8 +824,8 @@ static void task_save_handler(retro_task_t *task)
size_t _len = strlcpy(err, size_t _len = strlcpy(err,
msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO),
err_size - 1); err_size - 1);
err[_len ] = ' '; err[ _len] = ' ';
err[_len+1] = '\0'; err[++_len] = '\0';
strlcat(err, state->path, err_size - 1); strlcat(err, state->path, err_size - 1);
} }

View File

@ -273,11 +273,9 @@ static bool screenshot_dump(
{ {
size_t len = strlcpy(state->filename, size_t len = strlcpy(state->filename,
name_base, sizeof(state->filename)); name_base, sizeof(state->filename));
state->filename[len ] = '.'; strlcpy(state->filename + len,
state->filename[len+1] = 'p'; ".png",
state->filename[len+2] = 'n'; sizeof(state->filename) - len);
state->filename[len+3] = 'g';
state->filename[len+4] = '\0';
} }
else else
{ {
@ -331,18 +329,16 @@ static bool screenshot_dump(
} }
else else
{ {
size_t len = strlcpy( size_t len = strlcpy(state->shotname,
state->shotname, path_basename_nocompression(name_base), path_basename_nocompression(name_base),
sizeof(state->shotname)); sizeof(state->shotname));
state->shotname[len ] = '.'; strlcpy(state->shotname + len,
state->shotname[len+1] = 'p'; ".png",
state->shotname[len+2] = 'n'; sizeof(state->shotname) - len);
state->shotname[len+3] = 'g';
state->shotname[len+4] = '\0';
} }
if ( string_is_empty(new_screenshot_dir) || if ( string_is_empty(new_screenshot_dir)
settings->bools.screenshots_in_content_dir) || settings->bools.screenshots_in_content_dir)
fill_pathname_basedir(new_screenshot_dir, name_base, fill_pathname_basedir(new_screenshot_dir, name_base,
sizeof(new_screenshot_dir)); sizeof(new_screenshot_dir));

View File

@ -1029,14 +1029,12 @@ bool run_translation_service(settings_t *settings, bool paused)
RARCH_LOG("Request size: %d\n", bmp64_length); RARCH_LOG("Request size: %d\n", bmp64_length);
#endif #endif
{ {
size_t _len;
char new_ai_service_url[PATH_MAX_LENGTH]; char new_ai_service_url[PATH_MAX_LENGTH];
char separator = '?'; char separator = '?';
unsigned ai_service_source_lang = settings->uints.ai_service_source_lang; unsigned ai_service_source_lang = settings->uints.ai_service_source_lang;
unsigned ai_service_target_lang = settings->uints.ai_service_target_lang; unsigned ai_service_target_lang = settings->uints.ai_service_target_lang;
const char *ai_service_url = settings->arrays.ai_service_url; const char *ai_service_url = settings->arrays.ai_service_url;
size_t _len = strlcpy(new_ai_service_url,
_len = strlcpy(new_ai_service_url,
ai_service_url, sizeof(new_ai_service_url)); ai_service_url, sizeof(new_ai_service_url));
/* if query already exists in url, then use &'s instead */ /* if query already exists in url, then use &'s instead */
@ -1051,14 +1049,14 @@ bool run_translation_service(settings_t *settings, bool paused)
if (!string_is_empty(lang_source)) if (!string_is_empty(lang_source))
{ {
new_ai_service_url[_len ] = separator; new_ai_service_url[ _len] = separator;
new_ai_service_url[_len+1] = '\0'; new_ai_service_url[++_len] = '\0';
strlcat( _len += strlcpy(new_ai_service_url + _len,
new_ai_service_url, "source_lang=", "source_lang=",
sizeof(new_ai_service_url)); sizeof(new_ai_service_url) - _len);
_len = strlcat( _len += strlcpy(new_ai_service_url + _len,
new_ai_service_url, lang_source, lang_source,
sizeof(new_ai_service_url)); sizeof(new_ai_service_url) - _len);
separator = '&'; separator = '&';
} }
} }
@ -1071,14 +1069,14 @@ bool run_translation_service(settings_t *settings, bool paused)
if (!string_is_empty(lang_target)) if (!string_is_empty(lang_target))
{ {
new_ai_service_url[_len ] = separator; new_ai_service_url[ _len] = separator;
new_ai_service_url[_len+1] = '\0'; new_ai_service_url[++_len] = '\0';
strlcat( _len += strlcpy(new_ai_service_url + _len,
new_ai_service_url, "target_lang=", "target_lang=",
sizeof(new_ai_service_url)); sizeof(new_ai_service_url) - _len);
_len = strlcat( _len += strlcpy(new_ai_service_url + _len,
new_ai_service_url, lang_target, lang_target,
sizeof(new_ai_service_url)); sizeof(new_ai_service_url) - _len);
separator = '&'; separator = '&';
} }
} }
@ -1089,34 +1087,38 @@ bool run_translation_service(settings_t *settings, bool paused)
/*"image" is included for backwards compatability with /*"image" is included for backwards compatability with
* vgtranslate < 1.04 */ * vgtranslate < 1.04 */
new_ai_service_url[_len ] = separator; new_ai_service_url[ _len] = separator;
new_ai_service_url[_len+1] = '\0'; new_ai_service_url[++_len] = '\0';
strlcat( _len += strlcpy(new_ai_service_url + _len,
new_ai_service_url, "output=", "output=",
sizeof(new_ai_service_url)); sizeof(new_ai_service_url) - _len);
switch (ai_service_mode) switch (ai_service_mode)
{ {
case 2: case 2:
strlcat(new_ai_service_url, "text", _len += strlcpy(new_ai_service_url + _len,
sizeof(new_ai_service_url)); "text",
sizeof(new_ai_service_url) - _len);
break; break;
case 1: case 1:
case 3: case 3:
strlcat(new_ai_service_url, "sound,wav", _len += strlcpy(new_ai_service_url + _len,
sizeof(new_ai_service_url)); "sound,wav",
sizeof(new_ai_service_url) - _len);
if (ai_service_mode == 1) if (ai_service_mode == 1)
break; break;
/* fall-through intentional for ai_service_mode == 3 */ /* fall-through intentional for ai_service_mode == 3 */
case 0: case 0:
strlcat(new_ai_service_url, "image,png", _len += strlcpy(new_ai_service_url + _len,
sizeof(new_ai_service_url)); "image,png",
sizeof(new_ai_service_url) - _len);
#ifdef HAVE_GFX_WIDGETS #ifdef HAVE_GFX_WIDGETS
if ( video_st->poke if ( video_st->poke
&& video_st->poke->load_texture && video_st->poke->load_texture
&& video_st->poke->unload_texture) && video_st->poke->unload_texture)
strlcat(new_ai_service_url, ",png-a", _len += strlcpy(new_ai_service_url + _len,
sizeof(new_ai_service_url)); ",png-a",
sizeof(new_ai_service_url) - _len);
#endif #endif
break; break;
default: default:

View File

@ -1410,7 +1410,7 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
{ {
size_t len; size_t len;
playlist_config_t playlist_config; playlist_config_t playlist_config;
char playlistPath[PATH_MAX_LENGTH]; char playlist_path[PATH_MAX_LENGTH];
QByteArray plNameByteArray = plName.toUtf8(); QByteArray plNameByteArray = plName.toUtf8();
const char *plNameCString = plNameByteArray.data(); const char *plNameCString = plNameByteArray.data();
playlist_t *cachedPlaylist = playlist_get_cached(); playlist_t *cachedPlaylist = playlist_get_cached();
@ -1430,18 +1430,16 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
/* Get playlist path */ /* Get playlist path */
len = fill_pathname_join_special( len = fill_pathname_join_special(
playlistPath, settings->paths.directory_playlist, playlist_path, settings->paths.directory_playlist,
plNameCString, sizeof(playlistPath)); plNameCString, sizeof(playlist_path));
playlistPath[len ] = '.'; strlcpy(playlist_path + len,
playlistPath[len+1] = 'l'; ".lpl",
playlistPath[len+2] = 'p'; sizeof(playlist_path) - len);
playlistPath[len+3] = 'l';
playlistPath[len+4] = '\0';
/* Load playlist, if required */ /* Load playlist, if required */
if (cachedPlaylist) if (cachedPlaylist)
{ {
if (string_is_equal(playlistPath, if (string_is_equal(playlist_path,
playlist_get_conf_path(cachedPlaylist))) playlist_get_conf_path(cachedPlaylist)))
{ {
playlist = cachedPlaylist; playlist = cachedPlaylist;
@ -1451,7 +1449,7 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
if (loadPlaylist) if (loadPlaylist)
{ {
playlist_config_set_path(&playlist_config, playlistPath); playlist_config_set_path(&playlist_config, playlist_path);
playlist = playlist_init(&playlist_config); playlist = playlist_init(&playlist_config);
} }