From 5031c11169ac2f9011c56c5395b77b40830d6e5a Mon Sep 17 00:00:00 2001 From: Jan Krassnigg Date: Tue, 16 Mar 2021 11:36:46 +0100 Subject: [PATCH 1/4] Fixed potential uninitialized variable access --- protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 94b1ab3d96097d179165332d636ad616f3ef1b2a Mon Sep 17 00:00:00 2001 From: Jan Krassnigg Date: Tue, 16 Mar 2021 11:37:02 +0100 Subject: [PATCH 2/4] Fixed #90 to unblock Linux builds --- unix.c | 3 +++ 1 file changed, 3 insertions(+) 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 From 414516c116e047c974e5ce24d44a6919b2c12556 Mon Sep 17 00:00:00 2001 From: Jan Krassnigg Date: Tue, 16 Mar 2021 11:37:13 +0100 Subject: [PATCH 3/4] Fixed an issue building on UWP --- win32.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) { From 673aab7a812960b5885913a12a1ca701fb2c8a83 Mon Sep 17 00:00:00 2001 From: Jan Krassnigg Date: Tue, 16 Mar 2021 11:37:32 +0100 Subject: [PATCH 4/4] Raised minimum CMake version to fix warning CMake complains that support for versions 2.8.x will be removed and shouldn't be used anymore. Enet works fine with version 2.9. CMake is already at version 3.19 at this time. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)