mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-04 19:13:06 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user