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,26 +868,35 @@ 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, {
"udev-Eingabetreiber. \n" /* Work around C89 limitations */
" \n" char u[501];
"Dieser Treiber kann ohne X ausgeführt werden. \n" char t[501];
" \n"
"Er verwende die neue evdev-Joypad-API \n" snprintf(t, sizeof(t),
"für die Joystick-Unterstützung und unterstützt \n" "udev-Eingabetreiber. \n"
"auch Hotplugging und Force-Feedback (wenn das \n" " \n"
"Gerät dies unterstützt). \n" "Dieser Treiber kann ohne X ausgeführt werden. \n"
" \n" " \n"
"Der Treiber liest evdev-Ereigniss für Tastatur- \n" "Er verwende die neue evdev-Joypad-API \n"
"Unterstützung und kann auch mit Tastatur-Callbacks, \n" "für die Joystick-Unterstützung und unterstützt \n"
"Mäusen und Touchpads umgehen. \n" "auch Hotplugging und Force-Feedback (wenn das \n"
" \n" "Gerät dies unterstützt). \n"
"Standardmäßig sind die /dev/input-Dateien in den \n" " \n"
"meisten Linux-Distribution nur für den Root- \n" );
"Benutzer lesbar (mode 600). Du kannst eine udev- \n" snprintf(u, sizeof(u),
"Regel erstellen, die auch den Zugriff für andere \n" "Der Treiber liest evdev-Ereigniss für Tastatur- \n"
"Benutzer erlaubt." "Unterstützung und kann auch mit Tastatur-Callbacks, \n"
); "Mäusen und Touchpads umgehen. \n"
" \n"
"Standardmäßig sind die /dev/input-Dateien in den \n"
"meisten Linux-Distribution nur für den Root- \n"
"Benutzer lesbar (mode 600). Du kannst eine udev- \n"
"Regel erstellen, die auch den Zugriff für andere \n"
"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,32 +931,41 @@ 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, {
"RetroArch utiliza un formato único para \n" /* Work around C89 limitations */
"sincronizar vídeo y sonido que necesita \n" char u[501];
"calibrarse con la frecuencia de \n" char t[501];
"actualización de tu monitor para obtener \n"
"el mejor rendimiento. \n" strlcpy(t,
" \n" "RetroArch utiliza un formato único para \n"
"Si notas cortes de sonido o en la imagen,\n" "sincronizar vídeo y sonido que necesita \n"
"lo normal es que necesites calibrar estos\n" "calibrarse con la frecuencia de \n"
"ajustes. Aquí van algunas opciones:\n" "actualización de tu monitor para obtener \n"
" \n" "el mejor rendimiento. \n"
"a) Ve a '%s' -> '%s' y activa\n" " \n"
"'Vídeo por hilos'. En este modo la tasa\n" "Si notas cortes de sonido o en la imagen,\n"
"de refresco es irrelevante, habrá más fps,\n" "lo normal es que necesites calibrar estos\n"
"'Vídeo multinúcleo'. En este modo la \n" "ajustes. Aquí van algunas opciones:\n"
"frecuencia es irrelevante, habrá más fps,\n" " \n", sizeof(t));
"pero la imagen podría ser menos fluida.\n" snprintf(u, sizeof(u),
"b) Ve a '%s' -> '%s' y busca\n" "a) Ve a '%s' -> '%s' y activa\n"
"'%s'. Deja que se ejecute durante\n" "'Vídeo por hilos'. En este modo la tasa\n"
"2048 fotogramas y selecciona Aceptar.", "de refresco es irrelevante, habrá más fps,\n"
menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS), "'Vídeo multinúcleo'. En este modo la \n"
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS), "frecuencia es irrelevante, habrá más fps,\n"
menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS), "pero la imagen podría ser menos fluida.\n"
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_SETTINGS), "b) Ve a '%s' -> '%s' y busca\n"
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_REFRESH_RATE_AUTO) "'%s'. Deja que se ejecute durante\n"
); "2048 fotogramas y selecciona Aceptar.",
menu_hash_to_str(MENU_LABEL_VALUE_SETTINGS),
menu_hash_to_str(MENU_LABEL_VALUE_VIDEO_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_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,26 +1017,37 @@ 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, {
"Controlador de entrada udev. \n" /* Work around C89 limitations */
" \n" char u[501];
"Este controlador puede funcionar sin X. \n" char t[501];
" \n"
"Utiliza la API más reciente para joypads \n" strlcpy(t,
"evdec para dar compatibilidad con joysticks. \n" "Controlador de entrada udev. \n"
"Permite conexión en caliente y force \n" " \n"
"feedback (si lo admite el dispositivo). \n" "Este controlador puede funcionar sin X. \n"
" \n" " \n"
"El controlador lee los eventos evdev para \n" "Utiliza la API más reciente para joypads \n"
"dar compatibilidad con teclados. También \n" "evdec para dar compatibilidad con joysticks. \n"
"es compatible con retrollamadas de teclado, \n" "Permite conexión en caliente y force \n"
"ratones y pantallas táctiles. \n" "feedback (si lo admite el dispositivo). \n",
" \n" sizeof(t));
"La mayoría de las distros tienen los nodos \n" strlcpy(u,
"/dev/input en modo root-only (modo 600). \n" " \n"
"Puedes configurar una regla udev que los haga \n" "El controlador lee los eventos evdev para \n"
"accesibles fuera de la raíz." "dar compatibilidad con teclados. También \n"
); "es compatible con retrollamadas de teclado, \n"
"ratones y pantallas táctiles. \n"
" \n"
"La mayoría de las distros tienen los nodos \n"
"/dev/input en modo root-only (modo 600). \n"
"Puedes configurar una regla udev que los haga \n"
"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,27 +1533,36 @@ 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, {
"Frecuencia de actualización automática.\n" /* Work around C89 limitations */
" \n" char u[501];
"La frecuencia de actualización precisa del \n" char t[501];
"monitor (en Hz). Se utiliza para calcular \n"
"la frecuencia de entrada de sonido con esta \n" strlcpy(t,
"fórmula: \n" "Frecuencia de actualización automática.\n"
" \n" " \n"
"audio_input_rate = veloc. de entrada de juego \n" "La frecuencia de actualización precisa del \n"
"* frecuencia de actualización de pantalla / \n" "monitor (en Hz). Se utiliza para calcular \n"
"frecuencia de actualización de juego \n" "la frecuencia de entrada de sonido con esta \n"
" \n" "fórmula: \n"
"Si la implementación no indica un valor, se \n" " \n"
"asumirá de forma predeterminada el sistema \n" "audio_input_rate = veloc. de entrada de juego \n"
"NTSC por compatibilidad.\n" "* frecuencia de actualización de pantalla / \n"
" \n" "frecuencia de actualización de juego \n"
"Este valor debería ser lo más similar a 60Hz \n" " \n", sizeof(t));
"para evitar cambios en el tono. Si tu \n" strlcpy(u,
"monitor no funciona a 60Hz o similar, \n" "Si la implementación no indica un valor, se \n"
"desactiva la sincronía vertical y deja \n" "asumirá de forma predeterminada el sistema \n"
"esta opción en su valor predeterminado."); "NTSC por compatibilidad.\n"
" \n"
"Este valor debería ser lo más similar a 60Hz \n"
"para evitar cambios en el tono. Si tu \n"
"monitor no funciona a 60Hz o similar, \n"
"desactiva la sincronía vertical y deja \n"
"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,24 +1336,32 @@ 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, {
"Taxa de Atualização Automática.\n" /* Work around C89 limitations */
" \n" char u[501];
"A taxa de atualização exata de nosso monitor (Hz).\n" char t[501];
"É usada para calcular a taxa de entrada de áudio \n" snprintf(u, sizeof(u),
"com a fórmula: \n" "Taxa de Atualização Automática.\n"
" \n" " \n"
"audio_input_rate = game input rate * display \n" "A taxa de atualização exata de nosso monitor (Hz).\n"
"refresh rate / game refresh rate\n" "É usada para calcular a taxa de entrada de áudio \n"
" \n" "com a fórmula: \n"
"Se a implementação não informar valores, \n" " \n"
"valores NTSC serão assumidos por questão de \n" "audio_input_rate = game input rate * display \n"
"compatibilidade.\n" "refresh rate / game refresh rate\n"
" \n" " \n");
"Esse valor deve ficar próximo de 60Hz para \n" snprintf(t, sizeof(t),
"evitar grande mudanças de pitch. Se o monitor \n" "Se a implementação não informar valores, \n"
"não rodar a 60Hz, ou algo próximo a isso, desative\n" "valores NTSC serão assumidos por questão de \n"
"o VSync, e deixe-o com valores padrão."); "compatibilidade.\n"
" \n"
"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.");
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: