mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-16 06:13:50 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -45,7 +45,7 @@ namespace API_NAMESPACE
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CommonAPI::CommonAPI(const char * hostList, const char * failoverHostList, unsigned connectionLimit, unsigned maxMsgSize, unsigned bufferSize)
|
||||
: mManager(NULL)
|
||||
: mManager(nullptr)
|
||||
, mHostReconnectTimeout()
|
||||
, mIdleHosts()
|
||||
, mHostMap()
|
||||
@@ -247,7 +247,7 @@ namespace API_NAMESPACE
|
||||
connection->Send((const char*)buffer, size);
|
||||
#endif
|
||||
}
|
||||
mLastRequestInputTime = time(NULL);
|
||||
mLastRequestInputTime = time(nullptr);
|
||||
}
|
||||
|
||||
#ifdef UDP_LIBRARY
|
||||
@@ -466,7 +466,7 @@ namespace API_NAMESPACE
|
||||
RequestMap_t::iterator reqIterator = mRequestMap.find(trackingNumber);
|
||||
bool found = false;
|
||||
|
||||
*pUserData = NULL;
|
||||
*pUserData = nullptr;
|
||||
if (reqIterator != mRequestMap.end())
|
||||
{
|
||||
TrackedRequest & request = reqIterator->second;
|
||||
@@ -594,7 +594,7 @@ namespace API_NAMESPACE
|
||||
|
||||
CommonAPI::ApiConnectionInfo * CommonAPI::GetNextUsableConnection()
|
||||
{
|
||||
ApiConnectionInfo * connectionInfo = NULL;
|
||||
ApiConnectionInfo * connectionInfo = nullptr;
|
||||
|
||||
if (!mUsableHosts[0].empty())
|
||||
{
|
||||
@@ -617,7 +617,7 @@ namespace API_NAMESPACE
|
||||
CommonAPI::ApiConnectionInfo * CommonAPI::FindConnectionInfo(ApiConnection * connection)
|
||||
{
|
||||
// find the connection in the set
|
||||
ApiConnectionInfo * pInfo = NULL;
|
||||
ApiConnectionInfo * pInfo = nullptr;
|
||||
ConnectionMap_t::iterator iter;
|
||||
if ( ((iter = mActiveHosts[0].find(connection)) != mActiveHosts[0].end()) ||
|
||||
((iter = mActiveHosts[1].find(connection)) != mActiveHosts[1].end()) )
|
||||
@@ -777,8 +777,8 @@ namespace API_NAMESPACE
|
||||
mspEnumerationToVersionStringMap = &enumerationToVersionStringMap;
|
||||
}
|
||||
|
||||
std::map<std::string, unsigned> *VersionMap::mspVersionStringToEnumerationMap = NULL;
|
||||
std::map<unsigned, std::string> *VersionMap::mspEnumerationToVersionStringMap = NULL;
|
||||
std::map<std::string, unsigned> *VersionMap::mspVersionStringToEnumerationMap = nullptr;
|
||||
std::map<unsigned, std::string> *VersionMap::mspEnumerationToVersionStringMap = nullptr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1009,7 +1009,7 @@ namespace API_NAMESPACE
|
||||
mspLabelToEntryMap = &labelToEntryMap;
|
||||
}
|
||||
|
||||
ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = NULL;
|
||||
ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = nullptr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace API_NAMESPACE
|
||||
typedef std::set<unsigned> TrackingSet_t;
|
||||
struct ApiConnectionInfo
|
||||
{
|
||||
ApiConnectionInfo(ApiConnection * Connection = NULL) : mConnection(Connection), mIsShuttingDown(false) { }
|
||||
ApiConnectionInfo(ApiConnection * Connection = nullptr) : mConnection(Connection), mIsShuttingDown(false) { }
|
||||
|
||||
ApiConnection * mConnection;
|
||||
TrackingSet_t mOutstandingRequests;
|
||||
|
||||
+11
-11
@@ -253,7 +253,7 @@ namespace API_NAMESPACE
|
||||
|
||||
Base * Base::Create(unsigned MsgId, StorageVector_t *pStorageVector)
|
||||
{
|
||||
Base * msg = NULL;
|
||||
Base * msg = nullptr;
|
||||
|
||||
if (ms_pClassMap) {
|
||||
std::map<unsigned, Base::DeepPointer>::iterator classIter = ms_pClassMap->find(MsgId);
|
||||
@@ -272,7 +272,7 @@ namespace API_NAMESPACE
|
||||
|
||||
const char * Base::GetMessageName(unsigned msgId)
|
||||
{
|
||||
const char * requestString = NULL;
|
||||
const char * requestString = nullptr;
|
||||
|
||||
if (ms_pClassMap) {
|
||||
std::map<unsigned, Base::DeepPointer>::iterator classIter = ms_pClassMap->find(msgId);
|
||||
@@ -287,7 +287,7 @@ namespace API_NAMESPACE
|
||||
|
||||
const char * Base::GetMessageIDString(unsigned msgId)
|
||||
{
|
||||
const char * idString = NULL;
|
||||
const char * idString = nullptr;
|
||||
|
||||
if (ms_pClassMap) {
|
||||
std::map<unsigned, Base::DeepPointer>::iterator classIter = ms_pClassMap->find(msgId);
|
||||
@@ -304,7 +304,7 @@ namespace API_NAMESPACE
|
||||
{
|
||||
static std::map<unsigned, Base::DeepPointer> classMap;
|
||||
|
||||
if (ms_pClassMap == NULL) {
|
||||
if (ms_pClassMap == nullptr) {
|
||||
ms_pClassMap = &classMap;
|
||||
}
|
||||
|
||||
@@ -326,24 +326,24 @@ namespace API_NAMESPACE
|
||||
}
|
||||
|
||||
Base::DeepPointer::DeepPointer() :
|
||||
m_ptr(NULL)
|
||||
m_ptr(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Base::DeepPointer::DeepPointer(const Base & source) :
|
||||
m_ptr(NULL)
|
||||
m_ptr(nullptr)
|
||||
{
|
||||
m_ptr = source.Clone(m_storageVector);
|
||||
}
|
||||
|
||||
Base::DeepPointer::DeepPointer(const Base * source) :
|
||||
m_ptr(NULL)
|
||||
m_ptr(nullptr)
|
||||
{
|
||||
m_ptr = source->Clone(m_storageVector);
|
||||
}
|
||||
|
||||
Base::DeepPointer::DeepPointer(const DeepPointer & source) :
|
||||
m_ptr(NULL)
|
||||
m_ptr(nullptr)
|
||||
{
|
||||
if (source.m_ptr) { m_ptr = source->Clone(m_storageVector); }
|
||||
}
|
||||
@@ -364,7 +364,7 @@ namespace API_NAMESPACE
|
||||
{
|
||||
Base *oldPtr = m_ptr;
|
||||
|
||||
m_ptr = rhs ? rhs->Clone(m_storageVector) : NULL;
|
||||
m_ptr = rhs ? rhs->Clone(m_storageVector) : nullptr;
|
||||
|
||||
if (oldPtr) {
|
||||
oldPtr->~Base();
|
||||
@@ -377,7 +377,7 @@ namespace API_NAMESPACE
|
||||
{
|
||||
Base *oldPtr = m_ptr;
|
||||
|
||||
m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : NULL;
|
||||
m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : nullptr;
|
||||
|
||||
if (oldPtr) {
|
||||
oldPtr->~Base();
|
||||
@@ -396,7 +396,7 @@ namespace API_NAMESPACE
|
||||
return *m_ptr;
|
||||
}
|
||||
|
||||
std::map<unsigned, Base::DeepPointer> *Base::ms_pClassMap = NULL;
|
||||
std::map<unsigned, Base::DeepPointer> *Base::ms_pClassMap = nullptr;
|
||||
|
||||
#if defined(PRINTABLE_MESSAGES) || defined(TRACK_READ_WRITE_FAILURES)
|
||||
Basic::Basic()
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace API_NAMESPACE
|
||||
protected:
|
||||
struct DECLSPEC MemberInfo
|
||||
{
|
||||
MemberInfo(soe::AutoVariableBase *dataIn = NULL, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect)
|
||||
MemberInfo(soe::AutoVariableBase *dataIn = nullptr, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect)
|
||||
: data(dataIn)
|
||||
, size(sizeIn)
|
||||
, version(versionIn)
|
||||
@@ -97,8 +97,8 @@ namespace API_NAMESPACE
|
||||
virtual Base * Clone() const;
|
||||
virtual Base * Clone(StorageVector_t &storageVector) const;
|
||||
virtual const char * MessageName() const { return "Base"; }
|
||||
virtual const char * MessageIDString() const { return "NULL"; }
|
||||
static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = NULL);
|
||||
virtual const char * MessageIDString() const { return "nullptr"; }
|
||||
static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = nullptr);
|
||||
static const char * GetMessageName(unsigned msgId);
|
||||
static const char * GetMessageIDString(unsigned msgId);
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace NAMESPACE
|
||||
if (!mActiveHosts[0].empty())
|
||||
{
|
||||
// get connection that corresponds to hash index
|
||||
ApiConnection * connection = NULL;
|
||||
ApiConnection * connection = nullptr;
|
||||
unsigned hashIndex = hashValue % mActiveHosts[0].size();
|
||||
unsigned curIndex = 0;
|
||||
for (ConnectionSet_t::iterator it = mActiveHosts[0].begin(); it != mActiveHosts[0].end(); it++, curIndex++)
|
||||
@@ -314,7 +314,7 @@ namespace NAMESPACE
|
||||
else if (!mActiveHosts[1].empty())
|
||||
{
|
||||
// get connection that corresponds to hash index
|
||||
ApiConnection * connection = NULL;
|
||||
ApiConnection * connection = nullptr;
|
||||
unsigned hashIndex = hashValue % mActiveHosts[1].size();
|
||||
unsigned curIndex = 0;
|
||||
for (ConnectionSet_t::iterator it = mActiveHosts[1].begin(); it != mActiveHosts[1].end(); it++, curIndex++)
|
||||
|
||||
@@ -132,7 +132,7 @@ int CmdLine::SplitLine(int argc, char **argv)
|
||||
|
||||
bool CmdLine::IsSwitch(const char *pParam)
|
||||
{
|
||||
if (pParam==NULL)
|
||||
if (pParam==nullptr)
|
||||
return false;
|
||||
|
||||
// switches must non-empty
|
||||
@@ -201,7 +201,7 @@ StringType CmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *p
|
||||
{
|
||||
StringType sRet;
|
||||
|
||||
if (pDefault!=NULL)
|
||||
if (pDefault!=nullptr)
|
||||
sRet = pDefault;
|
||||
|
||||
try
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace soe
|
||||
, mSecond(0)
|
||||
{
|
||||
struct tm timeStruct;
|
||||
struct tm *gotTime = NULL;
|
||||
struct tm *gotTime = nullptr;
|
||||
#ifdef WIN32
|
||||
gotTime = gmtime(&src);
|
||||
#else
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace soe
|
||||
|
||||
inline time_t localTimeToGmt(int dstOffsetMinutes = DST_OFFSET_MINUTES_USA)
|
||||
{
|
||||
time_t localTime = time(NULL);
|
||||
time_t localTime = time(nullptr);
|
||||
struct tm gt = *(gmtime(&localTime));
|
||||
struct tm lt = *(localtime(&localTime));
|
||||
bool isDst = (lt.tm_isdst? true:false);
|
||||
@@ -187,7 +187,7 @@ namespace soe
|
||||
dstOffsetSecs = dstOffsetMS/1000;
|
||||
return retval;
|
||||
}
|
||||
inline int getGMT(time_t & theTime, const char *id = NULL)
|
||||
inline int getGMT(time_t & theTime, const char *id = nullptr)
|
||||
{
|
||||
UDate date;
|
||||
UErrorCode ec;
|
||||
|
||||
Vendored
+3
-3
@@ -245,7 +245,7 @@ namespace soe
|
||||
template<typename FixedKeyType, typename ArbitraryKeyType, typename LimitType, typename CounterType, typename TimeType>
|
||||
const LimitType * GenericRateLimitingMechanism<FixedKeyType, ArbitraryKeyType, LimitType, CounterType, TimeType>::GetRateLimit(const FixedKeyType & fixedKey) const
|
||||
{
|
||||
LimitType const * rateLimit = NULL;
|
||||
LimitType const * rateLimit = nullptr;
|
||||
typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.find(fixedKey);
|
||||
|
||||
if (limIter != mRateLimits.end()) {
|
||||
@@ -258,7 +258,7 @@ namespace soe
|
||||
template<typename FixedKeyType, typename ArbitraryKeyType, typename LimitType, typename CounterType, typename TimeType>
|
||||
const LimitType * GenericRateLimitingMechanism<FixedKeyType, ArbitraryKeyType, LimitType, CounterType, TimeType>::GetNextRateLimit(FixedKeyType & fixedKey) const
|
||||
{
|
||||
LimitType const * rateLimit = NULL;
|
||||
LimitType const * rateLimit = nullptr;
|
||||
typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.upper_bound(fixedKey);
|
||||
|
||||
if (limIter != mRateLimits.end()) {
|
||||
@@ -272,7 +272,7 @@ namespace soe
|
||||
template<typename FixedKeyType, typename ArbitraryKeyType, typename LimitType, typename CounterType, typename TimeType>
|
||||
const CounterType * GenericRateLimitingMechanism<FixedKeyType, ArbitraryKeyType, LimitType, CounterType, TimeType>::GetRateCounter(const FixedKeyType & fixedKey, const ArbitraryKeyType & arbitraryKey) const
|
||||
{
|
||||
const CounterType * counter = NULL;
|
||||
const CounterType * counter = nullptr;
|
||||
typename RateCounterByKeyPairMap_t::const_iterator counterIter = mRateCounters.find(KeyPair(fixedKey, arbitraryKey));
|
||||
if (counterIter != mRateCounters.end()) {
|
||||
counter = &(counterIter->second->mCounter);
|
||||
|
||||
+50
-50
@@ -174,11 +174,11 @@ template<typename T> class HashTable
|
||||
bool Remove(T& obj, int hashValue);
|
||||
void Reset(); // removes all entries from the table
|
||||
|
||||
T *FindFirst(int hashValue) const; // returns NULL if not found
|
||||
T *FindNext(T *prevResult) const; // returns NULL if not found
|
||||
T *FindFirst(int hashValue) const; // returns nullptr if not found
|
||||
T *FindNext(T *prevResult) const; // returns nullptr if not found
|
||||
|
||||
T *WalkFirst() const; // returns NULL if not found
|
||||
T *WalkNext(T *prevResult) const; // returns NULL if not found
|
||||
T *WalkFirst() const; // returns nullptr if not found
|
||||
T *WalkNext(T *prevResult) const; // returns nullptr if not found
|
||||
|
||||
void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended)
|
||||
void GetStatistics(HashTableStatistics *stats) const;
|
||||
@@ -200,7 +200,7 @@ template<typename T> class HashTable
|
||||
|
||||
template<typename T> HashTable<T>::HashTable(int hashSize)
|
||||
{
|
||||
mTable = NULL;
|
||||
mTable = nullptr;
|
||||
mTableSize = 0;
|
||||
mEntryCount = 0;
|
||||
mStatUsedSlots = 0;
|
||||
@@ -220,9 +220,9 @@ template<typename T> void HashTable<T>::Insert(T& obj, int hashValue)
|
||||
entry->hashValue = hashValue;
|
||||
|
||||
int spot = ((unsigned)hashValue) % mTableSize;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
{
|
||||
entry->nextEntry = NULL;
|
||||
entry->nextEntry = nullptr;
|
||||
mTable[spot] = entry;
|
||||
mStatUsedSlots++;
|
||||
}
|
||||
@@ -239,14 +239,14 @@ template<typename T> bool HashTable<T>::Remove(T& obj, int hashValue)
|
||||
int spot = ((unsigned)hashValue) % mTableSize;
|
||||
HashEntry* next = mTable[spot];
|
||||
HashEntry** prev = &mTable[spot];
|
||||
while (next != NULL)
|
||||
while (next != nullptr)
|
||||
{
|
||||
if (next->obj == obj && next->hashValue == hashValue)
|
||||
{
|
||||
*prev = next->nextEntry;
|
||||
delete next;
|
||||
mEntryCount--;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
mStatUsedSlots--;
|
||||
return(true);
|
||||
break;
|
||||
@@ -263,17 +263,17 @@ template<typename T> void HashTable<T>::Reset()
|
||||
for (int spot = 0; spot < mTableSize; spot++)
|
||||
{
|
||||
HashEntry *curr = mTable[spot];
|
||||
if (curr != NULL)
|
||||
if (curr != nullptr)
|
||||
{
|
||||
mStatUsedSlots--;
|
||||
while (curr != NULL)
|
||||
while (curr != nullptr)
|
||||
{
|
||||
HashEntry *next = curr->nextEntry;
|
||||
delete curr;
|
||||
mEntryCount--;
|
||||
curr = next;
|
||||
}
|
||||
mTable[spot] = NULL;
|
||||
mTable[spot] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,13 +281,13 @@ template<typename T> void HashTable<T>::Reset()
|
||||
template<typename T> T *HashTable<T>::FindFirst(int hashValue) const
|
||||
{
|
||||
HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize];
|
||||
while (entry != NULL)
|
||||
while (entry != nullptr)
|
||||
{
|
||||
if (entry->hashValue == hashValue)
|
||||
return(&entry->obj);
|
||||
entry = entry->nextEntry;
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T *HashTable<T>::FindNext(T *prevResult) const
|
||||
@@ -295,13 +295,13 @@ template<typename T> T *HashTable<T>::FindNext(T *prevResult) const
|
||||
HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj));
|
||||
int hashValue = entry->hashValue;
|
||||
entry = entry->nextEntry;
|
||||
while (entry != NULL)
|
||||
while (entry != nullptr)
|
||||
{
|
||||
if (entry->hashValue == hashValue)
|
||||
return(&entry->obj);
|
||||
entry = entry->nextEntry;
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T *HashTable<T>::WalkFirst() const
|
||||
@@ -309,10 +309,10 @@ template<typename T> T *HashTable<T>::WalkFirst() const
|
||||
for (int bucket = 0; bucket < mTableSize; bucket++)
|
||||
{
|
||||
HashEntry *entry = mTable[bucket];
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(&entry->obj);
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T *HashTable<T>::WalkNext(T *prevResult) const
|
||||
@@ -321,17 +321,17 @@ template<typename T> T *HashTable<T>::WalkNext(T *prevResult) const
|
||||
int bucket = ((unsigned)entry->hashValue) % mTableSize;
|
||||
|
||||
entry = entry->nextEntry;
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(&entry->obj);
|
||||
|
||||
bucket++; // go onto next bucket
|
||||
for (; bucket < mTableSize; bucket++)
|
||||
{
|
||||
HashEntry *entry = mTable[bucket];
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(&entry->obj);
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> void HashTable<T>::Resize(int hashSize)
|
||||
@@ -351,16 +351,16 @@ template<typename T> void HashTable<T>::Resize(int hashSize)
|
||||
for (int i = 0; i < oldSize; i++)
|
||||
{
|
||||
HashEntry* next = oldTable[i];
|
||||
while (next != NULL)
|
||||
while (next != nullptr)
|
||||
{
|
||||
HashEntry* hold = next;
|
||||
next = next->nextEntry;
|
||||
|
||||
// insert hold into new table
|
||||
int spot = ((unsigned)hold->hashValue) % mTableSize;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
{
|
||||
hold->nextEntry = NULL;
|
||||
hold->nextEntry = nullptr;
|
||||
mTable[spot] = hold;
|
||||
mStatUsedSlots++;
|
||||
}
|
||||
@@ -414,11 +414,11 @@ template<typename T> class ObjectHashTable
|
||||
bool Remove(T obj, int hashValue);
|
||||
void Reset(); // removes all entries from the table
|
||||
|
||||
T FindFirst(int hashValue) const; // returns NULL if not found
|
||||
T FindNext(T prevResult) const; // returns NULL if not found
|
||||
T FindFirst(int hashValue) const; // returns nullptr if not found
|
||||
T FindNext(T prevResult) const; // returns nullptr if not found
|
||||
|
||||
T WalkFirst() const; // returns NULL if not found
|
||||
T WalkNext(T prevResult) const; // returns NULL if not found
|
||||
T WalkFirst() const; // returns nullptr if not found
|
||||
T WalkNext(T prevResult) const; // returns nullptr if not found
|
||||
|
||||
void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended)
|
||||
void GetStatistics(HashTableStatistics *stats) const;
|
||||
@@ -433,7 +433,7 @@ template<typename T> class ObjectHashTable
|
||||
|
||||
template<typename T> ObjectHashTable<T>::ObjectHashTable(int hashSize)
|
||||
{
|
||||
mTable = NULL;
|
||||
mTable = nullptr;
|
||||
mTableSize = 0;
|
||||
mEntryCount = 0;
|
||||
mStatUsedSlots = 0;
|
||||
@@ -451,9 +451,9 @@ template<typename T> void ObjectHashTable<T>::Insert(T obj, int hashValue)
|
||||
obj->mHashValue = hashValue;
|
||||
|
||||
int spot = ((unsigned)hashValue) % mTableSize;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
{
|
||||
obj->mHashNextEntry = NULL;
|
||||
obj->mHashNextEntry = nullptr;
|
||||
mTable[spot] = obj;
|
||||
mStatUsedSlots++;
|
||||
}
|
||||
@@ -470,14 +470,14 @@ template<typename T> bool ObjectHashTable<T>::Remove(T obj, int hashValue)
|
||||
int spot = ((unsigned)hashValue) % mTableSize;
|
||||
T next = mTable[spot];
|
||||
T *prev = &mTable[spot];
|
||||
while (next != NULL)
|
||||
while (next != nullptr)
|
||||
{
|
||||
if (next == obj)
|
||||
{
|
||||
*prev = (T)next->mHashNextEntry;
|
||||
next->mHashNextEntry = NULL;
|
||||
next->mHashNextEntry = nullptr;
|
||||
mEntryCount--;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
mStatUsedSlots--;
|
||||
return(true);
|
||||
break;
|
||||
@@ -494,16 +494,16 @@ template<typename T> void ObjectHashTable<T>::Reset()
|
||||
for (int spot = 0; spot < mTableSize; spot++)
|
||||
{
|
||||
T curr = mTable[spot];
|
||||
if (curr != NULL)
|
||||
if (curr != nullptr)
|
||||
{
|
||||
while (curr != NULL)
|
||||
while (curr != nullptr)
|
||||
{
|
||||
T next = (T)curr->mHashNextEntry;
|
||||
curr->mHashNextEntry = NULL;
|
||||
curr->mHashNextEntry = nullptr;
|
||||
mEntryCount--;
|
||||
curr = next;
|
||||
}
|
||||
mTable[spot] = NULL;
|
||||
mTable[spot] = nullptr;
|
||||
mStatUsedSlots--;
|
||||
}
|
||||
}
|
||||
@@ -512,13 +512,13 @@ template<typename T> void ObjectHashTable<T>::Reset()
|
||||
template<typename T> T ObjectHashTable<T>::FindFirst(int hashValue) const
|
||||
{
|
||||
T entry = mTable[((unsigned)hashValue) % mTableSize];
|
||||
while (entry != NULL)
|
||||
while (entry != nullptr)
|
||||
{
|
||||
if (entry->mHashValue == hashValue)
|
||||
return(entry);
|
||||
entry = (T)entry->mHashNextEntry;
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T ObjectHashTable<T>::FindNext(T prevResult) const
|
||||
@@ -526,13 +526,13 @@ template<typename T> T ObjectHashTable<T>::FindNext(T prevResult) const
|
||||
T entry = prevResult;
|
||||
int hashValue = entry->mHashValue;
|
||||
entry = (T)entry->mHashNextEntry;
|
||||
while (entry != NULL)
|
||||
while (entry != nullptr)
|
||||
{
|
||||
if (entry->mHashValue == hashValue)
|
||||
return(entry);
|
||||
entry = (T)entry->mHashNextEntry;
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T ObjectHashTable<T>::WalkFirst() const
|
||||
@@ -540,10 +540,10 @@ template<typename T> T ObjectHashTable<T>::WalkFirst() const
|
||||
for (int bucket = 0; bucket < mTableSize; bucket++)
|
||||
{
|
||||
T entry = mTable[bucket];
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(entry);
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> T ObjectHashTable<T>::WalkNext(T prevResult) const
|
||||
@@ -552,17 +552,17 @@ template<typename T> T ObjectHashTable<T>::WalkNext(T prevResult) const
|
||||
int bucket = ((unsigned)entry->mHashValue) % mTableSize;
|
||||
|
||||
entry = (T)entry->mHashNextEntry;
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(entry);
|
||||
|
||||
bucket++; // go onto next bucket
|
||||
for (; bucket < mTableSize; bucket++)
|
||||
{
|
||||
entry = mTable[bucket];
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
return(entry);
|
||||
}
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T> void ObjectHashTable<T>::Resize(int hashSize)
|
||||
@@ -582,16 +582,16 @@ template<typename T> void ObjectHashTable<T>::Resize(int hashSize)
|
||||
for (int i = 0; i < oldSize; i++)
|
||||
{
|
||||
T next = oldTable[i];
|
||||
while (next != NULL)
|
||||
while (next != nullptr)
|
||||
{
|
||||
T hold = next;
|
||||
next = (T)next->mHashNextEntry;
|
||||
|
||||
// insert hold into new table
|
||||
int spot = ((unsigned)hold->mHashValue) % mTableSize;
|
||||
if (mTable[spot] == NULL)
|
||||
if (mTable[spot] == nullptr)
|
||||
{
|
||||
hold->mHashNextEntry = NULL;
|
||||
hold->mHashNextEntry = nullptr;
|
||||
mTable[spot] = hold;
|
||||
mStatUsedSlots++;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ Logger::Logger(const char *programName,
|
||||
void Logger::LoggerInit(const char *programName)
|
||||
{
|
||||
char buf[1024];
|
||||
FILE *logDir = NULL;
|
||||
FILE *logDir = nullptr;
|
||||
|
||||
if (0 != (m_logType & eUseLocalFile))
|
||||
{
|
||||
@@ -124,13 +124,13 @@ void Logger::LoggerInit(const char *programName)
|
||||
{
|
||||
cmkdir(m_dirPrefix.c_str(), 0755);
|
||||
}
|
||||
else if(logDir != NULL)
|
||||
else if(logDir != nullptr)
|
||||
{
|
||||
fclose(logDir);
|
||||
}
|
||||
|
||||
tm now;
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
|
||||
LOGGER_GET_CURR_TIME(now, t);
|
||||
|
||||
@@ -148,7 +148,7 @@ void Logger::LoggerInit(const char *programName)
|
||||
{
|
||||
cmkdir(buf, 0755);
|
||||
}
|
||||
else if(logDir != NULL)
|
||||
else if(logDir != nullptr)
|
||||
{
|
||||
fclose(logDir);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
LogInfo *info = (*iter).second;
|
||||
if(level >= info->level)
|
||||
{
|
||||
@@ -400,7 +400,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co
|
||||
{
|
||||
return;
|
||||
}
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
LogInfo *info = (*iter).second;
|
||||
|
||||
if(level >= info->level)
|
||||
@@ -482,7 +482,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch
|
||||
{
|
||||
return;
|
||||
}
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
LogInfo *info = (*iter).second;
|
||||
|
||||
if(level >= info->level)
|
||||
@@ -562,7 +562,7 @@ void Logger::vlogWithSys(unsigned logenum, unsigned priority, int level, const c
|
||||
{
|
||||
return;
|
||||
}
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
LogInfo *info = (*iter).second;
|
||||
|
||||
if(level >= info->level)
|
||||
@@ -630,14 +630,14 @@ void Logger::vlog(unsigned logenum, int level, const char *message, va_list argp
|
||||
void Logger::rollDate(time_t t)
|
||||
{
|
||||
char buf[80];
|
||||
FILE *logDir = NULL;
|
||||
FILE *logDir = nullptr;
|
||||
|
||||
logDir = fopen(m_dirPrefix.c_str(), "r+");
|
||||
if(errno == ENOENT)
|
||||
{
|
||||
cmkdir(m_dirPrefix.c_str(), 0755);
|
||||
}
|
||||
else if(logDir != NULL)
|
||||
else if(logDir != nullptr)
|
||||
{
|
||||
fclose(logDir);
|
||||
}
|
||||
@@ -653,7 +653,7 @@ void Logger::rollDate(time_t t)
|
||||
{
|
||||
cmkdir(buf, 0755);
|
||||
}
|
||||
else if(logDir != NULL)
|
||||
else if(logDir != nullptr)
|
||||
{
|
||||
fclose(logDir);
|
||||
}
|
||||
@@ -737,7 +737,7 @@ void Logger::rollLog(LogInfo *logInfo)
|
||||
{
|
||||
std::string newLogName;
|
||||
char timeStampBuffer[256];
|
||||
time_t t = time(NULL);
|
||||
time_t t = time(nullptr);
|
||||
tm now;
|
||||
int r;
|
||||
int nTries = 10;
|
||||
|
||||
+14
-14
@@ -48,7 +48,7 @@ MonitorObject::~MonitorObject()
|
||||
|
||||
if( mConnection )
|
||||
{
|
||||
mConnection->SetHandler(NULL);
|
||||
mConnection->SetHandler(nullptr);
|
||||
mConnection->Disconnect();
|
||||
mConnection->Release();
|
||||
}
|
||||
@@ -72,10 +72,10 @@ char hold[214];
|
||||
UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason()));
|
||||
}
|
||||
}
|
||||
mConnection->SetHandler(NULL);
|
||||
mConnection->SetHandler(nullptr);
|
||||
mConnection->Disconnect();
|
||||
mConnection->Release();
|
||||
mConnection = NULL;
|
||||
mConnection = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +91,10 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d
|
||||
|
||||
simpleMessage msg(data);
|
||||
|
||||
if( con == NULL )
|
||||
if( con == nullptr )
|
||||
{
|
||||
if( mbprint)
|
||||
fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n");
|
||||
fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d
|
||||
if( mHierarchySent == true )
|
||||
{
|
||||
if( mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ))
|
||||
mlastUpdateTime = time(NULL);
|
||||
mlastUpdateTime = time(nullptr);
|
||||
break;
|
||||
}
|
||||
// NOTE: if mHierarchy is not sent or changed, then send it.
|
||||
@@ -258,7 +258,7 @@ MonitorManager::MonitorManager(char *configFile, CMonitorData *_gamedata, UdpMan
|
||||
{
|
||||
mManager = manager;
|
||||
mbprint = _bprint;
|
||||
passString = NULL;
|
||||
passString = nullptr;
|
||||
mMonitorData = _gamedata;
|
||||
mObjectCount = 0;
|
||||
|
||||
@@ -288,7 +288,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con)
|
||||
{
|
||||
if( con )
|
||||
{
|
||||
con->SetHandler(NULL);
|
||||
con->SetHandler(nullptr);
|
||||
con->Disconnect();
|
||||
con->Release();
|
||||
}
|
||||
@@ -310,7 +310,7 @@ void MonitorManager::GiveTime()
|
||||
// check if the monitor object is no longer connected
|
||||
for (int i = 0; i < mObjectCount; i++)
|
||||
{
|
||||
if( mObject[i]->mConnection == NULL ||
|
||||
if( mObject[i]->mConnection == nullptr ||
|
||||
mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected )
|
||||
{
|
||||
MonitorObject *o = mObject[i];
|
||||
@@ -342,7 +342,7 @@ int x;
|
||||
char buffer[1024];
|
||||
|
||||
FILE *fp = fopen(filename,"r");
|
||||
if (fp == NULL)
|
||||
if (fp == nullptr)
|
||||
{
|
||||
fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename);
|
||||
return false;
|
||||
@@ -364,7 +364,7 @@ char buffer[1024];
|
||||
x = 0;
|
||||
while(!feof(fp))
|
||||
{
|
||||
if (fgets( buffer, 1023, fp) != NULL) {
|
||||
if (fgets( buffer, 1023, fp) != nullptr) {
|
||||
|
||||
// get rid of '\n' and '\r' for comparisons
|
||||
strtok(buffer,"\r\n");
|
||||
@@ -402,17 +402,17 @@ CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint ,
|
||||
mbprint = _bprint;
|
||||
mPort = Port;
|
||||
|
||||
mAddress = NULL;
|
||||
mAddress = nullptr;
|
||||
if( address )
|
||||
{
|
||||
mAddress = (char *)malloc(strlen(address)+1);
|
||||
strcpy(mAddress,address);
|
||||
}
|
||||
|
||||
if( mang == NULL )
|
||||
if( mang == nullptr )
|
||||
{
|
||||
UdpManager::Params params;
|
||||
params.handler = NULL;
|
||||
params.handler = nullptr;
|
||||
params.maxConnections = CONNECTION_MAX;
|
||||
params.outgoingBufferSize = 1000000;
|
||||
params.noDataTimeout = 130000;
|
||||
|
||||
@@ -72,13 +72,13 @@ class CMonitorAPI {
|
||||
|
||||
public:
|
||||
|
||||
CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = NULL, UdpManager * mang = NULL );
|
||||
CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr );
|
||||
|
||||
~CMonitorAPI();
|
||||
|
||||
void Update();
|
||||
|
||||
void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = NULL );
|
||||
void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = nullptr );
|
||||
|
||||
void setDescription( int Id, const char *Description ) ;
|
||||
|
||||
|
||||
+9
-9
@@ -55,7 +55,7 @@ CMonitorData::CMonitorData()
|
||||
{
|
||||
|
||||
m_sequence = 1;
|
||||
m_buffer = NULL;
|
||||
m_buffer = nullptr;
|
||||
m_nbuffer = 0;
|
||||
m_count = 0;
|
||||
m_max = ELEMENT_START_VALUE;
|
||||
@@ -85,7 +85,7 @@ void CMonitorData::resize_buffer(int new_size)
|
||||
{
|
||||
char *temp;
|
||||
|
||||
if( m_buffer != NULL )
|
||||
if( m_buffer != nullptr )
|
||||
{
|
||||
temp = m_buffer;
|
||||
m_buffer = new char[ new_size];
|
||||
@@ -252,7 +252,7 @@ char *p;
|
||||
{
|
||||
if( get_bit(mark,x) == 0 )
|
||||
{
|
||||
if( m_data[x].discription != NULL )
|
||||
if( m_data[x].discription != nullptr )
|
||||
snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription);
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id);
|
||||
@@ -282,7 +282,7 @@ char *p;
|
||||
{
|
||||
flag = 2;
|
||||
|
||||
if( m_data[x].discription != NULL )
|
||||
if( m_data[x].discription != nullptr )
|
||||
snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription);
|
||||
else
|
||||
snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id);
|
||||
@@ -338,7 +338,7 @@ int x;
|
||||
|
||||
//******* Discription ******
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = NULL;
|
||||
m_data[x].discription = nullptr;
|
||||
|
||||
if( des )
|
||||
{
|
||||
@@ -387,10 +387,10 @@ int x;
|
||||
for(x=0;x<m_count;x++)
|
||||
{
|
||||
|
||||
if( Description == NULL )
|
||||
if( Description == nullptr )
|
||||
{
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = NULL;
|
||||
m_data[x].discription = nullptr;
|
||||
mode = 0;
|
||||
retVal = x;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ void CMonitorData::set(int Id, int value)
|
||||
if( Id == m_data[x].id )
|
||||
{
|
||||
if( m_data[x].ChangedTime == 0 || m_data[x].value != value )
|
||||
m_data[x].ChangedTime = time(NULL);
|
||||
m_data[x].ChangedTime = time(nullptr);
|
||||
m_data[x].value = value;
|
||||
return;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ int CMonitorData::parseList( char **list, char *data, char tok , int max )
|
||||
int count;
|
||||
int cnt;
|
||||
|
||||
if( data == NULL )
|
||||
if( data == nullptr )
|
||||
return 0;
|
||||
|
||||
list[0] = data;
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ Usage
|
||||
'L' - long long int (8)
|
||||
'i' - int (4)
|
||||
's' - short int (2)
|
||||
'S' - C-style, null-terminated string (n + null)
|
||||
'S' - C-style, nullptr-terminated string (n + nullptr)
|
||||
'Bn' - buffer, of size n. Used for non-terminated strings, or
|
||||
other binary data.
|
||||
*/
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// stringMessage
|
||||
// This message type is used for passing messages that can consist of a NULL terminated string
|
||||
// This message type is used for passing messages that can consist of a nullptr terminated string
|
||||
class stringMessage : public monMessage
|
||||
{
|
||||
public:
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark);
|
||||
int add(const char *label, int id, int ping, char *des );
|
||||
int setDescription( int Id, const char *Description , int & mode);
|
||||
char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;}
|
||||
char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;}
|
||||
int pingValue(int p);
|
||||
void set(int Id, int value);
|
||||
void remove(int Id);
|
||||
|
||||
@@ -37,12 +37,12 @@ template<typename T, typename P> class PriorityQueue
|
||||
PriorityQueue(int queueSize);
|
||||
~PriorityQueue();
|
||||
|
||||
T* Top(); // returns NULL if queue is empty
|
||||
T* TopRemove(); // returns NULL if queue is empty
|
||||
T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL
|
||||
T* Top(); // returns nullptr if queue is empty
|
||||
T* TopRemove(); // returns nullptr if queue is empty
|
||||
T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr
|
||||
T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always
|
||||
T* Remove(T* entry); // returns entry always (even if it was not in the queue)
|
||||
P *GetPriority(T* entry); // returns NULL if entry is not in the queue
|
||||
P *GetPriority(T* entry); // returns nullptr if entry is not in the queue
|
||||
int QueueUsed(); // returns how many entries are in the queue
|
||||
protected:
|
||||
struct QueueEntry
|
||||
@@ -88,14 +88,14 @@ template<typename T, typename P> PriorityQueue<T, P>::~PriorityQueue()
|
||||
template<typename T, typename P> T* PriorityQueue<T, P>::Top()
|
||||
{
|
||||
if (mQueueEnd == 0)
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
return(mQueue[0].entry);
|
||||
}
|
||||
|
||||
template<typename T, typename P> T* PriorityQueue<T, P>::TopRemove()
|
||||
{
|
||||
if (mQueueEnd == 0)
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
T* top = mQueue[0].entry;
|
||||
Remove(top);
|
||||
return(top);
|
||||
@@ -105,14 +105,14 @@ template<typename T, typename P> T* PriorityQueue<T, P>::TopRemove(P priority)
|
||||
{
|
||||
if (mQueueEnd > 0 && mQueue[0].priority <= priority)
|
||||
return(Remove(mQueue[0].entry));
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T, typename P> P* PriorityQueue<T, P>::GetPriority(T* entry)
|
||||
{
|
||||
if (entry->mPriorityQueuePosition >= 0)
|
||||
return(&mQueue[entry->mPriorityQueuePosition].priority);
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
template<typename T, typename P> T* PriorityQueue<T, P>::Add(T* entry, P priority)
|
||||
@@ -121,7 +121,7 @@ template<typename T, typename P> T* PriorityQueue<T, P>::Add(T* entry, P priorit
|
||||
{
|
||||
// not in queue, so add it to the bottom
|
||||
if (mQueueEnd >= mQueueSize)
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
mQueue[mQueueEnd].entry = entry;
|
||||
mQueue[mQueueEnd].priority = priority;
|
||||
mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd;
|
||||
|
||||
+2
-2
@@ -78,12 +78,12 @@ namespace soe
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
// tok not found take the whole thing
|
||||
if (dest != NULL) { dest->assign(*base);}
|
||||
if (dest != nullptr) { dest->assign(*base);}
|
||||
base->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dest != NULL) {dest->assign(base->substr(0,pos));}
|
||||
if (dest != nullptr) {dest->assign(base->substr(0,pos));}
|
||||
base->erase(0,pos + tok.length());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace soe
|
||||
void trim(std::string& str);
|
||||
void crack(std::string * dest, std::string * base, const std::string& tok);
|
||||
void inline crack(std::string& dest, std::string& base, const std::string& tok) {crack(&dest, &base, tok);}
|
||||
void inline crack(std::string& base, const std::string& tok) {crack(NULL, &base, tok);}
|
||||
void inline crack(std::string& base, const std::string& tok) {crack(nullptr, &base, tok);}
|
||||
|
||||
class lowerCaseString
|
||||
{
|
||||
|
||||
+27
-27
@@ -156,15 +156,15 @@ private:
|
||||
class letterNode
|
||||
{
|
||||
public:
|
||||
letterNode() : mpData(NULL), mpChildren(NULL), mNumChildren(0) { }
|
||||
letterNode(const letter_t & letter) : mLetter(letter), mpData(NULL), mpChildren(NULL), mNumChildren(0) { }
|
||||
letterNode() : mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { }
|
||||
letterNode(const letter_t & letter) : mLetter(letter), mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { }
|
||||
~letterNode();
|
||||
|
||||
inline bool hasData() const { return (mpData != NULL); }
|
||||
inline bool hasData() const { return (mpData != nullptr); }
|
||||
inline data_t & getData() { return *mpData; }
|
||||
inline const data_t & getData() const { return *mpData; }
|
||||
inline void setData(const data_t & data) { if (mpData) { *mpData = data; } else { mpData = new data_t(data); } }
|
||||
inline void removeData() { delete mpData; mpData = NULL; }
|
||||
inline void removeData() { delete mpData; mpData = nullptr; }
|
||||
|
||||
letterNode * get(letter_t index) const;
|
||||
bool put(letter_t index, letterNode ** tree);
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
|
||||
inline letter_t & letter() { return mLetter; }
|
||||
inline const letter_t & letter() const { return mLetter; }
|
||||
inline bool hasNoChildren() const { return (mpChildren == NULL) || (mNumChildren == 0); }
|
||||
inline bool hasNoChildren() const { return (mpChildren == nullptr) || (mNumChildren == 0); }
|
||||
|
||||
private:
|
||||
letter_t mLetter;
|
||||
@@ -272,9 +272,9 @@ bool stringTree<letter_t, data_t>::seek(iter_t & start, const iter_t & stop, typ
|
||||
position.mBranch.push_back(&mRoot);
|
||||
}
|
||||
|
||||
const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL;
|
||||
const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr;
|
||||
|
||||
for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++)
|
||||
for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++)
|
||||
{
|
||||
position.mBranch.push_back(pnode);
|
||||
if (pnode->hasData()) {
|
||||
@@ -298,9 +298,9 @@ bool stringTree<letter_t, data_t>::seek(iter_t & start, const iter_t & stop, typ
|
||||
position.mBranch.push_back(&mRoot);
|
||||
}
|
||||
|
||||
const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL;
|
||||
const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr;
|
||||
|
||||
for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++)
|
||||
for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++)
|
||||
{
|
||||
position.mBranch.push_back(pnode);
|
||||
if (pnode->hasData()) {
|
||||
@@ -441,7 +441,7 @@ stringTree<letter_t, data_t>::letterNode::~letterNode()
|
||||
template<typename letter_t, typename data_t>
|
||||
typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>::letterNode::get(letter_t index) const
|
||||
{
|
||||
letterNode * tree = NULL;
|
||||
letterNode * tree = nullptr;
|
||||
letterNode * end = mpChildren + mNumChildren;
|
||||
letterNode * place = std::lower_bound<letterNode *>(mpChildren, mpChildren + mNumChildren, index);
|
||||
|
||||
@@ -495,10 +495,10 @@ bool stringTree<letter_t, data_t>::letterNode::take(letter_t index, bool dealloc
|
||||
mNumChildren--;
|
||||
if (!mNumChildren) { deallocate = true; }
|
||||
|
||||
letterNode * children = NULL;
|
||||
letterNode * children = nullptr;
|
||||
|
||||
if (deallocate) {
|
||||
children = mNumChildren ? new letterNode[mNumChildren] : NULL;
|
||||
children = mNumChildren ? new letterNode[mNumChildren] : nullptr;
|
||||
} else {
|
||||
children = mpChildren;
|
||||
}
|
||||
@@ -536,7 +536,7 @@ void stringTree<letter_t, data_t>::const_iterator::getKey(string_t & key) const
|
||||
template<typename letter_t, typename data_t>
|
||||
typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>::letterNode::firstChild() const
|
||||
{
|
||||
letterNode * child = NULL;
|
||||
letterNode * child = nullptr;
|
||||
|
||||
if (mpChildren) {
|
||||
child = mpChildren;
|
||||
@@ -548,7 +548,7 @@ typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>
|
||||
template<typename letter_t, typename data_t>
|
||||
typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>::letterNode::lastChild() const
|
||||
{
|
||||
letterNode * child = NULL;
|
||||
letterNode * child = nullptr;
|
||||
|
||||
if (mpChildren) {
|
||||
child = mpChildren + mNumChildren - 1;
|
||||
@@ -560,7 +560,7 @@ typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>
|
||||
template<typename letter_t, typename data_t>
|
||||
typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>::letterNode::nextChild(const letterNode * child) const
|
||||
{
|
||||
letterNode * next = NULL;
|
||||
letterNode * next = nullptr;
|
||||
|
||||
if (mpChildren) {
|
||||
size_t index = child - mpChildren;
|
||||
@@ -577,7 +577,7 @@ typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>
|
||||
template<typename letter_t, typename data_t>
|
||||
typename stringTree<letter_t, data_t>::letterNode * stringTree<letter_t, data_t>::letterNode::previousChild(const letterNode * child) const
|
||||
{
|
||||
letterNode * previous = NULL;
|
||||
letterNode * previous = nullptr;
|
||||
|
||||
if (mpChildren) {
|
||||
size_t index = child - mpChildren;
|
||||
@@ -623,13 +623,13 @@ template<typename letter_t, typename data_t>
|
||||
bool stringTree<letter_t, data_t>::const_iterator::advance()
|
||||
{
|
||||
bool wentForward = false;
|
||||
const letterNode * terminal = NULL;
|
||||
const letterNode * penultimate = NULL;
|
||||
const letterNode * next = NULL;
|
||||
const letterNode * terminal = nullptr;
|
||||
const letterNode * penultimate = nullptr;
|
||||
const letterNode * next = nullptr;
|
||||
|
||||
if (mBranch.back()->hasNoChildren()) {
|
||||
// go forward
|
||||
while ((mBranch.size() >= 2) && (next == NULL))
|
||||
while ((mBranch.size() >= 2) && (next == nullptr))
|
||||
{
|
||||
penultimate = mBranch[mBranch.size() - 2];
|
||||
terminal = mBranch[mBranch.size() - 1];
|
||||
@@ -654,9 +654,9 @@ template<typename letter_t, typename data_t>
|
||||
bool stringTree<letter_t, data_t>::const_iterator::retreat()
|
||||
{
|
||||
bool wentBack = false;
|
||||
const letterNode * terminal = NULL;
|
||||
const letterNode * penultimate = NULL;
|
||||
const letterNode * next = NULL;
|
||||
const letterNode * terminal = nullptr;
|
||||
const letterNode * penultimate = nullptr;
|
||||
const letterNode * next = nullptr;
|
||||
|
||||
if (mBranch.size() >= 2) {
|
||||
// go backwards
|
||||
@@ -670,7 +670,7 @@ bool stringTree<letter_t, data_t>::const_iterator::retreat()
|
||||
mBranch.pop_back();
|
||||
}
|
||||
// go to leaf
|
||||
for (; next != NULL; next = next->lastChild())
|
||||
for (; next != nullptr; next = next->lastChild())
|
||||
{
|
||||
mBranch.push_back(next);
|
||||
if (next->hasData() && next->hasNoChildren()) {
|
||||
@@ -724,9 +724,9 @@ template<typename letter_t, typename data_t>
|
||||
void stringTree<letter_t, data_t>::setBegin() const
|
||||
{
|
||||
mBegin.mBranch.clear();
|
||||
const letterNode * leaf = NULL;
|
||||
const letterNode * leaf = nullptr;
|
||||
|
||||
for (leaf = &mRoot; leaf != NULL; leaf = leaf->firstChild())
|
||||
for (leaf = &mRoot; leaf != nullptr; leaf = leaf->firstChild())
|
||||
{
|
||||
mBegin.mBranch.push_back(leaf);
|
||||
if (leaf->hasData()) {
|
||||
@@ -782,7 +782,7 @@ template<typename letter_t, typename data_t>
|
||||
template<typename iter_t>
|
||||
const data_t * stringTree<letter_t, data_t>::finder<iter_t>::data() const
|
||||
{
|
||||
const data_t * pData = NULL;
|
||||
const data_t * pData = nullptr;
|
||||
|
||||
if (mDictionaryIter != mDictionary.end()) {
|
||||
pData = &(*mDictionaryIter);
|
||||
|
||||
@@ -120,10 +120,10 @@ Event::Event(bool signaled) :
|
||||
mEvent()
|
||||
{
|
||||
#ifdef WIN32
|
||||
mEvent = CreateEvent(NULL, FALSE, signaled ? TRUE : FALSE, NULL);
|
||||
mEvent = CreateEvent(nullptr, FALSE, signaled ? TRUE : FALSE, nullptr);
|
||||
#else
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_cond_init(&mCond, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
pthread_cond_init(&mCond, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ bool Event::Wait(unsigned timeoutMilliseconds)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec abs_timeout;
|
||||
gettimeofday(&now, NULL);
|
||||
gettimeofday(&now, nullptr);
|
||||
abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000;
|
||||
abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000;
|
||||
abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000;
|
||||
@@ -198,10 +198,10 @@ EventLock::EventLock(bool locked) :
|
||||
mEvent()
|
||||
{
|
||||
#ifdef WIN32
|
||||
mEvent = CreateEvent(NULL, TRUE, locked ? FALSE : TRUE, NULL);
|
||||
mEvent = CreateEvent(nullptr, TRUE, locked ? FALSE : TRUE, nullptr);
|
||||
#else
|
||||
pthread_mutex_init(&mMutex, NULL);
|
||||
pthread_cond_init(&mCond, NULL);
|
||||
pthread_mutex_init(&mMutex, nullptr);
|
||||
pthread_cond_init(&mCond, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ bool EventLock::Wait(unsigned timeoutMilliseconds)
|
||||
{
|
||||
struct timeval now;
|
||||
struct timespec abs_timeout;
|
||||
gettimeofday(&now, NULL);
|
||||
gettimeofday(&now, nullptr);
|
||||
abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000;
|
||||
abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000;
|
||||
abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace soe
|
||||
size_t UTF8_convertToUTF16( char * ptr , UTF16 * ret, size_t limit )
|
||||
{
|
||||
size_t len = 0;
|
||||
while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator
|
||||
while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator
|
||||
{
|
||||
size_t clen = UTF8_convertCharToUTF16( ptr, ret );
|
||||
ptr += clen;
|
||||
|
||||
+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, unsigned 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, unsigned 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)
|
||||
@@ -206,7 +206,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)
|
||||
@@ -471,16 +471,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;
|
||||
}
|
||||
@@ -626,7 +626,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.
|
||||
*/
|
||||
|
||||
+55
-55
@@ -57,14 +57,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),
|
||||
@@ -103,7 +103,7 @@ TcpManager::~TcpManager()
|
||||
close(m_socket);
|
||||
#endif
|
||||
}
|
||||
while (m_connectionList != NULL)
|
||||
while (m_connectionList != nullptr)
|
||||
{
|
||||
TcpConnection *con = m_connectionList;
|
||||
con->AddRef();
|
||||
@@ -179,7 +179,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
|
||||
@@ -204,7 +204,7 @@ bool TcpManager::BindAsServer()
|
||||
|
||||
TcpConnection *TcpManager::acceptClient()
|
||||
{
|
||||
TcpConnection *newConn = NULL;
|
||||
TcpConnection *newConn = nullptr;
|
||||
|
||||
if (m_boundAsServer && m_connectionListCount < m_params.maxConnections)
|
||||
{
|
||||
@@ -218,7 +218,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);
|
||||
}
|
||||
@@ -243,8 +243,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)
|
||||
@@ -258,8 +258,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)
|
||||
@@ -268,7 +268,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)
|
||||
@@ -290,8 +290,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();
|
||||
@@ -358,7 +358,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)
|
||||
@@ -384,8 +384,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();
|
||||
@@ -450,8 +450,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;
|
||||
@@ -491,7 +491,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT
|
||||
}
|
||||
|
||||
//process regular msg(s)
|
||||
if (con == NULL)
|
||||
if (con == nullptr)
|
||||
{
|
||||
close(pollfds[idx].fd);
|
||||
continue;
|
||||
@@ -523,7 +523,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;
|
||||
@@ -541,21 +541,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;
|
||||
@@ -569,8 +569,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();
|
||||
@@ -584,7 +584,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;
|
||||
@@ -606,17 +606,17 @@ 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);
|
||||
if (address == INADDR_NONE)
|
||||
{
|
||||
if (m_dnsMap[serverAddress].timeout >= time(NULL))
|
||||
if (m_dnsMap[serverAddress].timeout >= time(nullptr))
|
||||
{
|
||||
address = m_dnsMap[serverAddress].addr;
|
||||
}
|
||||
@@ -624,12 +624,12 @@ 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;
|
||||
|
||||
m_dnsMap[serverAddress].addr = address;
|
||||
m_dnsMap[serverAddress].timeout = time(NULL)+DNS_TIMEOUT;
|
||||
m_dnsMap[serverAddress].timeout = time(nullptr)+DNS_TIMEOUT;
|
||||
}
|
||||
}
|
||||
IPAddress destIP(address);
|
||||
@@ -649,22 +649,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
|
||||
@@ -682,40 +682,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;
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -168,7 +168,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.
|
||||
*/
|
||||
@@ -223,7 +223,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);
|
||||
|
||||
+217
-217
File diff suppressed because it is too large
Load Diff
+21
-21
@@ -150,7 +150,7 @@ class UdpMisc
|
||||
// memory manager does a little bit of this, but if you know you have an allocation that is likely
|
||||
// to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid
|
||||
// unnecessary reallocs at the cost of a little potentially wasted space
|
||||
// initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0
|
||||
// initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0
|
||||
static void *SmartResize(void *ptr, int bytes, int round = 1);
|
||||
|
||||
// the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1)
|
||||
@@ -170,7 +170,7 @@ class UdpMisc
|
||||
static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format
|
||||
static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format
|
||||
|
||||
static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0);
|
||||
static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
||||
|
||||
// looks up the specified name and translates it to an IP address
|
||||
// this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms)
|
||||
@@ -243,7 +243,7 @@ class LogicalPacket
|
||||
protected:
|
||||
friend class UdpReliableChannel;
|
||||
mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch
|
||||
// NULL = unclaimed, point-to-self = claimed, but end of list
|
||||
// nullptr = unclaimed, point-to-self = claimed, but end of list
|
||||
};
|
||||
|
||||
class SimpleLogicalPacket : public LogicalPacket
|
||||
@@ -252,7 +252,7 @@ class SimpleLogicalPacket : public LogicalPacket
|
||||
// it was originally created to allow the internal code to handle reliable data that was sent
|
||||
// via the Send(char *, int) api call.
|
||||
public:
|
||||
SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it)
|
||||
SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it)
|
||||
virtual void *GetDataPtr();
|
||||
virtual const void *GetDataPtr() const;
|
||||
virtual int GetDataLen() const;
|
||||
@@ -323,7 +323,7 @@ template<typename T> class StructLogicalPacket : public LogicalPacket
|
||||
// with virtual functions) via this method as they may contain hidden data-members (such as pointers
|
||||
// to vtables).
|
||||
public:
|
||||
StructLogicalPacket(T *initData = NULL);
|
||||
StructLogicalPacket(T *initData = nullptr);
|
||||
virtual void *GetDataPtr();
|
||||
virtual const void *GetDataPtr() const;
|
||||
virtual int GetDataLen() const;
|
||||
@@ -396,7 +396,7 @@ class PooledLogicalPacket : public LogicalPacket
|
||||
int mMaxDataLen;
|
||||
protected:
|
||||
friend class UdpManager;
|
||||
void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0);
|
||||
void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
||||
UdpManager *mUdpManager;
|
||||
PooledLogicalPacket *mAvailableNext;
|
||||
PooledLogicalPacket *mCreatedNext;
|
||||
@@ -476,7 +476,7 @@ class UdpManager
|
||||
// pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object
|
||||
// also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler
|
||||
// if a handler is specified, the callback function is ignored, even if specified.
|
||||
// default = NULL (not used)
|
||||
// default = nullptr (not used)
|
||||
UdpManagerHandler *handler;
|
||||
|
||||
// this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections
|
||||
@@ -901,7 +901,7 @@ class UdpManager
|
||||
// will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see
|
||||
// if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows
|
||||
// the application to look for the ESC key or timeout an attempted connection.
|
||||
// This function will return NULL if the manager object has exceeded its maximum number of connections
|
||||
// This function will return nullptr if the manager object has exceeded its maximum number of connections
|
||||
// or if the serverAddress cannot be resolved to an IP address
|
||||
// as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it
|
||||
// setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change
|
||||
@@ -933,13 +933,13 @@ class UdpManager
|
||||
// manually forces all live connections to flush their multi buffers immediately
|
||||
void FlushAllMultiBuffer();
|
||||
|
||||
// creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet
|
||||
// creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet
|
||||
// of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax),
|
||||
// it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical
|
||||
// are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface)
|
||||
// they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers
|
||||
// to explicitly call this function.
|
||||
LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0);
|
||||
LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
||||
|
||||
protected:
|
||||
friend class PooledLogicalPacket;
|
||||
@@ -1165,7 +1165,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember,
|
||||
int ConnectionAge() const;
|
||||
|
||||
// returns the UdpManager object that is managing this connection
|
||||
// will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager)
|
||||
// will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager)
|
||||
UdpManager *GetUdpManager() const;
|
||||
|
||||
// returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process.
|
||||
@@ -1245,9 +1245,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember,
|
||||
friend class UdpManager;
|
||||
friend class UdpReliableChannel;
|
||||
|
||||
// note: if connectPacket is NULL, that means this connection object is being created to establish
|
||||
// note: if connectPacket is nullptr, that means this connection object is being created to establish
|
||||
// a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode)
|
||||
// if connectPacket is non-NULL, that menas this connection object is being created to handle an
|
||||
// if connectPacket is non-nullptr, that menas this connection object is being created to handle an
|
||||
// incoming connect request and it will start out in cStatusConnected mode.
|
||||
UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol
|
||||
UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request
|
||||
@@ -1282,7 +1282,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember,
|
||||
void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes)
|
||||
uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets)
|
||||
bool InternalSend(UdpChannel channel, const LogicalPacket *packet);
|
||||
bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0);
|
||||
bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0);
|
||||
|
||||
uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature)
|
||||
|
||||
@@ -1573,7 +1573,7 @@ class UdpReliableChannel
|
||||
void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen);
|
||||
bool PullDown(int windowSpaceLeft);
|
||||
void FlushCoalesce();
|
||||
void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0);
|
||||
void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0);
|
||||
void QueueLogicalPacket(const LogicalPacket *packet);
|
||||
|
||||
UdpManager::ReliableConfig mConfig;
|
||||
@@ -1627,7 +1627,7 @@ class UdpReliableChannel
|
||||
template<int t_quickSize> FixedLogicalPacket<t_quickSize>::FixedLogicalPacket(const void *data, int dataLen)
|
||||
{
|
||||
mDataLen = dataLen;
|
||||
if (data != NULL)
|
||||
if (data != nullptr)
|
||||
memcpy(mData, data, mDataLen);
|
||||
}
|
||||
|
||||
@@ -1657,7 +1657,7 @@ template<int t_quickSize> void FixedLogicalPacket<t_quickSize>::SetDataLen(int l
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
template<typename T> StructLogicalPacket<T>::StructLogicalPacket(T *initData)
|
||||
{
|
||||
if (initData != NULL)
|
||||
if (initData != nullptr)
|
||||
mStruct = *initData;
|
||||
}
|
||||
|
||||
@@ -1802,7 +1802,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam
|
||||
if (stamp < mMinimumScheduledStamp)
|
||||
stamp = mMinimumScheduledStamp;
|
||||
|
||||
if (mPriorityQueue != NULL)
|
||||
if (mPriorityQueue != nullptr)
|
||||
mPriorityQueue->Add(con, stamp);
|
||||
}
|
||||
|
||||
@@ -1829,7 +1829,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet)
|
||||
|
||||
inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp)
|
||||
{
|
||||
wp->SetLogicalPacket(NULL);
|
||||
wp->SetLogicalPacket(nullptr);
|
||||
|
||||
if (mWrappedAvailable < mParams.wrappedPoolMax)
|
||||
{
|
||||
@@ -1877,7 +1877,7 @@ inline void UdpConnection::ScheduleTimeNow()
|
||||
// prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong.
|
||||
if (!mGettingTime)
|
||||
{
|
||||
if (mUdpManager != NULL)
|
||||
if (mUdpManager != nullptr)
|
||||
mUdpManager->SetPriority(this, 0);
|
||||
}
|
||||
}
|
||||
@@ -2066,7 +2066,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const
|
||||
|
||||
inline void UdpReliableChannel::ClearBufferedAck()
|
||||
{
|
||||
mBufferedAckPtr = NULL;
|
||||
mBufferedAckPtr = nullptr;
|
||||
}
|
||||
|
||||
inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const
|
||||
|
||||
Reference in New Issue
Block a user