From 0286dcdb3481966e0f2c2cabbc468a4b299adf5c Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 25 Apr 2021 23:44:51 -0400 Subject: [PATCH] silence some MSVC warnings --- include/enet/win32.h | 2 ++ peer.c | 3 ++- protocol.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/enet/win32.h b/include/enet/win32.h index e73ca9d..6fbd7c0 100644 --- a/include/enet/win32.h +++ b/include/enet/win32.h @@ -11,6 +11,8 @@ #pragma warning (disable: 4244) // 64bit to 32bit int #pragma warning (disable: 4018) // signed/unsigned mismatch #pragma warning (disable: 4146) // unary minus operator applied to unsigned type +#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_WARNINGS #endif #endif diff --git a/peer.c b/peer.c index 9370ef4..32f9809 100644 --- a/peer.c +++ b/peer.c @@ -99,7 +99,7 @@ enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) int enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet) { - ENetChannel * channel = & peer -> channels [channelID]; + ENetChannel * channel; ENetProtocol command; size_t fragmentLength; @@ -108,6 +108,7 @@ enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet) packet -> dataLength > peer -> host -> maximumPacketSize) return -1; + channel = & peer -> channels [channelID]; fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment); if (peer -> host -> checksum != NULL) fragmentLength -= sizeof(enet_uint32); diff --git a/protocol.c b/protocol.c index 9d654f1..8b3c3db 100644 --- a/protocol.c +++ b/protocol.c @@ -1390,8 +1390,8 @@ enet_protocol_check_outgoing_commands (ENetHost * host, ENetPeer * peer) ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; ENetOutgoingCommand * outgoingCommand; ENetListIterator currentCommand; - ENetChannel *channel; - enet_uint16 reliableWindow; + ENetChannel *channel = NULL; + enet_uint16 reliableWindow = 0; size_t commandSize; int windowExceeded = 0, windowWrap = 0, canPing = 1;