]> granicus.if.org Git - libevent/commitdiff
Build fixes for MSVC
authorNick Mathewson <nickm@torproject.org>
Thu, 5 Nov 2009 20:37:19 +0000 (20:37 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 5 Nov 2009 20:37:19 +0000 (20:37 +0000)
svn:r1506

WIN32-Code/event-config.h
evdns.c
include/event2/util.h
test/test-eof.c
test/test-init.c
test/test-time.c
test/test-weof.c

index 0fd5d3f1e6e813c77bf27d5b5f785022e3710104..5f0e76a313030ab5f07b7fea39155e9bc6550f1e 100644 (file)
@@ -22,7 +22,8 @@
 /* #undef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID */
 
 /* Define is no secure id variant is available */
-#define _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID 1
+/* #define _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID 1 */
+#define _EVENT_DNS_USE_FTIME_FOR_ID 1
 
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 /* #undef _EVENT_HAVE_ARPA_INET_H */
diff --git a/evdns.c b/evdns.c
index 41a5cf8a403f5ebf0a8b812b0911ab23cbcf3054..1bfa105492003eed91f3bf03412744074fe61844 100644 (file)
--- a/evdns.c
+++ b/evdns.c
 #include "event-config.h"
 #endif
 
-#ifdef DNS_USE_FTIME_FOR_ID
+#ifdef _EVENT_DNS_USE_FTIME_FOR_ID
 #include <sys/timeb.h>
 #endif
 
 #ifndef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID
 #ifndef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
-#ifndef DNS_USE_OPENSSL_FOR_ID
-#ifndef DNS_USE_FTIME_FOR_ID
+#ifndef _EVENT_DNS_USE_OPENSSL_FOR_ID
+#ifndef _EVENT_DNS_USE_FTIME_FOR_ID
 #error Must configure at least one id generation method.
 #error Please see the documentation.
 #endif
@@ -60,7 +60,7 @@
 #define _REENTRANT
 
 #ifdef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID
-#ifdef DNS_USE_OPENSSL_FOR_ID
+#ifdef _EVENT_DNS_USE_OPENSSL_FOR_ID
 #error Multiple id options selected
 #endif
 #ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
@@ -69,7 +69,7 @@
 #include <time.h>
 #endif
 
-#ifdef DNS_USE_OPENSSL_FOR_ID
+#ifdef _EVENT_DNS_USE_OPENSSL_FOR_ID
 #ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
 #error Multiple id options selected
 #endif
@@ -1182,7 +1182,7 @@ default_transaction_id_fn(void)
        trans_id = ts.tv_nsec & 0xffff;
 #endif
 
-#ifdef DNS_USE_FTIME_FOR_ID
+#ifdef _EVENT_DNS_USE_FTIME_FOR_ID
        struct _timeb tb;
        _ftime(&tb);
        trans_id = tb.millitm & 0xffff;
@@ -1194,7 +1194,7 @@ default_transaction_id_fn(void)
        trans_id = tv.tv_usec & 0xffff;
 #endif
 
-#ifdef DNS_USE_OPENSSL_FOR_ID
+#ifdef _EVENT_DNS_USE_OPENSSL_FOR_ID
        if (RAND_pseudo_bytes((u8 *) &trans_id, 2) == -1) {
                /* in the case that the RAND call fails we used to back */
                /* down to using gettimeofday. */
index 2b23e62bbfc3560c0454d9b76a65507d565e9925..b2b9a8ab070b3060df027e5bad8e547d0eba2f8a 100644 (file)
@@ -52,6 +52,9 @@ extern "C" {
 #ifdef _EVENT_HAVE_STDDEF_H
 #include <stddef.h>
 #endif
+#ifdef _MSC_VER
+#include <BaseTsd.h>
+#endif
 #include <stdarg.h>
 
 /* Integer type definitions for types that are supposed to be defined in the
index 099242c493d2b0ebb13c1056cc03dfe02c6e6bc5..0c17093b32b027ef86c4bb0049adaf6d6ede1a87 100644 (file)
@@ -9,10 +9,14 @@
 
 #ifdef WIN32
 #include <winsock2.h>
+#else
+#include <unistd.h>
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef _EVENT_HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 #ifdef _EVENT_HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include <event.h>
 #include <evutil.h>
 
+#ifdef _EVENT___func__
+#define __func__ _EVENT___func__
+#endif
+
 int test_okay = 1;
 int called = 0;
 
index 6e2ec141f7141d19e47844c1b9ee5297fb9f672a..b622217d1e1d57282a86a43e1776dca81320fc7d 100644 (file)
@@ -9,7 +9,9 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef _EVENT_HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 #ifdef _EVENT_HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -17,7 +19,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <errno.h>
 
 #include <event.h>
index 14bed7c4ac705f14250a2c78ae42d9aef14545dd..cf96bf5efc88290f58e9eb904e547a39caf5ccd3 100644 (file)
@@ -9,12 +9,14 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#ifndef WIN32
 #include <unistd.h>
+#include <sys/time.h>
+#endif
 #include <errno.h>
 
 #include <event2/event.h>
index c5444f768a17c67909bbe65e952dcc8b9a439fa3..a2a7eb32ebcb5e0d48ec507643d91c6dc01bb646 100644 (file)
@@ -9,10 +9,14 @@
 
 #ifdef WIN32
 #include <winsock2.h>
+#else
+#include <unistd.h>
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef _EVENT_HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 #ifdef _EVENT_HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -21,7 +25,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <signal.h>
-#include <unistd.h>
 #include <errno.h>
 
 #include <event2/event.h>
 #include <event2/event_compat.h>
 #include <event2/util.h>
 
+#ifdef _EVENT___func__
+#define __func__ _EVENT___func__
+#endif
+
 int pair[2];
 int test_okay = 1;
 int called = 0;
@@ -47,7 +54,7 @@ write_cb(int fd, short event, void *arg)
        if (len > 0) {
                if (!called)
                        event_add(arg, NULL);
-               close(pair[0]);
+               EVUTIL_CLOSESOCKET(pair[0]);
        } else if (called == 1)
                test_okay = 0;