refactor(Core): replace NULL with nullptr (#4593)

This commit is contained in:
Kitzunu
2021-03-02 01:34:20 +01:00
committed by GitHub
parent dbefa17a53
commit 28f1dc5c0c
231 changed files with 923 additions and 923 deletions

View File

@@ -16,7 +16,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.

View File

@@ -35,11 +35,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
@@ -130,7 +130,7 @@ LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter(
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;
@@ -220,7 +220,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;
@@ -582,7 +582,7 @@ void WheatyExceptionReport::GenerateExceptionReport(
CONTEXT trashableContext = *pCtx;
WriteStackDetails(&trashableContext, false, NULL);
WriteStackDetails(&trashableContext, false, nullptr);
printTracesForAllThreads(false);
// #ifdef _M_IX86 // X86 Only!
@@ -591,7 +591,7 @@ void WheatyExceptionReport::GenerateExceptionReport(
Log(_T("Local Variables And Parameters\r\n"));
trashableContext = *pCtx;
WriteStackDetails(&trashableContext, true, NULL);
WriteStackDetails(&trashableContext, true, nullptr);
printTracesForAllThreads(true);
SymCleanup(GetCurrentProcess());
@@ -764,7 +764,7 @@ void WheatyExceptionReport::WriteStackDetails(
// Get the next stack frame
if (! StackWalk64(dwMachineType,
m_hProcess,
pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(),
pThreadHandle != nullptr ? pThreadHandle : GetCurrentThread(),
&sf,
pContext,
0,
@@ -969,7 +969,7 @@ void WheatyExceptionReport::DumpTypeIndex(
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;
@@ -978,7 +978,7 @@ void WheatyExceptionReport::DumpTypeIndex(
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;
@@ -988,7 +988,7 @@ void WheatyExceptionReport::DumpTypeIndex(
LocalFree(pwszTypeName);
}
else if (Name != NULL && Name[0] != '\0')
else if (Name != nullptr && Name[0] != '\0')
symbolDetails.top().Name = Name;
if (!StoreSymbol(dwTypeIndex, offset))
@@ -1005,7 +1005,7 @@ void WheatyExceptionReport::DumpTypeIndex(
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;
@@ -1083,7 +1083,7 @@ void WheatyExceptionReport::DumpTypeIndex(
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);