mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-01 02:15:54 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -23,16 +23,16 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize)
|
||||
mLoginName[0] = 0;
|
||||
mPassword[0] = 0;
|
||||
mDefaultDirectory[0] = 0;
|
||||
mConnection = NULL;
|
||||
mUdpManager = NULL;
|
||||
mTransaction = NULL;
|
||||
mSessionId = int(time(NULL));
|
||||
mConnection = nullptr;
|
||||
mUdpManager = nullptr;
|
||||
mTransaction = nullptr;
|
||||
mSessionId = int(time(nullptr));
|
||||
mSessionSequence = 1;
|
||||
}
|
||||
|
||||
LoggingServerApi::~LoggingServerApi()
|
||||
{
|
||||
if (mTransaction != NULL)
|
||||
if (mTransaction != nullptr)
|
||||
StopTransaction();
|
||||
|
||||
for (int i = 0; i < mQueueCount; i++)
|
||||
@@ -77,7 +77,7 @@ void LoggingServerApi::Connect(const char *address, int port, const char *loginN
|
||||
mUdpManager = new UdpManager(¶ms);
|
||||
|
||||
mConnection = mUdpManager->EstablishConnection(address, port, 30000);
|
||||
if (mConnection != NULL)
|
||||
if (mConnection != nullptr)
|
||||
mConnection->SetHandler(this);
|
||||
mLoginSent = false;
|
||||
}
|
||||
@@ -89,17 +89,17 @@ void LoggingServerApi::Disconnect()
|
||||
mPassword[0] = 0;
|
||||
mDefaultDirectory[0] = 0;
|
||||
|
||||
if (mConnection != NULL)
|
||||
if (mConnection != nullptr)
|
||||
{
|
||||
mConnection->Disconnect();
|
||||
mConnection->Release();
|
||||
mConnection = NULL;
|
||||
mConnection = nullptr;
|
||||
}
|
||||
|
||||
if (mUdpManager != NULL)
|
||||
if (mUdpManager != nullptr)
|
||||
{
|
||||
mUdpManager->Release();
|
||||
mUdpManager = NULL;
|
||||
mUdpManager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void LoggingServerApi::Flush(int timeout)
|
||||
|
||||
LoggingServerApi::Status LoggingServerApi::GetStatus() const
|
||||
{
|
||||
if (mConnection != NULL)
|
||||
if (mConnection != nullptr)
|
||||
{
|
||||
switch (mConnection->GetStatus())
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int)
|
||||
FlushQueue();
|
||||
}
|
||||
|
||||
if (mHandler != NULL)
|
||||
if (mHandler != nullptr)
|
||||
mHandler->LshOnLoginConfirm(mAuthenticated);
|
||||
break;
|
||||
}
|
||||
@@ -171,13 +171,13 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int)
|
||||
char *filename = ptr;
|
||||
ptr += strlen(ptr) + 1;
|
||||
char *message = ptr;
|
||||
if (mHandler != NULL)
|
||||
if (mHandler != nullptr)
|
||||
mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message);
|
||||
break;
|
||||
}
|
||||
case cS2CPacketFileList:
|
||||
{
|
||||
if (mHandler != NULL)
|
||||
if (mHandler != nullptr)
|
||||
mHandler->LshOnFileList((char *)(data + 1));
|
||||
break;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int)
|
||||
|
||||
void LoggingServerApi::OnTerminated(UdpConnection *con)
|
||||
{
|
||||
if(mHandler != NULL)
|
||||
if(mHandler != nullptr)
|
||||
{
|
||||
mHandler->LshOnTerminated( con->GetDisconnectReason() );
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void LoggingServerApi::OnTerminated(UdpConnection *con)
|
||||
|
||||
void LoggingServerApi::GiveTime()
|
||||
{
|
||||
if (mConnection != NULL && mConnection->GetStatus() == UdpConnection::cStatusConnected)
|
||||
if (mConnection != nullptr && mConnection->GetStatus() == UdpConnection::cStatusConnected)
|
||||
{
|
||||
if (!mLoginSent)
|
||||
{
|
||||
@@ -225,7 +225,7 @@ void LoggingServerApi::GiveTime()
|
||||
if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime)
|
||||
{
|
||||
mQueue[spot].packet->Release();
|
||||
mQueue[spot].packet = NULL;
|
||||
mQueue[spot].packet = nullptr;
|
||||
mQueuePosition++;
|
||||
mQueueCount--;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ void LoggingServerApi::GiveTime()
|
||||
}
|
||||
}
|
||||
|
||||
if (mUdpManager != NULL)
|
||||
if (mUdpManager != nullptr)
|
||||
{
|
||||
mUdpManager->GiveTime();
|
||||
}
|
||||
@@ -243,17 +243,17 @@ void LoggingServerApi::GiveTime()
|
||||
|
||||
void LoggingServerApi::StartTransaction()
|
||||
{
|
||||
if (mTransaction == NULL)
|
||||
if (mTransaction == nullptr)
|
||||
mTransaction = new GroupLogicalPacket();
|
||||
}
|
||||
|
||||
void LoggingServerApi::StopTransaction()
|
||||
{
|
||||
if (mTransaction != NULL)
|
||||
if (mTransaction != nullptr)
|
||||
{
|
||||
PacketSend(mTransaction);
|
||||
mTransaction->Release();
|
||||
mTransaction = NULL;
|
||||
mTransaction = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp)
|
||||
{
|
||||
int spot = mQueuePosition % mQueueSize;
|
||||
mQueue[spot].packet->Release();
|
||||
mQueue[spot].packet = NULL;
|
||||
mQueue[spot].packet = nullptr;
|
||||
mQueuePosition++;
|
||||
mQueueCount--;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ void LoggingServerApi::Log(const char *filename, int typeCode, const char *messa
|
||||
|
||||
void LoggingServerApi::LogPacket(char *data, int len)
|
||||
{
|
||||
if (mTransaction != NULL)
|
||||
if (mTransaction != nullptr)
|
||||
{
|
||||
// add it to the transaction
|
||||
mTransaction->AddPacket(data, len);
|
||||
@@ -389,7 +389,7 @@ void LoggingServerApi::LogPacket(char *data, int len)
|
||||
|
||||
LogicalPacket *LoggingServerApi::CreatePacket(char *data, int dataLen)
|
||||
{
|
||||
if (mUdpManager != NULL)
|
||||
if (mUdpManager != nullptr)
|
||||
{
|
||||
return(mUdpManager->CreatePacket(data, dataLen));
|
||||
}
|
||||
@@ -440,7 +440,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats)
|
||||
memset( stats, 0, sizeof( *stats) );
|
||||
UdpConnectionStatistics udpConnectionStats;
|
||||
memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) );
|
||||
if( mConnection != NULL )
|
||||
if( mConnection != nullptr )
|
||||
{
|
||||
mConnection->GetStats( &udpConnectionStats );
|
||||
stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived;
|
||||
@@ -454,7 +454,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats)
|
||||
}
|
||||
|
||||
UdpManagerStatistics managerStats;
|
||||
if( mUdpManager != NULL )
|
||||
if( mUdpManager != nullptr )
|
||||
{
|
||||
mUdpManager->GetStats( &managerStats );
|
||||
udp_int64 iterations = managerStats.iterations;
|
||||
|
||||
Reference in New Issue
Block a user