mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
gdatetime: Ignore %E modifier on 64-bit big-endian for the moment
This doesn't appear to work reliably on s390x and ppc64, returning the results that were expected without %E or intermittently crashing. It seems that on little-endian 64-bit, the intptr_t returned by the undocumented _NL_TIME_ERA_NUM_ENTRIES correctly has the number of entries in its low-order half (at the time of writing, 0x0000'0000'0000'000b for Japan), but on big-endian 64-bit, it has the number of entries in its high-order half instead (for example 0x0000'000b'0000'0000 for Japan), with the low-order half being all-zero or possibly uninitialized. Making this reliable will require some sort of defined API from glibc. Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3225 Bug-Debian: https://bugs.debian.org/1060735 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
1964c4f833
commit
6de98cc255
@ -558,7 +558,10 @@ get_month_name_abbr_with_day (gint month)
|
||||
|
||||
#endif /* HAVE_LANGINFO_ABALTMON */
|
||||
|
||||
#ifdef HAVE_LANGINFO_ERA
|
||||
/* FIXME: It doesn’t seem to be possible to use ERA on 64-bit big-endian platforms with glibc
|
||||
* in a POSIX-compliant way right now.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/3225 */
|
||||
#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
|
||||
|
||||
#define PREFERRED_ERA_DATE_TIME_FMT nl_langinfo (ERA_D_T_FMT)
|
||||
#define PREFERRED_ERA_DATE_FMT nl_langinfo (ERA_D_FMT)
|
||||
|
@ -1725,7 +1725,7 @@ test_non_utf8_printf (void)
|
||||
TEST_PRINTF ("%%", "%");
|
||||
TEST_PRINTF ("%", "");
|
||||
TEST_PRINTF ("%9", NULL);
|
||||
#ifdef HAVE_LANGINFO_ERA
|
||||
#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
|
||||
TEST_PRINTF ("%Ec", "平成21年10月24日 00時00分00秒");
|
||||
TEST_PRINTF ("%EC", "平成");
|
||||
TEST_PRINTF ("%Ex", "平成21年10月24日");
|
||||
@ -2272,7 +2272,7 @@ test_all_dates (void)
|
||||
static void
|
||||
test_date_time_eras_japan (void)
|
||||
{
|
||||
#ifdef HAVE_LANGINFO_ERA
|
||||
#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
|
||||
gchar *oldlocale;
|
||||
|
||||
oldlocale = g_strdup (setlocale (LC_ALL, NULL));
|
||||
@ -2319,7 +2319,7 @@ test_date_time_eras_japan (void)
|
||||
static void
|
||||
test_date_time_eras_thailand (void)
|
||||
{
|
||||
#ifdef HAVE_LANGINFO_ERA
|
||||
#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
|
||||
gchar *oldlocale;
|
||||
|
||||
oldlocale = g_strdup (setlocale (LC_ALL, NULL));
|
||||
|
Loading…
Reference in New Issue
Block a user