diff --git a/compress.c b/compress.c index 784489a7..c16dfbe7 100644 --- a/compress.c +++ b/compress.c @@ -249,7 +249,7 @@ enet_range_coder_compress (void * context, const ENetBuffer * inBuffers, size_t ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; const enet_uint8 * inData, * inEnd; - enet_uint32 encodeLow = 0, encodeRange = ~0; + enet_uint32 encodeLow = 0, encodeRange = ~0u; ENetSymbol * root; enet_uint16 predicted = 0; size_t order = 0, nextSymbol = 0; @@ -501,7 +501,7 @@ enet_range_coder_decompress (void * context, const enet_uint8 * inData, size_t i ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; const enet_uint8 * inEnd = & inData [inLimit]; - enet_uint32 decodeLow = 0, decodeCode = 0, decodeRange = ~0; + enet_uint32 decodeLow = 0, decodeCode = 0, decodeRange = ~0u; ENetSymbol * root; enet_uint16 predicted = 0; size_t order = 0, nextSymbol = 0; diff --git a/host.c b/host.c index fff946a3..f507d7bb 100644 --- a/host.c +++ b/host.c @@ -341,8 +341,8 @@ enet_host_bandwidth_throttle (ENetHost * host) enet_uint32 timeCurrent = enet_time_get (), elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch, peersRemaining = (enet_uint32) host -> connectedPeers, - dataTotal = ~0, - bandwidth = ~0, + dataTotal = ~0u, + bandwidth = ~0u, throttle = 0, bandwidthLimit = 0; int needsAdjustment = host -> bandwidthLimitedPeers > 0 ? 1 : 0; diff --git a/peer.c b/peer.c index a7ac0120..962e6d68 100644 --- a/peer.c +++ b/peer.c @@ -278,6 +278,7 @@ enet_peer_reset_outgoing_commands (ENetList * queue) static void enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand, ENetIncomingCommand * excludeCommand) { + (void)(queue); ENetListIterator currentCommand; for (currentCommand = startCommand; currentCommand != endCommand; ) diff --git a/protocol.c b/protocol.c index 73e80564..ef7b9703 100644 --- a/protocol.c +++ b/protocol.c @@ -35,6 +35,7 @@ enet_protocol_command_size (enet_uint8 commandNumber) static void enet_protocol_change_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) { + (void)(host); if (state == ENET_PEER_STATE_CONNECTED || state == ENET_PEER_STATE_DISCONNECT_LATER) enet_peer_on_connect (peer); else @@ -294,6 +295,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl static ENetPeer * enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command) { + (void)(header); enet_uint8 incomingSessionID, outgoingSessionID; enet_uint32 mtu, windowSize; ENetChannel * channel; @@ -765,6 +767,8 @@ enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer, static int enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) { + (void)(host); + (void)(command); if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) return -1; @@ -808,6 +812,7 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN static int enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) { + (void)(host); if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) return -1; diff --git a/win32.c b/win32.c index f67e16b7..763a13ab 100644 --- a/win32.c +++ b/win32.c @@ -4,10 +4,16 @@ */ #ifdef _WIN32 +#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#endif + + #define ENET_BUILDING_LIB 1 #include "enet/enet.h" #include #include +#include #include static enet_uint32 timeBase = 0; @@ -288,6 +294,7 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address) { SOCKET result; struct sockaddr_in sin; + memset(&sin, 0, sizeof sin); int sinLength = sizeof (struct sockaddr_in); result = accept (socket, @@ -366,7 +373,7 @@ enet_socket_receive (ENetSocket socket, DWORD flags = 0, recvLength = 0; struct sockaddr_in sin; - + memset(&sin, 0, sizeof sin); if (WSARecvFrom (socket, (LPWSABUF) buffers, (DWORD) bufferCount,