diff --git a/src/DirectPlay8Peer.cpp b/src/DirectPlay8Peer.cpp index ffba20d..e7b0598 100644 --- a/src/DirectPlay8Peer.cpp +++ b/src/DirectPlay8Peer.cpp @@ -1,5 +1,5 @@ /* DirectPlay Lite - * Copyright (C) 2018 Daniel Collins + * Copyright (C) 2018-2023 Daniel Collins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -497,7 +497,7 @@ HRESULT DirectPlay8Peer::Connect(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, I log_printf("port = %d", (int)(port_value)); - r_port = port_value; + r_port = (uint16_t)(port_value); } else{ return DPNERR_INVALIDHOSTADDRESS; @@ -3146,7 +3146,7 @@ void DirectPlay8Peer::handle_udp_socket_event() try { pd.reset(new PacketDeserialiser(recv_buf, r)); } - catch(const PacketDeserialiser::Error &e) + catch(const PacketDeserialiser::Error &) { /* Malformed packet received */ return; @@ -3197,7 +3197,7 @@ void DirectPlay8Peer::handle_other_socket_event() try { pd.reset(new PacketDeserialiser(recv_buf, r)); } - catch(const PacketDeserialiser::Error &e) + catch(const PacketDeserialiser::Error &) { /* Malformed packet received */ return; diff --git a/src/HostEnumerator.cpp b/src/HostEnumerator.cpp index 27d3439..779edc9 100644 --- a/src/HostEnumerator.cpp +++ b/src/HostEnumerator.cpp @@ -1,5 +1,5 @@ /* DirectPlay Lite - * Copyright (C) 2018 Daniel Collins + * Copyright (C) 2018-2023 Daniel Collins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +133,7 @@ HostEnumerator::HostEnumerator( throw COMAPIException(DPNERR_INVALIDHOSTADDRESS); } - send_addr.sin_port = htons(port_value); + send_addr.sin_port = htons((uint16_t)(port_value)); } } @@ -284,7 +284,7 @@ void HostEnumerator::handle_packet(const void *data, size_t size, struct sockadd try { pd.reset(new PacketDeserialiser(data, size)); } - catch(const PacketDeserialiser::Error &e) + catch(const PacketDeserialiser::Error &) { /* Malformed packet received */ return; @@ -333,7 +333,7 @@ void HostEnumerator::handle_packet(const void *data, size_t size, struct sockadd request_tick_count = pd->get_dword(8); } - catch(const PacketDeserialiser::Error &e) + catch(const PacketDeserialiser::Error &) { /* Malformed packet received */ return; diff --git a/src/packet.hpp b/src/packet.hpp index 6145ec2..4512820 100644 --- a/src/packet.hpp +++ b/src/packet.hpp @@ -1,5 +1,5 @@ /* DirectPlay Lite - * Copyright (C) 2018 Daniel Collins + * Copyright (C) 2018-2023 Daniel Collins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,8 @@ struct TLVChunk { uint32_t type; uint32_t value_length; + +#pragma warning(suppress: 4200) unsigned char value[0]; }; diff --git a/tests/DirectPlay8Peer.cpp b/tests/DirectPlay8Peer.cpp index 99fd611..b249717 100644 --- a/tests/DirectPlay8Peer.cpp +++ b/tests/DirectPlay8Peer.cpp @@ -1,5 +1,5 @@ /* DirectPlay Lite - * Copyright (C) 2018 Daniel Collins + * Copyright (C) 2018-2023 Daniel Collins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,8 @@ #include "../src/DirectPlay8Address.hpp" #include "../src/DirectPlay8Peer.hpp" +#pragma warning(disable: 4065) /* switch statement contains 'default' but no 'case' labels */ + // #define INSTANTIATE_FROM_COM #define PORT 42895 @@ -9163,8 +9165,6 @@ TEST(DirectPlay8Peer, DestroyGroupBeforeJoin) TestPeer peer1("peer1"); - DPNID p1_cg_dpnidGroup; - peer1.expect_begin(); peer1.expect_push([&host](DWORD dwMessageType, PVOID pMessage) {