nl_langinfo() portability

Bug #790186 reported by Fneufneu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Light Display Manager
Fix Released
Medium
Unassigned

Bug Description

not all system have _NL_IDENTIFICATION_TERRITORY for nl_langinfo() ex: BSD
my patch let compile on those system but is not a real fix

Revision history for this message
Fneufneu (mickael-maillot) wrote :
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Comitted, thanks!

Changed in lightdm:
status: New → Fix Committed
importance: Undecided → Low
importance: Low → Medium
Revision history for this message
Sebastien Bacher (seb128) wrote :

the fix is in the current version

Changed in lightdm:
status: Fix Committed → Fix Released
Revision history for this message
reed (reed-reedmedia) wrote :

I am confused why comment #3 says is in current version. The latest tarball I see is lightdm-1.2.2.

Also LC_IDENTIFICATION is unknown for me.

I am using this patch to build (but untested):

--- liblightdm-gobject/language.c.orig 2012-05-14 21:00:33.000000000 -0500
+++ liblightdm-gobject/language.c 2012-05-14 21:13:28.000000000 -0500
@@ -229,10 +229,16 @@
         if (locale)
         {
             gchar *current = setlocale (LC_ALL, NULL);
+#ifdef LC_IDENTIFICATION
             setlocale (LC_IDENTIFICATION, locale);
+#endif
             setlocale (LC_MESSAGES, "");

+#ifdef _NL_IDENTIFICATION_LANGUAGE
             gchar *language_en = nl_langinfo (_NL_IDENTIFICATION_LANGUAGE);
+#else
+ gchar *language_en = "Unknown";
+#endif
             if (language_en && strlen (language_en) > 0)
                 priv->name = g_strdup (dgettext ("iso_639_3", language_en));

@@ -272,10 +278,16 @@
         if (locale)
         {
             gchar *current = setlocale (LC_ALL, NULL);
+#ifdef LC_IDENTIFICATION
             setlocale (LC_IDENTIFICATION, locale);
+#endif
             setlocale (LC_MESSAGES, "");

+#ifdef _NL_IDENTIFICATION_TERRITORY
             gchar *country_en = nl_langinfo (_NL_IDENTIFICATION_TERRITORY);
+#else
+ gchar *country_en = "Unknown";
+#endif
             if (country_en && strlen (country_en) > 0 && g_strcmp0 (country_en, "ISO") != 0)
                 priv->territory = g_strdup (dgettext ("iso_3166", country_en));

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.