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:
+8
-8
@@ -119,7 +119,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);
|
||||
@@ -138,7 +138,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;
|
||||
@@ -150,7 +150,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());
|
||||
@@ -163,7 +163,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
|
||||
@@ -180,7 +180,7 @@ void GenericAPICore::process()
|
||||
}
|
||||
}
|
||||
|
||||
if (con != NULL)
|
||||
if (con != nullptr)
|
||||
{
|
||||
Base::ByteStream msg;
|
||||
req->pack(msg);
|
||||
@@ -215,7 +215,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
|
||||
@@ -235,7 +235,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;
|
||||
}
|
||||
@@ -261,7 +261,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;
|
||||
|
||||
+10
-10
@@ -25,7 +25,7 @@ using namespace Base;
|
||||
GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, 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
|
||||
@@ -50,8 +50,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();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,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;
|
||||
@@ -77,7 +77,7 @@ void GenericConnection::OnTerminated(TcpConnection *)
|
||||
if(m_con)
|
||||
{
|
||||
m_con->Release();
|
||||
m_con = NULL;
|
||||
m_con = nullptr;
|
||||
}
|
||||
m_conState = CON_DISCONNECT;
|
||||
m_bConnected = CON_NONE;
|
||||
@@ -93,7 +93,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data
|
||||
|
||||
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
|
||||
@@ -152,7 +152,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:
|
||||
@@ -178,12 +178,12 @@ void GenericConnection::process()
|
||||
put(msg, std::string(m_apiCore->m_gameIdentifiers[index]));
|
||||
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;
|
||||
}
|
||||
@@ -199,7 +199,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();
|
||||
|
||||
+5
-5
@@ -25,9 +25,9 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi
|
||||
std::vector<short> portArray;
|
||||
char hostConfig[4096];
|
||||
char identifierConfig[4096];
|
||||
if (hostNames == NULL)
|
||||
if (hostNames == nullptr)
|
||||
hostNames = DEFAULT_HOST;
|
||||
if(identifiers == NULL)
|
||||
if(identifiers == nullptr)
|
||||
identifiers = DEFAULT_IDENTIFIER;
|
||||
|
||||
// parse the hosts and ports out :
|
||||
@@ -52,7 +52,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi
|
||||
portArray.push_back(port);
|
||||
}
|
||||
}
|
||||
while ((ptr = strtok(NULL, " ")) != NULL);
|
||||
while ((ptr = strtok(nullptr, " ")) != nullptr);
|
||||
}
|
||||
|
||||
strncpy(identifierConfig, identifiers, 4096); identifierConfig[4095] = 0;
|
||||
@@ -67,7 +67,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi
|
||||
identifierArray.push_back(identifier);
|
||||
}
|
||||
}
|
||||
while ((ptr = strtok(NULL, ";")) != NULL);
|
||||
while ((ptr = strtok(nullptr, ";")) != nullptr);
|
||||
}
|
||||
|
||||
if (hostArray.empty())
|
||||
@@ -134,7 +134,7 @@ unsigned AuctionTransferAPI::sendCommitTransaction(long long transactionID, void
|
||||
unsigned AuctionTransferAPI::sendPrepareTransaction(const char *serverIdentifier, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset, void *user, bool compress)
|
||||
{
|
||||
RequestTypes requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION;
|
||||
GenericRequest *req = NULL;
|
||||
GenericRequest *req = nullptr;
|
||||
if( compress )
|
||||
{
|
||||
requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION_COMPRESSED;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ void put(Base::ByteStream &msg, const Blob &source);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Blob::Blob(const unsigned char *data, unsigned len)
|
||||
: m_data(NULL),
|
||||
: m_data(nullptr),
|
||||
m_len(len)
|
||||
{
|
||||
if (m_len > 0)
|
||||
@@ -20,7 +20,7 @@ void put(Base::ByteStream &msg, const Blob &source);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Blob::Blob(const Blob &cpy)
|
||||
: m_data(NULL),
|
||||
: m_data(nullptr),
|
||||
m_len(cpy.m_len)
|
||||
{
|
||||
if (m_len > 0)
|
||||
@@ -45,7 +45,7 @@ void put(Base::ByteStream &msg, const Blob &source);
|
||||
if (m_data)
|
||||
{
|
||||
delete [] m_data;
|
||||
m_data = NULL;
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
||||
m_len = cpy.m_len;
|
||||
|
||||
+1
-1
@@ -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.
|
||||
*/
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
+32
-32
@@ -11,28 +11,28 @@ namespace NAMESPACE
|
||||
|
||||
//used when want to open new connection with this socket
|
||||
TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, 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 ¶ms, 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)
|
||||
@@ -208,7 +208,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)
|
||||
{
|
||||
@@ -303,7 +303,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;
|
||||
@@ -327,22 +327,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)
|
||||
@@ -467,16 +467,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;
|
||||
}
|
||||
@@ -622,7 +622,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)
|
||||
|
||||
+1
-1
@@ -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.
|
||||
*/
|
||||
|
||||
+53
-53
@@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy)
|
||||
}
|
||||
|
||||
TcpManager::TcpManager(const TcpParams ¶ms)
|
||||
: 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;
|
||||
@@ -166,7 +166,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
|
||||
@@ -191,7 +191,7 @@ bool TcpManager::BindAsServer()
|
||||
|
||||
TcpConnection *TcpManager::acceptClient()
|
||||
{
|
||||
TcpConnection *newConn = NULL;
|
||||
TcpConnection *newConn = nullptr;
|
||||
|
||||
if (m_boundAsServer && m_connectionListCount < m_params.maxConnections)
|
||||
{
|
||||
@@ -205,7 +205,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);
|
||||
}
|
||||
@@ -230,8 +230,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)
|
||||
@@ -245,8 +245,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)
|
||||
@@ -255,7 +255,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)
|
||||
@@ -277,8 +277,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();
|
||||
@@ -345,7 +345,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)
|
||||
@@ -371,8 +371,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();
|
||||
@@ -437,8 +437,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;
|
||||
@@ -478,7 +478,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
|
||||
}
|
||||
|
||||
//process regular msg(s)
|
||||
if (con == NULL)
|
||||
if (con == nullptr)
|
||||
{
|
||||
close(pollfds[idx].fd);
|
||||
continue;
|
||||
@@ -510,7 +510,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;
|
||||
@@ -528,21 +528,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;
|
||||
@@ -556,8 +556,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();
|
||||
@@ -571,7 +571,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;
|
||||
@@ -593,11 +593,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);
|
||||
@@ -605,8 +605,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);
|
||||
@@ -631,22 +631,22 @@ void TcpManager::addNewConnection(TcpConnection *con)
|
||||
}
|
||||
#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
|
||||
@@ -667,40 +667,40 @@ void TcpManager::removeConnection(TcpConnection *con)
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#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;
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+2
-2
@@ -187,7 +187,7 @@ class CA2GZIPT
|
||||
int destroy()
|
||||
{
|
||||
int err = Z_OK;
|
||||
if (m_zstream.state != NULL) {
|
||||
if (m_zstream.state != nullptr) {
|
||||
err = deflateEnd(&(m_zstream));
|
||||
}
|
||||
if (m_z_err < 0) err = m_z_err;
|
||||
@@ -459,7 +459,7 @@ class CGZIP2AT
|
||||
int destroy()
|
||||
{
|
||||
int err = Z_OK;
|
||||
if (m_zstream.state != NULL) {
|
||||
if (m_zstream.state != nullptr) {
|
||||
err = inflateEnd(&(m_zstream));
|
||||
}
|
||||
if (m_z_err < 0) err = m_z_err;
|
||||
|
||||
+19
-19
@@ -74,7 +74,7 @@ typedef struct z_stream_s {
|
||||
uInt avail_out; /* remaining free space at next_out */
|
||||
uLong total_out; /* total nb of bytes output so far */
|
||||
|
||||
char *msg; /* last error message, NULL if no error */
|
||||
char *msg; /* last error message, nullptr if no error */
|
||||
struct internal_state FAR *state; /* not visible by applications */
|
||||
|
||||
alloc_func zalloc; /* used to allocate the internal state */
|
||||
@@ -193,7 +193,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
|
||||
enough memory, Z_STREAM_ERROR if level is not a valid compression level,
|
||||
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
|
||||
with the version assumed by the caller (ZLIB_VERSION).
|
||||
msg is set to null if there is no error message. deflateInit does not
|
||||
msg is set to nullptr if there is no error message. deflateInit does not
|
||||
perform any compression: this will be done by deflate().
|
||||
*/
|
||||
|
||||
@@ -271,7 +271,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
|
||||
processed or more output produced), Z_STREAM_END if all input has been
|
||||
consumed and all output has been produced (only when flush is set to
|
||||
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
|
||||
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
|
||||
if next_in or next_out was nullptr), Z_BUF_ERROR if no progress is possible
|
||||
(for example avail_in or avail_out was zero).
|
||||
*/
|
||||
|
||||
@@ -304,7 +304,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
|
||||
|
||||
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
||||
version assumed by the caller. msg is set to null if there is no error
|
||||
version assumed by the caller. msg is set to nullptr if there is no error
|
||||
message. inflateInit does not perform any decompression apart from reading
|
||||
the zlib header if present: this will be done by inflate(). (So next_in and
|
||||
avail_in may be modified, but next_out and avail_out are unchanged.)
|
||||
@@ -372,7 +372,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
|
||||
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
|
||||
corrupted (input stream not conforming to the zlib format or incorrect
|
||||
adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
|
||||
(for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
|
||||
(for example if next_in or next_out was nullptr), Z_MEM_ERROR if there was not
|
||||
enough memory, Z_BUF_ERROR if no progress is possible or if there was not
|
||||
enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
|
||||
case, the application may then call inflateSync to look for a good
|
||||
@@ -437,7 +437,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
|
||||
|
||||
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
|
||||
method). msg is set to null if there is no error message. deflateInit2 does
|
||||
method). msg is set to nullptr if there is no error message. deflateInit2 does
|
||||
not perform any compression: this will be done by deflate().
|
||||
*/
|
||||
|
||||
@@ -471,7 +471,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
|
||||
actually used by the compressor.)
|
||||
|
||||
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
|
||||
parameter is invalid (such as NULL dictionary) or the stream state is
|
||||
parameter is invalid (such as nullptr dictionary) or the stream state is
|
||||
inconsistent (for example if deflate has already been called for this stream
|
||||
or if the compression method is bsort). deflateSetDictionary does not
|
||||
perform any compression: this will be done by deflate().
|
||||
@@ -491,7 +491,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
|
||||
|
||||
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
|
||||
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
|
||||
(such as zalloc being NULL). msg is left unchanged in both source and
|
||||
(such as zalloc being nullptr). msg is left unchanged in both source and
|
||||
destination.
|
||||
*/
|
||||
|
||||
@@ -503,7 +503,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
|
||||
that may have been set by deflateInit2.
|
||||
|
||||
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent (such as zalloc or state being NULL).
|
||||
stream state was inconsistent (such as zalloc or state being nullptr).
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
|
||||
@@ -544,7 +544,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
|
||||
|
||||
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
|
||||
memLevel). msg is set to null if there is no error message. inflateInit2
|
||||
memLevel). msg is set to nullptr if there is no error message. inflateInit2
|
||||
does not perform any decompression apart from reading the zlib header if
|
||||
present: this will be done by inflate(). (So next_in and avail_in may be
|
||||
modified, but next_out and avail_out are unchanged.)
|
||||
@@ -562,7 +562,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
|
||||
dictionary (see deflateSetDictionary).
|
||||
|
||||
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
|
||||
parameter is invalid (such as NULL dictionary) or the stream state is
|
||||
parameter is invalid (such as nullptr dictionary) or the stream state is
|
||||
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
|
||||
expected one (incorrect Adler32 value). inflateSetDictionary does not
|
||||
perform any decompression: this will be done by subsequent calls of
|
||||
@@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
|
||||
The stream will keep attributes that may have been set by inflateInit2.
|
||||
|
||||
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent (such as zalloc or state being NULL).
|
||||
stream state was inconsistent (such as zalloc or state being nullptr).
|
||||
*/
|
||||
|
||||
|
||||
@@ -667,7 +667,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
|
||||
gzopen can be used to read a file which is not in gzip format; in this
|
||||
case gzread will directly read from the file without decompression.
|
||||
|
||||
gzopen returns NULL if the file could not be opened or if there was
|
||||
gzopen returns nullptr if the file could not be opened or if there was
|
||||
insufficient memory to allocate the (de)compression state; errno
|
||||
can be checked to distinguish the two cases (if errno is zero, the
|
||||
zlib error is Z_MEM_ERROR). */
|
||||
@@ -681,7 +681,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
|
||||
The next call of gzclose on the returned gzFile will also close the
|
||||
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
|
||||
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
|
||||
gzdopen returns NULL if there was insufficient memory to allocate
|
||||
gzdopen returns nullptr if there was insufficient memory to allocate
|
||||
the (de)compression state.
|
||||
*/
|
||||
|
||||
@@ -718,8 +718,8 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
|
||||
|
||||
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
|
||||
/*
|
||||
Writes the given null-terminated string to the compressed file, excluding
|
||||
the terminating null character.
|
||||
Writes the given nullptr-terminated string to the compressed file, excluding
|
||||
the terminating nullptr character.
|
||||
gzputs returns the number of characters written, or -1 in case of error.
|
||||
*/
|
||||
|
||||
@@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
|
||||
/*
|
||||
Reads bytes from the compressed file until len-1 characters are read, or
|
||||
a newline character is read and transferred to buf, or an end-of-file
|
||||
condition is encountered. The string is then terminated with a null
|
||||
condition is encountered. The string is then terminated with a nullptr
|
||||
character.
|
||||
gzgets returns buf, or Z_NULL in case of error.
|
||||
*/
|
||||
@@ -822,7 +822,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||
|
||||
/*
|
||||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||
return the updated checksum. If buf is NULL, this function returns
|
||||
return the updated checksum. If buf is nullptr, this function returns
|
||||
the required initial value for the checksum.
|
||||
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
|
||||
much faster. Usage example:
|
||||
@@ -838,7 +838,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
|
||||
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
|
||||
/*
|
||||
Update a running crc with the bytes buf[0..len-1] and return the updated
|
||||
crc. If buf is NULL, this function returns the required initial value
|
||||
crc. If buf is nullptr, this function returns the required initial value
|
||||
for the crc. Pre- and post-conditioning (one's complement) is performed
|
||||
within this function so it shouldn't be done by the application.
|
||||
Usage example:
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# define fdopen(fd,mode) nullptr /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@@ -130,7 +130,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
#endif
|
||||
|
||||
#if defined(_BEOS_) || defined(RISCOS)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# define fdopen(fd,mode) nullptr /* No fdopen() */
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
||||
|
||||
Reference in New Issue
Block a user