From 061430a8ae36f7f71f878172f1472af407ceaa29 Mon Sep 17 00:00:00 2001 From: Linus Yang Date: Sun, 12 Jan 2014 00:00:22 +0800 Subject: [PATCH] win32: suppress compilation errors --- src/cache.c | 4 ++++ src/include.h | 2 +- src/udprelay.c | 4 ++-- src/win32.h | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/cache.c b/src/cache.c index a73b6a01..e70e0998 100644 --- a/src/cache.c +++ b/src/cache.c @@ -7,6 +7,10 @@ #include #include "cache.h" +#ifdef __MINGW32__ +#include "win32.h" +#endif + /** Creates a new cache object @param dst diff --git a/src/include.h b/src/include.h index 5c9089bf..d9514ded 100644 --- a/src/include.h +++ b/src/include.h @@ -8,6 +8,6 @@ int udprelay_init(const char *server_host, const char *server_port, #ifdef UDPRELAY_REMOTE asyncns_t *asyncns, #endif - int method, int timeout, const char *interface); + int method, int timeout, const char *iface); #endif // _INCLUDE_H diff --git a/src/udprelay.c b/src/udprelay.c index dac7a2a9..e97205cc 100644 --- a/src/udprelay.c +++ b/src/udprelay.c @@ -754,7 +754,7 @@ int udprelay_init(const char *server_host, const char *server_port, #ifdef UDPRELAY_REMOTE asyncns_t *asyncns, #endif - int method, int timeout, const char *interface) + int method, int timeout, const char *iface) { // Inilitialize ev loop @@ -778,7 +778,7 @@ int udprelay_init(const char *server_host, const char *server_port, struct server_ctx *server_ctx = new_server_ctx(serverfd); server_ctx->timeout = timeout; server_ctx->method = method; - server_ctx->iface = interface; + server_ctx->iface = iface; server_ctx->conn_cache = conn_cache; #ifdef UDPRELAY_LOCAL server_ctx->remote_host = remote_host; diff --git a/src/win32.h b/src/win32.h index cd0edc10..c69accad 100644 --- a/src/win32.h +++ b/src/win32.h @@ -1,6 +1,10 @@ #ifndef _WIN32_H #define _WIN32_H +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif + #define _WIN32_WINNT 0x0501 #include @@ -29,5 +33,7 @@ void winsock_init(void); void winsock_cleanup(void); void ss_error(const char *s); size_t strnlen(const char *s, size_t maxlen); +int setnonblocking(int fd); +const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif \ No newline at end of file