mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
Cut down on more strlcat calls
This commit is contained in:
parent
d6d0195060
commit
31d8f4fd51
@ -193,9 +193,9 @@ retry:
|
||||
* access to it is established. */
|
||||
else if (event->mask & (IN_CREATE | IN_ATTRIB))
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
strlcpy(path, "/dev/input/", sizeof(path));
|
||||
strlcat(path, event->name, sizeof(path));
|
||||
char path[256];
|
||||
size_t _len = strlcpy(path, "/dev/input/", sizeof(path));
|
||||
strlcpy(path + _len, event->name, sizeof(path) - _len);
|
||||
|
||||
if ( !string_is_empty(linuxraw_pads[idx].ident)
|
||||
&& linuxraw_joypad_init_pad(path, &linuxraw_pads[idx]))
|
||||
|
@ -286,8 +286,8 @@ static void *parport_joypad_init(void *data)
|
||||
{
|
||||
if (!pad->button_enable[j])
|
||||
{
|
||||
snprintf(pin, sizeof(pin), "%d ", j);
|
||||
strlcat(buf, pin, sizeof(buf));
|
||||
size_t _len = snprintf(pin, sizeof(pin), "%d ", j);
|
||||
strlcpy(buf + _len, pin, sizeof(buf) - _len);
|
||||
}
|
||||
}
|
||||
RARCH_WARN("[Joypad]: Pin(s) %son %s were low"
|
||||
|
@ -1024,8 +1024,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
|
||||
size_t _len = strlcpy(lbl_setting, "input_player", sizeof(lbl_setting));
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d", i + 1);
|
||||
strlcat(lbl_setting, "_joypad_index", sizeof(lbl_setting));
|
||||
snprintf(lbl_setting + _len, sizeof(lbl_setting) - _len, "%d_joypad_index", i + 1);
|
||||
|
||||
if (!string_is_equal(label, lbl_setting))
|
||||
continue;
|
||||
|
@ -1853,7 +1853,8 @@ static int action_bind_sublabel_playlist_entry(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
|
||||
s[_len ] = ' ';
|
||||
s[_len+1] = '\0';
|
||||
strlcat(s, entry->core_name, len);
|
||||
_len += 1;
|
||||
strlcpy(s + _len, entry->core_name, len - _len);
|
||||
|
||||
/* Get runtime info *if* required runtime log is enabled
|
||||
* *and* this is a valid playlist type */
|
||||
@ -2030,7 +2031,7 @@ static int action_bind_sublabel_core_backup_entry(
|
||||
s[_len+8] = '\0';
|
||||
}
|
||||
else
|
||||
strlcat(s, crc, len);
|
||||
strlcpy(s + _len, crc, len - _len);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -5333,7 +5334,7 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
size_t _len = strlcpy(key_input_adc_type, "input_player", sizeof(key_input_adc_type));
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
snprintf(key_input_adc_type + _len,
|
||||
snprintf(key_input_adc_type + _len,
|
||||
sizeof(key_input_adc_type) - _len, "%u", i + 1);
|
||||
strlcat(key_input_adc_type, "_analog_dpad_mode", sizeof(key_input_adc_type));
|
||||
if (!string_is_equal(label, key_input_adc_type))
|
||||
|
@ -1076,10 +1076,11 @@ extern "C" {
|
||||
|
||||
enum retro_language uwp_get_language(void)
|
||||
{
|
||||
size_t _len;
|
||||
char lang_iso[16];
|
||||
auto lang = Windows::System::UserProfile::GlobalizationPreferences::Languages->GetAt(0);
|
||||
struct string_list split = {0};
|
||||
char lang_bcp[16] = {0};
|
||||
char lang_iso[16] = {0};
|
||||
|
||||
wcstombs(lang_bcp, lang->Data(), sizeof(lang_bcp));
|
||||
|
||||
@ -1087,11 +1088,11 @@ extern "C" {
|
||||
string_list_initialize(&split);
|
||||
string_split_noalloc(&split, lang_bcp, "-");
|
||||
|
||||
strlcpy(lang_iso, split.elems[0].data, sizeof(lang_iso));
|
||||
_len = strlcpy(lang_iso, split.elems[0].data, sizeof(lang_iso));
|
||||
|
||||
if (split.size >= 2)
|
||||
{
|
||||
strlcat(lang_iso, "_", sizeof(lang_iso));
|
||||
strlcpy(lang_iso + _len, "_", sizeof(lang_iso) - _len);
|
||||
strlcat(lang_iso, split.elems[split.size >= 3 ? 2 : 1].data,
|
||||
sizeof(lang_iso));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user