Build fixes for MSVC

svn:r1506
This commit is contained in:
Nick Mathewson 2009-11-05 20:37:19 +00:00
parent d34019289c
commit 25a5e6819d
7 changed files with 36 additions and 12 deletions

View 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 */

14
evdns.c
View File

@ -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. */

View 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

View 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
@ -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;

View 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>

View 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>

View 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>
@ -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;