summaryrefslogtreecommitdiff
path: root/glib/gconvert.c
diff options
context:
space:
mode:
Diffstat (limited to 'glib/gconvert.c')
-rw-r--r--glib/gconvert.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/glib/gconvert.c b/glib/gconvert.c
index 7aefe24f3..c0952da59 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -24,9 +24,13 @@
#include "glib.h"
+
+#ifdef ANDROID_STUB
#ifndef G_OS_WIN32
#include <iconv.h>
#endif
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -57,6 +61,8 @@
#include "galias.h"
+typedef void iconv_t;
+
GQuark
g_convert_error_quark (void)
{
@@ -68,12 +74,16 @@ try_conversion (const char *to_codeset,
const char *from_codeset,
iconv_t *cd)
{
+#ifdef ANDROID_STUB
*cd = iconv_open (to_codeset, from_codeset);
if (*cd == (iconv_t)-1 && errno == EINVAL)
return FALSE;
else
return TRUE;
+#else
+ return FALSE;
+#endif
}
static gboolean
@@ -96,8 +106,10 @@ try_to_aliases (const char **to_aliases,
return FALSE;
}
+#ifdef ANDROID_STUB
G_GNUC_INTERNAL extern const char **
_g_charset_get_aliases (const char *canonical_name);
+#endif
/**
* g_iconv_open:
@@ -118,6 +130,7 @@ GIConv
g_iconv_open (const gchar *to_codeset,
const gchar *from_codeset)
{
+#ifdef ANDROID_STUB
iconv_t cd;
if (!try_conversion (to_codeset, from_codeset, &cd))
@@ -146,6 +159,9 @@ g_iconv_open (const gchar *to_codeset,
out:
return (cd == (iconv_t)-1) ? (GIConv)-1 : (GIConv)cd;
+#else
+ return (GIConv) -1;
+#endif
}
/**
@@ -172,9 +188,13 @@ g_iconv (GIConv converter,
gchar **outbuf,
gsize *outbytes_left)
{
+#ifdef ANDROID_STUB
iconv_t cd = (iconv_t)converter;
return iconv (cd, inbuf, inbytes_left, outbuf, outbytes_left);
+#else
+ return -1;
+#endif
}
/**
@@ -195,9 +215,13 @@ g_iconv (GIConv converter,
gint
g_iconv_close (GIConv converter)
{
+#ifdef ANDROID_STUB
iconv_t cd = (iconv_t)converter;
return iconv_close (cd);
+#else
+ return -1;
+#endif
}