Initial push
[termux-packages] / packages / c-ares / patch-from-nodejs.patch
1 Patch generated by diffing $NODEJS/deps/cares/src to pristine c-ares 1.10 source.
2
3 diff -u -r /home/fornwall/termux/c-ares/src/ares_init.c ./ares_init.c
4 --- /home/fornwall/termux/c-ares/src/ares_init.c 2013-02-17 11:44:02.000000000 -0500
5 +++ ./ares_init.c 2014-09-24 17:46:41.000000000 -0400
6 @@ -997,6 +997,11 @@
7 }
8 else if (namesrvr.sa->sa_family == AF_INET6)
9 {
10 + /* Windows apparently always reports some IPv6 DNS servers that
11 + * prefixed with fec0:0:0:ffff. These ususally do not point to
12 + * working DNS servers, so we ignore them. */
13 + if (strncmp(txtaddr, "fec0:0:0:ffff:", 14) == 0)
14 + continue;
15 if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any,
16 sizeof(namesrvr.sa6->sin6_addr)) == 0)
17 continue;
18 diff -u -r /home/fornwall/termux/c-ares/src/ares_nowarn.c ./ares_nowarn.c
19 --- /home/fornwall/termux/c-ares/src/ares_nowarn.c 2013-02-13 05:01:50.000000000 -0500
20 +++ ./ares_nowarn.c 2014-09-24 17:46:41.000000000 -0400
21 @@ -36,50 +36,13 @@
22
23 #include "ares_nowarn.h"
24
25 -#if (SIZEOF_SHORT == 2)
26 -# define CARES_MASK_SSHORT 0x7FFF
27 -# define CARES_MASK_USHORT 0xFFFF
28 -#elif (SIZEOF_SHORT == 4)
29 -# define CARES_MASK_SSHORT 0x7FFFFFFF
30 -# define CARES_MASK_USHORT 0xFFFFFFFF
31 -#elif (SIZEOF_SHORT == 8)
32 -# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF
33 -# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF
34 -#else
35 -# error "SIZEOF_SHORT not defined"
36 -#endif
37 +#define CARES_MASK_USHORT (~(unsigned short) 0)
38 +#define CARES_MASK_UINT (~(unsigned int) 0)
39 +#define CARES_MASK_ULONG (~(unsigned long) 0)
40
41 -#if (SIZEOF_INT == 2)
42 -# define CARES_MASK_SINT 0x7FFF
43 -# define CARES_MASK_UINT 0xFFFF
44 -#elif (SIZEOF_INT == 4)
45 -# define CARES_MASK_SINT 0x7FFFFFFF
46 -# define CARES_MASK_UINT 0xFFFFFFFF
47 -#elif (SIZEOF_INT == 8)
48 -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
49 -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
50 -#elif (SIZEOF_INT == 16)
51 -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
52 -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
53 -#else
54 -# error "SIZEOF_INT not defined"
55 -#endif
56 -
57 -#if (CARES_SIZEOF_LONG == 2)
58 -# define CARES_MASK_SLONG 0x7FFFL
59 -# define CARES_MASK_ULONG 0xFFFFUL
60 -#elif (CARES_SIZEOF_LONG == 4)
61 -# define CARES_MASK_SLONG 0x7FFFFFFFL
62 -# define CARES_MASK_ULONG 0xFFFFFFFFUL
63 -#elif (CARES_SIZEOF_LONG == 8)
64 -# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFL
65 -# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL
66 -#elif (CARES_SIZEOF_LONG == 16)
67 -# define CARES_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
68 -# define CARES_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL
69 -#else
70 -# error "CARES_SIZEOF_LONG not defined"
71 -#endif
72 +#define CARES_MASK_SSHORT (CARES_MASK_USHORT >> 1)
73 +#define CARES_MASK_SINT (CARES_MASK_UINT >> 1)
74 +#define CARES_MASK_SLONG (CARES_MASK_ULONG >> 1)
75
76 /*
77 ** unsigned size_t to signed long
78 diff -u -r /home/fornwall/termux/c-ares/src/ares_parse_txt_reply.c ./ares_parse_txt_reply.c
79 --- /home/fornwall/termux/c-ares/src/ares_parse_txt_reply.c 2013-04-22 17:34:07.000000000 -0400
80 +++ ./ares_parse_txt_reply.c 2014-09-24 17:46:41.000000000 -0400
81 @@ -133,8 +133,6 @@
82 break;
83 }
84
85 - ++strptr;
86 -
87 /* Allocate storage for this TXT answer appending it to the list */
88 txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY);
89 if (!txt_curr)
90 @@ -152,6 +150,7 @@
91 }
92 txt_last = txt_curr;
93
94 + txt_curr->record_start = strptr == aptr;
95 txt_curr->length = substr_len;
96 txt_curr->txt = malloc (substr_len + 1/* Including null byte */);
97 if (txt_curr->txt == NULL)
98 @@ -159,6 +158,8 @@
99 status = ARES_ENOMEM;
100 break;
101 }
102 +
103 + ++strptr;
104 memcpy ((char *) txt_curr->txt, strptr, substr_len);
105
106 /* Make sure we NULL-terminate */
107 diff -u -r /home/fornwall/termux/c-ares/src/ares_setup.h ./ares_setup.h
108 --- /home/fornwall/termux/c-ares/src/ares_setup.h 2012-04-17 16:51:22.000000000 -0400
109 +++ ./ares_setup.h 2014-09-24 17:46:41.000000000 -0400
110 @@ -75,6 +75,9 @@
111 /* please, do it beyond the point further indicated in this file. */
112 /* ================================================================ */
113
114 +#if 1 /* libuv hack */
115 +#include <errno.h> /* needed on windows */
116 +#else
117 /*
118 * c-ares external interface definitions are also used internally,
119 * and might also include required system header files to define them.
120 @@ -87,6 +90,7 @@
121 */
122
123 #include <ares_rules.h>
124 +#endif /* libuv hack */
125
126 /* ================================================================= */
127 /* No system header file shall be included in this file before this */