newer standards prefer nullptr over NULL - this is most of them but there are others too

This commit is contained in:
DarthArgus
2016-02-11 15:16:14 -06:00
parent a7f2d0ea6a
commit 3e4cc36e7e
937 changed files with 14983 additions and 14983 deletions
+15 -15
View File
@@ -51,7 +51,7 @@ MonitorObject::~MonitorObject()
if( mConnection )
{
mConnection->SetHandler(NULL);
mConnection->SetHandler(nullptr);
mConnection->Disconnect();
mConnection->Release();
}
@@ -75,10 +75,10 @@ char hold[214];
UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason()));
}
}
mConnection->SetHandler(NULL);
mConnection->SetHandler(nullptr);
mConnection->Disconnect();
mConnection->Release();
mConnection = NULL;
mConnection = nullptr;
}
}
@@ -94,10 +94,10 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da
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;
}
@@ -123,7 +123,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da
if( mHierarchySent == true )
{
mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime );
mlastUpdateTime = (long)time(NULL);
mlastUpdateTime = (long)time(nullptr);
break;
}
@@ -261,7 +261,7 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata,
{
mManager = manager;
mbprint = _bprint;
passString = NULL;
passString = nullptr;
mMonitorData = _gamedata;
mObjectCount = 0;
@@ -291,7 +291,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con)
{
if( con )
{
con->SetHandler(NULL);
con->SetHandler(nullptr);
con->Disconnect();
con->Release();
}
@@ -313,7 +313,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];
@@ -345,7 +345,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;
@@ -367,7 +367,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");
len = (int)strlen(buffer);
@@ -403,17 +403,17 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr
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;
@@ -595,7 +595,7 @@ int err;
unsigned long S = 4000000;
unsigned char *p;
data = NULL;
data = nullptr;
p = (unsigned char *)malloc(4000000);
memset(p,0,4000000);
err = uncompress(p,&S,(source+6),(long)getSize());
@@ -42,14 +42,14 @@ public:
*
* debug = turn on/off debugging.
*
* address = (NOT USED) Leave as NULL
* address = (NOT USED) Leave as nullptr
*
* UdpManager * mang = (NOT USED) Leave as NULL
* UdpManager * mang = (NOT USED) Leave as nullptr
*
* // GenericNotifier *notifier = (NOT USED) Leave as NULL
* // GenericNotifier *notifier = (NOT USED) Leave as nullptr
*
*/
CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL );
CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr );
~CMonitorAPI();
@@ -112,7 +112,7 @@ public:
* Max Limited
* #define ELEMENT_MAX_START 2000
*/
int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL );
int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = nullptr );
/**************** Set the description of an element **
@@ -58,7 +58,7 @@ CMonitorData::CMonitorData()
{
m_sequence = 1;
m_buffer = NULL;
m_buffer = nullptr;
m_nbuffer = 0;
m_count = 0;
m_max = ELEMENT_MAX_START;
@@ -103,7 +103,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];
@@ -331,7 +331,7 @@ char *p;
if( get_bit(mark,x) == 0 )
{
set_bit( mark, x );
if( m_data[x].discription != NULL )
if( m_data[x].discription != nullptr )
{
sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription);
size += (int)strlen(tmp);
@@ -360,7 +360,7 @@ char *p;
{
flag = 2;
set_bit(mark,x);
if( m_data[x].discription != NULL )
if( m_data[x].discription != nullptr )
{
sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription);
size += (int)strlen(tmp);
@@ -412,7 +412,7 @@ int x;
//******* Discription ******
delete [] m_data[x].discription;
m_data[x].discription = NULL;
m_data[x].discription = nullptr;
if( des )
{
m_data[x].discription = new char [strlen(des)+1];
@@ -459,10 +459,10 @@ int x;
{
if( Id == m_data[x].id )
{
if( Description == NULL )
if( Description == nullptr )
{
delete [] m_data[x].discription;
m_data[x].discription = NULL;
m_data[x].discription = nullptr;
mode = 0;
return x;
}
@@ -510,7 +510,7 @@ int high, i, low;
if ( high < m_count && Id==m_data[high].id )
{
if (m_data[high].ChangedTime == 0 || m_data[high].value != value) {
m_data[high].ChangedTime = (long)time(NULL);
m_data[high].ChangedTime = (long)time(nullptr);
m_data[high].value = value;
}
}
@@ -560,7 +560,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;
@@ -35,7 +35,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:
@@ -252,7 +252,7 @@ class CMonitorData {
public:
// CMonitorData(GenericNotifier *notifier=NULL );
// CMonitorData(GenericNotifier *notifier=nullptr );
CMonitorData();
virtual ~CMonitorData();
@@ -266,7 +266,7 @@ public:
bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark);
int add(const char *label, int id, int ping, const 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);