Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for windows builds warnings #122

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; )
Expand Down
5 changes: 5 additions & 0 deletions protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
9 changes: 8 additions & 1 deletion win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
*/
#ifdef _WIN32

#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
#define _WINSOCK_DEPRECATED_NO_WARNINGS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just muting warnings, not fixing them

#endif


#define ENET_BUILDING_LIB 1
#include "enet/enet.h"
#include <windows.h>
#include <mmsystem.h>
#include <string.h>
#include <ws2ipdef.h>

static enet_uint32 timeBase = 0;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down