source: gs2-extensions/gnome-lib/trunk/src/packages/android-patches/glib-android.patch

Last change on this file was 26787, checked in by davidb, 11 years ago

Files that patch code fro Android NDK

File size: 9.9 KB
RevLine 
[26787]1--- glib-2.28.1/glib/gstrfuncs.c 2011-02-16 10:55:33.000000000 +0800
2+++ aglib-2.28.1/glib/gstrfuncs.c 2011-03-21 16:33:18.000000000 +0800
3@@ -442,8 +442,12 @@ g_ascii_strtod (const gchar *nptr,
4
5 fail_pos = NULL;
6
7+#ifdef __ANDROID__
8+ decimal_point = ".";
9+#else
10 locale_data = localeconv ();
11 decimal_point = locale_data->decimal_point;
12+#endif
13 decimal_point_len = strlen (decimal_point);
14
15 g_assert (decimal_point_len != 0);
16@@ -656,8 +660,12 @@ g_ascii_formatd (gchar *buffer,
17
18 _g_snprintf (buffer, buf_len, format, d);
19
20+#ifdef __ANDROID__
21+ decimal_point = ".";
22+#else
23 locale_data = localeconv ();
24 decimal_point = locale_data->decimal_point;
25+#endif
26 decimal_point_len = strlen (decimal_point);
27
28 g_assert (decimal_point_len != 0);
29--- glib-2.28.1/glib/gutils.c 2011-02-11 23:23:13.000000000 +0800
30+++ aglib-2.28.1/glib/gutils.c 2011-03-21 17:08:09.000000000 +0800
31@@ -29,6 +29,9 @@
32 */
33
34 #include "config.h"
35+#ifdef __ANDROID__
36+#undef HAVE_PWD_H
37+#endif
38
39 #ifdef HAVE_UNISTD_H
40 #include <unistd.h>
41--- glib-2.28.1/gio/libasyncns/asyncns.c 2010-04-13 21:33:16.000000000 +0800
42+++ aglib-2.28.1/gio/libasyncns/asyncns.c 2011-03-21 17:11:43.000000000 +0800
43@@ -18,6 +18,30 @@
44 <http://www.gnu.org/licenses/>.
45 ***/
46
47+#ifdef __ANDROID__
48+typedef struct {
49+ unsigned id :16; /*%< query identification number */
50+ /* fields in third byte */
51+ unsigned rd :1; /*%< recursion desired */
52+ unsigned tc :1; /*%< truncated message */
53+ unsigned aa :1; /*%< authoritive answer */
54+ unsigned opcode :4; /*%< purpose of message */
55+ unsigned qr :1; /*%< response flag */
56+ /* fields in fourth byte */
57+ unsigned rcode :4; /*%< response code */
58+ unsigned cd: 1; /*%< checking disabled by resolver */
59+ unsigned ad: 1; /*%< authentic data from named */
60+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
61+ unsigned ra :1; /*%< recursion available */
62+ /* remaining bytes */
63+ unsigned qdcount :16; /*%< number of question entries */
64+ unsigned ancount :16; /*%< number of answer entries */
65+ unsigned nscount :16; /*%< number of authority entries */
66+ unsigned arcount :16; /*%< number of resource entries */
67+} HEADER;
68+#endif
69+
70+
71 #ifdef HAVE_CONFIG_H
72 #include "g-asyncns.h"
73 #endif
74@@ -57,6 +81,10 @@
75 #include <inttypes.h>
76 #endif
77
78+#ifdef __ANDROID__
79+#undef HAVE_SYS_PRCTL_H
80+#endif
81+
82 #ifdef HAVE_SYS_PRCTL_H
83 #include <sys/prctl.h>
84 #endif
85--- glib-2.28.1/gio/gresolver.c 2011-02-11 23:23:11.000000000 +0800
86+++ aglib-2.28.1/gio/gresolver.c 2011-03-21 16:42:18.000000000 +0800
87@@ -20,6 +20,61 @@
88 * Boston, MA 02111-1307, USA.
89 */
90
91+#ifdef __ANDROID__
92+/*%
93+ * Inline versions of get/put short/long. Pointer is advanced.
94+ */
95+#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
96+#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
97+#define NS_GET16(s, cp) do { \
98+ register const u_char *t_cp = (const u_char *)(cp); \
99+ (s) = ((u_int16_t)t_cp[0] << 8) \
100+ | ((u_int16_t)t_cp[1]) \
101+ ; \
102+ (cp) += NS_INT16SZ; \
103+} while (0)
104+#define NS_GET32(l, cp) do { \
105+ register const u_char *t_cp = (const u_char *)(cp); \
106+ (l) = ((u_int32_t)t_cp[0] << 24) \
107+ | ((u_int32_t)t_cp[1] << 16) \
108+ | ((u_int32_t)t_cp[2] << 8) \
109+ | ((u_int32_t)t_cp[3]) \
110+ ; \
111+ (cp) += NS_INT32SZ; \
112+} while (0)
113+
114+
115+#define GETSHORT NS_GET16
116+#define GETLONG NS_GET32
117+
118+#define ns_c_in 1 /*%< Internet. */
119+#define ns_t_srv 33 /*%< Internet. */
120+#define C_IN ns_c_in
121+#define T_SRV ns_t_srv
122+
123+typedef struct {
124+ unsigned id :16; /*%< query identification number */
125+ /* fields in third byte */
126+ unsigned rd :1; /*%< recursion desired */
127+ unsigned tc :1; /*%< truncated message */
128+ unsigned aa :1; /*%< authoritive answer */
129+ unsigned opcode :4; /*%< purpose of message */
130+ unsigned qr :1; /*%< response flag */
131+ /* fields in fourth byte */
132+ unsigned rcode :4; /*%< response code */
133+ unsigned cd: 1; /*%< checking disabled by resolver */
134+ unsigned ad: 1; /*%< authentic data from named */
135+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
136+ unsigned ra :1; /*%< recursion available */
137+ /* remaining bytes */
138+ unsigned qdcount :16; /*%< number of question entries */
139+ unsigned ancount :16; /*%< number of answer entries */
140+ unsigned nscount :16; /*%< number of authority entries */
141+ unsigned arcount :16; /*%< number of resource entries */
142+} HEADER;
143+#endif
144+
145+
146 #include "config.h"
147 #include <glib.h>
148 #include "glibintl.h"
149--- glib-2.28.1/gio/gthreadedresolver.c 2011-02-11 23:23:12.000000000 +0800
150+++ aglib-2.28.1/gio/gthreadedresolver.c 2011-03-21 16:44:29.000000000 +0800
151@@ -20,6 +20,60 @@
152 * Boston, MA 02111-1307, USA.
153 */
154
155+#ifdef __ANDROID__
156+/*%
157+ * Inline versions of get/put short/long. Pointer is advanced.
158+ */
159+#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
160+#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
161+#define NS_GET16(s, cp) do { \
162+ register const u_char *t_cp = (const u_char *)(cp); \
163+ (s) = ((u_int16_t)t_cp[0] << 8) \
164+ | ((u_int16_t)t_cp[1]) \
165+ ; \
166+ (cp) += NS_INT16SZ; \
167+} while (0)
168+#define NS_GET32(l, cp) do { \
169+ register const u_char *t_cp = (const u_char *)(cp); \
170+ (l) = ((u_int32_t)t_cp[0] << 24) \
171+ | ((u_int32_t)t_cp[1] << 16) \
172+ | ((u_int32_t)t_cp[2] << 8) \
173+ | ((u_int32_t)t_cp[3]) \
174+ ; \
175+ (cp) += NS_INT32SZ; \
176+} while (0)
177+
178+
179+#define GETSHORT NS_GET16
180+#define GETLONG NS_GET32
181+
182+#define ns_c_in 1 /*%< Internet. */
183+#define ns_t_srv 33 /*%< Internet. */
184+#define C_IN ns_c_in
185+#define T_SRV ns_t_srv
186+
187+ typedef struct {
188+ unsigned id :16; /*%< query identification number */
189+ /* fields in third byte */
190+ unsigned rd :1; /*%< recursion desired */
191+ unsigned tc :1; /*%< truncated message */
192+ unsigned aa :1; /*%< authoritive answer */
193+ unsigned opcode :4; /*%< purpose of message */
194+ unsigned qr :1; /*%< response flag */
195+ /* fields in fourth byte */
196+ unsigned rcode :4; /*%< response code */
197+ unsigned cd: 1; /*%< checking disabled by resolver */
198+ unsigned ad: 1; /*%< authentic data from named */
199+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
200+ unsigned ra :1; /*%< recursion available */
201+ /* remaining bytes */
202+ unsigned qdcount :16; /*%< number of question entries */
203+ unsigned ancount :16; /*%< number of answer entries */
204+ unsigned nscount :16; /*%< number of authority entries */
205+ unsigned arcount :16; /*%< number of resource entries */
206+ } HEADER;
207+#endif
208+
209 #include "config.h"
210 #include <glib.h>
211 #include "glibintl.h"
212--- glib-2.28.1/gio/gunixresolver.c 2011-02-11 23:23:12.000000000 +0800
213+++ aglib-2.28.1/gio/gunixresolver.c 2011-03-21 16:45:01.000000000 +0800
214@@ -20,6 +20,62 @@
215 * Boston, MA 02111-1307, USA.
216 */
217
218+#ifdef __ANDROID__
219+/*%
220+ * Inline versions of get/put short/long. Pointer is advanced.
221+ */
222+#define NS_INT32SZ 4 /*%< #/bytes of data in a u_int32_t */
223+#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
224+#define NS_GET16(s, cp) do { \
225+ register const u_char *t_cp = (const u_char *)(cp); \
226+ (s) = ((u_int16_t)t_cp[0] << 8) \
227+ | ((u_int16_t)t_cp[1]) \
228+ ; \
229+ (cp) += NS_INT16SZ; \
230+} while (0)
231+#define NS_GET32(l, cp) do { \
232+ register const u_char *t_cp = (const u_char *)(cp); \
233+ (l) = ((u_int32_t)t_cp[0] << 24) \
234+ | ((u_int32_t)t_cp[1] << 16) \
235+ | ((u_int32_t)t_cp[2] << 8) \
236+ | ((u_int32_t)t_cp[3]) \
237+ ; \
238+ (cp) += NS_INT32SZ; \
239+} while (0)
240+
241+
242+#define GETSHORT NS_GET16
243+#define GETLONG NS_GET32
244+
245+#define ns_c_in 1 /*%< Internet. */
246+#define ns_t_srv 33 /*%< Internet. */
247+#define C_IN ns_c_in
248+#define T_SRV ns_t_srv
249+
250+ typedef struct {
251+ unsigned id :16; /*%< query identification number */
252+ /* fields in third byte */
253+ unsigned rd :1; /*%< recursion desired */
254+ unsigned tc :1; /*%< truncated message */
255+ unsigned aa :1; /*%< authoritive answer */
256+ unsigned opcode :4; /*%< purpose of message */
257+ unsigned qr :1; /*%< response flag */
258+ /* fields in fourth byte */
259+ unsigned rcode :4; /*%< response code */
260+ unsigned cd: 1; /*%< checking disabled by resolver */
261+ unsigned ad: 1; /*%< authentic data from named */
262+ unsigned unused :1; /*%< unused bits (MBZ as of 4.9.3a3) */
263+ unsigned ra :1; /*%< recursion available */
264+ /* remaining bytes */
265+ unsigned qdcount :16; /*%< number of question entries */
266+ unsigned ancount :16; /*%< number of answer entries */
267+ unsigned nscount :16; /*%< number of authority entries */
268+ unsigned arcount :16; /*%< number of resource entries */
269+ } HEADER;
270+#endif
271+
272+
273+
274 #include "config.h"
275 #include <glib.h>
276 #include "glibintl.h"
277--- glib-2.28.1/gio/glocalfileinfo.c 2011-02-11 23:23:11.000000000 +0800
278+++ aglib-2.28.1/gio/glocalfileinfo.c 2011-03-21 16:55:10.000000000 +0800
279@@ -1096,7 +1096,11 @@ lookup_uid_data (uid_t uid)
280 if (pwbufp->pw_name != NULL && pwbufp->pw_name[0] != 0)
281 data->user_name = convert_pwd_string_to_utf8 (pwbufp->pw_name);
282
283+#ifdef __ANDROID__
284+ gecos = NULL;
285+#else
286 gecos = pwbufp->pw_gecos;
287+#endif
288
289 if (gecos)
290 {
291--- glib-2.28.1/gio/ginetaddress.c 2011-02-11 23:23:11.000000000 +0800
292+++ aglib-2.28.1/gio/ginetaddress.c 2011-03-21 16:55:45.000000000 +0800
293@@ -20,6 +20,27 @@
294 * Authors: Christian Kellner <address@hidden>
295 * Samuel Cormier-Iijima <address@hidden>
296 */
297+#ifdef __ANDROID__
298+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
299+ (IN6_IS_ADDR_MULTICAST(a) \
300+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
301+
302+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
303+ (IN6_IS_ADDR_MULTICAST(a) \
304+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
305+
306+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
307+ (IN6_IS_ADDR_MULTICAST(a) \
308+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
309+
310+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
311+ (IN6_IS_ADDR_MULTICAST(a) \
312+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
313+
314+#define IN6_IS_ADDR_MC_GLOBAL(a) \
315+ (IN6_IS_ADDR_MULTICAST(a) \
316+ && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
317+#endif
318
319 #include <config.h>
320
Note: See TracBrowser for help on using the repository browser.