>> Uhm, "these days" perhaps but won't your unconditional define of
>> strdup() to _strdup() break building with older compilers?
>
> I'll modify the patch to look for VC8 and higher. I'll get that to
> you tomorrow morning.
Attached is a patch that wraps it for only VS2005 (VC8, _MSC_VER 1400 and higher).
This still includes the int -> time_t patch as well, since time_t with VS2005
is 64bit and int is 32bit.
-Brad
diff -ruN c-ares-1.3.2.orig/ares_process.c c-ares-1.3.2/ares_process.c
--- c-ares-1.3.2.orig/ares_process.c 2006-10-25 09:16:31.000000000 -0400
+++ c-ares-1.3.2/ares_process.c 2007-06-01 09:42:48.000000000 -0400
@@ -73,7 +73,7 @@
time_t now);
static void process_timeouts(ares_channel channel, time_t now);
static void process_answer(ares_channel channel, unsigned char *abuf,
- int alen, int whichserver, int tcp, int now);
+ int alen, int whichserver, int tcp, time_t now);
static void handle_error(ares_channel channel, int whichserver, time_t now);
static struct query *next_server(ares_channel channel, struct query *query, time_t now);
static int open_tcp_socket(ares_channel channel, struct server_state *server);
@@ -349,7 +349,7 @@
/* Handle an answer from a server. */
static void process_answer(ares_channel channel, unsigned char *abuf,
- int alen, int whichserver, int tcp, int now)
+ int alen, int whichserver, int tcp, time_t now)
{
int id, tc, rcode;
struct query *query;
diff -ruN c-ares-1.3.2.orig/ares_timeout.c c-ares-1.3.2/ares_timeout.c
--- c-ares-1.3.2.orig/ares_timeout.c 2006-07-25 14:39:22.000000000 -0400
+++ c-ares-1.3.2/ares_timeout.c 2007-06-01 09:42:48.000000000 -0400
@@ -32,7 +32,7 @@
{
struct query *query;
time_t now;
- int offset, min_offset;
+ time_t offset, min_offset;
/* No queries, no timeout (and no fetch of the current time). */
if (!channel->queries)
@@ -58,7 +58,7 @@
*/
if (min_offset != -1 && (!maxtv || min_offset <= maxtv->tv_sec))
{
- tvbuf->tv_sec = min_offset;
+ tvbuf->tv_sec = (long)min_offset;
tvbuf->tv_usec = 0;
return tvbuf;
}
diff -ruN c-ares-1.3.2.orig/setup.h c-ares-1.3.2/setup.h
--- c-ares-1.3.2.orig/setup.h 2006-10-18 17:08:27.000000000 -0400
+++ c-ares-1.3.2/setup.h 2007-06-01 09:43:34.000000000 -0400
@@ -156,6 +156,11 @@
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
+#ifdef _MSC_VER
+# if _MSC_VER >= 1400
+# define strdup(a) _strdup(a)
+# endif
+#endif
#endif
/* IPv6 compatibility */
Received on 2007-06-01