From 25a5e6819d9f49fd143308fad0d9189a8eef8a97 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 5 Nov 2009 20:37:19 +0000 Subject: [PATCH] Build fixes for MSVC svn:r1506 --- WIN32-Code/event-config.h | 3 ++- evdns.c | 14 +++++++------- include/event2/util.h | 3 +++ test/test-eof.c | 9 ++++++++- test/test-init.c | 4 ++++ test/test-time.c | 4 +++- test/test-weof.c | 11 +++++++++-- 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 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 #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 #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 #endif +#ifdef _MSC_VER +#include +#endif #include /* 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 +#else +#include #endif #include #include +#ifdef _EVENT_HAVE_SYS_TIME_H #include +#endif #ifdef _EVENT_HAVE_SYS_SOCKET_H #include #endif @@ -20,12 +24,15 @@ #include #include #include -#include #include #include #include +#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 #include +#ifdef _EVENT_HAVE_SYS_TIME_H #include +#endif #ifdef _EVENT_HAVE_SYS_SOCKET_H #include #endif @@ -17,7 +19,9 @@ #include #include #include +#ifndef WIN32 #include +#endif #include #include 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 #include -#include #include #include #include #include +#ifndef WIN32 #include +#include +#endif #include #include 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 +#else +#include #endif #include #include +#ifdef _EVENT_HAVE_SYS_TIME_H #include +#endif #ifdef _EVENT_HAVE_SYS_SOCKET_H #include #endif @@ -21,7 +25,6 @@ #include #include #include -#include #include #include @@ -29,6 +32,10 @@ #include #include +#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;