summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-11-05 20:37:19 +0000
committerNick Mathewson <nickm@torproject.org>2009-11-05 20:37:19 +0000
commit25a5e6819d9f49fd143308fad0d9189a8eef8a97 (patch)
tree1c5b06de1d2f12c09a6b31947f9a515007ab1799
parentd34019289ca58deb0c1c182f5fbd3cb6b93774ee (diff)
downloadlibevent-25a5e6819d9f49fd143308fad0d9189a8eef8a97.tar.gz
Build fixes for MSVC
svn:r1506
-rw-r--r--WIN32-Code/event-config.h3
-rw-r--r--evdns.c14
-rw-r--r--include/event2/util.h3
-rw-r--r--test/test-eof.c9
-rw-r--r--test/test-init.c4
-rw-r--r--test/test-time.c4
-rw-r--r--test/test-weof.c11
7 files changed, 36 insertions, 12 deletions
diff --git a/WIN32-Code/event-config.h b/WIN32-Code/event-config.h
index 0fd5d3f1..5f0e76a3 100644
--- a/WIN32-Code/event-config.h
+++ b/WIN32-Code/event-config.h
@@ -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 41a5cf8a..1bfa1054 100644
--- a/evdns.c
+++ b/evdns.c
@@ -39,14 +39,14 @@
#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. */
diff --git a/include/event2/util.h b/include/event2/util.h
index 2b23e62b..b2b9a8ab 100644
--- a/include/event2/util.h
+++ b/include/event2/util.h
@@ -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
diff --git a/test/test-eof.c b/test/test-eof.c
index 099242c4..0c17093b 100644
--- a/test/test-eof.c
+++ b/test/test-eof.c
@@ -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
@@ -20,12 +24,15 @@
#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;
diff --git a/test/test-init.c b/test/test-init.c
index 6e2ec141..b622217d 100644
--- a/test/test-init.c
+++ b/test/test-init.c
@@ -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>
diff --git a/test/test-time.c b/test/test-time.c
index 14bed7c4..cf96bf5e 100644
--- a/test/test-time.c
+++ b/test/test-time.c
@@ -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>
diff --git a/test/test-weof.c b/test/test-weof.c
index c5444f76..a2a7eb32 100644
--- a/test/test-weof.c
+++ b/test/test-weof.c
@@ -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>
@@ -29,6 +32,10 @@
#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;