mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 14:36:16 +01:00
gdatetime: Fix locale-changing code
As pointed out by Ryan Lortie, the code didn't actually ever switch back to the old locale. https://bugzilla.gnome.org/show_bug.cgi?id=658104
This commit is contained in:
parent
9860c83ad6
commit
f091c6a99b
@ -849,7 +849,7 @@ GDateTime *__dt = g_date_time_new_local (2009, 10, 24, 0, 0, 0);\
|
|||||||
static void
|
static void
|
||||||
test_modifiers (void)
|
test_modifiers (void)
|
||||||
{
|
{
|
||||||
const gchar *oldlocale;
|
gchar *oldlocale;
|
||||||
|
|
||||||
TEST_PRINTF_DATE (2009, 1, 1, "%d", "01");
|
TEST_PRINTF_DATE (2009, 1, 1, "%d", "01");
|
||||||
TEST_PRINTF_DATE (2009, 1, 1, "%_d", " 1");
|
TEST_PRINTF_DATE (2009, 1, 1, "%_d", " 1");
|
||||||
@ -892,7 +892,8 @@ test_modifiers (void)
|
|||||||
TEST_PRINTF_TIME ( 1, 0, 0, "%-k", "1");
|
TEST_PRINTF_TIME ( 1, 0, 0, "%-k", "1");
|
||||||
TEST_PRINTF_TIME ( 1, 0, 0, "%0k", "01");
|
TEST_PRINTF_TIME ( 1, 0, 0, "%0k", "01");
|
||||||
|
|
||||||
oldlocale = setlocale (LC_ALL, "fa_IR.UTF-8");
|
oldlocale = g_strdup (setlocale (LC_ALL, NULL));
|
||||||
|
setlocale (LC_ALL, "fa_IR.utf-8");
|
||||||
if (strstr (setlocale (LC_ALL, NULL), "fa_IR") != NULL)
|
if (strstr (setlocale (LC_ALL, NULL), "fa_IR") != NULL)
|
||||||
{
|
{
|
||||||
TEST_PRINTF_TIME (23, 0, 0, "%OH", "\333\262\333\263");
|
TEST_PRINTF_TIME (23, 0, 0, "%OH", "\333\262\333\263");
|
||||||
@ -910,6 +911,7 @@ test_modifiers (void)
|
|||||||
else
|
else
|
||||||
g_test_message ("locale fa_IR not available, skipping O modifier tests");
|
g_test_message ("locale fa_IR not available, skipping O modifier tests");
|
||||||
setlocale (LC_ALL, oldlocale);
|
setlocale (LC_ALL, oldlocale);
|
||||||
|
g_free (oldlocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user