From fd9e5b766d9483eac466d08033c5d66a6bf65e0d Mon Sep 17 00:00:00 2001 From: evil-at-wow Date: Sun, 22 Oct 2023 18:13:27 +0200 Subject: [PATCH] Narrow the scope of (WorldPacket) variables to avoid a shadow variable. --- src/game/Server/WorldSocket.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/game/Server/WorldSocket.cpp b/src/game/Server/WorldSocket.cpp index 043549c6fc..56f7d315dd 100644 --- a/src/game/Server/WorldSocket.cpp +++ b/src/game/Server/WorldSocket.cpp @@ -302,7 +302,6 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) std::string account, os; Sha1Hash sha1; BigNumber v, s, g, N, K; - WorldPacket packet, SendAddonPacked; // Read the content of the packet recvPacket >> ClientBuild; @@ -319,7 +318,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) // Check the version of client trying to connect if (!IsAcceptableClientBuild(ClientBuild)) { - packet.Initialize(SMSG_AUTH_RESPONSE, 1); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_VERSION_MISMATCH); SendPacket(packet); @@ -355,7 +354,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) // Stop if the account is not found if (!queryResult) { - packet.Initialize(SMSG_AUTH_RESPONSE, 1); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_UNKNOWN_ACCOUNT); SendPacket(packet); @@ -388,7 +387,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) { if (strcmp(fields[3].GetString(), GetRemoteAddress().c_str())) { - packet.Initialize(SMSG_AUTH_RESPONSE, 1); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_FAILED); SendPacket(packet); @@ -431,7 +430,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (banresult) // if account banned { - packet.Initialize(SMSG_AUTH_RESPONSE, 1); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_BANNED); SendPacket(packet); @@ -468,7 +467,7 @@ bool WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (memcmp(sha.GetDigest(), digest, 20)) { - packet.Initialize(SMSG_AUTH_RESPONSE, 1); + WorldPacket packet(SMSG_AUTH_RESPONSE, 1); packet << uint8(AUTH_FAILED); SendPacket(packet);