mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-01 02:15:54 -04:00
Revert "Revert "newer standards prefer nullptr over NULL - this is most of them but there are others too""
This reverts commit 8e2160f33e.
This commit is contained in:
+8
-8
@@ -107,7 +107,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res
|
||||
}
|
||||
req->setTrack(m_currTrack);
|
||||
res->setTrack(m_currTrack);
|
||||
time_t timeout = time(NULL) + m_requestTimeout;
|
||||
time_t timeout = time(nullptr) + m_requestTimeout;
|
||||
|
||||
req->setTimeout(timeout);
|
||||
res->setTimeout(timeout);
|
||||
@@ -125,7 +125,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res
|
||||
}
|
||||
req->setTrack(m_currTrack);
|
||||
res->setTrack(m_currTrack);
|
||||
time_t timeout = time(NULL) + reqTimeout;
|
||||
time_t timeout = time(nullptr) + reqTimeout;
|
||||
|
||||
req->setTimeout(timeout);
|
||||
res->setTimeout(timeout);
|
||||
@@ -140,7 +140,7 @@ void GenericAPICore::process()
|
||||
GenericResponse *res;
|
||||
|
||||
// Process timeout on pending requests - regardless of whether processing is suspended or not
|
||||
while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL)))
|
||||
while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr)))
|
||||
{
|
||||
--m_outCount;
|
||||
res = m_outboundQueue.front().second;
|
||||
@@ -152,7 +152,7 @@ void GenericAPICore::process()
|
||||
}
|
||||
|
||||
// Process timeout on pending responses
|
||||
while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL)))
|
||||
while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr)))
|
||||
{
|
||||
--m_pendingCount;
|
||||
m_pending.erase(m_pending.begin());
|
||||
@@ -165,7 +165,7 @@ void GenericAPICore::process()
|
||||
while(m_outCount > 0)
|
||||
{
|
||||
GenericConnection *con = getNextActiveConnection();
|
||||
if (con != NULL)
|
||||
if (con != nullptr)
|
||||
{
|
||||
pair<GenericRequest *, GenericResponse *> out_pair = m_outboundQueue.front();
|
||||
|
||||
@@ -184,7 +184,7 @@ void GenericAPICore::process()
|
||||
else
|
||||
{
|
||||
#ifdef USE_SERIALIZE_LIB
|
||||
const unsigned char *msgBuf = NULL;
|
||||
const unsigned char *msgBuf = nullptr;
|
||||
unsigned msgSize = 0;
|
||||
msgBuf = req->pack(msgSize);
|
||||
con->Send(msgBuf, msgSize);
|
||||
@@ -222,7 +222,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection()
|
||||
unsigned startIndex = m_nextConnectionIndex;
|
||||
unsigned maxIndex = m_serverConnections.size() - 1;
|
||||
|
||||
GenericConnection *con = NULL;
|
||||
GenericConnection *con = nullptr;
|
||||
|
||||
//loop until we find an active connection, or until we get back
|
||||
// to where we started
|
||||
@@ -242,7 +242,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection()
|
||||
//went past end of vector, start back at 0
|
||||
m_nextConnectionIndex = 0;
|
||||
}
|
||||
}while (con == NULL && m_nextConnectionIndex != startIndex);
|
||||
}while (con == nullptr && m_nextConnectionIndex != startIndex);
|
||||
|
||||
return con;
|
||||
}
|
||||
|
||||
+10
-10
@@ -28,7 +28,7 @@ unsigned GenericConnection::ms_crcBytes = 0;
|
||||
GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime)
|
||||
: m_bConnected(false),
|
||||
m_apiCore(apiCore),
|
||||
m_con(NULL),
|
||||
m_con(nullptr),
|
||||
m_host(host),
|
||||
m_nextHost(host),
|
||||
m_port(port),
|
||||
@@ -72,8 +72,8 @@ GenericConnection::~GenericConnection()
|
||||
{
|
||||
if(m_con)
|
||||
{
|
||||
m_con->SetHandler(NULL);
|
||||
m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont
|
||||
m_con->SetHandler(nullptr);
|
||||
m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont
|
||||
m_con->Release();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void GenericConnection::disconnect()
|
||||
{
|
||||
m_con->Disconnect();
|
||||
//no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release();
|
||||
m_con = NULL;
|
||||
m_con = nullptr;
|
||||
}
|
||||
m_conState = CON_DISCONNECT;
|
||||
m_bConnected = false;
|
||||
@@ -112,7 +112,7 @@ void GenericConnection::OnTerminated(UdpConnection *con)
|
||||
if(m_con)
|
||||
{
|
||||
m_con->Release();
|
||||
m_con = NULL;
|
||||
m_con = nullptr;
|
||||
}
|
||||
m_conState = CON_DISCONNECT;
|
||||
m_bConnected = false;
|
||||
@@ -146,7 +146,7 @@ void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *d
|
||||
get(iter, type);
|
||||
get(iter, track);
|
||||
#endif
|
||||
GenericResponse *res = NULL;
|
||||
GenericResponse *res = nullptr;
|
||||
|
||||
// the following if block is a temporary fix that prevents
|
||||
// a crash with a game team in which they occasionally find
|
||||
@@ -208,7 +208,7 @@ void GenericConnection::process(bool giveTime)
|
||||
{
|
||||
m_con->SetHandler(this);
|
||||
m_conState = CON_NEGOTIATE;
|
||||
m_conTimeout = time(NULL) + m_reconnectTimeout;
|
||||
m_conTimeout = time(nullptr) + m_reconnectTimeout;
|
||||
}
|
||||
break;
|
||||
case CON_NEGOTIATE:
|
||||
@@ -225,12 +225,12 @@ void GenericConnection::process(bool giveTime)
|
||||
m_apiCore->OnConnect(m_host.c_str(), m_port);
|
||||
m_bConnected = true;
|
||||
}
|
||||
else if(time(NULL) > m_conTimeout)
|
||||
else if(time(nullptr) > m_conTimeout)
|
||||
{
|
||||
// we did not connect
|
||||
m_con->Disconnect();
|
||||
//no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release();
|
||||
m_con = NULL;
|
||||
m_con = nullptr;
|
||||
m_conState = CON_DISCONNECT;
|
||||
m_bConnected = false;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void GenericConnection::process(bool giveTime)
|
||||
{
|
||||
m_con->Disconnect();
|
||||
//no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release();
|
||||
m_con = NULL;
|
||||
m_con = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user