mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
This commit is contained in:
parent
12199fa7a5
commit
5b5b880be7
@ -334,4 +334,6 @@
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#define _EVENT_ssize_t intptr_t
|
||||
|
||||
#define ssize_t SSIZE_T
|
||||
|
||||
#endif
|
||||
|
@ -334,11 +334,12 @@ win32_dispatch(struct event_base *base, struct timeval *tv)
|
||||
}
|
||||
}
|
||||
if (win32op->writeset_out->fd_count) {
|
||||
SOCKET s;
|
||||
i = rand() % win32op->writeset_out->fd_count;
|
||||
for (j=0; j<win32op->writeset_out->fd_count; ++j) {
|
||||
if (++i >= win32op->writeset_out->fd_count)
|
||||
i = 0;
|
||||
SOCKET s = win32op->writeset_out->fd_array[i];
|
||||
s = win32op->writeset_out->fd_array[i];
|
||||
evmap_io_active(base, s, EV_WRITE);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "iocp-internal.h"
|
||||
#include "mm-internal.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
1
evdns.c
1
evdns.c
@ -121,6 +121,7 @@
|
||||
#include "evthread-internal.h"
|
||||
#ifdef WIN32
|
||||
#include <ctype.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <io.h>
|
||||
|
1
event.h
1
event.h
@ -179,6 +179,7 @@ extern "C" {
|
||||
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
typedef unsigned char u_char;
|
||||
|
@ -24,6 +24,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
|
3
evmap.c
3
evmap.c
@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
@ -35,7 +36,7 @@
|
||||
#include <sys/types.h>
|
||||
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#elif !defined(WIN32)
|
||||
#include <sys/_time.h>
|
||||
#endif
|
||||
#include <sys/queue.h>
|
||||
|
@ -50,6 +50,7 @@ extern "C" {
|
||||
#include <event2/util.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
3
log.c
3
log.c
@ -42,6 +42,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
@ -49,7 +50,7 @@
|
||||
#include <sys/types.h>
|
||||
#ifdef _EVENT_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#elif !defined(WIN32)
|
||||
#include <sys/_time.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
@ -61,6 +61,7 @@
|
||||
|
||||
#include "event2/event.h"
|
||||
#include "event2/event_compat.h"
|
||||
#include <event2/util.h>
|
||||
#include "evdns.h"
|
||||
#include "log-internal.h"
|
||||
#include "regress.h"
|
||||
@ -222,7 +223,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
||||
ans.s_addr = htonl(0xc0a80b0bUL); /* 192.168.11.11 */
|
||||
if (req->questions[i]->type == EVDNS_TYPE_A &&
|
||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
||||
!strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
||||
!evutil_strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
||||
r = evdns_server_request_add_a_reply(req,
|
||||
req->questions[i]->name,
|
||||
1, &ans.s_addr, 12345);
|
||||
@ -230,7 +231,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
||||
dns_ok = 0;
|
||||
} else if (req->questions[i]->type == EVDNS_TYPE_AAAA &&
|
||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
||||
!strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
||||
!evutil_strcasecmp(req->questions[i]->name, "zz.example.com")) {
|
||||
char addr6[17] = "abcdefghijklmnop";
|
||||
r = evdns_server_request_add_aaaa_reply(req,
|
||||
req->questions[i]->name,
|
||||
@ -239,7 +240,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
||||
dns_ok = 0;
|
||||
} else if (req->questions[i]->type == EVDNS_TYPE_PTR &&
|
||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
||||
!strcasecmp(req->questions[i]->name, TEST_ARPA)) {
|
||||
!evutil_strcasecmp(req->questions[i]->name, TEST_ARPA)) {
|
||||
r = evdns_server_request_add_ptr_reply(req, NULL,
|
||||
req->questions[i]->name,
|
||||
"ZZ.EXAMPLE.COM", 54321);
|
||||
@ -247,7 +248,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
||||
dns_ok = 0;
|
||||
} else if (req->questions[i]->type == EVDNS_TYPE_A &&
|
||||
req->questions[i]->dns_question_class == EVDNS_CLASS_INET &&
|
||||
!strcasecmp(req->questions[i]->name, "drop.example.com")) {
|
||||
!evutil_strcasecmp(req->questions[i]->name, "drop.example.com")) {
|
||||
if (evdns_server_request_drop(req)<0)
|
||||
dns_ok = 0;
|
||||
return;
|
||||
|
@ -31,7 +31,6 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
@ -39,7 +38,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <event2/event.h>
|
||||
|
@ -2102,7 +2102,7 @@ static void
|
||||
http_multi_line_header_test(void)
|
||||
{
|
||||
struct bufferevent *bev= NULL;
|
||||
int fd = -1;
|
||||
evutil_socket_t fd = -1;
|
||||
const char *http_start_request;
|
||||
short port = -1;
|
||||
|
||||
@ -2135,7 +2135,7 @@ http_multi_line_header_test(void)
|
||||
if (bev)
|
||||
bufferevent_free(bev);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
EVUTIL_CLOSESOCKET(fd);
|
||||
if (http)
|
||||
evhttp_free(http);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
@ -36,6 +37,8 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <event2/util.h>
|
||||
|
||||
#include "tinytest.h"
|
||||
#include "tinytest_macros.h"
|
||||
|
||||
@ -116,7 +119,7 @@ _testcase_run_forked(const struct testgroup_t *group,
|
||||
if (opt_verbosity>0)
|
||||
printf("[forking] ");
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%s --RUNNING-FORKED %s %s%s",
|
||||
evutil_snprintf(buffer, sizeof(buffer), "%s --RUNNING-FORKED %s %s%s",
|
||||
commandname, verbosity_flag, group->prefix, testcase->name);
|
||||
|
||||
memset(&si, 0, sizeof(si));
|
||||
@ -245,7 +248,7 @@ _tinytest_set_flag(struct testgroup_t *groups, const char *arg, unsigned long fl
|
||||
length = strstr(arg,"..")-arg;
|
||||
for (i=0; groups[i].prefix; ++i) {
|
||||
for (j=0; groups[i].cases[j].name; ++j) {
|
||||
snprintf(fullname, sizeof(fullname), "%s%s",
|
||||
evutil_snprintf(fullname, sizeof(fullname), "%s%s",
|
||||
groups[i].prefix, groups[i].cases[j].name);
|
||||
if (!flag) /* Hack! */
|
||||
printf(" %s\n", fullname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user