From 1b8ad49d1e07f7341f55ac0ce657349b303cae7e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Apr 2018 16:24:09 -0400 Subject: [PATCH] TraversalClient: In-class initialize members where applicable --- Source/Core/Common/TraversalClient.cpp | 3 +-- Source/Core/Common/TraversalClient.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/Core/Common/TraversalClient.cpp b/Source/Core/Common/TraversalClient.cpp index 96fe7c75d6..f87fd7e603 100644 --- a/Source/Core/Common/TraversalClient.cpp +++ b/Source/Core/Common/TraversalClient.cpp @@ -22,8 +22,7 @@ static void GetRandomishBytes(u8* buf, size_t size) } TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port) - : m_NetHost(netHost), m_Client(nullptr), m_ConnectRequestId(0), m_PendingConnect(false), - m_Server(server), m_port(port), m_PingTime(0) + : m_NetHost(netHost), m_Server(server), m_port(port) { netHost->intercept = TraversalClient::InterceptCallback; diff --git a/Source/Core/Common/TraversalClient.h b/Source/Core/Common/TraversalClient.h index ce6a78e768..aedc435d86 100644 --- a/Source/Core/Common/TraversalClient.h +++ b/Source/Core/Common/TraversalClient.h @@ -54,7 +54,7 @@ public: bool TestPacket(u8* data, size_t size, ENetAddress* from); void HandleResends(); - TraversalClientClient* m_Client; + TraversalClientClient* m_Client = nullptr; private: struct OutgoingTraversalPacketInfo @@ -71,16 +71,16 @@ private: static int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event); ENetHost* m_NetHost; - TraversalHostId m_HostId; - State m_State; - FailureReason m_FailureReason; - TraversalRequestId m_ConnectRequestId; - bool m_PendingConnect; + TraversalHostId m_HostId{}; + State m_State{}; + FailureReason m_FailureReason{}; + TraversalRequestId m_ConnectRequestId = 0; + bool m_PendingConnect = false; std::list m_OutgoingTraversalPackets; - ENetAddress m_ServerAddress; + ENetAddress m_ServerAddress{}; std::string m_Server; u16 m_port; - enet_uint32 m_PingTime; + enet_uint32 m_PingTime = 0; }; extern std::unique_ptr g_TraversalClient; // the NetHost connected to the TraversalClient.