aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Collision/BoundingIntervalHierarchyWrapper.h2
-rw-r--r--src/common/Collision/Management/VMapFactory.cpp4
-rw-r--r--src/common/Collision/Management/VMapManager2.cpp8
-rw-r--r--src/common/Collision/Maps/MapTree.cpp2
-rw-r--r--src/common/Collision/Models/GameObjectModel.cpp2
-rw-r--r--src/common/Collision/Models/WorldModel.cpp2
-rw-r--r--src/common/Collision/Models/WorldModel.h8
-rw-r--r--src/common/Cryptography/OpenSSLCrypto.cpp4
-rw-r--r--src/common/Debugging/Errors.cpp14
-rw-r--r--src/common/Debugging/WheatyExceptionReport.cpp64
-rw-r--r--src/common/Logging/AppenderFile.cpp8
-rw-r--r--src/common/Logging/Log.cpp2
-rw-r--r--src/common/Platform/ServiceWin32.cpp22
-rw-r--r--src/common/Utilities/Util.cpp16
14 files changed, 79 insertions, 79 deletions
diff --git a/src/common/Collision/BoundingIntervalHierarchyWrapper.h b/src/common/Collision/BoundingIntervalHierarchyWrapper.h
index 4c593dff62b..90c077d6764 100644
--- a/src/common/Collision/BoundingIntervalHierarchyWrapper.h
+++ b/src/common/Collision/BoundingIntervalHierarchyWrapper.h
@@ -79,7 +79,7 @@ public:
uint32 Idx = 0;
const T * temp;
if (m_obj2Idx.getRemove(&obj, temp, Idx))
- m_objects[Idx] = NULL;
+ m_objects[Idx] = nullptr;
else
m_objects_to_push.remove(&obj);
}
diff --git a/src/common/Collision/Management/VMapFactory.cpp b/src/common/Collision/Management/VMapFactory.cpp
index f25a3357527..7d951fba12e 100644
--- a/src/common/Collision/Management/VMapFactory.cpp
+++ b/src/common/Collision/Management/VMapFactory.cpp
@@ -20,7 +20,7 @@
namespace VMAP
{
- IVMapManager* gVMapManager = NULL;
+ IVMapManager* gVMapManager = nullptr;
//===============================================
// just return the instance
@@ -36,6 +36,6 @@ namespace VMAP
void VMapFactory::clear()
{
delete gVMapManager;
- gVMapManager = NULL;
+ gVMapManager = nullptr;
}
}
diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp
index 20d74531dd7..428ae6ba146 100644
--- a/src/common/Collision/Management/VMapManager2.cpp
+++ b/src/common/Collision/Management/VMapManager2.cpp
@@ -335,7 +335,7 @@ namespace VMAP
if (!reqLiquidType || (GetLiquidFlagsPtr(liquidType) & reqLiquidType))
if (info.hitInstance->GetLiquidLevel(pos, info, liquidLevel))
data.liquidInfo = boost::in_place(liquidType, liquidLevel);
-
+
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))
data.areaInfo = boost::in_place(info.hitInstance->adtId, info.rootId, info.hitModel->GetWmoID(), info.hitModel->GetMogpFlags());
}
@@ -355,12 +355,12 @@ namespace VMAP
{
TC_LOG_ERROR("misc", "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
- return NULL;
+ return nullptr;
}
TC_LOG_DEBUG("maps", "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
-
+
worldmodel->Flags = flags;
-
+
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
model->second.setModel(worldmodel);
}
diff --git a/src/common/Collision/Maps/MapTree.cpp b/src/common/Collision/Maps/MapTree.cpp
index a9ed75414c8..313a95d855b 100644
--- a/src/common/Collision/Maps/MapTree.cpp
+++ b/src/common/Collision/Maps/MapTree.cpp
@@ -120,7 +120,7 @@ namespace VMAP
}
StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath)
- : iMapID(mapID), iTreeValues(NULL), iNTreeValues(0), iBasePath(basePath)
+ : iMapID(mapID), iTreeValues(nullptr), iNTreeValues(0), iBasePath(basePath)
{
if (iBasePath.length() > 0 && iBasePath[iBasePath.length()-1] != '/' && iBasePath[iBasePath.length()-1] != '\\')
{
diff --git a/src/common/Collision/Models/GameObjectModel.cpp b/src/common/Collision/Models/GameObjectModel.cpp
index d81ccee9c5a..148ecff9066 100644
--- a/src/common/Collision/Models/GameObjectModel.cpp
+++ b/src/common/Collision/Models/GameObjectModel.cpp
@@ -154,7 +154,7 @@ GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBas
if (!mdl->initialize(std::move(modelOwner), dataPath))
{
delete mdl;
- return NULL;
+ return nullptr;
}
return mdl;
diff --git a/src/common/Collision/Models/WorldModel.cpp b/src/common/Collision/Models/WorldModel.cpp
index c725aea9d6c..a547a402b9d 100644
--- a/src/common/Collision/Models/WorldModel.cpp
+++ b/src/common/Collision/Models/WorldModel.cpp
@@ -358,7 +358,7 @@ namespace VMAP
triangles.clear();
vertices.clear();
delete iLiquid;
- iLiquid = NULL;
+ iLiquid = nullptr;
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) result = false;
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) result = false;
diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h
index 9358d840d3a..4392f9b194f 100644
--- a/src/common/Collision/Models/WorldModel.h
+++ b/src/common/Collision/Models/WorldModel.h
@@ -60,7 +60,7 @@ namespace VMAP
static bool readFromFile(FILE* rf, WmoLiquid* &liquid);
void getPosInfo(uint32 &tilesX, uint32 &tilesY, G3D::Vector3 &corner) const;
private:
- WmoLiquid() : iTilesX(0), iTilesY(0), iCorner(), iType(0), iHeight(NULL), iFlags(NULL) { }
+ WmoLiquid() : iTilesX(0), iTilesY(0), iCorner(), iType(0), iHeight(nullptr), iFlags(nullptr) { }
uint32 iTilesX; //!< number of tiles in x direction, each
uint32 iTilesY;
G3D::Vector3 iCorner; //!< the lower corner
@@ -73,15 +73,15 @@ namespace VMAP
class TC_COMMON_API GroupModel
{
public:
- GroupModel() : iBound(), iMogpFlags(0), iGroupWMOID(0), iLiquid(NULL) { }
+ GroupModel() : iBound(), iMogpFlags(0), iGroupWMOID(0), iLiquid(nullptr) { }
GroupModel(const GroupModel &other);
GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound):
- iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(NULL) { }
+ iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(nullptr) { }
~GroupModel() { delete iLiquid; }
//! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry!
void setMeshData(std::vector<G3D::Vector3> &vert, std::vector<MeshTriangle> &tri);
- void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; }
+ void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = nullptr; }
bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const;
bool IsInsideObject(const G3D::Vector3 &pos, const G3D::Vector3 &down, float &z_dist) const;
bool GetLiquidLevel(const G3D::Vector3 &pos, float &liqHeight) const;
diff --git a/src/common/Cryptography/OpenSSLCrypto.cpp b/src/common/Cryptography/OpenSSLCrypto.cpp
index cf2563581d5..eca063804fe 100644
--- a/src/common/Cryptography/OpenSSLCrypto.cpp
+++ b/src/common/Cryptography/OpenSSLCrypto.cpp
@@ -59,8 +59,8 @@ void OpenSSLCrypto::threadsSetup()
void OpenSSLCrypto::threadsCleanup()
{
- CRYPTO_set_locking_callback(NULL);
- CRYPTO_THREADID_set_callback(NULL);
+ CRYPTO_set_locking_callback(nullptr);
+ CRYPTO_THREADID_set_callback(nullptr);
for(int i = 0 ; i < CRYPTO_num_locks(); ++i)
{
delete cryptoLocks[i];
diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp
index 27828da775a..01bee703e80 100644
--- a/src/common/Debugging/Errors.cpp
+++ b/src/common/Debugging/Errors.cpp
@@ -27,7 +27,7 @@
@brief This file contains definitions of functions used for reporting critical application errors
- It is very important that (std::)abort is NEVER called in place of *((volatile int*)NULL) = 0;
+ It is very important that (std::)abort is NEVER called in place of *((volatile int*)nullptr) = 0;
Calling abort() on Windows does not invoke unhandled exception filters - a mechanism used by WheatyExceptionReport
to log crashes. exit(1) calls here are for static analysis tools to indicate that calling functions defined in this file
terminates the application.
@@ -39,7 +39,7 @@ void Assert(char const* file, int line, char const* function, char const* messag
{
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n",
file, line, function, message);
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
@@ -54,7 +54,7 @@ void Assert(char const* file, int line, char const* function, char const* messag
fflush(stderr);
va_end(args);
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
@@ -69,7 +69,7 @@ void Fatal(char const* file, int line, char const* function, char const* message
fflush(stderr);
std::this_thread::sleep_for(std::chrono::seconds(10));
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
@@ -77,7 +77,7 @@ void Error(char const* file, int line, char const* function, char const* message
{
fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n",
file, line, function, message);
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
@@ -91,14 +91,14 @@ void Abort(char const* file, int line, char const* function)
{
fprintf(stderr, "\n%s:%i in %s ABORTED.\n",
file, line, function);
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
void AbortHandler(int /*sigval*/)
{
// nothing useful to log here, no way to pass args
- *((volatile int*)NULL) = 0;
+ *((volatile int*)nullptr) = 0;
exit(1);
}
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp
index 836ae7b0837..57d09fb01c6 100644
--- a/src/common/Debugging/WheatyExceptionReport.cpp
+++ b/src/common/Debugging/WheatyExceptionReport.cpp
@@ -34,11 +34,11 @@ inline LPTSTR ErrorMessage(DWORD dw)
DWORD formatResult = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
+ nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
- 0, NULL);
+ 0, nullptr);
if (formatResult != 0)
return (LPTSTR)lpMsgBuf;
else
@@ -125,7 +125,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
stackOverflowException = true;
TCHAR module_folder_name[MAX_PATH];
- GetModuleFileName(0, module_folder_name, MAX_PATH);
+ GetModuleFileName(nullptr, module_folder_name, MAX_PATH);
TCHAR* pos = _tcsrchr(module_folder_name, '\\');
if (!pos)
return 0;
@@ -134,7 +134,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
TCHAR crash_folder_path[MAX_PATH];
sprintf_s(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
- if (!CreateDirectory(crash_folder_path, NULL))
+ if (!CreateDirectory(crash_folder_path, nullptr))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
return 0;
@@ -151,18 +151,18 @@ PEXCEPTION_POINTERS pExceptionInfo)
m_hDumpFile = CreateFile(m_szDumpFileName,
GENERIC_WRITE,
0,
- 0,
+ nullptr,
OPEN_ALWAYS,
FILE_FLAG_WRITE_THROUGH,
- 0);
+ nullptr);
m_hReportFile = CreateFile(m_szLogFileName,
GENERIC_WRITE,
0,
- 0,
+ nullptr,
OPEN_ALWAYS,
FILE_FLAG_WRITE_THROUGH,
- 0);
+ nullptr);
if (m_hDumpFile)
{
@@ -172,19 +172,19 @@ PEXCEPTION_POINTERS pExceptionInfo)
info.ThreadId = GetCurrentThreadId();
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
- m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, 0, 0);
+ m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, nullptr, nullptr);
CloseHandle(m_hDumpFile);
}
if (m_hReportFile)
{
- SetFilePointer(m_hReportFile, 0, 0, FILE_END);
+ SetFilePointer(m_hReportFile, 0, nullptr, FILE_END);
GenerateExceptionReport(pExceptionInfo);
CloseHandle(m_hReportFile);
- m_hReportFile = 0;
+ m_hReportFile = nullptr;
}
if (m_previousFilter)
@@ -211,7 +211,7 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco
return FALSE;
TCHAR szTmp[2048];
DWORD cntBytes = sizeof(szTmp);
- lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), NULL, NULL,
+ lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), nullptr, nullptr,
(LPBYTE)szTmp, &cntBytes);
if (lRet != ERROR_SUCCESS)
return FALSE;
@@ -560,7 +560,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
SymSetOptions(SYMOPT_DEFERRED_LOADS);
// Initialize DbgHelp
- if (!SymInitialize(GetCurrentProcess(), 0, TRUE))
+ if (!SymInitialize(GetCurrentProcess(), nullptr, TRUE))
{
Log(_T("\n\rCRITICAL ERROR.\n\r Couldn't initialize the symbol handler for process.\n\rError [%s].\n\r\n\r"),
ErrorMessage(GetLastError()));
@@ -568,7 +568,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
CONTEXT trashableContext = *pCtx;
- WriteStackDetails(&trashableContext, false, NULL);
+ WriteStackDetails(&trashableContext, false, nullptr);
printTracesForAllThreads(false);
// #ifdef _M_IX86 // X86 Only!
@@ -577,7 +577,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
Log(_T("Local Variables And Parameters\r\n"));
trashableContext = *pCtx;
- WriteStackDetails(&trashableContext, true, NULL);
+ WriteStackDetails(&trashableContext, true, nullptr);
printTracesForAllThreads(true);
SymCleanup(GetCurrentProcess());
@@ -631,7 +631,7 @@ LPTSTR WheatyExceptionReport::GetExceptionString(DWORD dwCode)
FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,
GetModuleHandle(_T("NTDLL.DLL")),
- dwCode, 0, szBuffer, sizeof(szBuffer), 0);
+ dwCode, 0, szBuffer, sizeof(szBuffer), nullptr);
return szBuffer;
}
@@ -750,13 +750,13 @@ bool bWriteVariables, HANDLE pThreadHandle)
// Get the next stack frame
if (! StackWalk64(dwMachineType,
m_hProcess,
- pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(),
+ pThreadHandle != nullptr ? pThreadHandle : GetCurrentThread(),
&sf,
pContext,
- 0,
+ nullptr,
SymFunctionTableAccess64,
SymGetModuleBase64,
- 0))
+ nullptr))
break;
if (0 == sf.AddrFrame.Offset) // Basic sanity check to make sure
break; // the frame is OK. Bail if not.
@@ -814,10 +814,10 @@ bool bWriteVariables, HANDLE pThreadHandle)
// Use SymSetContext to get just the locals/params for this frame
IMAGEHLP_STACK_FRAME imagehlpStackFrame;
imagehlpStackFrame.InstructionOffset = sf.AddrPC.Offset;
- SymSetContext(m_hProcess, &imagehlpStackFrame, 0);
+ SymSetContext(m_hProcess, &imagehlpStackFrame, nullptr);
// Enumerate the locals/parameters
- SymEnumSymbols(m_hProcess, 0, 0, EnumerateSymbolsCallback, &sf);
+ SymEnumSymbols(m_hProcess, 0, nullptr, EnumerateSymbolsCallback, &sf);
Log(_T("\r\n"));
}
@@ -839,7 +839,7 @@ PVOID UserContext)
{
ClearSymbols();
FormatSymbolValue(pSymInfo, (STACKFRAME64*)UserContext);
-
+
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
@@ -958,7 +958,7 @@ bool logChildren)
char buffer[50];
FormatOutputValue(buffer, btStdString, 0, (PVOID)offset, sizeof(buffer));
symbolDetails.top().Value = buffer;
- if (Name != NULL && Name[0] != '\0')
+ if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
bHandled = true;
return;
@@ -967,7 +967,7 @@ bool logChildren)
char buffer[WER_SMALL_BUFFER_SIZE];
wcstombs(buffer, pwszTypeName, sizeof(buffer));
buffer[WER_SMALL_BUFFER_SIZE - 1] = '\0';
- if (Name != NULL && Name[0] != '\0')
+ if (Name != nullptr && Name[0] != '\0')
{
symbolDetails.top().Type = buffer;
symbolDetails.top().Name = Name;
@@ -977,7 +977,7 @@ bool logChildren)
LocalFree(pwszTypeName);
}
- else if (Name != NULL && Name[0] != '\0')
+ else if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
if (!StoreSymbol(dwTypeIndex, offset))
@@ -994,7 +994,7 @@ bool logChildren)
case SymTagPointerType:
if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_TYPEID, &innerTypeID))
{
- if (Name != NULL && Name[0] != '\0')
+ if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
BOOL isReference;
@@ -1019,7 +1019,7 @@ bool logChildren)
logChildren = false;
// no need to log any children since the address is invalid anyway
- if (address == NULL || address == DWORD_PTR(-1))
+ if (address == 0 || address == DWORD_PTR(-1))
logChildren = false;
DumpTypeIndex(modBase, innerTypeID, address, bHandled, Name, addressStr, false, logChildren);
@@ -1030,7 +1030,7 @@ bool logChildren)
if (symbolDetails.top().Type.empty())
symbolDetails.top().Type = rgBaseType[basicType];
- if (address == NULL)
+ if (address == 0)
symbolDetails.top().Value = "NULL";
else if (address == DWORD_PTR(-1))
symbolDetails.top().Value = "<Unable to read memory>";
@@ -1046,7 +1046,7 @@ bool logChildren)
bHandled = true;
return;
}
- else if (address == NULL)
+ else if (address == 0)
symbolDetails.top().Value = "NULL";
else if (address == DWORD_PTR(-1))
{
@@ -1072,7 +1072,7 @@ bool logChildren)
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
break;
case SymTagPointerType:
- if (Name != NULL && Name[0] != '\0')
+ if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
DumpTypeIndex(modBase, innerTypeID,
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
@@ -1390,7 +1390,7 @@ int __cdecl WheatyExceptionReport::StackLog(const TCHAR * format, va_list argptr
TCHAR szBuff[WER_LARGE_BUFFER_SIZE];
retValue = vsprintf(szBuff, format, argptr);
- WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
+ WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, nullptr);
return retValue;
}
@@ -1403,7 +1403,7 @@ int __cdecl WheatyExceptionReport::HeapLog(const TCHAR * format, va_list argptr)
if (szBuff != nullptr)
{
retValue = vsprintf(szBuff, format, argptr);
- WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
+ WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, nullptr);
free(szBuff);
}
diff --git a/src/common/Logging/AppenderFile.cpp b/src/common/Logging/AppenderFile.cpp
index 451eaa6a95b..3cfd6b950a6 100644
--- a/src/common/Logging/AppenderFile.cpp
+++ b/src/common/Logging/AppenderFile.cpp
@@ -22,7 +22,7 @@
AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<char const*> extraArgs) :
Appender(id, name, level, flags),
- logfile(NULL),
+ logfile(nullptr),
_logDir(sLog->GetLogsDir()),
_maxFileSize(0),
_fileSize(0)
@@ -97,7 +97,7 @@ FILE* AppenderFile::OpenFile(std::string const& filename, std::string const& mod
CloseFile();
std::string newName(fullName);
newName.push_back('.');
- newName.append(LogMessage::getTimeStr(time(NULL)));
+ newName.append(LogMessage::getTimeStr(time(nullptr)));
std::replace(newName.begin(), newName.end(), ':', '-');
rename(fullName.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore
}
@@ -108,7 +108,7 @@ FILE* AppenderFile::OpenFile(std::string const& filename, std::string const& mod
return ret;
}
- return NULL;
+ return nullptr;
}
void AppenderFile::CloseFile()
@@ -116,6 +116,6 @@ void AppenderFile::CloseFile()
if (logfile)
{
fclose(logfile);
- logfile = NULL;
+ logfile = nullptr;
}
}
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index 3ec5aeb421a..209a952dad2 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -243,7 +243,7 @@ Logger const* Log::GetLoggerByType(std::string const& type) const
return it->second.get();
if (type == LOGGER_ROOT)
- return NULL;
+ return nullptr;
std::string parentLogger = LOGGER_ROOT;
size_t found = type.find_last_of('.');
diff --git a/src/common/Platform/ServiceWin32.cpp b/src/common/Platform/ServiceWin32.cpp
index 162632551f0..7e99b61ac64 100644
--- a/src/common/Platform/ServiceWin32.cpp
+++ b/src/common/Platform/ServiceWin32.cpp
@@ -40,18 +40,18 @@ extern int m_ServiceStatus;
SERVICE_STATUS serviceStatus;
-SERVICE_STATUS_HANDLE serviceStatusHandle = 0;
+SERVICE_STATUS_HANDLE serviceStatusHandle = nullptr;
typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID);
bool WinServiceInstall()
{
- SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
+ SC_HANDLE serviceControlManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_CREATE_SERVICE);
if (serviceControlManager)
{
char path[_MAX_PATH + 10];
- if (GetModuleFileName( 0, path, sizeof(path)/sizeof(path[0]) ) > 0)
+ if (GetModuleFileName( nullptr, path, sizeof(path)/sizeof(path[0]) ) > 0)
{
SC_HANDLE service;
std::strcat(path, " --service run");
@@ -64,11 +64,11 @@ bool WinServiceInstall()
SERVICE_AUTO_START, // start type
SERVICE_ERROR_IGNORE, // error control type
path, // service's binary
- 0, // no load ordering group
- 0, // no tag identifier
- 0, // no dependencies
- 0, // LocalSystem account
- 0); // no password
+ nullptr, // no load ordering group
+ nullptr, // no tag identifier
+ nullptr, // no dependencies
+ nullptr, // LocalSystem account
+ nullptr); // no password
if (service)
{
HMODULE advapi32 = GetModuleHandle("ADVAPI32.DLL");
@@ -120,7 +120,7 @@ bool WinServiceInstall()
bool WinServiceUninstall()
{
- SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
+ SC_HANDLE serviceControlManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT);
if (serviceControlManager)
{
@@ -201,7 +201,7 @@ void WINAPI ServiceMain(DWORD argc, char *argv[])
char path[_MAX_PATH + 1];
unsigned int i, last_slash = 0;
- GetModuleFileName(0, path, sizeof(path)/sizeof(path[0]));
+ GetModuleFileName(nullptr, path, sizeof(path)/sizeof(path[0]));
size_t pathLen = std::strlen(path);
for (i = 0; i < pathLen; i++)
@@ -249,7 +249,7 @@ bool WinServiceRun()
SERVICE_TABLE_ENTRY serviceTable[] =
{
{ serviceName, ServiceMain },
- { 0, 0 }
+ { nullptr, nullptr }
};
if (!StartServiceCtrlDispatcher(serviceTable))
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp
index 7625ae9d2ff..5a1ed443649 100644
--- a/src/common/Utilities/Util.cpp
+++ b/src/common/Utilities/Util.cpp
@@ -222,7 +222,7 @@ bool IsIPAddress(char const* ipaddress)
uint32 CreatePIDFile(std::string const& filename)
{
FILE* pid_file = fopen(filename.c_str(), "w");
- if (pid_file == NULL)
+ if (pid_file == nullptr)
return 0;
uint32 pid = GetPID();
@@ -592,12 +592,12 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension)
static wchar_t const j_End[] = { wchar_t(1), wchar_t(0x0439), wchar_t(0x0000)};
static wchar_t const* const dropEnds[6][8] = {
- { &a_End[1], &o_End[1], &ya_End[1], &ie_End[1], &soft_End[1], &j_End[1], NULL, NULL },
- { &a_End[1], &ya_End[1], &yeru_End[1], &i_End[1], NULL, NULL, NULL, NULL },
- { &ie_End[1], &u_End[1], &yu_End[1], &i_End[1], NULL, NULL, NULL, NULL },
- { &u_End[1], &yu_End[1], &o_End[1], &ie_End[1], &soft_End[1], &ya_End[1], &a_End[1], NULL },
- { &oj_End[1], &io_j_End[1], &ie_j_End[1], &o_m_End[1], &io_m_End[1], &ie_m_End[1], &yu_End[1], NULL },
- { &ie_End[1], &i_End[1], NULL, NULL, NULL, NULL, NULL, NULL }
+ { &a_End[1], &o_End[1], &ya_End[1], &ie_End[1], &soft_End[1], &j_End[1], nullptr, nullptr },
+ { &a_End[1], &ya_End[1], &yeru_End[1], &i_End[1], nullptr, nullptr, nullptr, nullptr },
+ { &ie_End[1], &u_End[1], &yu_End[1], &i_End[1], nullptr, nullptr, nullptr, nullptr },
+ { &u_End[1], &yu_End[1], &o_End[1], &ie_End[1], &soft_End[1], &ya_End[1], &a_End[1], nullptr },
+ { &oj_End[1], &io_j_End[1], &ie_j_End[1], &o_m_End[1], &io_m_End[1], &ie_m_End[1], &yu_End[1], nullptr },
+ { &ie_End[1], &i_End[1], nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
};
for (wchar_t const* const* itr = &dropEnds[declension][0]; *itr; ++itr)
@@ -744,7 +744,7 @@ void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= fals
for (int32 i = init; i != end; i += 2 * op)
{
char buffer[3] = { str[i], str[i + 1], '\0' };
- out[j++] = uint8(strtoul(buffer, NULL, 16));
+ out[j++] = uint8(strtoul(buffer, nullptr, 16));
}
}