mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Use strlcat instead of strcat
This commit is contained in:
parent
941b5f83f3
commit
982e35db45
@ -3,6 +3,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
|
||||
#include "scope.h"
|
||||
|
||||
union number
|
||||
@ -17,8 +19,7 @@ typedef struct generator
|
||||
union number value;
|
||||
union number increment;
|
||||
int shift;
|
||||
}
|
||||
generator_t;
|
||||
} generator_t;
|
||||
|
||||
struct param
|
||||
{
|
||||
@ -258,9 +259,10 @@ const char *scope_eval(scope_t *scope, const char *src)
|
||||
tmp[len] = '\0';
|
||||
|
||||
if ((param = param_find(scope, tmp, 0)))
|
||||
strcat(scope->eval, param->value);
|
||||
strlcat(scope->eval, param->value,
|
||||
sizeof(scope->eval));
|
||||
else
|
||||
strcat(scope->eval, tmp);
|
||||
strlcat(scope->eval, tmp, sizeof(scope->eval));
|
||||
|
||||
++next;
|
||||
}
|
||||
@ -273,7 +275,7 @@ const char *scope_eval(scope_t *scope, const char *src)
|
||||
{
|
||||
if (in_var)
|
||||
--cur;
|
||||
strcat(scope->eval, cur);
|
||||
strlcat(scope->eval, cur, sizeof(scope->eval));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -757,22 +757,23 @@ extern "C" {
|
||||
|
||||
enum retro_language uwp_get_language()
|
||||
{
|
||||
auto lang = Windows::System::UserProfile::GlobalizationPreferences::Languages->GetAt(0);
|
||||
char lang_bcp[16] = { 0 };
|
||||
char lang_iso[16] = { 0 };
|
||||
string_list* split = NULL;
|
||||
auto lang = Windows::System::UserProfile::GlobalizationPreferences::Languages->GetAt(0);
|
||||
char lang_bcp[16] = { 0 };
|
||||
char lang_iso[16] = { 0 };
|
||||
|
||||
wcstombs(lang_bcp, lang->Data(), 16);
|
||||
|
||||
/* Trying to convert BCP 47 language codes to ISO 639 ones */
|
||||
string_list* split;
|
||||
split = string_split(lang_bcp, "-");
|
||||
|
||||
strcat(lang_iso, split->elems[0].data);
|
||||
strlcat(lang_iso, split->elems[0].data, sizeof(lang_iso));
|
||||
|
||||
if (split->size >= 2)
|
||||
{
|
||||
strcat(lang_iso, "_");
|
||||
strcat(lang_iso, split->elems[split->size >= 3 ? 2 : 1].data);
|
||||
strlcat(lang_iso, "_", sizeof(lang_iso));
|
||||
strlcat(lang_iso, split->elems[split->size >= 3 ? 2 : 1].data,
|
||||
sizeof(lang_iso));
|
||||
}
|
||||
free(split);
|
||||
return rarch_get_language_from_iso(lang_iso);
|
||||
|
Loading…
x
Reference in New Issue
Block a user