Skip to content

Commit

Permalink
Narrow the scope of (WorldPacket) variables to avoid a shadow variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-at-wow committed Oct 22, 2023
1 parent 688db50 commit fd9e5b7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/game/Server/WorldSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

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

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

0 comments on commit fd9e5b7

Please sign in to comment.