summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaikumar Ganesh <jaikumar@google.com>2010-08-27 19:47:52 -0700
committerJaikumar Ganesh <jaikumar@google.com>2010-08-27 19:49:09 -0700
commit938ebb1b1ab5c724b5b679324aa94836d23aadef (patch)
tree6bc77b2a90b3d34f1a245e8046f142c9a83950b8
parentff61d7bb269918a6ae663bfaccaf96fb6f19c1bb (diff)
downloadglib-938ebb1b1ab5c724b5b679324aa94836d23aadef.tar.gz
Reverse meaning of ANDROID_STUB C flag.
Also add defaults so that bluetoothd doesn't crash. Change-Id: Icd6efbdc7522ea8e92bf7ac8803b136b5d41b8ca
-rwxr-xr-xglib/Android.mk3
-rw-r--r--glib/galiasdef.c8
-rw-r--r--glib/gconvert.c12
-rw-r--r--glib/gmain.c2
-rw-r--r--glib/gstrfuncs.c4
-rw-r--r--glib/gutf8.c15
-rw-r--r--glib/gutils.c6
7 files changed, 28 insertions, 22 deletions
diff --git a/glib/Android.mk b/glib/Android.mk
index e74a9cdd7..2a6045f39 100755
--- a/glib/Android.mk
+++ b/glib/Android.mk
@@ -40,6 +40,9 @@ LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/../ \
$(LOCAL_PATH)
+LOCAL_CFLAGS:= \
+ -DANDROID_STUB
+
LOCAL_MODULE:=libglib
include $(BUILD_SHARED_LIBRARY)
diff --git a/glib/galiasdef.c b/glib/galiasdef.c
index c8ba51c3d..f5d8a2529 100644
--- a/glib/galiasdef.c
+++ b/glib/galiasdef.c
@@ -459,7 +459,7 @@ extern __typeof (g_completion_set_compare) g_completion_set_compare __attribute(
#undef g_get_filename_charsets
extern __typeof (g_get_filename_charsets) g_get_filename_charsets __attribute((alias("IA__g_get_filename_charsets"), visibility("default")));
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#undef g_convert
extern __typeof (g_convert) g_convert __attribute((alias("IA__g_convert"), visibility("default")));
#endif
@@ -467,7 +467,7 @@ extern __typeof (g_convert) g_convert __attribute((alias("IA__g_convert"), visib
#undef g_convert_error_quark
extern __typeof (g_convert_error_quark) g_convert_error_quark __attribute((alias("IA__g_convert_error_quark"), visibility("default")));
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#undef g_convert_with_fallback
extern __typeof (g_convert_with_fallback) g_convert_with_fallback __attribute((alias("IA__g_convert_with_fallback"), visibility("default")));
@@ -2707,7 +2707,7 @@ extern __typeof (g_ascii_digit_value) g_ascii_digit_value __attribute((alias("IA
#undef g_ascii_dtostr
extern __typeof (g_ascii_dtostr) g_ascii_dtostr __attribute((alias("IA__g_ascii_dtostr"), visibility("default")));
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#undef g_ascii_formatd
extern __typeof (g_ascii_formatd) g_ascii_formatd __attribute((alias("IA__g_ascii_formatd"), visibility("default")));
#endif
@@ -2715,7 +2715,7 @@ extern __typeof (g_ascii_formatd) g_ascii_formatd __attribute((alias("IA__g_asci
#undef g_ascii_strdown
extern __typeof (g_ascii_strdown) g_ascii_strdown __attribute((alias("IA__g_ascii_strdown"), visibility("default")));
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#undef g_ascii_strtod
extern __typeof (g_ascii_strtod) g_ascii_strtod __attribute((alias("IA__g_ascii_strtod"), visibility("default")));
#endif
diff --git a/glib/gconvert.c b/glib/gconvert.c
index c0952da59..2f4d54f76 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -25,7 +25,7 @@
#include "glib.h"
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#ifndef G_OS_WIN32
#include <iconv.h>
#endif
@@ -74,7 +74,7 @@ try_conversion (const char *to_codeset,
const char *from_codeset,
iconv_t *cd)
{
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
*cd = iconv_open (to_codeset, from_codeset);
if (*cd == (iconv_t)-1 && errno == EINVAL)
@@ -106,7 +106,7 @@ try_to_aliases (const char **to_aliases,
return FALSE;
}
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
G_GNUC_INTERNAL extern const char **
_g_charset_get_aliases (const char *canonical_name);
#endif
@@ -130,7 +130,7 @@ GIConv
g_iconv_open (const gchar *to_codeset,
const gchar *from_codeset)
{
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
iconv_t cd;
if (!try_conversion (to_codeset, from_codeset, &cd))
@@ -188,7 +188,7 @@ g_iconv (GIConv converter,
gchar **outbuf,
gsize *outbytes_left)
{
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
iconv_t cd = (iconv_t)converter;
return iconv (cd, inbuf, inbytes_left, outbuf, outbytes_left);
@@ -215,7 +215,7 @@ g_iconv (GIConv converter,
gint
g_iconv_close (GIConv converter)
{
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
iconv_t cd = (iconv_t)converter;
return iconv_close (cd);
diff --git a/glib/gmain.c b/glib/gmain.c
index 61fcdded5..47e124b30 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -3665,7 +3665,7 @@ g_child_watch_source_init_single (void)
sigaction (SIGCHLD, &action, NULL);
}
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
G_GNUC_NORETURN static gpointer
#else
void
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index b076aa9ee..ed885fc6f 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -428,7 +428,7 @@ g_ascii_strtod (const gchar *nptr,
fail_pos = NULL;
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
@@ -645,7 +645,7 @@ g_ascii_formatd (gchar *buffer,
_g_snprintf (buffer, buf_len, format, d);
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
diff --git a/glib/gutf8.c b/glib/gutf8.c
index 9f98cc172..a786aade4 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -22,7 +22,7 @@
#include "config.h"
#include <stdlib.h>
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#ifdef HAVE_CODESET
#include <langinfo.h>
#endif
@@ -38,7 +38,7 @@
#undef STRICT
#endif
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#include "libcharset/libcharset.h"
#endif
@@ -447,7 +447,7 @@ get_alias_hash (void)
/* As an abuse of the alias table, the following routines gets
* the charsets that are aliases for the canonical name.
*/
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
G_GNUC_INTERNAL const char **
_g_charset_get_aliases (const char *canonical_name)
{
@@ -477,11 +477,10 @@ g_utf8_get_charset_internal (const char *raw_data,
* a lock, but has a memory leak and a missing memory
* barrier, so we lock for it
*/
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
G_LOCK (aliases);
charset = _g_locale_charset_unalias (raw_data);
G_UNLOCK (aliases);
-#endif
if (charset && *charset)
{
@@ -492,6 +491,7 @@ g_utf8_get_charset_internal (const char *raw_data,
else
return FALSE;
}
+#endif
/* Assume this for compatibility at present. */
*a = "US-ASCII";
@@ -553,7 +553,7 @@ g_get_charset (G_CONST_RETURN char **charset)
g_static_private_set (&cache_private, cache, charset_cache_free);
}
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
raw = _g_locale_charset_raw ();
if (!(cache->raw && strcmp (cache->raw, raw) == 0))
@@ -566,6 +566,9 @@ g_get_charset (G_CONST_RETURN char **charset)
cache->is_utf8 = g_utf8_get_charset_internal (raw, &new_charset);
cache->charset = g_strdup (new_charset);
}
+#else
+ cache->charset = g_strdup("UTF-8");
+ cache->is_utf8 = TRUE;
#endif
if (charset)
*charset = cache->charset;
diff --git a/glib/gutils.c b/glib/gutils.c
index 8228babae..c8006e950 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -116,7 +116,7 @@
#include <CoreServices/CoreServices.h>
#endif
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
#ifdef HAVE_CODESET
#include <langinfo.h>
#endif
@@ -1681,7 +1681,7 @@ g_get_any_init_do (void)
while (!pw);
# endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
-#ifdef ANDROID_STUB
+#ifndef ANDROID_STUB
if (!pw)
{
setpwent ();
@@ -1693,7 +1693,7 @@ g_get_any_init_do (void)
{
g_user_name = g_strdup (pw->pw_name);
- #ifdef ANDROID_STUB
+ #ifndef ANDROID_STUB
if (pw->pw_gecos && *pw->pw_gecos != '\0')
{
gchar **gecos_fields;