mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 07:36:23 +00:00
refactor(Core): NULL -> nullptr (#3275)
* NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr * NULL to nullptr Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com> Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "ByteBuffer.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
PacketLog::PacketLog() : _file(NULL)
|
||||
PacketLog::PacketLog() : _file(nullptr)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
@@ -19,7 +19,7 @@ PacketLog::~PacketLog()
|
||||
if (_file)
|
||||
fclose(_file);
|
||||
|
||||
_file = NULL;
|
||||
_file = nullptr;
|
||||
}
|
||||
|
||||
PacketLog* PacketLog::instance()
|
||||
@@ -46,7 +46,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
|
||||
ByteBuffer data(4+4+4+1+packet.size());
|
||||
data << int32(packet.GetOpcode());
|
||||
data << int32(packet.size());
|
||||
data << uint32(time(NULL));
|
||||
data << uint32(time(nullptr));
|
||||
data << uint8(direction);
|
||||
|
||||
for (uint32 i = 0; i < packet.size(); i++)
|
||||
|
||||
@@ -27,7 +27,7 @@ class PacketLog
|
||||
static PacketLog* instance();
|
||||
|
||||
void Initialize();
|
||||
bool CanLogPacket() const { return (_file != NULL); }
|
||||
bool CanLogPacket() const { return (_file != nullptr); }
|
||||
void LogPacket(WorldPacket const& packet, Direction direction);
|
||||
|
||||
private:
|
||||
|
||||
@@ -93,7 +93,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8
|
||||
_lastAuctionListOwnerItemsMSTime(0),
|
||||
AntiDOS(this),
|
||||
m_GUIDLow(0),
|
||||
_player(NULL),
|
||||
_player(nullptr),
|
||||
m_Socket(sock),
|
||||
_security(sec),
|
||||
_skipQueue(skipQueue),
|
||||
@@ -119,7 +119,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8
|
||||
{
|
||||
memset(m_Tutorials, 0, sizeof(m_Tutorials));
|
||||
|
||||
_warden = NULL;
|
||||
_warden = nullptr;
|
||||
_offlineTime = 0;
|
||||
_kicked = false;
|
||||
_shouldSetOfflineInDB = true;
|
||||
@@ -149,17 +149,17 @@ WorldSession::~WorldSession()
|
||||
{
|
||||
m_Socket->CloseSocket("WorldSession destructor");
|
||||
m_Socket->RemoveReference();
|
||||
m_Socket = NULL;
|
||||
m_Socket = nullptr;
|
||||
}
|
||||
|
||||
if (_warden)
|
||||
{
|
||||
delete _warden;
|
||||
_warden = NULL;
|
||||
_warden = nullptr;
|
||||
}
|
||||
|
||||
///- empty incoming packet queue
|
||||
WorldPacket* packet = NULL;
|
||||
WorldPacket* packet = nullptr;
|
||||
while (_recvQueue.next(packet))
|
||||
delete packet;
|
||||
|
||||
@@ -200,13 +200,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||
static uint64 sendPacketCount = 0;
|
||||
static uint64 sendPacketBytes = 0;
|
||||
|
||||
static time_t firstTime = time(NULL);
|
||||
static time_t firstTime = time(nullptr);
|
||||
static time_t lastTime = firstTime; // next 60 secs start time
|
||||
|
||||
static uint64 sendLastPacketCount = 0;
|
||||
static uint64 sendLastPacketBytes = 0;
|
||||
|
||||
time_t cur_time = time(NULL);
|
||||
time_t cur_time = time(nullptr);
|
||||
|
||||
if ((cur_time - lastTime) < 60)
|
||||
{
|
||||
@@ -264,10 +264,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
HandleTeleportTimeout(updater.ProcessLogout());
|
||||
|
||||
uint32 _startMSTime = getMSTime();
|
||||
WorldPacket* packet = NULL;
|
||||
WorldPacket* movementPacket = NULL;
|
||||
WorldPacket* packet = nullptr;
|
||||
WorldPacket* movementPacket = nullptr;
|
||||
bool deletePacket = true;
|
||||
WorldPacket* firstDelayedPacket = NULL;
|
||||
WorldPacket* firstDelayedPacket = nullptr;
|
||||
uint32 processedPackets = 0;
|
||||
time_t currentTime = time(nullptr);
|
||||
|
||||
@@ -309,7 +309,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
{
|
||||
HandleMovementOpcodes(*movementPacket);
|
||||
delete movementPacket;
|
||||
movementPacket = NULL;
|
||||
movementPacket = nullptr;
|
||||
}
|
||||
sScriptMgr->OnPacketReceive(this, *packet);
|
||||
#ifdef ELUNA
|
||||
@@ -325,7 +325,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
if (movementPacket)
|
||||
{
|
||||
delete movementPacket;
|
||||
movementPacket = NULL;
|
||||
movementPacket = nullptr;
|
||||
}
|
||||
sScriptMgr->OnPacketReceive(this, *packet);
|
||||
#ifdef ELUNA
|
||||
@@ -390,7 +390,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
|
||||
if (updater.ProcessLogout())
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = time(nullptr);
|
||||
if (ShouldLogOut(currTime) && !m_playerLoading)
|
||||
LogoutPlayer(true);
|
||||
|
||||
@@ -400,7 +400,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
if (m_Socket && m_Socket->IsClosed())
|
||||
{
|
||||
m_Socket->RemoveReference();
|
||||
m_Socket = NULL;
|
||||
m_Socket = nullptr;
|
||||
}
|
||||
|
||||
if (!m_Socket)
|
||||
@@ -415,7 +415,7 @@ bool WorldSession::HandleSocketClosed()
|
||||
if (m_Socket && m_Socket->IsClosed() && !IsKicked() && GetPlayer() && !PlayerLogout() && GetPlayer()->m_taxi.empty() && GetPlayer()->IsInWorld() && !World::IsStopped())
|
||||
{
|
||||
m_Socket->RemoveReference();
|
||||
m_Socket = NULL;
|
||||
m_Socket = nullptr;
|
||||
GetPlayer()->TradeCancel(false);
|
||||
return true;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions)
|
||||
// pussywizard: handle teleport ack timeout
|
||||
if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported())
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = time(nullptr);
|
||||
if (updateInSessions) // session update from World::UpdateSessions
|
||||
{
|
||||
if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar() + sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime)
|
||||
@@ -520,7 +520,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
guild->HandleMemberLogout(this);
|
||||
|
||||
///- Remove pet
|
||||
_player->RemovePet(NULL, PET_SAVE_AS_CURRENT);
|
||||
_player->RemovePet(nullptr, PET_SAVE_AS_CURRENT);
|
||||
|
||||
// pussywizard: on logout remove auras that are removed at map change (before saving to db)
|
||||
// there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses
|
||||
@@ -596,7 +596,7 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
_map->AfterPlayerUnlinkFromMap();
|
||||
}
|
||||
|
||||
SetPlayer(NULL); // pointer already deleted
|
||||
SetPlayer(nullptr); // pointer already deleted
|
||||
|
||||
//! Send the 'logout complete' packet to the client
|
||||
//! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle
|
||||
@@ -775,7 +775,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
|
||||
void WorldSession::SendAccountDataTimes(uint32 mask)
|
||||
{
|
||||
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK
|
||||
data << uint32(time(NULL)); // unix time of something
|
||||
data << uint32(time(nullptr)); // unix time of something
|
||||
data << uint8(1);
|
||||
data << uint32(mask); // type mask
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
|
||||
@@ -136,7 +136,7 @@ void WorldSocket::CloseSocket(std::string const& reason)
|
||||
{
|
||||
ACE_GUARD (LockType, Guard, m_SessionLock);
|
||||
|
||||
m_Session = NULL;
|
||||
m_Session = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
|
||||
{
|
||||
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
|
||||
|
||||
m_Session = NULL;
|
||||
m_Session = nullptr;
|
||||
}
|
||||
|
||||
reactor()->remove_handler(this, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::ALL_EVENTS_MASK);
|
||||
@@ -466,7 +466,7 @@ int WorldSocket::Update(void)
|
||||
|
||||
int WorldSocket::handle_input_header(void)
|
||||
{
|
||||
ACE_ASSERT (m_RecvWPct == NULL);
|
||||
ACE_ASSERT (m_RecvWPct == nullptr);
|
||||
|
||||
ACE_ASSERT (m_Header.length() == sizeof(ClientPktHeader));
|
||||
|
||||
@@ -479,7 +479,7 @@ int WorldSocket::handle_input_header(void)
|
||||
|
||||
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
|
||||
{
|
||||
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
|
||||
Player* _player = m_Session ? m_Session->GetPlayer() : nullptr;
|
||||
sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "<none>", header.size, header.cmd);
|
||||
|
||||
errno = EINVAL;
|
||||
@@ -510,13 +510,13 @@ int WorldSocket::handle_input_payload(void)
|
||||
|
||||
ACE_ASSERT (m_RecvPct.space() == 0);
|
||||
ACE_ASSERT (m_Header.space() == 0);
|
||||
ACE_ASSERT (m_RecvWPct != NULL);
|
||||
ACE_ASSERT (m_RecvWPct != nullptr);
|
||||
|
||||
const int ret = ProcessIncoming (m_RecvWPct);
|
||||
|
||||
m_RecvPct.base (NULL, 0);
|
||||
m_RecvPct.base (nullptr, 0);
|
||||
m_RecvPct.reset();
|
||||
m_RecvWPct = NULL;
|
||||
m_RecvWPct = nullptr;
|
||||
|
||||
m_Header.reset();
|
||||
|
||||
@@ -699,7 +699,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||
{
|
||||
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
|
||||
|
||||
if (m_Session != NULL)
|
||||
if (m_Session != nullptr)
|
||||
{
|
||||
// Our Idle timer will reset on any non PING opcodes.
|
||||
// Catches people idling on the login screen and any lingering ingame connections.
|
||||
@@ -849,7 +849,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
|
||||
if (mutetime < 0)
|
||||
{
|
||||
mutetime = time(NULL) + llabs(mutetime);
|
||||
mutetime = time(nullptr) + llabs(mutetime);
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
|
||||
|
||||
@@ -941,7 +941,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
sha.UpdateData ((uint8 *) & t, 4);
|
||||
sha.UpdateData ((uint8 *) & clientSeed, 4);
|
||||
sha.UpdateData ((uint8 *) & seed, 4);
|
||||
sha.UpdateBigNumbers (&k, NULL);
|
||||
sha.UpdateBigNumbers (&k, nullptr);
|
||||
sha.Finalize();
|
||||
|
||||
if (memcmp (sha.GetDigest(), digest, 20))
|
||||
|
||||
Reference in New Issue
Block a user