Work around C89 string literal length limitations

This commit is contained in:
twinaphex 2015-09-22 14:07:02 +02:00
parent 8e2b04d556
commit e19f82988c
4 changed files with 156 additions and 109 deletions

View File

@ -868,7 +868,12 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
switch (driver_hash) switch (driver_hash)
{ {
case MENU_LABEL_INPUT_DRIVER_UDEV: case MENU_LABEL_INPUT_DRIVER_UDEV:
snprintf(s, len, {
/* Work around C89 limitations */
char u[501];
char t[501];
snprintf(t, sizeof(t),
"udev-Eingabetreiber. \n" "udev-Eingabetreiber. \n"
" \n" " \n"
"Dieser Treiber kann ohne X ausgeführt werden. \n" "Dieser Treiber kann ohne X ausgeführt werden. \n"
@ -878,6 +883,8 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
"auch Hotplugging und Force-Feedback (wenn das \n" "auch Hotplugging und Force-Feedback (wenn das \n"
"Gerät dies unterstützt). \n" "Gerät dies unterstützt). \n"
" \n" " \n"
);
snprintf(u, sizeof(u),
"Der Treiber liest evdev-Ereigniss für Tastatur- \n" "Der Treiber liest evdev-Ereigniss für Tastatur- \n"
"Unterstützung und kann auch mit Tastatur-Callbacks, \n" "Unterstützung und kann auch mit Tastatur-Callbacks, \n"
"Mäusen und Touchpads umgehen. \n" "Mäusen und Touchpads umgehen. \n"
@ -886,8 +893,10 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
"meisten Linux-Distribution nur für den Root- \n" "meisten Linux-Distribution nur für den Root- \n"
"Benutzer lesbar (mode 600). Du kannst eine udev- \n" "Benutzer lesbar (mode 600). Du kannst eine udev- \n"
"Regel erstellen, die auch den Zugriff für andere \n" "Regel erstellen, die auch den Zugriff für andere \n"
"Benutzer erlaubt." "Benutzer erlaubt.");
); strlcat(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_LABEL_INPUT_DRIVER_LINUXRAW: case MENU_LABEL_INPUT_DRIVER_LINUXRAW:
snprintf(s, len, snprintf(s, len,

View File

@ -931,7 +931,12 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
switch (hash) switch (hash)
{ {
case MENU_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC: case MENU_LABEL_VALUE_HELP_AUDIO_VIDEO_TROUBLESHOOTING_DESC:
snprintf(s, len, {
/* Work around C89 limitations */
char u[501];
char t[501];
strlcpy(t,
"RetroArch utiliza un formato único para \n" "RetroArch utiliza un formato único para \n"
"sincronizar vídeo y sonido que necesita \n" "sincronizar vídeo y sonido que necesita \n"
"calibrarse con la frecuencia de \n" "calibrarse con la frecuencia de \n"
@ -941,7 +946,8 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"Si notas cortes de sonido o en la imagen,\n" "Si notas cortes de sonido o en la imagen,\n"
"lo normal es que necesites calibrar estos\n" "lo normal es que necesites calibrar estos\n"
"ajustes. Aquí van algunas opciones:\n" "ajustes. Aquí van algunas opciones:\n"
" \n" " \n", sizeof(t));
snprintf(u, sizeof(u),
"a) Ve a '%s' -> '%s' y activa\n" "a) Ve a '%s' -> '%s' y activa\n"
"'Vídeo por hilos'. En este modo la tasa\n" "'Vídeo por hilos'. En este modo la tasa\n"
"de refresco es irrelevante, habrá más fps,\n" "de refresco es irrelevante, habrá más fps,\n"
@ -957,6 +963,9 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS), menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS),
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO) menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)
); );
strlcat(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: case MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC:
snprintf(s, len, snprintf(s, len,
@ -1008,7 +1017,12 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
switch (driver_hash) switch (driver_hash)
{ {
case MENU_LABEL_INPUT_DRIVER_UDEV: case MENU_LABEL_INPUT_DRIVER_UDEV:
snprintf(s, len, {
/* Work around C89 limitations */
char u[501];
char t[501];
strlcpy(t,
"Controlador de entrada udev. \n" "Controlador de entrada udev. \n"
" \n" " \n"
"Este controlador puede funcionar sin X. \n" "Este controlador puede funcionar sin X. \n"
@ -1016,7 +1030,9 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"Utiliza la API más reciente para joypads \n" "Utiliza la API más reciente para joypads \n"
"evdec para dar compatibilidad con joysticks. \n" "evdec para dar compatibilidad con joysticks. \n"
"Permite conexión en caliente y force \n" "Permite conexión en caliente y force \n"
"feedback (si lo admite el dispositivo). \n" "feedback (si lo admite el dispositivo). \n",
sizeof(t));
strlcpy(u,
" \n" " \n"
"El controlador lee los eventos evdev para \n" "El controlador lee los eventos evdev para \n"
"dar compatibilidad con teclados. También \n" "dar compatibilidad con teclados. También \n"
@ -1026,8 +1042,12 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"La mayoría de las distros tienen los nodos \n" "La mayoría de las distros tienen los nodos \n"
"/dev/input en modo root-only (modo 600). \n" "/dev/input en modo root-only (modo 600). \n"
"Puedes configurar una regla udev que los haga \n" "Puedes configurar una regla udev que los haga \n"
"accesibles fuera de la raíz." "accesibles fuera de la raíz.", sizeof(u)
); );
strlcat(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_LABEL_INPUT_DRIVER_LINUXRAW: case MENU_LABEL_INPUT_DRIVER_LINUXRAW:
snprintf(s, len, snprintf(s, len,
@ -1513,7 +1533,12 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"implementaciones de núcleos libretro."); "implementaciones de núcleos libretro.");
break; break;
case MENU_LABEL_VIDEO_REFRESH_RATE_AUTO: case MENU_LABEL_VIDEO_REFRESH_RATE_AUTO:
snprintf(s, len, {
/* Work around C89 limitations */
char u[501];
char t[501];
strlcpy(t,
"Frecuencia de actualización automática.\n" "Frecuencia de actualización automática.\n"
" \n" " \n"
"La frecuencia de actualización precisa del \n" "La frecuencia de actualización precisa del \n"
@ -1524,7 +1549,8 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"audio_input_rate = veloc. de entrada de juego \n" "audio_input_rate = veloc. de entrada de juego \n"
"* frecuencia de actualización de pantalla / \n" "* frecuencia de actualización de pantalla / \n"
"frecuencia de actualización de juego \n" "frecuencia de actualización de juego \n"
" \n" " \n", sizeof(t));
strlcpy(u,
"Si la implementación no indica un valor, se \n" "Si la implementación no indica un valor, se \n"
"asumirá de forma predeterminada el sistema \n" "asumirá de forma predeterminada el sistema \n"
"NTSC por compatibilidad.\n" "NTSC por compatibilidad.\n"
@ -1533,7 +1559,10 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
"para evitar cambios en el tono. Si tu \n" "para evitar cambios en el tono. Si tu \n"
"monitor no funciona a 60Hz o similar, \n" "monitor no funciona a 60Hz o similar, \n"
"desactiva la sincronía vertical y deja \n" "desactiva la sincronía vertical y deja \n"
"esta opción en su valor predeterminado."); "esta opción en su valor predeterminado.", sizeof(u));
strlcat(s, t, len);
strlcat(s, u, len);
}
break; break;
case MENU_LABEL_VIDEO_ROTATION: case MENU_LABEL_VIDEO_ROTATION:
snprintf(s, len, snprintf(s, len,

View File

@ -1336,7 +1336,11 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
"implementações de cores libretro."); "implementações de cores libretro.");
break; break;
case MENU_LABEL_VIDEO_REFRESH_RATE_AUTO: case MENU_LABEL_VIDEO_REFRESH_RATE_AUTO:
snprintf(s, len, {
/* Work around C89 limitations */
char u[501];
char t[501];
snprintf(u, sizeof(u),
"Taxa de Atualização Automática.\n" "Taxa de Atualização Automática.\n"
" \n" " \n"
"A taxa de atualização exata de nosso monitor (Hz).\n" "A taxa de atualização exata de nosso monitor (Hz).\n"
@ -1345,7 +1349,8 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
" \n" " \n"
"audio_input_rate = game input rate * display \n" "audio_input_rate = game input rate * display \n"
"refresh rate / game refresh rate\n" "refresh rate / game refresh rate\n"
" \n" " \n");
snprintf(t, sizeof(t),
"Se a implementação não informar valores, \n" "Se a implementação não informar valores, \n"
"valores NTSC serão assumidos por questão de \n" "valores NTSC serão assumidos por questão de \n"
"compatibilidade.\n" "compatibilidade.\n"
@ -1354,6 +1359,9 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
"evitar grande mudanças de pitch. Se o monitor \n" "evitar grande mudanças de pitch. Se o monitor \n"
"não rodar a 60Hz, ou algo próximo a isso, desative\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.");
strlcat(s, u, len);
strlcat(s, t, len);
}
break; break;
case MENU_LABEL_VIDEO_ROTATION: case MENU_LABEL_VIDEO_ROTATION:
snprintf(s, len, snprintf(s, len,

View File

@ -1545,7 +1545,8 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
/* Work around C89 limitations */ /* Work around C89 limitations */
char u[501]; char u[501];
char t[501]; char t[501];
strlcpy(u,
strlcpy(t,
"RetroArch relies on an unique form of\n" "RetroArch relies on an unique form of\n"
"audio/video synchronization where it needs to be\n" "audio/video synchronization where it needs to be\n"
"calibrated against the refresh rate of your\n" "calibrated against the refresh rate of your\n"
@ -1554,8 +1555,8 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
"If you experience any audio crackling or video\n" "If you experience any audio crackling or video\n"
"tearing, usually it means that you need to\n" "tearing, usually it means that you need to\n"
"calibrate the settings. Some choices below:\n" "calibrate the settings. Some choices below:\n"
" \n", sizeof(u)); " \n", sizeof(t));
snprintf(t, sizeof(t), snprintf(u, sizeof(u),
"a) Go to '%s' -> '%s', and enable\n" "a) Go to '%s' -> '%s', and enable\n"
"'Threaded Video'. Refresh rate will not matter\n" "'Threaded Video'. Refresh rate will not matter\n"
"in this mode, framerate will be higher,\n" "in this mode, framerate will be higher,\n"
@ -1568,8 +1569,8 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS), menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS),
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS), menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS),
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO)); menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO));
strlcat(s, u, len);
strlcat(s, t, len); strlcat(s, t, len);
strlcat(s, u, len);
} }
break; break;
case MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: case MENU_LABEL_VALUE_HELP_SCANNING_CONTENT_DESC: