Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
diff -Nur glib-2.34.3-orig/gio/android-dep.h glib-2.34.3/gio/android-dep.h
--- glib-2.34.3-orig/gio/android-dep.h 1970-01-01 08:00:00.000000000 +0800
+++ glib-2.34.3/gio/android-dep.h 2013-04-01 12:30:13.927975756 +0800
@@ -0,0 +1,169 @@
+#ifndef ANDROID-DEP_H
+#define ANDROID-DEP_H
+
+#ifdef __ANDROID__
+
+#define dn_skipname __dn_skipname
+int dn_skipname(const u_char *, const u_char *);
+
+typedef enum __ns_type {
+ ns_t_invalid = 0, /*%< Cookie. */
+ ns_t_a = 1, /*%< Host address. */
+ ns_t_ns = 2, /*%< Authoritative server. */
+ ns_t_md = 3, /*%< Mail destination. */
+ ns_t_mf = 4, /*%< Mail forwarder. */
+ ns_t_cname = 5, /*%< Canonical name. */
+ ns_t_soa = 6, /*%< Start of authority zone. */
+ ns_t_mb = 7, /*%< Mailbox domain name. */
+ ns_t_mg = 8, /*%< Mail group member. */
+ ns_t_mr = 9, /*%< Mail rename name. */
+ ns_t_null = 10, /*%< Null resource record. */
+ ns_t_wks = 11, /*%< Well known service. */
+ ns_t_ptr = 12, /*%< Domain name pointer. */
+ ns_t_hinfo = 13, /*%< Host information. */
+ ns_t_minfo = 14, /*%< Mailbox information. */
+ ns_t_mx = 15, /*%< Mail routing information. */
+ ns_t_txt = 16, /*%< Text strings. */
+ ns_t_rp = 17, /*%< Responsible person. */
+ ns_t_afsdb = 18, /*%< AFS cell database. */
+ ns_t_x25 = 19, /*%< X_25 calling address. */
+ ns_t_isdn = 20, /*%< ISDN calling address. */
+ ns_t_rt = 21, /*%< Router. */
+ ns_t_nsap = 22, /*%< NSAP address. */
+ ns_t_nsap_ptr = 23, /*%< Reverse NSAP lookup (deprecated). */
+ ns_t_sig = 24, /*%< Security signature. */
+ ns_t_key = 25, /*%< Security key. */
+ ns_t_px = 26, /*%< X.400 mail mapping. */
+ ns_t_gpos = 27, /*%< Geographical position (withdrawn). */
+ ns_t_aaaa = 28, /*%< Ip6 Address. */
+ ns_t_loc = 29, /*%< Location Information. */
+ ns_t_nxt = 30, /*%< Next domain (security). */
+ ns_t_eid = 31, /*%< Endpoint identifier. */
+ ns_t_nimloc = 32, /*%< Nimrod Locator. */
+ ns_t_srv = 33, /*%< Server Selection. */
+ ns_t_atma = 34, /*%< ATM Address */
+ ns_t_naptr = 35, /*%< Naming Authority PoinTeR */
+ ns_t_kx = 36, /*%< Key Exchange */
+ ns_t_cert = 37, /*%< Certification record */
+ ns_t_a6 = 38, /*%< IPv6 address (deprecated, use ns_t_aaaa) */
+ ns_t_dname = 39, /*%< Non-terminal DNAME (for IPv6) */
+ ns_t_sink = 40, /*%< Kitchen sink (experimentatl) */
+ ns_t_opt = 41, /*%< EDNS0 option (meta-RR) */
+ ns_t_apl = 42, /*%< Address prefix list (RFC3123) */
+ ns_t_tkey = 249, /*%< Transaction key */
+ ns_t_tsig = 250, /*%< Transaction signature. */
+ ns_t_ixfr = 251, /*%< Incremental zone transfer. */
+ ns_t_axfr = 252, /*%< Transfer zone of authority. */
+ ns_t_mailb = 253, /*%< Transfer mailbox records. */
+ ns_t_maila = 254, /*%< Transfer mail agent records. */
+ ns_t_any = 255, /*%< Wildcard match. */
+ ns_t_zxfr = 256, /*%< BIND-specific, nonstandard. */
+ ns_t_max = 65536
+} ns_type;
+
+/*%
+ * Values for class field
+ */
+typedef enum __ns_class {
+ ns_c_invalid = 0, /*%< Cookie. */
+ ns_c_in = 1, /*%< Internet. */
+ ns_c_2 = 2, /*%< unallocated/unsupported. */
+ ns_c_chaos = 3, /*%< MIT Chaos-net. */
+ ns_c_hs = 4, /*%< MIT Hesiod. */
+ /* Query class values which do not appear in resource records */
+ ns_c_none = 254, /*%< for prereq. sections in update requests */
+ ns_c_any = 255, /*%< Wildcard match. */
+ ns_c_max = 65536
+} ns_class;
+
+#define T_NS ns_t_ns
+#define T_SOA ns_t_soa
+#define T_MX ns_t_mx
+#define T_TXT ns_t_txt
+#define C_IN ns_c_in
+typedef struct {
+ unsigned id :16; /*%< query identification number */
+ /* fields in third byte */
+ unsigned rd :1; /*%< recursion desired */
+ unsigned tc :1; /*%< truncated message */
+ unsigned aa :1; /*%< authoritive answer */
+ unsigned opcode :4; /*%< purpose of message */
+ unsigned qr :1; /*%< response flag */
+ /* fields in fourth byte */
+ unsigned rcode :4; /*%< response code */
+ unsigned cd: 1; /*%< checking disabled by resolver */
+ unsigned ad: 1; /*%< authentic data from named */
+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
+ unsigned ra :1; /*%< recursion available */
+ /* remaining bytes */
+ unsigned qdcount :16; /*%< number of question entries */
+ unsigned ancount :16; /*%< number of answer entries */
+ unsigned nscount :16; /*%< number of authority entries */
+ unsigned arcount :16; /*%< number of resource entries */
+} HEADER;
+
+/*
+ * Define constants based on RFC 883, RFC 1034, RFC 1035
+ */
+#define NS_PACKETSZ 512 /*%< default UDP packet size */
+#define NS_MAXDNAME 1025 /*%< maximum domain name */
+#define NS_MAXMSG 65535 /*%< maximum message size */
+#define NS_MAXCDNAME 255 /*%< maximum compressed domain name */
+#define NS_MAXLABEL 63 /*%< maximum length of domain label */
+#define NS_HFIXEDSZ 12 /*%< #/bytes of fixed data in header */
+#define NS_QFIXEDSZ 4 /*%< #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ 10 /*%< #/bytes of fixed data in r record */
+#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
+#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
+#define NS_INT8SZ 1 /*%< #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ 4 /*%< IPv4 T_A */
+#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
+#define NS_CMPRSFLGS 0xc0 /*%< Flag bits indicating name compression. */
+#define NS_DEFAULTPORT 53 /*%< For both TCP and UDP. */
+
+#define GETSHORT NS_GET16
+#define GETLONG NS_GET32
+#define PUTSHORT NS_PUT16
+#define PUTLONG NS_PUT32
+/*%
+ * Inline versions of get/put short/long. Pointer is advanced.
+ */
+#define NS_GET16(s, cp) do { \
+ register const u_char *t_cp = (const u_char *)(cp); \
+ (s) = ((u_int16_t)t_cp[0] << 8) \
+ | ((u_int16_t)t_cp[1]) \
+ ; \
+ (cp) += NS_INT16SZ; \
+} while (0)
+
+#define NS_GET32(l, cp) do { \
+ register const u_char *t_cp = (const u_char *)(cp); \
+ (l) = ((u_int32_t)t_cp[0] << 24) \
+ | ((u_int32_t)t_cp[1] << 16) \
+ | ((u_int32_t)t_cp[2] << 8) \
+ | ((u_int32_t)t_cp[3]) \
+ ; \
+ (cp) += NS_INT32SZ; \
+} while (0)
+
+#define NS_PUT16(s, cp) do { \
+ register u_int16_t t_s = (u_int16_t)(s); \
+ register u_char *t_cp = (u_char *)(cp); \
+ *t_cp++ = t_s >> 8; \
+ *t_cp = t_s; \
+ (cp) += NS_INT16SZ; \
+} while (0)
+
+#define NS_PUT32(l, cp) do { \
+ register u_int32_t t_l = (u_int32_t)(l); \
+ register u_char *t_cp = (u_char *)(cp); \
+ *t_cp++ = t_l >> 24; \
+ *t_cp++ = t_l >> 16; \
+ *t_cp++ = t_l >> 8; \
+ *t_cp = t_l; \
+ (cp) += NS_INT32SZ; \
+} while (0)
+
+#endif /* __ANDROID__ */
+
+#endif
diff -Nur glib-2.34.3-orig/gio/glocalfileinfo.c glib-2.34.3/gio/glocalfileinfo.c
--- glib-2.34.3-orig/gio/glocalfileinfo.c 2012-11-27 00:52:48.000000000 +0800
+++ glib-2.34.3/gio/glocalfileinfo.c 2013-04-01 12:33:18.661975295 +0800
@@ -1094,6 +1094,7 @@
if (pwbufp->pw_name != NULL && pwbufp->pw_name[0] != 0)
data->user_name = convert_pwd_string_to_utf8 (pwbufp->pw_name);
+#ifndef __ANDROID__
gecos = pwbufp->pw_gecos;
if (gecos)
@@ -1103,6 +1104,7 @@
*comma = 0;
data->real_name = convert_pwd_string_to_utf8 (gecos);
}
+#endif
}
/* Default fallbacks */
diff -Nur glib-2.34.3-orig/gio/gresolver.c glib-2.34.3/gio/gresolver.c
--- glib-2.34.3-orig/gio/gresolver.c 2012-11-27 00:52:48.000000000 +0800
+++ glib-2.34.3/gio/gresolver.c 2013-04-01 12:31:11.041975613 +0800
@@ -32,6 +32,7 @@
#include "gsimpleasyncresult.h"
#include "gsrvtarget.h"
#include "gthreadedresolver.h"
+#include "android-dep.h"
#ifdef G_OS_UNIX
#include <sys/stat.h>
diff -Nur glib-2.34.3-orig/gio/gthreadedresolver.c glib-2.34.3/gio/gthreadedresolver.c
--- glib-2.34.3-orig/gio/gthreadedresolver.c 2012-11-27 00:52:48.000000000 +0800
+++ glib-2.34.3/gio/gthreadedresolver.c 2013-04-01 12:31:46.654975524 +0800
@@ -33,6 +33,7 @@
#include "gcancellable.h"
#include "gsimpleasyncresult.h"
#include "gsocketaddress.h"
+#include "android-dep.h"
G_DEFINE_TYPE (GThreadedResolver, g_threaded_resolver, G_TYPE_RESOLVER)
diff -Nur glib-2.34.3-orig/glib/gstrfuncs.c glib-2.34.3/glib/gstrfuncs.c
--- glib-2.34.3-orig/glib/gstrfuncs.c 2012-11-20 22:27:12.000000000 +0800
+++ glib-2.34.3/glib/gstrfuncs.c 2013-04-01 12:22:35.085976900 +0800
@@ -703,7 +703,9 @@
gchar *fail_pos;
gdouble val;
+#ifndef __ANDROID__
struct lconv *locale_data;
+#endif
const char *decimal_point;
int decimal_point_len;
const char *p, *decimal_point_pos;
@@ -714,8 +716,12 @@
fail_pos = NULL;
+#ifdef __ANDROID__
+ decimal_point = ".";
+#else
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
+#endif
decimal_point_len = strlen (decimal_point);
g_assert (decimal_point_len != 0);
@@ -907,7 +913,9 @@
return buffer;
#else
+#ifndef __ANDROID__
struct lconv *locale_data;
+#endif
const char *decimal_point;
int decimal_point_len;
gchar *p;
@@ -938,8 +946,12 @@
_g_snprintf (buffer, buf_len, format, d);
+#ifdef __ANDROID__
+ decimal_point = ".";
+#else
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
+#endif
decimal_point_len = strlen (decimal_point);
g_assert (decimal_point_len != 0);
diff -Nur glib-2.34.3-orig/glib/gutils.c glib-2.34.3/glib/gutils.c
--- glib-2.34.3-orig/glib/gutils.c 2012-11-27 00:52:48.000000000 +0800
+++ glib-2.34.3/glib/gutils.c 2013-04-01 12:24:30.389976612 +0800
@@ -653,6 +653,13 @@
#endif
+#ifdef __ANDROID__
+void setpwent(void)
+{
+ return;
+}
+#endif
+
/* HOLDS: g_utils_global_lock */
static void
g_get_any_init_do (void)
@@ -837,6 +844,7 @@
{
g_user_name = g_strdup (pw->pw_name);
+#ifndef __ANDROID__
if (pw->pw_gecos && *pw->pw_gecos != '\0')
{
gchar **gecos_fields;
@@ -850,6 +858,7 @@
g_strfreev (gecos_fields);
g_strfreev (name_parts);
}
+#endif
if (!g_home_dir)
g_home_dir = g_strdup (pw->pw_dir);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment