diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d4aa8d..be53943d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.9) project(enet) diff --git a/protocol.c b/protocol.c index 9d654f1d..46272661 100644 --- a/protocol.c +++ b/protocol.c @@ -1390,7 +1390,7 @@ enet_protocol_check_outgoing_commands (ENetHost * host, ENetPeer * peer) ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; ENetOutgoingCommand * outgoingCommand; ENetListIterator currentCommand; - ENetChannel *channel; + ENetChannel *channel = NULL; enet_uint16 reliableWindow; size_t commandSize; int windowExceeded = 0, windowWrap = 0, canPing = 1; diff --git a/unix.c b/unix.c index a636f037..978fbb68 100644 --- a/unix.c +++ b/unix.c @@ -53,9 +53,12 @@ #include #endif +// see https://github.com/lsalzman/enet/issues/90 #ifndef HAS_SOCKLEN_T +#ifndef __socklen_t_defined typedef int socklen_t; #endif +#endif #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 diff --git a/win32.c b/win32.c index eebdb033..0b4048c5 100644 --- a/win32.c +++ b/win32.c @@ -11,6 +11,20 @@ static enet_uint32 timeBase = 0; +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP +// if we are compiling for the Universal Windows Platform (UWP) +// the functions timeBeginPeriod, timeEndPeriod and timeGetTime are not available + +void timeBeginPeriod(int) {} +void timeEndPeriod(int) {} + +enet_uint32 timeGetTime() +{ + return static_cast(GetTickCount64()); +} + +#endif + int enet_initialize (void) {