From cfd6073a66fda3db150998ef40dbbc76c198c02e Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 18 Mar 2015 16:27:43 -0700 Subject: Various Windows fixes. -) using dupenv_s instead of getenv_s and calling strdup ourselves. -) few impossible-to-obtain if checks. -) various signed/unsigned casting. -) using time_t instead of time32_t -) checking output of FormatMessage for failures. -) don't redefine _WIN32_WINNT without undefining it first. -) fixed msvc's interlocked casting. -) renamed AddPort to AddListeningPort. -) added protobuf's third_party includes to search path. -) added a missing definition for inet_ntop in mingw32. -) removed useless declarations. --- src/core/iomgr/sockaddr_win32.h | 5 +++++ src/core/iomgr/tcp_server_windows.c | 3 --- src/core/iomgr/tcp_windows.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/core/iomgr') diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/iomgr/sockaddr_win32.h index 3a5f27bb34..c0385ea614 100644 --- a/src/core/iomgr/sockaddr_win32.h +++ b/src/core/iomgr/sockaddr_win32.h @@ -38,4 +38,9 @@ #include #include +#ifdef __MINGW32__ +/* mingw seems to be missing that definition. */ +const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); +#endif + #endif /* GRPC_INTERNAL_CORE_IOMGR_SOCKADDR_WIN32_H */ diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index 59319da26d..0c3ab1dc91 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -53,9 +53,6 @@ #define INIT_PORT_CAP 2 #define MIN_SAFE_ACCEPT_QUEUE_SIZE 100 -static gpr_once s_init_max_accept_queue_size; -static int s_max_accept_queue_size; - /* one listening port */ typedef struct server_port { gpr_uint8 addresses[sizeof(struct sockaddr_in6) * 2 + 32]; diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 3efd69a71b..ec5496e7ee 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -172,7 +172,7 @@ static void win_notify_on_read(grpc_endpoint *ep, tcp->read_slice = gpr_slice_malloc(8192); buffer.len = GPR_SLICE_LENGTH(tcp->read_slice); - buffer.buf = GPR_SLICE_START_PTR(tcp->read_slice); + buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice); gpr_log(GPR_DEBUG, "win_notify_on_read: calling WSARecv without overlap"); status = WSARecv(tcp->socket->socket, &buffer, 1, &bytes_read, &flags, @@ -284,7 +284,7 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, for (i = 0; i < tcp->write_slices.count; i++) { buffers[i].len = GPR_SLICE_LENGTH(tcp->write_slices.slices[i]); - buffers[i].buf = GPR_SLICE_START_PTR(tcp->write_slices.slices[i]); + buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices.slices[i]); } gpr_log(GPR_DEBUG, "win_write: calling WSASend without overlap"); -- cgit v1.2.3