From 39ad8ff8654759253b2d1f9116a6d1932668337c Mon Sep 17 00:00:00 2001 From: Alcaro Date: Tue, 25 Oct 2016 20:42:23 +0200 Subject: [PATCH] Get rid of a few unnecessary strcpys --- intl/msg_hash_de.c | 12 ++++-------- intl/msg_hash_es.c | 7 +++---- intl/msg_hash_it.c | 11 ++++------- intl/msg_hash_jp.c | 8 +++----- intl/msg_hash_pt.c | 10 ++++------ intl/msg_hash_us.c | 8 +++----- 6 files changed, 21 insertions(+), 35 deletions(-) diff --git a/intl/msg_hash_de.c b/intl/msg_hash_de.c index d8fc5432b7..0e66e95550 100644 --- a/intl/msg_hash_de.c +++ b/intl/msg_hash_de.c @@ -58,10 +58,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_LABEL_INPUT_DRIVER_UDEV: { /* Work around C89 limitations */ - char u[501]; - char t[501]; - - snprintf(t, sizeof(t), + const char * t = "udev-Eingabetreiber. \n" " \n" "Dieser Treiber kann ohne X ausgeführt werden. \n" @@ -70,9 +67,8 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) "für die Joystick-Unterstützung und unterstützt \n" "auch Hotplugging und Force-Feedback (wenn das \n" "Gerät dies unterstützt). \n" - " \n" - ); - snprintf(u, sizeof(u), + " \n"; + const char * u = "Der Treiber liest evdev-Ereignisse für die Tastatur- \n" "Unterstützung und kann auch mit Tastatur-Callbacks, \n" "Mäusen und Touchpads umgehen. \n" @@ -81,7 +77,7 @@ int menu_hash_get_help_de_enum(enum msg_hash_enums msg, char *s, size_t len) "meisten Linux-Distribution nur vom Root- \n" "Benutzer lesbar (mode 600). Du kannst eine udev- \n" "Regel erstellen, die auch den Zugriff für andere \n" - "Benutzer erlaubt."); + "Benutzer erlaubt."; strlcpy(s, t, len); strlcat(s, u, len); } diff --git a/intl/msg_hash_es.c b/intl/msg_hash_es.c index 3cd0bbcb98..eacd606441 100644 --- a/intl/msg_hash_es.c +++ b/intl/msg_hash_es.c @@ -68,9 +68,8 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) { /* Work around C89 limitations */ char u[501]; - char t[501]; - strlcpy(t, + const char * t = "RetroArch utiliza un formato único para \n" "sincronizar vídeo y sonido que necesita \n" "calibrarse con la frecuencia de \n" @@ -80,8 +79,8 @@ int menu_hash_get_help_es_enum(enum msg_hash_enums msg, char *s, size_t len) "Si notas cortes de sonido o en la imagen,\n" "lo normal es que necesites calibrar estos\n" "ajustes. Aquí van algunas opciones:\n" - " \n", sizeof(t)); - snprintf(u, sizeof(u), + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ "a) Ve a '%s' -> '%s' y activa\n" "'Vídeo por hilos'. En este modo la tasa\n" "de refresco es irrelevante, habrá más fps,\n" diff --git a/intl/msg_hash_it.c b/intl/msg_hash_it.c index 9a69a0f1b7..815d1bce8b 100644 --- a/intl/msg_hash_it.c +++ b/intl/msg_hash_it.c @@ -128,10 +128,7 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_LABEL_INPUT_DRIVER_UDEV: { /* Work around C89 limitations */ - char u[501]; - char t[501]; - - strlcpy(t, + const char * t = "udev Input driver. \n" " \n" "Questo driver può caricare senza X. \n" @@ -140,15 +137,15 @@ int menu_hash_get_help_it_enum(enum msg_hash_enums msg, char *s, size_t len) "per il supporto del joystick. Supporta \n" "hotplugging e force feedback (se \n" "supportato dal dispositivo). \n" - " \n", sizeof(t)); - strlcpy(u, + " \n"; + const char * u = "Il driver legge gli eventi evdev per il supporto \n" "della tastiera. Supporta anche la callback della tastiera, \n" "mouse e touchpads. \n" " \n" "Come predefinito nella maggior parte delle distribuzioni, i nodi /dev/input \n" "sono only-root (modalità 600). Puoi settare una regola udev \n" - "che fa queste accessibili ai non-root.", sizeof(u)); + "che fa queste accessibili ai non-root."; strlcpy(s, t, len); strlcat(s, u, len); } diff --git a/intl/msg_hash_jp.c b/intl/msg_hash_jp.c index 613e12d0c1..bfae1a9fac 100644 --- a/intl/msg_hash_jp.c +++ b/intl/msg_hash_jp.c @@ -624,9 +624,7 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) { /* Work around C89 limitations */ char u[501]; - char t[501]; - - strlcpy(t, + const char * t = "RetroArch relies on an unique form of\n" "audio/video synchronization where it needs to be\n" "calibrated against the refresh rate of your\n" @@ -635,8 +633,8 @@ int menu_hash_get_help_jp_enum(enum msg_hash_enums msg, char *s, size_t len) "If you experience any audio crackling or video\n" "tearing, usually it means that you need to\n" "calibrate the settings. Some choices below:\n" - " \n", sizeof(t)); - snprintf(u, sizeof(u), + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ "a) Go to '%s' -> '%s', and enable\n" "'Threaded Video'. Refresh rate will not matter\n" "in this mode, framerate will be higher,\n" diff --git a/intl/msg_hash_pt.c b/intl/msg_hash_pt.c index d62b47c292..cb97699212 100644 --- a/intl/msg_hash_pt.c +++ b/intl/msg_hash_pt.c @@ -494,9 +494,7 @@ int menu_hash_get_help_pt_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_VIDEO_REFRESH_RATE_AUTO: { /* Work around C89 limitations */ - char u[501]; - char t[501]; - snprintf(u, sizeof(u), + const char * u = "Taxa de Atualização Automática.\n" " \n" "A taxa de atualização exata de nosso monitor (Hz).\n" @@ -505,8 +503,8 @@ int menu_hash_get_help_pt_enum(enum msg_hash_enums msg, char *s, size_t len) " \n" "audio_input_rate = game input rate * display \n" "refresh rate / game refresh rate\n" - " \n"); - snprintf(t, sizeof(t), + " \n"; + const char * t = "Se a implementação não informar valores, \n" "valores NTSC serão assumidos por questão de \n" "compatibilidade.\n" @@ -514,7 +512,7 @@ int menu_hash_get_help_pt_enum(enum msg_hash_enums msg, char *s, size_t len) "Esse valor deve ficar próximo de 60Hz para \n" "evitar grande mudanças de pitch. Se o monitor \n" "não rodar a 60Hz, ou algo próximo a isso, desative\n" - "o VSync, e deixe-o com valores padrão."); + "o VSync, e deixe-o com valores padrão."; strlcpy(s, u, len); strlcat(s, t, len); } diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 3f6ed08594..b5e820df0e 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -625,9 +625,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) { /* Work around C89 limitations */ char u[501]; - char t[501]; - - strlcpy(t, + const char * t = "RetroArch relies on an unique form of\n" "audio/video synchronization where it needs to be\n" "calibrated against the refresh rate of your\n" @@ -636,8 +634,8 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) "If you experience any audio crackling or video\n" "tearing, usually it means that you need to\n" "calibrate the settings. Some choices below:\n" - " \n", sizeof(t)); - snprintf(u, sizeof(u), + " \n"; + snprintf(u, sizeof(u), /* can't inline this due to the printf arguments */ "a) Go to '%s' -> '%s', and enable\n" "'Threaded Video'. Refresh rate will not matter\n" "in this mode, framerate will be higher,\n"