mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-31 01:15:48 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
+15
-15
@@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename)
|
||||
//-------------------------------------
|
||||
{
|
||||
|
||||
if( NULL == filename)
|
||||
if( nullptr == filename)
|
||||
return false;
|
||||
|
||||
if (pFilename)
|
||||
@@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename)
|
||||
|
||||
// Sanitize slashes
|
||||
char *ptr;
|
||||
while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL)
|
||||
while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr)
|
||||
*ptr = SLASHCHAR[0];
|
||||
|
||||
char strPath[1024];
|
||||
strcpy(strPath,pFilename);
|
||||
ptr = strrchr(strPath, SLASHCHAR[0]);
|
||||
if (ptr != NULL)
|
||||
if (ptr != nullptr)
|
||||
{
|
||||
*ptr = 0;
|
||||
|
||||
@@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename)
|
||||
char curdir[128];
|
||||
|
||||
// remember current directory
|
||||
if( getcwd(curdir,sizeof(curdir)) == NULL )
|
||||
if( getcwd(curdir,sizeof(curdir)) == nullptr )
|
||||
{
|
||||
fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n");
|
||||
free(pFilename);
|
||||
pFilename = NULL;
|
||||
pFilename = nullptr;
|
||||
return false; // error, can't proceed
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename)
|
||||
{
|
||||
fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath);
|
||||
free(pFilename);
|
||||
pFilename = NULL;
|
||||
pFilename = nullptr;
|
||||
return false; // error, can't proceed
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename)
|
||||
{
|
||||
fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath);
|
||||
free(pFilename);
|
||||
pFilename = NULL;
|
||||
pFilename = nullptr;
|
||||
return false; // error, can't proceed
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename)
|
||||
|
||||
|
||||
pFile = fopen(pFilename,"a+");
|
||||
if( pFile == NULL || pFile == (FILE *)-1)
|
||||
if( pFile == nullptr || pFile == (FILE *)-1)
|
||||
{
|
||||
//fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename);
|
||||
Close();
|
||||
@@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename)
|
||||
void CAutoLog::Close(void)
|
||||
//-------------------------------------
|
||||
{
|
||||
if( pFile != (FILE *)-1 && pFile != NULL)
|
||||
if( pFile != (FILE *)-1 && pFile != nullptr)
|
||||
{
|
||||
fclose(pFile);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ void CAutoLog::Close(void)
|
||||
|
||||
|
||||
free(pFilename);
|
||||
pFilename = NULL;
|
||||
pFilename = nullptr;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
@@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...)
|
||||
void CAutoLog::Log(eLogLevel severity, char *fmt, ...)
|
||||
//-------------------------------------
|
||||
{
|
||||
if (pFile == (FILE *)-1 || pFile == NULL)
|
||||
if (pFile == (FILE *)-1 || pFile == nullptr)
|
||||
{
|
||||
//fprintf(stderr,"CAutoLog::Log called with no file open!\n");
|
||||
return;
|
||||
@@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...)
|
||||
void CAutoLog::Archive(void)
|
||||
//-------------------------------------
|
||||
{
|
||||
if( pFile == (FILE *)-1 || pFile == NULL)
|
||||
if( pFile == (FILE *)-1 || pFile == nullptr)
|
||||
{
|
||||
//fprintf(stderr,"CAutoLog::Archive called with no file open!\n");
|
||||
return;
|
||||
@@ -281,7 +281,7 @@ void CAutoLog::Archive(void)
|
||||
|
||||
strcpy(strCurrent,pFilename);
|
||||
pCurrent = strrchr(strCurrent, SLASHCHAR[0]);
|
||||
if (pCurrent != NULL)
|
||||
if (pCurrent != nullptr)
|
||||
*pCurrent = 0;
|
||||
else
|
||||
sprintf(strCurrent,".");
|
||||
@@ -290,7 +290,7 @@ void CAutoLog::Archive(void)
|
||||
|
||||
#ifdef WIN32
|
||||
// remember current directory
|
||||
if( getcwd(curdir,sizeof(curdir)) == NULL )
|
||||
if( getcwd(curdir,sizeof(curdir)) == nullptr )
|
||||
{
|
||||
fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n");
|
||||
return; // error, can't proceed
|
||||
@@ -324,7 +324,7 @@ void CAutoLog::Archive(void)
|
||||
#endif
|
||||
|
||||
pCurrent = strrchr(pFilename, SLASHCHAR[0]);
|
||||
if (pCurrent == NULL)
|
||||
if (pCurrent == nullptr)
|
||||
pCurrent = pFilename;
|
||||
else
|
||||
pCurrent++;
|
||||
|
||||
Reference in New Issue
Block a user