[PATCH] [glib] Check the return of setlocale for NULL
- From: David Bartley <dtbartle csclub uwaterloo ca>
- To: gtk-devel-list gnome org
- Subject: [PATCH] [glib] Check the return of setlocale for NULL
- Date: Mon, 25 May 2009 20:56:28 -0700
Hi,
On Android/bionic, setlocale always returns NULL, which glib does not
always check for. The following patch corrects this.
-- David
From 723fa97135cf4c4ae4142d6d0d9b70cc5dcc6c6a Mon Sep 17 00:00:00 2001
From: David Bartley <dtb dalek (none)>
Date: Mon, 25 May 2009 20:41:24 -0700
Subject: [PATCH] Check the return of setlocale for NULL
On Android/bionic, setlocale always returns NULL.
---
glib/gstrfuncs.c | 1 +
glib/guniprop.c | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 3aed62c..15d575d 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -3149,6 +3149,7 @@ _g_dgettext_should_translate (void)
*/
if (0 != strcmp (default_domain, "messages") &&
'\0' == *translator_comment &&
+ translate_locale &&
0 != strncmp (translate_locale, "en_", 3) &&
0 != strcmp (translate_locale, "C"))
should_translate = FALSE;
diff --git a/glib/guniprop.c b/glib/guniprop.c
index 8a28513..8356bb9 100644
--- a/glib/guniprop.c
+++ b/glib/guniprop.c
@@ -734,6 +734,9 @@ get_locale_type (void)
const char *locale = setlocale (LC_CTYPE, NULL);
#endif
+ if (!locale)
+ return LOCALE_NORMAL;
+
switch (locale[0])
{
case 'a':
--
1.6.0.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]