nixpkgs/pkgs/games/klavaro/trans_lang_get_similar.patch
2022-03-13 22:39:35 -05:00

72 lines
1.7 KiB
Diff

--- a/src/translation.c (revision 137)
+++ b/src/translation.c (working copy)
@@ -257,23 +257,23 @@
* Private auxiliar function
*/
static gboolean
-trans_lang_get_similar (gchar * test)
+trans_lang_get_similar (gchar ** test)
{
gint i;
gchar aux_code_2[3];
/* Prefer C over en_GB for English variants other than en_GB. (Debian patch 02) */
- if (g_str_has_prefix (test, "en"))
+ if (g_str_has_prefix (*test, "en"))
{
- g_free (test);
- test = g_strdup ("C");
+ g_free (*test);
+ *test = g_strdup ("C");
return (TRUE);
}
- if (g_str_equal (test, "C"))
+ if (g_str_equal (*test, "C"))
return TRUE;
- strncpy (aux_code_2, test, 2);
+ strncpy (aux_code_2, *test, 2);
aux_code_2[2] = '\0';
for (i = 0; i < lang_num; i++)
@@ -280,15 +280,15 @@
{
if (strstr (lang[i].code, aux_code_2))
{
- g_free (test);
- test = g_strdup (lang[i].code);
+ g_free (*test);
+ *test = g_strdup (lang[i].code);
break;
}
}
- if (i == lang_num && g_str_has_prefix (test, "en"))
+ if (i == lang_num && g_str_has_prefix (*test, "en"))
{
- g_free (test);
- test = g_strdup ("C");
+ g_free (*test);
+ *test = g_strdup ("C");
return (TRUE);
}
return (i == lang_num ? FALSE : TRUE);
@@ -356,7 +356,7 @@
lang_ok = (i == 0 ? TRUE : FALSE);
break;
}
- lang_ok = trans_lang_get_similar (tmp_code);
+ lang_ok = trans_lang_get_similar (&tmp_code);
if (lang_ok == TRUE)
break;
g_free (tmp_code);
@@ -368,7 +368,7 @@
tmp_code = g_win32_getlocale ();
lang_ok = trans_lang_is_available (tmp_code);
if (lang_ok == FALSE)
- lang_ok = trans_lang_get_similar (tmp_code);
+ lang_ok = trans_lang_get_similar (&tmp_code);
#endif
}
if (tmp_code == NULL)