mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Build fixes for MSVC
svn:r1506
This commit is contained in:
parent
d34019289c
commit
25a5e6819d
@ -22,7 +22,8 @@
|
|||||||
/* #undef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID */
|
/* #undef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID */
|
||||||
|
|
||||||
/* Define is no secure id variant is available */
|
/* 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. */
|
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||||
/* #undef _EVENT_HAVE_ARPA_INET_H */
|
/* #undef _EVENT_HAVE_ARPA_INET_H */
|
||||||
|
14
evdns.c
14
evdns.c
@ -39,14 +39,14 @@
|
|||||||
#include "event-config.h"
|
#include "event-config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DNS_USE_FTIME_FOR_ID
|
#ifdef _EVENT_DNS_USE_FTIME_FOR_ID
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID
|
#ifndef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID
|
||||||
#ifndef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
#ifndef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
||||||
#ifndef DNS_USE_OPENSSL_FOR_ID
|
#ifndef _EVENT_DNS_USE_OPENSSL_FOR_ID
|
||||||
#ifndef DNS_USE_FTIME_FOR_ID
|
#ifndef _EVENT_DNS_USE_FTIME_FOR_ID
|
||||||
#error Must configure at least one id generation method.
|
#error Must configure at least one id generation method.
|
||||||
#error Please see the documentation.
|
#error Please see the documentation.
|
||||||
#endif
|
#endif
|
||||||
@ -60,7 +60,7 @@
|
|||||||
#define _REENTRANT
|
#define _REENTRANT
|
||||||
|
|
||||||
#ifdef _EVENT_DNS_USE_CPU_CLOCK_FOR_ID
|
#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
|
#error Multiple id options selected
|
||||||
#endif
|
#endif
|
||||||
#ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
#ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
||||||
@ -69,7 +69,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DNS_USE_OPENSSL_FOR_ID
|
#ifdef _EVENT_DNS_USE_OPENSSL_FOR_ID
|
||||||
#ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
#ifdef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
||||||
#error Multiple id options selected
|
#error Multiple id options selected
|
||||||
#endif
|
#endif
|
||||||
@ -1182,7 +1182,7 @@ default_transaction_id_fn(void)
|
|||||||
trans_id = ts.tv_nsec & 0xffff;
|
trans_id = ts.tv_nsec & 0xffff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DNS_USE_FTIME_FOR_ID
|
#ifdef _EVENT_DNS_USE_FTIME_FOR_ID
|
||||||
struct _timeb tb;
|
struct _timeb tb;
|
||||||
_ftime(&tb);
|
_ftime(&tb);
|
||||||
trans_id = tb.millitm & 0xffff;
|
trans_id = tb.millitm & 0xffff;
|
||||||
@ -1194,7 +1194,7 @@ default_transaction_id_fn(void)
|
|||||||
trans_id = tv.tv_usec & 0xffff;
|
trans_id = tv.tv_usec & 0xffff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DNS_USE_OPENSSL_FOR_ID
|
#ifdef _EVENT_DNS_USE_OPENSSL_FOR_ID
|
||||||
if (RAND_pseudo_bytes((u8 *) &trans_id, 2) == -1) {
|
if (RAND_pseudo_bytes((u8 *) &trans_id, 2) == -1) {
|
||||||
/* in the case that the RAND call fails we used to back */
|
/* in the case that the RAND call fails we used to back */
|
||||||
/* down to using gettimeofday. */
|
/* down to using gettimeofday. */
|
||||||
|
@ -52,6 +52,9 @@ extern "C" {
|
|||||||
#ifdef _EVENT_HAVE_STDDEF_H
|
#ifdef _EVENT_HAVE_STDDEF_H
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
#endif
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* Integer type definitions for types that are supposed to be defined in the
|
/* Integer type definitions for types that are supposed to be defined in the
|
||||||
|
@ -9,10 +9,14 @@
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
@ -20,12 +24,15 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <evutil.h>
|
#include <evutil.h>
|
||||||
|
|
||||||
|
#ifdef _EVENT___func__
|
||||||
|
#define __func__ _EVENT___func__
|
||||||
|
#endif
|
||||||
|
|
||||||
int test_okay = 1;
|
int test_okay = 1;
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
@ -17,7 +19,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
|
@ -9,12 +9,14 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <event2/event.h>
|
#include <event2/event.h>
|
||||||
|
@ -9,10 +9,14 @@
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
@ -21,7 +25,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <event2/event.h>
|
#include <event2/event.h>
|
||||||
@ -29,6 +32,10 @@
|
|||||||
#include <event2/event_compat.h>
|
#include <event2/event_compat.h>
|
||||||
#include <event2/util.h>
|
#include <event2/util.h>
|
||||||
|
|
||||||
|
#ifdef _EVENT___func__
|
||||||
|
#define __func__ _EVENT___func__
|
||||||
|
#endif
|
||||||
|
|
||||||
int pair[2];
|
int pair[2];
|
||||||
int test_okay = 1;
|
int test_okay = 1;
|
||||||
int called = 0;
|
int called = 0;
|
||||||
@ -47,7 +54,7 @@ write_cb(int fd, short event, void *arg)
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (!called)
|
if (!called)
|
||||||
event_add(arg, NULL);
|
event_add(arg, NULL);
|
||||||
close(pair[0]);
|
EVUTIL_CLOSESOCKET(pair[0]);
|
||||||
} else if (called == 1)
|
} else if (called == 1)
|
||||||
test_okay = 0;
|
test_okay = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user