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:
DarthArgus
2016-02-11 21:19:18 -06:00
parent 8e2160f33e
commit dd9db6d350
937 changed files with 14983 additions and 14983 deletions
@@ -91,7 +91,7 @@ namespace Base
ByteStream::ByteStream() :
allocatedSize(0),
beginReadIterator(),
data(NULL),
data(nullptr),
size(0),
lastPutSize(0)
{
@@ -208,7 +208,7 @@ namespace Base
if(data->size < allocatedSize)
{
unsigned char * tmp = new unsigned char[newSize];
if(data->buffer != NULL)
if(data->buffer != nullptr)
memcpy(tmp, data->buffer, size);
delete[] data->buffer;
data->buffer = tmp;
@@ -117,7 +117,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);
@@ -136,7 +136,7 @@ void GenericAPICore::process()
if (!m_suspended)
{
// Process timeout on pending requests
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;
@@ -148,7 +148,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());
@@ -161,7 +161,7 @@ void GenericAPICore::process()
pair<GenericRequest *, GenericResponse *> out_pair = m_outboundQueue.front();
req = out_pair.first;
res = out_pair.second;
GenericConnection *con = NULL;
GenericConnection *con = nullptr;
if (req->getMappedServerTrack() == 0) // request has no originating "owner" server
{
con = getNextActiveConnection(); // it does not matter which server we send this to
@@ -178,7 +178,7 @@ void GenericAPICore::process()
}
}
if (con != NULL)
if (con != nullptr)
{
Base::ByteStream msg;
req->pack(msg);
@@ -213,7 +213,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
@@ -233,7 +233,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;
}
@@ -259,7 +259,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track)
{
std::map<unsigned, ServerTrackObject *>::iterator iter = m_serverTracks.find(server_track);
if (iter == m_serverTracks.end())
return NULL;
return nullptr;
ServerTrackObject *stobj = (*iter).second;
m_serverTracks.erase(server_track);
return stobj;
@@ -22,7 +22,7 @@ using namespace Base;
GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB)
: m_bConnected(CON_NONE),
m_apiCore(apiCore),
m_con(NULL),
m_con(nullptr),
m_host(host),
m_port(port),
m_lastTrack(123455), //random choice != 1
@@ -47,8 +47,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();
}
@@ -61,7 +61,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 = CON_NONE;
@@ -74,7 +74,7 @@ void GenericConnection::OnTerminated(TcpConnection *con)
if(m_con)
{
m_con->Release();
m_con = NULL;
m_con = nullptr;
}
m_conState = CON_DISCONNECT;
m_bConnected = CON_NONE;
@@ -90,7 +90,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *d
get(iter, type);
get(iter, track);
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
@@ -148,7 +148,7 @@ void GenericConnection::process()
{
m_con->SetHandler(this);
m_conState = CON_NEGOTIATE;
m_conTimeout = time(NULL) + m_reconnectTimeout;
m_conTimeout = time(nullptr) + m_reconnectTimeout;
}
break;
case CON_NEGOTIATE:
@@ -169,12 +169,12 @@ void GenericConnection::process()
put(msg, m_apiCore->getGameCode());
Send(msg);
}
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 = CON_NONE;
}
@@ -190,7 +190,7 @@ void GenericConnection::process()
{
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_manager->GiveTime();
@@ -23,7 +23,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game)
std::vector<const char *> hostArray;
std::vector<short> portArray;
char hostConfig[4096];
if (hostName == NULL)
if (hostName == nullptr)
hostName = DEFAULT_HOST;
if (!game)
game = DEFAULT_GAMECODE;
@@ -47,7 +47,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game)
portArray.push_back(port);
}
}
while ((ptr = strtok(NULL, " ")) != NULL);
while ((ptr = strtok(nullptr, " ")) != nullptr);
}
if (hostArray.empty())
{
@@ -32,7 +32,7 @@ public:
* @brief Used to retreive the the dot-notation represenatatiion of this address.
*
* @param buffer A pointer to the buffer to place the ip address into.
* Must be at least 17 characters long, will be null terminated.
* Must be at least 17 characters long, will be nullptr terminated.
*
* @return A pointer to the buffer the address was placed into.
*/
@@ -6,7 +6,7 @@ namespace NAMESPACE
#endif
TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount)
: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0)
: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0)
{
realloc();
}
@@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock()
tmp = m_freeHead;
m_freeHead = m_freeHead->m_next;
tmp->m_next = NULL;
tmp->m_next = nullptr;
m_numAvailBlocks--;
return(tmp);
}
@@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b)
void TcpBlockAllocator::realloc()
{
data_block *tmp = NULL, *cursor = NULL;
data_block *tmp = nullptr, *cursor = nullptr;
tmp = new data_block; m_numAvailBlocks++;
cursor = tmp;
@@ -11,28 +11,28 @@ namespace NAMESPACE
//used when want to open new connection with this socket
TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams &params, const IPAddress &destIP, short destPort, unsigned timeout)
: m_nextConnection(NULL),
m_prevConnection(NULL),
: m_nextConnection(nullptr),
m_prevConnection(nullptr),
m_socket(INVALID_SOCKET),
m_nextKeepAliveConnection(NULL),
m_prevKeepAliveConnection(NULL),
m_nextKeepAliveConnection(nullptr),
m_prevKeepAliveConnection(nullptr),
m_aliveListId(tcpManager->m_aliveList.m_listID),
m_nextRecvDataConnection(NULL),
m_prevRecvDataConnection(NULL),
m_nextRecvDataConnection(nullptr),
m_prevRecvDataConnection(nullptr),
m_recvDataListId(tcpManager->m_dataList.m_listID),
m_manager(tcpManager),
m_status(StatusNegotiating),
m_handler(NULL),
m_handler(nullptr),
m_destIP(destIP),
m_destPort(destPort),
m_refCount(0),
m_sendAllocator(sendAlloc),
m_head(NULL),
m_tail(NULL),
m_head(nullptr),
m_tail(nullptr),
m_bytesRead(0),
m_bytesNeeded(0),
m_params(params),
m_recvBuff(NULL),
m_recvBuff(nullptr),
m_connectTimeout(timeout),
m_connectTimer(),
m_wasConRemovedFromMgr(false)
@@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo
//used when server mode creates new connection object representing a connect request
TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams &params, SOCKET socket, const IPAddress &destIP, short destPort)
: m_nextConnection(NULL),
m_prevConnection(NULL),
: m_nextConnection(nullptr),
m_prevConnection(nullptr),
m_socket(socket),
m_nextKeepAliveConnection(NULL),
m_prevKeepAliveConnection(NULL),
m_nextKeepAliveConnection(nullptr),
m_prevKeepAliveConnection(nullptr),
m_aliveListId(tcpManager->m_aliveList.m_listID),
m_nextRecvDataConnection(NULL),
m_prevRecvDataConnection(NULL),
m_nextRecvDataConnection(nullptr),
m_prevRecvDataConnection(nullptr),
m_recvDataListId(tcpManager->m_dataList.m_listID),
m_manager(tcpManager),
m_status(StatusConnected),
m_handler(NULL),
m_handler(nullptr),
m_destIP(destIP),
m_destPort(destPort),
m_refCount(0),
m_sendAllocator(sendAlloc),
m_head(NULL),
m_tail(NULL),
m_head(nullptr),
m_tail(nullptr),
m_bytesRead(0),
m_bytesNeeded(0),
m_params(params),
m_recvBuff(NULL),
m_recvBuff(nullptr),
m_connectTimeout(0),
m_connectTimer(),
m_wasConRemovedFromMgr(false)
@@ -205,7 +205,7 @@ int TcpConnection::finishConnect()
t.tv_sec = 0;
t.tv_usec = 0;
int err = select(m_socket + 1, NULL, &wrSet, NULL, &t);
int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t);
if (err == 0)
{
@@ -300,7 +300,7 @@ TcpConnection::~TcpConnection()
{
delete [] m_recvBuff;
while(m_head != NULL)
while(m_head != nullptr)
{
data_block *tmp = m_head;
m_head = m_head->m_next;
@@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen)
{
m_aliveListId = m_manager->m_keepAliveList.m_listID;
if (m_prevKeepAliveConnection != NULL)
if (m_prevKeepAliveConnection != nullptr)
m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection;
if (m_nextKeepAliveConnection != NULL)
if (m_nextKeepAliveConnection != nullptr)
m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection;
if (m_manager->m_keepAliveList.m_beginList == this)
m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection;
m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList;
m_prevKeepAliveConnection = NULL;
if (m_manager->m_aliveList.m_beginList != NULL)
m_prevKeepAliveConnection = nullptr;
if (m_manager->m_aliveList.m_beginList != nullptr)
m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this;
m_manager->m_aliveList.m_beginList = this;
}
data_block *work = NULL;
data_block *work = nullptr;
// this connection has no send buffer. Get a block
if(!m_tail)
@@ -464,16 +464,16 @@ int TcpConnection::processIncoming()
{
m_recvDataListId = m_manager->m_noDataList.m_listID;
if (m_prevRecvDataConnection != NULL)
if (m_prevRecvDataConnection != nullptr)
m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection;
if (m_nextRecvDataConnection != NULL)
if (m_nextRecvDataConnection != nullptr)
m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection;
if (m_manager->m_noDataList.m_beginList == this)
m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection;
m_nextRecvDataConnection = m_manager->m_dataList.m_beginList;
m_prevRecvDataConnection = NULL;
if (m_manager->m_dataList.m_beginList != NULL)
m_prevRecvDataConnection = nullptr;
if (m_manager->m_dataList.m_beginList != nullptr)
m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this;
m_manager->m_dataList.m_beginList = this;
}
@@ -619,7 +619,7 @@ int TcpConnection::processOutgoing()
int sendError = 1;
// If m_head is not null, then this connection has something to send
// If m_head is not nullptr, then this connection has something to send
if(m_head)
@@ -50,7 +50,7 @@ public:
* connection is disconnected, you simply need to derive your class
* (multiply if necessary) from TcpConnectionHandler, then you can use
* this method to set the object the TcpConnection will call as appropriate.
* default = NULL (no callbacks made)
* default = nullptr (no callbacks made)
*
* @param handler The object which will be called for notifications.
*/
@@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy)
}
TcpManager::TcpManager(const TcpParams &params)
: m_handler(NULL),
m_keepAliveList(NULL, 1),
m_aliveList(NULL, 2),
m_noDataList(NULL, 1),
m_dataList(NULL, 2),
: m_handler(nullptr),
m_keepAliveList(nullptr, 1),
m_aliveList(nullptr, 2),
m_noDataList(nullptr, 1),
m_dataList(nullptr, 2),
m_params(params),
m_refCount(1),
m_connectionList(NULL),
m_connectionList(nullptr),
m_connectionListCount(0),
m_socket(INVALID_SOCKET),
m_boundAsServer(false),
@@ -86,7 +86,7 @@ TcpManager::~TcpManager()
close(m_socket);
#endif
}
while (m_connectionList != NULL)
while (m_connectionList != nullptr)
{
TcpConnection *con = m_connectionList;
m_connectionList = m_connectionList->m_nextConnection;
@@ -162,7 +162,7 @@ bool TcpManager::BindAsServer()
{
struct hostent * lphp;
lphp = gethostbyname(m_params.bindAddress);
if (lphp != NULL)
if (lphp != nullptr)
addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr;
}
else
@@ -187,7 +187,7 @@ bool TcpManager::BindAsServer()
TcpConnection *TcpManager::acceptClient()
{
TcpConnection *newConn = NULL;
TcpConnection *newConn = nullptr;
if (m_boundAsServer && m_connectionListCount < m_params.maxConnections)
{
@@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient()
{
newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port));
addNewConnection(newConn);
if (m_handler != NULL)
if (m_handler != nullptr)
{
m_handler->OnConnectRequest(newConn);
}
@@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD()
if (m_boundAsServer)
maxfd = m_socket+1;
TcpConnection *next = NULL;
for (TcpConnection *con = m_connectionList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next)
{
next = con->m_nextConnection;
if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd)
@@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD()
TcpConnection *TcpManager::getConnection(SOCKET fd)
{
TcpConnection *next = NULL;
for (TcpConnection *con = m_connectionList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next)
{
next = con->m_nextConnection;
if (con->m_socket == fd)
@@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd)
}
}
//if get here ,couldn't find it
return NULL;
return nullptr;
}
bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection)
@@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
{
// Send output from last heartbeat
TcpConnection *next = NULL;
for (TcpConnection *con = m_connectionList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next)
{
con->AddRef();
if (next) next->Release();
@@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
tmpfds = m_permfds;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout
int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout
if (cnt > 0)
@@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
//process incoming client messages
if (maxRecvTimePerConnection != 0)
{
TcpConnection *next = NULL;
for (TcpConnection *con = m_connectionList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next)
{
con->AddRef();
if (next) next->Release();
@@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
pollfds[0].events |= POLLIN;
}
TcpConnection *next = NULL;
for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++)
{
next = con->m_nextConnection;
pollfds[idx].fd = con->m_socket;
@@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
}
//process regular msg(s)
if (con == NULL)
if (con == nullptr)
{
close(pollfds[idx].fd);
continue;
@@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
}//if(pollfds[...
else if (pollfds[idx].revents & POLLHUP)
{
if (con == NULL)
if (con == nullptr)
{
close(pollfds[idx].fd);
continue;
@@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
//now process any keepalives, if time to do that
if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay))
{
TcpConnection *next = NULL;
for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next)
{
con->AddRef();
if (next) next->Release();
next = con->m_nextKeepAliveConnection;
if (next) next->AddRef();
con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList
con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList
con->Release();
}
//now move the complete alive list over to the keepalive list to reset those timers
m_keepAliveList.m_beginList = m_aliveList.m_beginList;
m_aliveList.m_beginList = NULL;
m_aliveList.m_beginList = nullptr;
//switch id's for those connections that were in the alive list last go - around
int tmpID = m_aliveList.m_listID;
@@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
//now process any noDataCons, if time to do that
if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout))
{
TcpConnection *next = NULL;
for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next)
TcpConnection *next = nullptr;
for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next)
{
con->AddRef();
if (next) next->Release();
@@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
//now move the complete data list over to the nodata list to reset those timers
m_noDataList.m_beginList = m_dataList.m_beginList;
m_dataList.m_beginList = NULL;
m_dataList.m_beginList = nullptr;
//switch id's for those connections that were in the data list last go - around
int tmpID = m_dataList.m_listID;
@@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign
{
//can't open outgoing connections when in server mode
// use a different TcpManager to do that
return NULL;
return nullptr;
}
if (m_connectionListCount >= m_params.maxConnections)
return(NULL);
return(nullptr);
// get server address
unsigned long address = inet_addr(serverAddress);
@@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign
{
struct hostent * lphp;
lphp = gethostbyname(serverAddress);
if (lphp == NULL)
return(NULL);
if (lphp == nullptr)
return(nullptr);
address = ((struct in_addr *)(lphp->h_addr))->s_addr;
}
IPAddress destIP(address);
@@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con)
FD_SET(con->m_socket, &m_permfds);
#endif
con->m_nextConnection = m_connectionList;
con->m_prevConnection = NULL;
if (m_connectionList != NULL)
con->m_prevConnection = nullptr;
if (m_connectionList != nullptr)
m_connectionList->m_prevConnection = con;
m_connectionList = con;
m_connectionListCount++;
con->m_nextKeepAliveConnection = m_aliveList.m_beginList;
con->m_prevKeepAliveConnection = NULL;
if (m_aliveList.m_beginList != NULL)
con->m_prevKeepAliveConnection = nullptr;
if (m_aliveList.m_beginList != nullptr)
m_aliveList.m_beginList->m_prevKeepAliveConnection = con;
m_aliveList.m_beginList = con;
con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is
con->m_nextRecvDataConnection = m_dataList.m_beginList;
con->m_prevRecvDataConnection = NULL;
if (m_dataList.m_beginList != NULL)
con->m_prevRecvDataConnection = nullptr;
if (m_dataList.m_beginList != nullptr)
m_dataList.m_beginList->m_prevRecvDataConnection = con;
m_dataList.m_beginList = con;
con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is
@@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con)
FD_CLR(con->m_socket, &m_permfds);
}
#endif
if (con->m_prevConnection != NULL)
if (con->m_prevConnection != nullptr)
con->m_prevConnection->m_nextConnection = con->m_nextConnection;
if (con->m_nextConnection != NULL)
if (con->m_nextConnection != nullptr)
con->m_nextConnection->m_prevConnection = con->m_prevConnection;
if (m_connectionList == con)
m_connectionList = con->m_nextConnection;
con->m_nextConnection = NULL;
con->m_prevConnection = NULL;
con->m_nextConnection = nullptr;
con->m_prevConnection = nullptr;
if (con->m_prevKeepAliveConnection != NULL)
if (con->m_prevKeepAliveConnection != nullptr)
con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection;
if (con->m_nextKeepAliveConnection != NULL)
if (con->m_nextKeepAliveConnection != nullptr)
con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection;
if (m_aliveList.m_beginList == con)
m_aliveList.m_beginList = con->m_nextKeepAliveConnection;
else if (m_keepAliveList.m_beginList == con)
m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection;
con->m_nextKeepAliveConnection = NULL;
con->m_prevKeepAliveConnection = NULL;
con->m_nextKeepAliveConnection = nullptr;
con->m_prevKeepAliveConnection = nullptr;
if (con->m_prevRecvDataConnection != NULL)
if (con->m_prevRecvDataConnection != nullptr)
con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection;
if (con->m_nextRecvDataConnection != NULL)
if (con->m_nextRecvDataConnection != nullptr)
con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection;
if (m_dataList.m_beginList == con)
m_dataList.m_beginList = con->m_nextRecvDataConnection;
else if (m_noDataList.m_beginList == con)
m_noDataList.m_beginList = con->m_nextRecvDataConnection;
con->m_nextRecvDataConnection = NULL;
con->m_prevRecvDataConnection = NULL;
con->m_nextRecvDataConnection = nullptr;
con->m_prevRecvDataConnection = nullptr;
@@ -156,7 +156,7 @@ public:
* simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use
* this method to set the object the TcpManager will call as appropriate. The TcpConnection object
* also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler
* default = NULL (no callbacks made)
* default = nullptr (no callbacks made)
*
* @param handler The object which will be called for manager related notifications.
*/
@@ -211,7 +211,7 @@ public:
* the connect-complete callback to be called if the connection is succesfull.
*
* @return A pointer to a TcpConnection object.
* NULL if the manager object has exceeded its maximum number of connections
* nullptr if the manager object has exceeded its maximum number of connections
* or if the serverAddress cannot be resolved to an IP address.
*/
TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0);
@@ -10,7 +10,7 @@
using namespace CTService;
unsigned openRequests = 0;
CTServiceAPI *waitclient = NULL;
CTServiceAPI *waitclient = nullptr;
std::map<unsigned, unsigned> m_tests;
std::string game_code;
@@ -122,7 +122,7 @@ namespace Plat_Unicode
/**
* Find a CharData for the given code point.
* @return null if no CharData exists for this code point
* @return nullptr if no CharData exists for this code point
*/
inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const
@@ -135,7 +135,7 @@ namespace CTService
const char *game,
const char *param)
{
printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(null)", param ? param : "(null)");
printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(nullptr)", param ? param : "(nullptr)");
replyTest(server_track, 999, 0);
}