diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index d77d681712..7a3de7f8f6 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -31,6 +31,7 @@ #include <3ds/services/mcuhwc.h> #include +#include #ifdef HAVE_CONFIG_H #include "../../config.h" @@ -80,7 +81,7 @@ static void get_first_valid_core(char* path_return, size_t len) if (strlen(ent->d_name) > strlen(extension) && !strcmp(ent->d_name + strlen(ent->d_name) - strlen(extension), extension)) { - strlcpy(path_return, "sdmc:/retroarch/cores/", len); + strcpy_literal(path_return, "sdmc:/retroarch/cores/"); strlcat(path_return, ent->d_name, len); break; } @@ -589,7 +590,7 @@ static void frontend_ctr_get_os(char* s, size_t len, int* major, int* minor) OS_VersionBin cver; OS_VersionBin nver; - strlcpy(s, "3DS OS", len); + strcpy_literal(s, "3DS OS"); Result data_invalid = osGetSystemVersionData(&nver, &cver); if (data_invalid == 0) { @@ -614,26 +615,26 @@ static void frontend_ctr_get_name(char* s, size_t len) switch (device_model) { case 0: - strlcpy(s, "Old 3DS", len); + strcpy_literal(s, "Old 3DS"); break; case 1: - strlcpy(s, "Old 3DS XL", len); + strcpy_literal(s, "Old 3DS XL"); break; case 2: - strlcpy(s, "New 3DS", len); + strcpy_literal(s, "New 3DS"); break; case 3: - strlcpy(s, "Old 2DS", len); + strcpy_literal(s, "Old 2DS"); break; case 4: - strlcpy(s, "New 3DS XL", len); + strcpy_literal(s, "New 3DS XL"); break; case 5: - strlcpy(s, "New 2DS XL", len); + strcpy_literal(s, "New 2DS XL"); break; default: - strlcpy(s, "Unknown Device", len); + strcpy_literal(s, "Unknown Device"); break; } } diff --git a/frontend/drivers/platform_switch.c b/frontend/drivers/platform_switch.c index 3b5873df9d..40d0145863 100644 --- a/frontend/drivers/platform_switch.c +++ b/frontend/drivers/platform_switch.c @@ -166,7 +166,7 @@ static void get_first_valid_core(char *path_return, size_t len) break; if (strlen(ent->d_name) > strlen(extension) && !strcmp(ent->d_name + strlen(ent->d_name) - strlen(extension), extension)) { - strlcpy(path_return, SD_PREFIX "/retroarch/cores", len); + strcpy_literal(path_return, SD_PREFIX "/retroarch/cores"); strlcat(path_return, "/", len); strlcat(path_return, ent->d_name, len); break; @@ -834,7 +834,7 @@ static void frontend_switch_get_os( ipc_request_t rq; #endif - strlcpy(s, "Horizon OS", len); + strcpy_literal(s, "Horizon OS"); #ifdef HAVE_LIBNX *major = 0; @@ -873,7 +873,7 @@ fail: static void frontend_switch_get_name(char *s, size_t len) { /* TODO: Add Mariko at some point */ - strlcpy(s, "Nintendo Switch", len); + strcpy_literal(s, "Nintendo Switch"); } void frontend_switch_process_args(int *argc, char *argv[]) diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 1d257bdc66..057c87abba 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -1256,7 +1256,7 @@ static void frontend_unix_get_os(char *s, int rel; frontend_android_get_version(major, minor, &rel); - strlcpy(s, "Android", len); + strcpy_literal(s, "Android"); #else unsigned krel; struct utsname buffer; @@ -1266,19 +1266,19 @@ static void frontend_unix_get_os(char *s, sscanf(buffer.release, "%d.%d.%u", major, minor, &krel); #if defined(__FreeBSD__) - strlcpy(s, "FreeBSD", len); + strcpy_literal(s, "FreeBSD"); #elif defined(__NetBSD__) - strlcpy(s, "NetBSD", len); + strcpy_literal(s, "NetBSD"); #elif defined(__OpenBSD__) - strlcpy(s, "OpenBSD", len); + strcpy_literal(s, "OpenBSD"); #elif defined(__DragonFly__) - strlcpy(s, "DragonFly BSD", len); + strcpy_literal(s, "DragonFly BSD"); #elif defined(BSD) - strlcpy(s, "BSD", len); + strcpy_literal(s, "BSD"); #elif defined(__HAIKU__) - strlcpy(s, "Haiku", len); + strcpy_literal(s, "Haiku"); #else - strlcpy(s, "Linux", len); + strcpy_literal(s, "Linux"); #endif #endif } @@ -1722,8 +1722,7 @@ static void frontend_unix_get_env(int *argc, { g_defaults.overlay_set = true; g_defaults.overlay_enable = false; - strlcpy(g_defaults.settings_menu, "ozone", - sizeof(g_defaults.settings_menu)); + strcpy_literal(g_defaults.settings_menu, "ozone"); } #else char base_path[PATH_MAX] = {0}; @@ -1741,7 +1740,7 @@ static void frontend_unix_get_env(int *argc, strlcat(base_path, "/.config/retroarch", sizeof(base_path)); } else - strlcpy(base_path, "retroarch", sizeof(base_path)); + strcpy_literal(base_path, "retroarch"); fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], base_path, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); @@ -2542,10 +2541,10 @@ static bool accessibility_speak_unix(int speed, else if (speed > 10) speed = 10; - strlcpy(voice_out, "-v", 3); + strcpy_literal(voice_out, "-v"); strlcat(voice_out, language, 5); - strlcpy(speed_out, "-s", 3); + strcpy_literal(speed_out, "-s"); strlcat(speed_out, speeds[speed-1], 6); if (priority < 10 && speak_pid > 0) diff --git a/frontend/drivers/platform_uwp.c b/frontend/drivers/platform_uwp.c index fd017cb91d..300d1f9fee 100644 --- a/frontend/drivers/platform_uwp.c +++ b/frontend/drivers/platform_uwp.c @@ -104,36 +104,36 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) { case 10: if (server) - strlcpy(s, "Windows Server 2016", len); + strcpy_literal(s, "Windows Server 2016"); else - strlcpy(s, "Windows 10", len); + strcpy_literal(s, "Windows 10"); break; case 6: switch (vi.dwMinorVersion) { case 3: if (server) - strlcpy(s, "Windows Server 2012 R2", len); + strcpy_literal(s, "Windows Server 2012 R2"); else - strlcpy(s, "Windows 8.1", len); + strcpy_literal(s, "Windows 8.1"); break; case 2: if (server) - strlcpy(s, "Windows Server 2012", len); + strcpy_literal(s, "Windows Server 2012"); else - strlcpy(s, "Windows 8", len); + strcpy_literal(s, "Windows 8"); break; case 1: if (server) - strlcpy(s, "Windows Server 2008 R2", len); + strcpy_literal(s, "Windows Server 2008 R2"); else - strlcpy(s, "Windows 7", len); + strcpy_literal(s, "Windows 7"); break; case 0: if (server) - strlcpy(s, "Windows Server 2008", len); + strcpy_literal(s, "Windows Server 2008"); else - strlcpy(s, "Windows Vista", len); + strcpy_literal(s, "Windows Vista"); break; default: break; @@ -144,19 +144,19 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) { case 2: if (server) - strlcpy(s, "Windows Server 2003", len); + strcpy_literal(s, "Windows Server 2003"); else { /* Yes, XP Pro x64 is a higher version number than XP x86 */ if (string_is_equal(arch, "x64")) - strlcpy(s, "Windows XP", len); + strcpy_literal(s, "Windows XP"); } break; case 1: - strlcpy(s, "Windows XP", len); + strcpy_literal(s, "Windows XP"); break; case 0: - strlcpy(s, "Windows 2000", len); + strcpy_literal(s, "Windows 2000"); break; } break; @@ -165,17 +165,17 @@ static void frontend_uwp_get_os(char *s, size_t len, int *major, int *minor) { case 0: if (vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - strlcpy(s, "Windows 95", len); + strcpy_literal(s, "Windows 95"); else if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT) - strlcpy(s, "Windows NT 4.0", len); + strcpy_literal(s, "Windows NT 4.0"); else - strlcpy(s, "Unknown", len); + strcpy_literal(s, "Unknown"); break; case 90: - strlcpy(s, "Windows ME", len); + strcpy_literal(s, "Windows ME"); break; case 10: - strlcpy(s, "Windows 98", len); + strcpy_literal(s, "Windows 98"); break; } break;