From 7441c3a3c46ad2d3af16668dfc662a293bbbac16 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 11:48:59 -0500 Subject: [PATCH 01/11] Replace legacy NULL with nullptr in llcommon --- indra/llcommon/StackWalker.cpp | 174 +++++++++--------- indra/llcommon/StackWalker.h | 12 +- indra/llcommon/hbxxh.cpp | 4 +- indra/llcommon/llalignedarray.h | 8 +- indra/llcommon/llapp.cpp | 76 ++++---- indra/llcommon/llapr.cpp | 42 ++--- indra/llcommon/llapr.h | 24 +-- indra/llcommon/llassettype.cpp | 4 +- indra/llcommon/llcallbacklist.h | 6 +- indra/llcommon/llcommon.cpp | 6 +- indra/llcommon/lldate.h | 2 +- indra/llcommon/lldependencies.h | 2 +- indra/llcommon/lldepthstack.h | 4 +- indra/llcommon/lldictionary.h | 2 +- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llevent.cpp | 8 +- indra/llcommon/llfasttimer.cpp | 10 +- indra/llcommon/llfindlocale.cpp | 26 +-- indra/llcommon/llhandle.h | 14 +- indra/llcommon/llheteromap.cpp | 2 +- indra/llcommon/llinitparam.cpp | 20 +- indra/llcommon/llinitparam.h | 62 +++---- indra/llcommon/llinstancetracker.h | 2 +- indra/llcommon/llkeythrottle.h | 4 +- indra/llcommon/llkeyusetracker.h | 6 +- indra/llcommon/llleap.cpp | 2 +- indra/llcommon/lllivefile.cpp | 2 +- indra/llcommon/llmd5.cpp | 2 +- indra/llcommon/llmemory.cpp | 6 +- indra/llcommon/llmemory.h | 6 +- indra/llcommon/llmetricperformancetester.cpp | 16 +- indra/llcommon/llmetrics.cpp | 2 +- indra/llcommon/llmutex.h | 2 +- indra/llcommon/llnametable.h | 2 +- indra/llcommon/llprocess.cpp | 18 +- indra/llcommon/llprocessor.cpp | 16 +- indra/llcommon/llrand.h | 4 +- indra/llcommon/llregistry.h | 10 +- indra/llcommon/llsafehandle.h | 26 +-- indra/llcommon/llsd.cpp | 2 +- indra/llcommon/llsd.h | 2 +- indra/llcommon/llsdparam.cpp | 2 +- indra/llcommon/llsdparam.h | 2 +- indra/llcommon/llsdserialize.cpp | 28 +-- indra/llcommon/llsdserialize_xml.cpp | 10 +- indra/llcommon/llsdutil.cpp | 2 +- indra/llcommon/llsdutil.h | 4 +- indra/llcommon/llstacktrace.cpp | 8 +- indra/llcommon/llstl.h | 12 +- indra/llcommon/llstrider.h | 2 +- indra/llcommon/llstring.cpp | 14 +- indra/llcommon/llstring.h | 2 +- indra/llcommon/llstringtable.cpp | 16 +- indra/llcommon/llstringtable.h | 4 +- indra/llcommon/llsys.cpp | 28 +-- indra/llcommon/llthread.cpp | 18 +- indra/llcommon/llthread.h | 2 +- indra/llcommon/llthreadlocalstorage.h | 2 +- indra/llcommon/lltimer.cpp | 20 +- indra/llcommon/lltimer.h | 2 +- indra/llcommon/lltrace.cpp | 8 +- indra/llcommon/lltrace.h | 6 +- indra/llcommon/lltraceaccumulators.cpp | 8 +- indra/llcommon/lltraceaccumulators.h | 18 +- indra/llcommon/lltracerecording.cpp | 68 +++---- indra/llcommon/lltracethreadrecorder.cpp | 14 +- indra/llcommon/lltreeiterators.h | 2 +- indra/llcommon/lluuid.cpp | 10 +- indra/llcommon/tests/llbase64_test.cpp | 2 +- .../llcommon/tests/lleventdispatcher_test.cpp | 12 +- indra/llcommon/tests/llpounceable_test.cpp | 2 +- indra/llcommon/tests/llprocess_test.cpp | 6 +- indra/llcommon/tests/llsdserialize_test.cpp | 2 +- indra/llcommon/tests/llstring_test.cpp | 8 +- indra/llcommon/tests/lltreeiterators_test.cpp | 4 +- indra/llcommon/u64.h | 2 +- 76 files changed, 496 insertions(+), 496 deletions(-) diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp index 77ae4db4bd6..88f1966695a 100644 --- a/indra/llcommon/StackWalker.cpp +++ b/indra/llcommon/StackWalker.cpp @@ -171,7 +171,7 @@ typedef struct _tagSTACKFRAME64 { ADDRESS64 AddrFrame; // frame pointer ADDRESS64 AddrStack; // stack pointer ADDRESS64 AddrBStore; // backing store pointer - PVOID FuncTableEntry; // pointer to pdata/fpo or NULL + PVOID FuncTableEntry; // pointer to pdata/fpo or nullptr DWORD64 Params[4]; // possible arguments to the function BOOL Far; // WOW far call BOOL Virtual; // is this a virtual frame? @@ -263,44 +263,44 @@ class StackWalkerInternal StackWalkerInternal(StackWalker *parent, HANDLE hProcess) { m_parent = parent; - m_hDbhHelp = NULL; - pSC = NULL; + m_hDbhHelp = nullptr; + pSC = nullptr; m_hProcess = hProcess; - m_szSymPath = NULL; - pSFTA = NULL; - pSGLFA = NULL; - pSGMB = NULL; - pSGMI = NULL; - pSGO = NULL; - pSGSFA = NULL; - pSI = NULL; - pSLM = NULL; - pSSO = NULL; - pSW = NULL; - pUDSN = NULL; - pSGSP = NULL; + m_szSymPath = nullptr; + pSFTA = nullptr; + pSGLFA = nullptr; + pSGMB = nullptr; + pSGMI = nullptr; + pSGO = nullptr; + pSGSFA = nullptr; + pSI = nullptr; + pSLM = nullptr; + pSSO = nullptr; + pSW = nullptr; + pUDSN = nullptr; + pSGSP = nullptr; } ~StackWalkerInternal() { - if (pSC != NULL) + if (pSC != nullptr) pSC(m_hProcess); // SymCleanup - if (m_hDbhHelp != NULL) + if (m_hDbhHelp != nullptr) FreeLibrary(m_hDbhHelp); - m_hDbhHelp = NULL; - m_parent = NULL; - if(m_szSymPath != NULL) + m_hDbhHelp = nullptr; + m_parent = nullptr; + if(m_szSymPath != nullptr) free(m_szSymPath); - m_szSymPath = NULL; + m_szSymPath = nullptr; } bool Init(LPCSTR szSymPath) { - if (m_parent == NULL) + if (m_parent == nullptr) return false; // Dynamically load the Entry-Points for dbghelp.dll: // First try to load the newsest one from TCHAR szTemp[4096]; // But before wqe do this, we first check if the ".local" file exists - if (GetModuleFileName(NULL, szTemp, 4096) > 0) + if (GetModuleFileName(nullptr, szTemp, 4096) > 0) { _tcscat_s(szTemp, _T(".local")); if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES) @@ -308,7 +308,7 @@ class StackWalkerInternal // ".local" file does not exist, so we can try to load the dbghelp.dll from the "Debugging Tools for Windows" // Ok, first try the new path according to the archtitecture: #ifdef _M_IX86 - if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) + if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) { _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (x86)\\dbghelp.dll")); // now check if the file exists: @@ -318,7 +318,7 @@ class StackWalkerInternal } } #elif _M_X64 - if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) + if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) { _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (x64)\\dbghelp.dll")); // now check if the file exists: @@ -328,7 +328,7 @@ class StackWalkerInternal } } #elif _M_IA64 - if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) + if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) { _tcscat_s(szTemp, _T("\\Debugging Tools for Windows (ia64)\\dbghelp.dll")); // now check if the file exists: @@ -339,7 +339,7 @@ class StackWalkerInternal } #endif // If still not found, try the old directories... - if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) + if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) { _tcscat_s(szTemp, _T("\\Debugging Tools for Windows\\dbghelp.dll")); // now check if the file exists: @@ -350,7 +350,7 @@ class StackWalkerInternal } #if defined _M_X64 || defined _M_IA64 // Still not found? Then try to load the (old) 64-Bit version: - if ( (m_hDbhHelp == NULL) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) + if ( (m_hDbhHelp == nullptr) && (GetEnvironmentVariable(_T("ProgramFiles"), szTemp, 4096) > 0) ) { _tcscat_s(szTemp, _T("\\Debugging Tools for Windows 64-Bit\\dbghelp.dll")); if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) @@ -361,9 +361,9 @@ class StackWalkerInternal #endif } } - if (m_hDbhHelp == NULL) // if not already loaded, try to load a default-one + if (m_hDbhHelp == nullptr) // if not already loaded, try to load a default-one m_hDbhHelp = LoadLibrary( _T("dbghelp.dll") ); - if (m_hDbhHelp == NULL) + if (m_hDbhHelp == nullptr) return false; pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize" ); pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup" ); @@ -381,18 +381,18 @@ class StackWalkerInternal pSLM = (tSLM) GetProcAddress(m_hDbhHelp, "SymLoadModule64" ); pSGSP =(tSGSP) GetProcAddress(m_hDbhHelp, "SymGetSearchPath" ); - if ( pSC == NULL || pSFTA == NULL || pSGMB == NULL || pSGMI == NULL || - pSGO == NULL || pSGSFA == NULL || pSI == NULL || pSSO == NULL || - pSW == NULL || pUDSN == NULL || pSLM == NULL ) + if ( pSC == nullptr || pSFTA == nullptr || pSGMB == nullptr || pSGMI == nullptr || + pSGO == nullptr || pSGSFA == nullptr || pSI == nullptr || pSSO == nullptr || + pSW == nullptr || pUDSN == nullptr || pSLM == nullptr ) { FreeLibrary(m_hDbhHelp); - m_hDbhHelp = NULL; - pSC = NULL; + m_hDbhHelp = nullptr; + pSC = nullptr; return false; } // SymInitialize - if (szSymPath != NULL) + if (szSymPath != nullptr) m_szSymPath = _strdup(szSymPath); if (this->pSI(m_hProcess, m_szSymPath, FALSE) == FALSE) this->m_parent->OnDbgHelpErr("SymInitialize", GetLastError(), 0); @@ -405,7 +405,7 @@ class StackWalkerInternal symOptions = this->pSSO(symOptions); char buf[StackWalker::STACKWALK_MAX_NAMELEN] = {0}; - if (this->pSGSP != NULL) + if (this->pSGSP != nullptr) { if (this->pSGSP(m_hProcess, buf, StackWalker::STACKWALK_MAX_NAMELEN) == FALSE) this->m_parent->OnDbgHelpErr("SymGetSearchPath", GetLastError(), 0); @@ -566,10 +566,10 @@ struct IMAGEHLP_MODULE64_V2 { // try both dlls... const TCHAR *dllname[] = { _T("kernel32.dll"), _T("tlhelp32.dll") }; - HINSTANCE hToolhelp = NULL; - tCT32S pCT32S = NULL; - tM32F pM32F = NULL; - tM32N pM32N = NULL; + HINSTANCE hToolhelp = nullptr; + tCT32S pCT32S = nullptr; + tM32F pM32F = nullptr; + tM32N pM32N = nullptr; HANDLE hSnap; MODULEENTRY32 me; @@ -580,18 +580,18 @@ struct IMAGEHLP_MODULE64_V2 { for (i = 0; i<(sizeof(dllname) / sizeof(dllname[0])); i++ ) { hToolhelp = LoadLibrary( dllname[i] ); - if (hToolhelp == NULL) + if (hToolhelp == nullptr) continue; pCT32S = (tCT32S) GetProcAddress(hToolhelp, "CreateToolhelp32Snapshot"); pM32F = (tM32F) GetProcAddress(hToolhelp, "Module32First"); pM32N = (tM32N) GetProcAddress(hToolhelp, "Module32Next"); - if ( (pCT32S != NULL) && (pM32F != NULL) && (pM32N != NULL) ) + if ( (pCT32S != nullptr) && (pM32F != nullptr) && (pM32N != nullptr) ) break; // found the functions! FreeLibrary(hToolhelp); - hToolhelp = NULL; + hToolhelp = nullptr; } - if (hToolhelp == NULL) + if (hToolhelp == nullptr) return false; hSnap = pCT32S( TH32CS_SNAPMODULE, pid ); @@ -645,20 +645,20 @@ struct IMAGEHLP_MODULE64_V2 { DWORD cbNeeded; MODULEINFO mi; HMODULE *hMods = 0; - char *tt = NULL; - char *tt2 = NULL; + char *tt = nullptr; + char *tt2 = nullptr; const SIZE_T TTBUFLEN = 8096; int cnt = 0; hPsapi = LoadLibrary( _T("psapi.dll") ); - if (hPsapi == NULL) + if (hPsapi == nullptr) return false; pEPM = (tEPM) GetProcAddress( hPsapi, "EnumProcessModules" ); pGMFNE = (tGMFNE) GetProcAddress( hPsapi, "GetModuleFileNameExA" ); pGMBN = (tGMFNE) GetProcAddress( hPsapi, "GetModuleBaseNameA" ); pGMI = (tGMI) GetProcAddress( hPsapi, "GetModuleInformation" ); - if ( (pEPM == NULL) || (pGMFNE == NULL) || (pGMBN == NULL) || (pGMI == NULL) ) + if ( (pEPM == nullptr) || (pGMFNE == nullptr) || (pGMBN == nullptr) || (pGMI == nullptr) ) { // we couldn't find all functions FreeLibrary(hPsapi); @@ -668,7 +668,7 @@ struct IMAGEHLP_MODULE64_V2 { hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof(HMODULE))); tt = (char*) malloc(sizeof(char) * TTBUFLEN); tt2 = (char*) malloc(sizeof(char) * TTBUFLEN); - if ( (hMods == NULL) || (tt == NULL) || (tt2 == NULL) ) + if ( (hMods == nullptr) || (tt == nullptr) || (tt2 == nullptr) ) goto cleanup; if ( ! pEPM( hProcess, hMods, TTBUFLEN, &cbNeeded ) ) @@ -701,10 +701,10 @@ struct IMAGEHLP_MODULE64_V2 { } cleanup: - if (hPsapi != NULL) FreeLibrary(hPsapi); - if (tt2 != NULL) free(tt2); - if (tt != NULL) free(tt); - if (hMods != NULL) free(hMods); + if (hPsapi != nullptr) FreeLibrary(hPsapi); + if (tt2 != nullptr) free(tt2); + if (tt != nullptr) free(tt); + if (hMods != nullptr) free(hMods); return cnt != 0; } // GetModuleListPSAPI @@ -714,7 +714,7 @@ struct IMAGEHLP_MODULE64_V2 { CHAR *szImg = _strdup(img); CHAR *szMod = _strdup(mod); DWORD result = ERROR_SUCCESS; - if ( (szImg == NULL) || (szMod == NULL) ) + if ( (szImg == nullptr) || (szMod == nullptr) ) result = ERROR_NOT_ENOUGH_MEMORY; else { @@ -722,25 +722,25 @@ struct IMAGEHLP_MODULE64_V2 { result = GetLastError(); } ULONGLONG fileVersion = 0; - if ( (m_parent != NULL) && (szImg != NULL) ) + if ( (m_parent != nullptr) && (szImg != nullptr) ) { // try to retrive the file-version: if ( (this->m_parent->m_options & StackWalker::RetrieveFileVersion) != 0) { - VS_FIXEDFILEINFO *fInfo = NULL; + VS_FIXEDFILEINFO *fInfo = nullptr; DWORD dwHandle; DWORD dwSize = GetFileVersionInfoSizeA(szImg, &dwHandle); if (dwSize > 0) { LPVOID vData = malloc(dwSize); - if (vData != NULL) + if (vData != nullptr) { if (GetFileVersionInfoA(szImg, dwHandle, dwSize, vData) != 0) { UINT len; TCHAR szSubBlock[] = _T("\\"); if (VerQueryValue(vData, szSubBlock, (LPVOID*) &fInfo, &len) == 0) - fInfo = NULL; + fInfo = nullptr; else { fileVersion = ((ULONGLONG)fInfo->dwFileVersionLS) + ((ULONGLONG)fInfo->dwFileVersionMS << 32); @@ -794,8 +794,8 @@ struct IMAGEHLP_MODULE64_V2 { pdbName = Module.LoadedPdbName; this->m_parent->OnLoadModule(img, mod, baseAddr, size, result, szSymType, pdbName, fileVersion); } - if (szImg != NULL) free(szImg); - if (szMod != NULL) free(szMod); + if (szImg != nullptr) free(szImg); + if (szMod != nullptr) free(szMod); return result; } public: @@ -812,7 +812,7 @@ struct IMAGEHLP_MODULE64_V2 { bool GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3 *pModuleInfo) { memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3)); - if(this->pSGMI == NULL) + if(this->pSGMI == nullptr) { SetLastError(ERROR_DLL_INIT_FAILED); return false; @@ -820,7 +820,7 @@ struct IMAGEHLP_MODULE64_V2 { // First try to use the larger ModuleInfo-Structure pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3); void *pData = malloc(4096); // reserve enough memory, so the bug in v6.3.5.1 does not lead to memory-overwrites... - if (pData == NULL) + if (pData == nullptr) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return false; @@ -866,7 +866,7 @@ StackWalker::StackWalker(DWORD dwProcessId, HANDLE hProcess) this->m_hProcess = hProcess; this->m_sw = new StackWalkerInternal(this, this->m_hProcess); this->m_dwProcessId = dwProcessId; - this->m_szSymPath = NULL; + this->m_szSymPath = nullptr; this->m_MaxRecursionCount = 1000; } StackWalker::StackWalker(bool verbose, int options, LPCSTR szSymPath, DWORD dwProcessId, HANDLE hProcess) @@ -877,29 +877,29 @@ StackWalker::StackWalker(bool verbose, int options, LPCSTR szSymPath, DWORD dwPr this->m_hProcess = hProcess; this->m_sw = new StackWalkerInternal(this, this->m_hProcess); this->m_dwProcessId = dwProcessId; - if (szSymPath != NULL) + if (szSymPath != nullptr) { this->m_szSymPath = _strdup(szSymPath); this->m_options |= SymBuildPath; } else - this->m_szSymPath = NULL; + this->m_szSymPath = nullptr; this->m_MaxRecursionCount = 1000; } StackWalker::~StackWalker() { - if (m_szSymPath != NULL) + if (m_szSymPath != nullptr) free(m_szSymPath); - m_szSymPath = NULL; - if (this->m_sw != NULL) + m_szSymPath = nullptr; + if (this->m_sw != nullptr) delete this->m_sw; - this->m_sw = NULL; + this->m_sw = nullptr; } bool StackWalker::LoadModules() { - if (this->m_sw == NULL) + if (this->m_sw == nullptr) { SetLastError(ERROR_DLL_INIT_FAILED); return false; @@ -908,19 +908,19 @@ bool StackWalker::LoadModules() return true; // Build the sym-path: - char *szSymPath = NULL; + char *szSymPath = nullptr; if ( (this->m_options & SymBuildPath) != 0) { const size_t nSymPathLen = 4096; szSymPath = (char*) malloc(nSymPathLen); - if (szSymPath == NULL) + if (szSymPath == nullptr) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return false; } szSymPath[0] = 0; // Now first add the (optional) provided sympath: - if (this->m_szSymPath != NULL) + if (this->m_szSymPath != nullptr) { strcat_s(szSymPath, nSymPathLen, this->m_szSymPath); strcat_s(szSymPath, nSymPathLen, ";"); @@ -939,7 +939,7 @@ bool StackWalker::LoadModules() } // Now add the path for the main-module: - if (GetModuleFileNameA(NULL, szTemp, nTempLen) > 0) + if (GetModuleFileNameA(nullptr, szTemp, nTempLen) > 0) { szTemp[nTempLen-1] = 0; for (char *p = (szTemp+strlen(szTemp)-1); p >= szTemp; --p) @@ -997,7 +997,7 @@ bool StackWalker::LoadModules() // First Init the whole stuff... bool bRet = this->m_sw->Init(szSymPath); - if (szSymPath != NULL) free(szSymPath); szSymPath = NULL; + if (szSymPath != nullptr) free(szSymPath); szSymPath = nullptr; if (!bRet) { this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0); @@ -1016,15 +1016,15 @@ bool StackWalker::LoadModules() // This has to be done due to a problem with the "hProcess"-parameter in x64... // Because this class is in no case multi-threading-enabled (because of the limitations // of dbghelp.dll) it is "safe" to use a static-variable -static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = NULL; -static LPVOID s_readMemoryFunction_UserData = NULL; +static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = nullptr; +static LPVOID s_readMemoryFunction_UserData = nullptr; bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData) { m_verbose = verbose; CONTEXT c; CallstackEntry csEntry; - IMAGEHLP_SYMBOL64 *pSym = NULL; + IMAGEHLP_SYMBOL64 *pSym = nullptr; StackWalkerInternal::IMAGEHLP_MODULE64_V3 Module; IMAGEHLP_LINE64 Line; int frameNum; @@ -1034,7 +1034,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con if (!m_modulesLoaded) this->LoadModules(); // ignore the result... - if (this->m_sw->m_hDbhHelp == NULL) + if (this->m_sw->m_hDbhHelp == nullptr) { SetLastError(ERROR_DLL_INIT_FAILED); return false; @@ -1043,7 +1043,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con s_readMemoryFunction = readMemoryFunction; s_readMemoryFunction_UserData = pUserData; - if (context == NULL) + if (context == nullptr) { // If no context is provided, capture the context // See: https://stackwalker.codeplex.com/discussions/446958 @@ -1125,7 +1125,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con // assume that either you are done, or that the stack is so hosed that the next // deeper frame could not be found. // CONTEXT need not to be suplied if imageTyp is IMAGE_FILE_MACHINE_I386! - if ( ! this->m_sw->pSW(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem, this->m_sw->pSFTA, this->m_sw->pSGMB, NULL) ) + if ( ! this->m_sw->pSW(imageType, this->m_hProcess, hThread, &s, &c, myReadProcMem, this->m_sw->pSFTA, this->m_sw->pSGMB, nullptr) ) { // INFO: "StackWalk64" does not set "GetLastError"... this->OnDbgHelpErr("StackWalk64", 0, s.AddrPC.Offset); @@ -1170,7 +1170,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con } // show line number info, NT5.0-method (SymGetLineFromAddr64()) - if (this->m_sw->pSGLFA != NULL ) + if (this->m_sw->pSGLFA != nullptr ) { // yes, we have SymGetLineFromAddr64() if (this->m_sw->pSGLFA(this->m_hProcess, s.AddrPC.Offset, &(csEntry.offsetFromLine), &Line) != FALSE) { @@ -1221,7 +1221,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con break; default: //_snprintf( ty, sizeof(ty), "symtype=%ld", (long) Module.SymType ); - csEntry.symTypeString = NULL; + csEntry.symTypeString = nullptr; break; } @@ -1261,7 +1261,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con if (!bLastEntryCalled) this->OnCallstackEntry(lastEntry, csEntry); - if (context == NULL) + if (context == nullptr) ResumeThread(hThread); return true; @@ -1275,7 +1275,7 @@ BOOL __stdcall StackWalker::myReadProcMem( LPDWORD lpNumberOfBytesRead ) { - if (s_readMemoryFunction == NULL) + if (s_readMemoryFunction == nullptr) { SIZE_T st; BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st); diff --git a/indra/llcommon/StackWalker.h b/indra/llcommon/StackWalker.h index c76b07a739d..823f80be222 100644 --- a/indra/llcommon/StackWalker.h +++ b/indra/llcommon/StackWalker.h @@ -96,7 +96,7 @@ class StackWalker StackWalker( bool verbose = true, int options = OptionsAll, // 'int' is by design, to combine the enum-flags - LPCSTR szSymPath = NULL, + LPCSTR szSymPath = nullptr, DWORD dwProcessId = GetCurrentProcessId(), HANDLE hProcess = GetCurrentProcess() ); @@ -117,9 +117,9 @@ class StackWalker bool ShowCallstack( bool verbose, HANDLE hThread = GetCurrentThread(), - const CONTEXT *context = NULL, - PReadProcessMemoryRoutine readMemoryFunction = NULL, - LPVOID pUserData = NULL // optional to identify some data in the 'readMemoryFunction'-callback + const CONTEXT *context = nullptr, + PReadProcessMemoryRoutine readMemoryFunction = nullptr, + LPVOID pUserData = nullptr // optional to identify some data in the 'readMemoryFunction'-callback ); #if _MSC_VER >= 1300 @@ -190,11 +190,11 @@ class StackWalker #define GET_CURRENT_CONTEXT_STACKWALKER_CODEPLEX(c, contextFlags) \ do { \ memset(&c, 0, sizeof(CONTEXT)); \ - EXCEPTION_POINTERS *pExp = NULL; \ + EXCEPTION_POINTERS *pExp = nullptr; \ __try { \ throw 0; \ } __except( ( (pExp = GetExceptionInformation()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER)) {} \ - if (pExp != NULL) \ + if (pExp != nullptr) \ memcpy(&c, pExp->ContextRecord, sizeof(CONTEXT)); \ c.ContextFlags = contextFlags; \ } while(0); diff --git a/indra/llcommon/hbxxh.cpp b/indra/llcommon/hbxxh.cpp index 41d797a7e3b..0fad1b1b6bb 100644 --- a/indra/llcommon/hbxxh.cpp +++ b/indra/llcommon/hbxxh.cpp @@ -151,7 +151,7 @@ void HBXXH64::finalize() } mDigest = XXH3_64bits_digest((XXH3_state_t*)mState); XXH3_freeState((XXH3_state_t*)mState); - mState = NULL; + mState = nullptr; } U64 HBXXH64::digest() const @@ -333,7 +333,7 @@ void HBXXH128::finalize() data[0] = hash.low64; data[1] = hash.high64; XXH3_freeState((XXH3_state_t*)mState); - mState = NULL; + mState = nullptr; } const LLUUID& HBXXH128::digest() const diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h index 8248f821866..60f38943f81 100644 --- a/indra/llcommon/llalignedarray.h +++ b/indra/llcommon/llalignedarray.h @@ -52,7 +52,7 @@ template LLAlignedArray::LLAlignedArray() { llassert(alignment >= 16); - mArray = NULL; + mArray = nullptr; mElementCount = 0; mCapacity = 0; } @@ -61,7 +61,7 @@ template LLAlignedArray::~LLAlignedArray() { ll_aligned_free(mArray); - mArray = NULL; + mArray = nullptr; mElementCount = 0; mCapacity = 0; } @@ -69,7 +69,7 @@ LLAlignedArray::~LLAlignedArray() template void LLAlignedArray::push_back(const T& elem) { - T* old_buf = NULL; + T* old_buf = nullptr; if (mCapacity <= mElementCount) { mCapacity++; @@ -95,7 +95,7 @@ void LLAlignedArray::resize(U32 size) if (mCapacity < size) { mCapacity = size+mCapacity*2; - T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T)) : NULL; + T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T)) : nullptr; if (mArray) { ll_memcpy_nonaliased_aligned_16((char*) new_buf, (char*) mArray, sizeof(T)*mElementCount); diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 73b50d0a504..27b80f6482f 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -74,7 +74,7 @@ S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2; #endif // !LL_WINDOWS // the static application instance -LLApp* LLApp::sApplication = NULL; +LLApp* LLApp::sApplication = nullptr; // Allows the generation of core files for post mortem under gdb // and disables crashlogger @@ -83,7 +83,7 @@ bool LLApp::sDisableCrashlogger = false; // static // Keeps track of application status LLScalarCond LLApp::sStatus{LLApp::APP_STATUS_STOPPED}; -LLAppErrorHandler LLApp::sErrorHandler = NULL; +LLAppErrorHandler LLApp::sErrorHandler = nullptr; LLApp::LLApp() @@ -507,33 +507,33 @@ void setup_signals() // Synchronous signals # ifndef LL_BUGSPLAT - sigaction(SIGABRT, &act, NULL); + sigaction(SIGABRT, &act, nullptr); # endif - sigaction(SIGALRM, &act, NULL); - sigaction(SIGBUS, &act, NULL); - sigaction(SIGFPE, &act, NULL); - sigaction(SIGHUP, &act, NULL); - sigaction(SIGILL, &act, NULL); - sigaction(SIGPIPE, &act, NULL); - sigaction(SIGSEGV, &act, NULL); - sigaction(SIGSYS, &act, NULL); - - sigaction(LL_HEARTBEAT_SIGNAL, &act, NULL); - sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); + sigaction(SIGALRM, &act, nullptr); + sigaction(SIGBUS, &act, nullptr); + sigaction(SIGFPE, &act, nullptr); + sigaction(SIGHUP, &act, nullptr); + sigaction(SIGILL, &act, nullptr); + sigaction(SIGPIPE, &act, nullptr); + sigaction(SIGSEGV, &act, nullptr); + sigaction(SIGSYS, &act, nullptr); + + sigaction(LL_HEARTBEAT_SIGNAL, &act, nullptr); + sigaction(LL_SMACKDOWN_SIGNAL, &act, nullptr); // Asynchronous signals that are normally ignored #ifndef LL_IGNORE_SIGCHLD - sigaction(SIGCHLD, &act, NULL); + sigaction(SIGCHLD, &act, nullptr); #endif // LL_IGNORE_SIGCHLD - sigaction(SIGUSR2, &act, NULL); + sigaction(SIGUSR2, &act, nullptr); // Asynchronous signals that result in attempted graceful exit - sigaction(SIGHUP, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGINT, &act, NULL); + sigaction(SIGHUP, &act, nullptr); + sigaction(SIGTERM, &act, nullptr); + sigaction(SIGINT, &act, nullptr); // Asynchronous signals that result in core - sigaction(SIGQUIT, &act, NULL); + sigaction(SIGQUIT, &act, nullptr); } @@ -546,33 +546,33 @@ void clear_signals() // Synchronous signals # ifndef LL_BUGSPLAT - sigaction(SIGABRT, &act, NULL); + sigaction(SIGABRT, &act, nullptr); # endif - sigaction(SIGALRM, &act, NULL); - sigaction(SIGBUS, &act, NULL); - sigaction(SIGFPE, &act, NULL); - sigaction(SIGHUP, &act, NULL); - sigaction(SIGILL, &act, NULL); - sigaction(SIGPIPE, &act, NULL); - sigaction(SIGSEGV, &act, NULL); - sigaction(SIGSYS, &act, NULL); - - sigaction(LL_HEARTBEAT_SIGNAL, &act, NULL); - sigaction(LL_SMACKDOWN_SIGNAL, &act, NULL); + sigaction(SIGALRM, &act, nullptr); + sigaction(SIGBUS, &act, nullptr); + sigaction(SIGFPE, &act, nullptr); + sigaction(SIGHUP, &act, nullptr); + sigaction(SIGILL, &act, nullptr); + sigaction(SIGPIPE, &act, nullptr); + sigaction(SIGSEGV, &act, nullptr); + sigaction(SIGSYS, &act, nullptr); + + sigaction(LL_HEARTBEAT_SIGNAL, &act, nullptr); + sigaction(LL_SMACKDOWN_SIGNAL, &act, nullptr); // Asynchronous signals that are normally ignored #ifndef LL_IGNORE_SIGCHLD - sigaction(SIGCHLD, &act, NULL); + sigaction(SIGCHLD, &act, nullptr); #endif // LL_IGNORE_SIGCHLD // Asynchronous signals that result in attempted graceful exit - sigaction(SIGHUP, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGINT, &act, NULL); + sigaction(SIGHUP, &act, nullptr); + sigaction(SIGTERM, &act, nullptr); + sigaction(SIGINT, &act, nullptr); // Asynchronous signals that result in core - sigaction(SIGUSR2, &act, NULL); - sigaction(SIGQUIT, &act, NULL); + sigaction(SIGUSR2, &act, nullptr); + sigaction(SIGQUIT, &act, nullptr); } diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 65ee383c6bb..228cff03412 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -32,8 +32,8 @@ #include "llmutex.h" #include "apr_dso.h" -apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool -LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool. +apr_pool_t *gAPRPoolp = nullptr; // Global APR memory pool +LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = nullptr; //global volatile APR memory pool. const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool @@ -52,7 +52,7 @@ void ll_init_apr() if (!gAPRPoolp) { - apr_pool_create_ex(&gAPRPoolp, NULL, abortfunc, NULL); + apr_pool_create_ex(&gAPRPoolp, nullptr, abortfunc, nullptr); } if(!LLAPRFile::sAPRFilePoolp) @@ -78,12 +78,12 @@ void ll_cleanup_apr() if (gAPRPoolp) { apr_pool_destroy(gAPRPoolp); - gAPRPoolp = NULL; + gAPRPoolp = nullptr; } if (LLAPRFile::sAPRFilePoolp) { delete LLAPRFile::sAPRFilePoolp ; - LLAPRFile::sAPRFilePoolp = NULL ; + LLAPRFile::sAPRFilePoolp = nullptr; } apr_terminate(); } @@ -96,7 +96,7 @@ LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, bool releasePoolFlag) : mParent(parent), mReleasePoolFlag(releasePoolFlag), mMaxSize(size), - mPool(NULL) + mPool(nullptr) { createAPRPool() ; } @@ -136,7 +136,7 @@ void LLAPRPool::releaseAPRPool() if(!mParent || mReleasePoolFlag) { apr_pool_destroy(mPool) ; - mPool = NULL ; + mPool = nullptr; } } @@ -252,7 +252,7 @@ void _ll_apr_assert_status(apr_status_t status, const char* file, int line) class LLAPRFilePoolScope { public: - LLAPRFilePoolScope() : pPool(NULL), mInitialized(false) {} + LLAPRFilePoolScope() : pPool(nullptr), mInitialized(false) {} LLAPRFilePoolScope(LLVolatileAPRPool* poolp) : mInitialized(false) { setFilePool(poolp); @@ -261,7 +261,7 @@ class LLAPRFilePoolScope { reset(); } - apr_pool_t* getVolatileAPRPool(LLVolatileAPRPool* poolp = NULL) + apr_pool_t* getVolatileAPRPool(LLVolatileAPRPool* poolp = nullptr) { if (!pPool) { @@ -285,7 +285,7 @@ class LLAPRFilePoolScope } private: - void setFilePool(LLVolatileAPRPool* poolp = NULL) + void setFilePool(LLVolatileAPRPool* poolp = nullptr) { if (poolp) { @@ -306,14 +306,14 @@ class LLAPRFilePoolScope // LLAPRFile functions // LLAPRFile::LLAPRFile() - : mFile(NULL), - mCurrentFilePoolp(NULL) + : mFile(nullptr), + mCurrentFilePoolp(nullptr) { } LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool) - : mFile(NULL), - mCurrentFilePoolp(NULL) + : mFile(nullptr), + mCurrentFilePoolp(nullptr) { open(filename, flags, pool); } @@ -329,13 +329,13 @@ apr_status_t LLAPRFile::close() if(mFile) { ret = apr_file_close(mFile); - mFile = NULL ; + mFile = nullptr; } if(mCurrentFilePoolp) { mCurrentFilePoolp->clearVolatileAPRPool() ; - mCurrentFilePoolp = NULL ; + mCurrentFilePoolp = nullptr; } return ret ; @@ -355,7 +355,7 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLV if (s != APR_SUCCESS || !mFile) { - mFile = NULL ; + mFile = nullptr; if (sizep) { @@ -398,7 +398,7 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, boo s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, gAPRPoolp); if (s != APR_SUCCESS || !mFile) { - mFile = NULL ; + mFile = nullptr; close() ; return s; } @@ -468,7 +468,7 @@ apr_status_t LLAPRFile::close(apr_file_t* file_handle) if(file_handle) { ret = apr_file_close(file_handle); - file_handle = NULL ; + file_handle = nullptr; } return ret ; @@ -486,9 +486,9 @@ apr_file_t* LLAPRFile::open(const std::string& filename, apr_pool_t* apr_pool, a { ll_apr_warn_status(s); LL_WARNS("APR") << " Attempting to open filename: " << filename << LL_ENDL; - file_handle = NULL ; + file_handle = nullptr; close(file_handle) ; - return NULL; + return nullptr; } return file_handle ; diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 11e474b5dda..0edf0d5b79f 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -77,7 +77,7 @@ bool LL_COMMON_API ll_apr_is_initialized(); class LL_COMMON_API LLAPRPool { public: - LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, bool releasePoolFlag = true) ; + LLAPRPool(apr_pool_t *parent = nullptr, apr_size_t size = 0, bool releasePoolFlag = true) ; virtual ~LLAPRPool() ; virtual apr_pool_t* getAPRPool() ; @@ -103,7 +103,7 @@ class LL_COMMON_API LLAPRPool class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool { public: - LLVolatileAPRPool(bool is_local = true, apr_pool_t *parent = NULL, apr_size_t size = 0, bool releasePoolFlag = true); + LLVolatileAPRPool(bool is_local = true, apr_pool_t *parent = nullptr, apr_size_t size = 0, bool releasePoolFlag = true); virtual ~LLVolatileAPRPool(); /*virtual*/ apr_pool_t* getAPRPool() ; //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool(). @@ -153,13 +153,13 @@ class LL_COMMON_API LLAPRFile public: LLAPRFile(); - LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL); + LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = nullptr); ~LLAPRFile(); LLAPRFile(const LLAPRFile&) = delete; LLAPRFile& operator=(const LLAPRFile&) = delete; - apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); + apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = nullptr, S32* sizep = nullptr); apr_status_t open(const std::string& filename, apr_int32_t flags, bool use_global_pool); //use gAPRPoolp. apr_status_t close() ; @@ -186,16 +186,16 @@ class LL_COMMON_API LLAPRFile static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset); public: // returns false if failure: - static bool remove(const std::string& filename, LLVolatileAPRPool* pool = NULL); - static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = NULL); - static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = NULL, apr_int32_t flags = APR_READ); - static S32 size(const std::string& filename, LLVolatileAPRPool* pool = NULL); - static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); - static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); + static bool remove(const std::string& filename, LLVolatileAPRPool* pool = nullptr); + static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = nullptr); + static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = nullptr, apr_int32_t flags = APR_READ); + static S32 size(const std::string& filename, LLVolatileAPRPool* pool = nullptr); + static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = nullptr); + static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = nullptr); // Returns bytes read/written, 0 if read/write fails: - static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); - static S32 writeEx(const std::string& filename, const void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append + static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = nullptr); + static S32 writeEx(const std::string& filename, const void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = nullptr); // offset<0 means append //******************************************************************************************************************************* }; diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 9672a3262be..927efffd5bb 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -100,8 +100,8 @@ LLAssetDictionary::LLAssetDictionary() addEntry(LLAssetType::AT_MATERIAL, new AssetEntry("MATERIAL", "material", "render material", true, true, true)); addEntry(LLAssetType::AT_GLTF, new AssetEntry("GLTF", "gltf", "GLTF", true, true, true)); addEntry(LLAssetType::AT_GLTF_BIN, new AssetEntry("GLTF_BIN", "glbin", "GLTF binary", true, true, true)); - addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", NULL, false, false, false)); - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, false, false, false)); + addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", nullptr, false, false, false)); + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", nullptr, false, false, false)); }; diff --git a/indra/llcommon/llcallbacklist.h b/indra/llcommon/llcallbacklist.h index 036e575117d..096a0510d5e 100644 --- a/indra/llcommon/llcallbacklist.h +++ b/indra/llcommon/llcallbacklist.h @@ -45,9 +45,9 @@ class LLCallbackList LLCallbackList(); ~LLCallbackList(); - void addFunction( callback_t func, void *data = NULL ); // register a callback, which will be called as func(data) - bool containsFunction( callback_t func, void *data = NULL ); // true if list already contains the function/data pair - bool deleteFunction( callback_t func, void *data = NULL ); // removes the first instance of this function/data pair from the list, false if not found + void addFunction( callback_t func, void *data = nullptr ); // register a callback, which will be called as func(data) + bool containsFunction( callback_t func, void *data = nullptr ); // true if list already contains the function/data pair + bool deleteFunction( callback_t func, void *data = nullptr ); // removes the first instance of this function/data pair from the list, false if not found void callFunctions(); // calls all functions void deleteAllFunctions(); diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp index bf8801c46b4..a5899ec9ad1 100644 --- a/indra/llcommon/llcommon.cpp +++ b/indra/llcommon/llcommon.cpp @@ -117,7 +117,7 @@ void operator delete[](void* ptr, std::align_val_t align) noexcept //static bool LLCommon::sAprInitialized = false; -static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; +static LLTrace::ThreadRecorder* sMasterThreadRecorder = nullptr; //static void LLCommon::initClass() @@ -140,8 +140,8 @@ void LLCommon::initClass() void LLCommon::cleanupClass() { delete sMasterThreadRecorder; - sMasterThreadRecorder = NULL; - LLTrace::set_master_thread_recorder(NULL); + sMasterThreadRecorder = nullptr; + LLTrace::set_master_thread_recorder(nullptr); SUBSYSTEM_CLEANUP_DBG(LLTimer); if (sAprInitialized) { diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 34c8692f20f..2d791784ca9 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -76,7 +76,7 @@ class LL_COMMON_API LLDate std::string asString() const; std::string asRFC1123() const; void toStream(std::ostream&) const; - bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; + bool split(S32 *year, S32 *month = nullptr, S32 *day = nullptr, S32 *hour = nullptr, S32 *min = nullptr, S32 *sec = nullptr) const; std::string toLocalDateString(std::string fmt) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index a1b5c83caf4..58231e3065b 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -433,7 +433,7 @@ class LLDependencies: public LLDependenciesBase { return &found->second.node; } - return NULL; + return nullptr; } /** diff --git a/indra/llcommon/lldepthstack.h b/indra/llcommon/lldepthstack.h index 66a7a4ce152..b7e1a7ac8fd 100644 --- a/indra/llcommon/lldepthstack.h +++ b/indra/llcommon/lldepthstack.h @@ -71,7 +71,7 @@ template class LLDepthStack DATA_TYPE *pop() { - DATA_TYPE *tempp = NULL; + DATA_TYPE *tempp = nullptr; if (!mStack.empty()) { tempp = mStack.back(); @@ -83,7 +83,7 @@ template class LLDepthStack DATA_TYPE *check() { - return mStack.empty() ? NULL : mStack.back(); + return mStack.empty() ? nullptr : mStack.back(); } void removeAllNodes() diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h index 9c399057ae1..c02588784f6 100644 --- a/indra/llcommon/lldictionary.h +++ b/indra/llcommon/lldictionary.h @@ -58,7 +58,7 @@ class LLDictionary : public std::map const Entry *lookup(Index index) const { const_iterator_t dictionary_iter = map_t::find(index); - if (dictionary_iter == map_t::end()) return NULL; + if (dictionary_iter == map_t::end()) return nullptr; return dictionary_iter->second; } const Index lookup(const std::string &name) const diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 8ae0fabcc62..90edb3c8aa9 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -290,7 +290,7 @@ namespace { // a tty then we assume yes. Can be turned off with // the LL_NO_ANSI_COLOR env var. return (0 != isatty(2)) && - (NULL == getenv("LL_NO_ANSI_COLOR")); + (nullptr == getenv("LL_NO_ANSI_COLOR")); } }; @@ -1552,7 +1552,7 @@ namespace LLError std::string utcTime() { - time_t now = time(NULL); + time_t now = time(nullptr); const size_t BUF_SIZE = 64; char time_str[BUF_SIZE]; /* Flawfinder: ignore */ diff --git a/indra/llcommon/llevent.cpp b/indra/llcommon/llevent.cpp index 305ab8144ab..06989caaf45 100644 --- a/indra/llcommon/llevent.cpp +++ b/indra/llcommon/llevent.cpp @@ -66,7 +66,7 @@ LLObservable::~LLObservable() if (mDispatcher.notNull()) { mDispatcher->disengage(this); - mDispatcher = NULL; + mDispatcher = nullptr; } } @@ -76,7 +76,7 @@ bool LLObservable::setDispatcher(LLPointer dispatcher) if (mDispatcher.notNull()) { mDispatcher->disengage(this); - mDispatcher = NULL; + mDispatcher = nullptr; } if (dispatcher.notNull() || dispatcher->engage(this)) { @@ -175,7 +175,7 @@ LLSimpleDispatcher::~LLSimpleDispatcher() void LLSimpleDispatcher::addListener(LLEventListener* listener, LLSD filter, const LLSD& userdata) { - if (listener == NULL) return; + if (listener == nullptr) return; removeListener(listener); LLListenerEntry new_entry; new_entry.listener = listener; @@ -235,7 +235,7 @@ LLEventDispatcher::~LLEventDispatcher() if (impl) { delete impl; - impl = NULL; + impl = nullptr; } } diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index c5a7a0e56b5..e3b24ecd4a3 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -70,7 +70,7 @@ U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution #endif -static LLMutex* sLogLock = NULL; +static LLMutex* sLogLock = nullptr; static std::queue sLogQueue; block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id) @@ -131,7 +131,7 @@ struct SortTimerByName } }; -static BlockTimerStatHandle sRootTimer("root", NULL); +static BlockTimerStatHandle sRootTimer("root", nullptr); BlockTimerStatHandle& BlockTimer::getRootTimeBlock() { return sRootTimer; @@ -314,7 +314,7 @@ void BlockTimer::processTimes() BlockTimerStatHandle& timer = static_cast(base); TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); - accumulator.mLastCaller = NULL; + accumulator.mLastCaller = nullptr; accumulator.mMoveUpTree = false; } #endif @@ -450,10 +450,10 @@ TimeBlockAccumulator::TimeBlockAccumulator() : mTotalTimeCounter(0), mSelfTimeCounter(0), mCalls(0), - mLastCaller(NULL), + mLastCaller(nullptr), mActiveCount(0), mMoveUpTree(false), - mParent(NULL) + mParent(nullptr) {} void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other, EBufferAppendType append_type ) diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index d606a6fdb90..6226e8b1264 100644 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -67,7 +67,7 @@ lang_country_variant_from_envstring(const char *str, s[i] = '\0'; *lang = s; } else { - *lang = NULL; + *lang = nullptr; } if (str[end] && str[end]!=':') { /* not at end of str */ @@ -89,7 +89,7 @@ lang_country_variant_from_envstring(const char *str, s[i] = '\0'; *country = s; } else { - *country = NULL; + *country = nullptr; } if (str[end] && str[end]!=':') { /* not at end of str */ @@ -111,16 +111,16 @@ lang_country_variant_from_envstring(const char *str, s[i] = '\0'; *variant = s; } else { - *variant = NULL; + *variant = nullptr; } } static int accumulate_locstring(const char *str, FL_Locale *l) { - char *lang = NULL; - char *country = NULL; - char *variant = NULL; + char *lang = nullptr; + char *country = nullptr; + char *variant = nullptr; if (str) { lang_country_variant_from_envstring(str, &lang, &country, &variant); if (lang) { @@ -138,9 +138,9 @@ accumulate_locstring(const char *str, FL_Locale *l) { static int accumulate_env(const char *name, FL_Locale *l) { char *env; - char *lang = NULL; - char *country = NULL; - char *variant = NULL; + char *lang = nullptr; + char *country = nullptr; + char *variant = nullptr; env = getenv(name); if (env) { return accumulate_locstring(env, l); @@ -452,9 +452,9 @@ FL_Success FL_FindLocale(FL_Locale **locale, FL_Domain domain) { FL_Success success = FL_FAILED; FL_Locale *rtn = (FL_Locale*)malloc(sizeof(FL_Locale)); - rtn->lang = NULL; - rtn->country = NULL; - rtn->variant = NULL; + rtn->lang = nullptr; + rtn->country = nullptr; + rtn->variant = nullptr; #ifdef WIN32 /* win32 >= mswindows95 */ @@ -520,7 +520,7 @@ FL_FreeLocale(FL_Locale **locale) { free((void*)l->variant); } free(l); - *locale = NULL; + *locale = nullptr; } } } diff --git a/indra/llcommon/llhandle.h b/indra/llcommon/llhandle.h index fd7d32e79af..6d1c6f2ab75 100644 --- a/indra/llcommon/llhandle.h +++ b/indra/llcommon/llhandle.h @@ -40,7 +40,7 @@ class LLTombStone : public LLRefCount { public: - LLTombStone(void* target = NULL) : mTarget(target) {} + LLTombStone(void* target = nullptr) : mTarget(target) {} void setTarget(void* target) { mTarget = target; } void* getTarget() const { return mTarget; } @@ -50,7 +50,7 @@ class LLTombStone : public LLRefCount /** * LLHandles are used to refer to objects whose lifetime you do not control or influence. - * Calling get() on a handle will return a pointer to the referenced object or NULL, + * Calling get() on a handle will return a pointer to the referenced object or nullptr, * if the object no longer exists. Note that during the lifetime of the returned pointer, * you are assuming that the object will not be deleted by any action you perform, * or any other thread, as normal when using pointers, so avoid using that pointer outside of @@ -76,7 +76,7 @@ class LLTombStone : public LLRefCount * Minor optimization: we want LLHandle's mTombStone to always be a valid * LLPointer, saving some conditionals in dereferencing. That's the * getDefaultTombStone() mechanism. The default LLTombStone object's target - * pointer is always NULL, so it's semantically identical to allowing + * pointer is always nullptr, so it's semantically identical to allowing * mTombStone to be invalid. */ template @@ -94,7 +94,7 @@ class LLHandle bool isDead() const { - return mTombStone->getTarget() == NULL; + return mTombStone->getTarget() == nullptr; } void markDead() @@ -164,7 +164,7 @@ class LLRootHandle : public LLHandle if (LLHandle::mTombStone.notNull()) { if (LLHandle::mTombStone->getTarget() == (void*)object) return; - LLHandle::mTombStone->setTarget(NULL); + LLHandle::mTombStone->setTarget(nullptr); } // tombstone reference counted, so no paired delete LLHandle::mTombStone = new LLTombStone((void*)object); @@ -172,7 +172,7 @@ class LLRootHandle : public LLHandle void unbind() { - LLHandle::mTombStone->setTarget(NULL); + LLHandle::mTombStone->setTarget(nullptr); } //don't allow copying of root handles, since there should only be one @@ -272,7 +272,7 @@ class LLCheckedHandle: public LLCheckedHandleBase */ /*explicit*/ operator bool() const // explicit conversion operator not available with Linux compiler { - return (mHandle.get() != NULL); + return (mHandle.get() != nullptr); } /** diff --git a/indra/llcommon/llheteromap.cpp b/indra/llcommon/llheteromap.cpp index 823bea7a3c1..03dd7856b60 100644 --- a/indra/llcommon/llheteromap.cpp +++ b/indra/llcommon/llheteromap.cpp @@ -27,6 +27,6 @@ LLHeteroMap::~LLHeteroMap() // pair.second is the std::pair; pair.second.first is the void*; // pair.second.second points to the deleter function (pair.second.second)(pair.second.first); - pair.second.first = NULL; + pair.second.first = nullptr; } } diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 7bba1a540de..ce5fb977bfe 100644 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -71,19 +71,19 @@ namespace LLInitParam mInspectFunc(inspect_func), mMinCount(min_count), mMaxCount(max_count), - mUserData(NULL) + mUserData(nullptr) {} ParamDescriptor::ParamDescriptor() : mParamHandle(0), - mMergeFunc(NULL), - mDeserializeFunc(NULL), - mSerializeFunc(NULL), - mValidationFunc(NULL), - mInspectFunc(NULL), + mMergeFunc(nullptr), + mDeserializeFunc(nullptr), + mSerializeFunc(nullptr), + mValidationFunc(nullptr), + mInspectFunc(nullptr), mMinCount(0), mMaxCount(0), - mUserData(NULL) + mUserData(nullptr) {} ParamDescriptor::~ParamDescriptor() @@ -153,7 +153,7 @@ namespace LLInitParam BlockDescriptor::BlockDescriptor() : mMaxParamOffset(0), mInitializationState(UNINITIALIZED), - mCurrentBlockPtr(NULL) + mCurrentBlockPtr(nullptr) {} // called by each derived class in least to most derived order @@ -242,7 +242,7 @@ namespace LLInitParam ParamDescriptor::serialize_func_t serialize_func = ptr->mSerializeFunc; if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided()))) { - const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; + const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : nullptr; serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); } } @@ -274,7 +274,7 @@ namespace LLInitParam } name_stack.push_back(std::make_pair(pair.first, !duplicate)); - const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; + const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : nullptr; serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); name_stack.pop_back(); } diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index b01ea0bfb1b..ea21549a7c9 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -294,7 +294,7 @@ namespace LLInitParam static std::vector* getPossibleValues() { - return NULL; + return nullptr; } void assignNamedValue(const Inaccessable& name) @@ -310,7 +310,7 @@ namespace LLInitParam return param_value_t::getValue(); } - static value_name_map_t* getValueNames() {return NULL;} + static value_name_map_t* getValueNames() {return nullptr;} }; // helper class to implement name value lookups @@ -574,7 +574,7 @@ namespace LLInitParam protected: template - void registerParserFuncs(parser_read_func_t read_func, parser_write_func_t write_func = NULL) + void registerParserFuncs(parser_read_func_t read_func, parser_write_func_t write_func = nullptr) { mParserReadFuncs->insert(std::make_pair(&typeid(T), read_func)); mParserWriteFuncs->insert(std::make_pair(&typeid(T), write_func)); @@ -685,7 +685,7 @@ namespace LLInitParam { public: LazyValue() - : mPtr(NULL) + : mPtr(nullptr) {} ~LazyValue() @@ -699,7 +699,7 @@ namespace LLInitParam } LazyValue(const LazyValue& other) - : mPtr(NULL) + : mPtr(nullptr) { *this = other; } @@ -709,7 +709,7 @@ namespace LLInitParam if (!other.mPtr) { delete mPtr; - mPtr = NULL; + mPtr = nullptr; } else { @@ -733,7 +733,7 @@ namespace LLInitParam bool empty() const { - return mPtr == NULL; + return mPtr == nullptr; } void set(const T& other) @@ -767,7 +767,7 @@ namespace LLInitParam // lazily allocate an instance of T T* ensureInstance() const { - if (mPtr == NULL) + if (mPtr == nullptr) { mPtr = new T(); } @@ -883,7 +883,7 @@ namespace LLInitParam Param* getParamFromHandle(const param_handle_t param_handle) { - if (param_handle == 0) return NULL; + if (param_handle == 0) return nullptr; U8* baseblock_address = reinterpret_cast(this); return reinterpret_cast(baseblock_address + param_handle); @@ -910,7 +910,7 @@ namespace LLInitParam } bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t rule, const BaseBlock* diff_block = NULL) const; + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t rule, const BaseBlock* diff_block = nullptr) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } @@ -1129,7 +1129,7 @@ namespace LLInitParam static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) { // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); + parser.inspectValue(name_stack, min_count, max_count, nullptr); // then tell it about string-based alternatives ("red", "blue", etc. for LLColor4) if (named_value_t::getPossibleValues()) { @@ -1279,7 +1279,7 @@ namespace LLInitParam const self_t& typed_param = static_cast(param); // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); + parser.inspectValue(name_stack, min_count, max_count, nullptr); // then tell it about string-based alternatives ("red", "blue", etc. for LLColor4) if (named_value_t::getPossibleValues()) { @@ -1500,7 +1500,7 @@ namespace LLInitParam static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) { - parser.inspectValue(name_stack, min_count, max_count, NULL); + parser.inspectValue(name_stack, min_count, max_count, nullptr); if (named_value_t::getPossibleValues()) { parser.inspectValue(name_stack, min_count, max_count, named_value_t::getPossibleValues()); @@ -1728,7 +1728,7 @@ namespace LLInitParam // NOTE: currently we don't do diffing of Multiples else { - serialized = it->serializeBlock(parser, name_stack, predicate_rule, NULL); + serialized = it->serializeBlock(parser, name_stack, predicate_rule, nullptr); } name_stack.pop_back(); @@ -1747,7 +1747,7 @@ namespace LLInitParam const param_value_t& value_param = param_value_t(value_t()); // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); + parser.inspectValue(name_stack, min_count, max_count, nullptr); // then tell it about string-based alternatives ("red", "blue", etc. for LLColor4) if (named_value_t::getPossibleValues()) { @@ -1942,7 +1942,7 @@ namespace LLInitParam using super_t::operator =; explicit Alternative(const char* name = "", const default_value_t& val = defaultValue()) - : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, NULL, 0, 1), + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, nullptr, 0, 1), mOriginalValue(val) { // assign initial choice to first declared option @@ -2064,7 +2064,7 @@ namespace LLInitParam using super_t::operator =; explicit Optional(const char* name = "", const default_value_t& val = defaultValue()) - : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, NULL, 0, 1) + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, nullptr, 0, 1) { //#pragma message("Parsing LLInitParam::Block::Optional") } @@ -2170,11 +2170,11 @@ namespace LLInitParam { ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), - NULL, + nullptr, &deserializeParam, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, 0, S32_MAX)); block_descriptor.addParam(param_descriptor, name); } @@ -2326,11 +2326,11 @@ namespace LLInitParam return mValue.deserializeBlock(p, name_stack_range, new_name); } - bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = nullptr) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) - : NULL; + : nullptr; return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } @@ -2445,11 +2445,11 @@ namespace LLInitParam } } - bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = nullptr) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) - : NULL; + : nullptr; return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } @@ -2546,13 +2546,13 @@ namespace LLInitParam return mValue.get().deserializeBlock(p, name_stack_range, new_name); } - bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = nullptr) const { if (mValue.empty()) return false; const BaseBlock* base_block = (diff_block && !diff_block->mValue.empty()) ? &(diff_block->mValue.get().getValue()) - : NULL; + : nullptr; return mValue.get().serializeBlock(p, name_stack, predicate_rule, base_block); } @@ -2652,7 +2652,7 @@ namespace LLInitParam // block param interface LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - LL_COMMON_API bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = nullptr) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any @@ -2709,7 +2709,7 @@ namespace LLInitParam return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); } - bool serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const + bool serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = nullptr) const { const derived_t& typed_param = static_cast(*this); const derived_t* diff_param = static_cast(diff_block); @@ -2749,11 +2749,11 @@ namespace LLInitParam // and serialize those params derived_t copy(typed_param); copy.updateBlockFromValue(true); - return copy.block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); + return copy.block_t::serializeBlock(parser, name_stack, predicate_rule, nullptr); } else { - return block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); + return block_t::serializeBlock(parser, name_stack, predicate_rule, nullptr); } } } diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 5a7f27e6888..9e404fa89b8 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -242,7 +242,7 @@ class LLInstanceTracker LockStatic lock; LL_PROFILE_MUTEX_LOCK(lock->mMutex); const InstanceMap& map(lock->mMap); typename InstanceMap::const_iterator found = map.find(k); - return (found == map.end()) ? NULL : found->second; + return (found == map.end()) ? nullptr : found->second; } protected: diff --git a/indra/llcommon/llkeythrottle.h b/indra/llcommon/llkeythrottle.h index 8ee0e08c69f..bca1de36032 100644 --- a/indra/llcommon/llkeythrottle.h +++ b/indra/llcommon/llkeythrottle.h @@ -69,8 +69,8 @@ class LLKeyThrottleImpl // prevMap covers the previous interval LLKeyThrottleImpl() : - prevMap(NULL), - currMap(NULL), + prevMap(nullptr), + currMap(nullptr), countLimit(0), intervalLength(1), startTime(0) diff --git a/indra/llcommon/llkeyusetracker.h b/indra/llcommon/llkeyusetracker.h index 790c7b713b9..0cf0f566485 100644 --- a/indra/llcommon/llkeyusetracker.h +++ b/indra/llcommon/llkeyusetracker.h @@ -102,7 +102,7 @@ class LLKeyUseTracker return *i; } - return NULL; + return nullptr; } TKeyUseTrackerNode *removeNode( TKey key ) @@ -116,7 +116,7 @@ class LLKeyUseTracker return i; } - return NULL; + return nullptr; } public: @@ -203,7 +203,7 @@ class LLKeyUseTracker { return &node->mData; } - return NULL; + return nullptr; } U32 getKeyCount() diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 1614cc6e57f..466ddd7000c 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -489,7 +489,7 @@ LLLeap* LLLeap::create(const LLProcess::Params& params, bool exc) } catch (const LLLeap::Error&) { - return NULL; + return nullptr; } } diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index 58de61a7e48..3f297a5dcc6 100644 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp @@ -63,7 +63,7 @@ LLLiveFile::Impl::Impl(const std::string& filename, const F32 refresh_period) mLastModTime(0), mLastStatTime(0), mLastExists(false), - mEventTimer(NULL) + mEventTimer(nullptr) { } diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index b05fd2e21bd..88a4147e334 100644 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -106,7 +106,7 @@ void LLMD5::update(const uint8_t* input, const size_t input_length) buffer_space = 64 - buffer_index; // how much space is left in buffer // now, transform each 64-byte piece of the input, bypassing the buffer - if (input == NULL || input_length == 0) + if (input == nullptr || input_length == 0) { std::cerr << "LLMD5::update: Invalid input!" << std::endl; return; diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 9617e30f0b6..52b57152960 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -236,7 +236,7 @@ U64 LLMemory::getCurrentRSS() #elif defined(LL_DARWIN) -// if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1) +// if (sysctl(ctl, 2, &page_size, &size, nullptr, 0) == -1) // { // LL_WARNS() << "Couldn't get page size" << LL_ENDL; // return 0; @@ -315,8 +315,8 @@ void* ll_aligned_malloc_fallback( size_t size, int align ) unsigned int for_alloc = (size/sysinfo.dwPageSize + !!(size%sysinfo.dwPageSize)) * sysinfo.dwPageSize; - void *p = VirtualAlloc(NULL, for_alloc+sysinfo.dwPageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); - if(NULL == p) { + void *p = VirtualAlloc(nullptr, for_alloc+sysinfo.dwPageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + if(nullptr == p) { // call debugger __asm int 3; } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index a25387d321e..d4ac2547cdd 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -134,7 +134,7 @@ public: \ if (0 != posix_memalign(&ret, align, size)) return nullptr; #else - char* aligned = NULL; + char* aligned = nullptr; void* mem = malloc( size + (align - 1) + sizeof(void*) ); if (mem) { @@ -338,8 +338,8 @@ inline void ll_memcpy_nonaliased_aligned_16(char* __restrict dst, const char* __ #if defined(LL_ARM64) memcpy(dst, src, bytes); #else - assert(src != NULL); - assert(dst != NULL); + assert(src != nullptr); + assert(dst != nullptr); assert(bytes > 0); assert((bytes % sizeof(F32))== 0); ll_assert_aligned(src,16); diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index cc258e4609a..b7a2680bd28 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -52,7 +52,7 @@ void LLMetricPerformanceTesterBasic::cleanupClass() /*static*/ bool LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) { - llassert_always(tester != NULL); + llassert_always(tester != nullptr); std::string name = tester->getTesterName() ; if (getTester(name)) { @@ -84,7 +84,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s { return found_it->second ; } - return NULL ; + return nullptr; } /*static*/ @@ -271,8 +271,8 @@ void LLMetricPerformanceTesterBasic::compareTestResults(llofstream* os, std::str LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : LLMetricPerformanceTesterBasic(name), - mBaseSessionp(NULL), - mCurrentSessionp(NULL) + mBaseSessionp(nullptr), + mCurrentSessionp(nullptr) { } @@ -281,12 +281,12 @@ LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() if (mBaseSessionp) { delete mBaseSessionp ; - mBaseSessionp = NULL ; + mBaseSessionp = nullptr ; } if (mCurrentSessionp) { delete mCurrentSessionp ; - mCurrentSessionp = NULL ; + mCurrentSessionp = nullptr ; } } @@ -313,12 +313,12 @@ void LLMetricPerformanceTesterWithSession::analyzePerformance(llofstream* os, LL if (mBaseSessionp) { delete mBaseSessionp ; - mBaseSessionp = NULL ; + mBaseSessionp = nullptr ; } if (mCurrentSessionp) { delete mCurrentSessionp ; - mCurrentSessionp = NULL ; + mCurrentSessionp = nullptr ; } } diff --git a/indra/llcommon/llmetrics.cpp b/indra/llcommon/llmetrics.cpp index 7c37b18bab4..c66397f2c36 100644 --- a/indra/llcommon/llmetrics.cpp +++ b/indra/llcommon/llmetrics.cpp @@ -139,7 +139,7 @@ LLMetrics::LLMetrics() LLMetrics::~LLMetrics() { delete mImpl; - mImpl = NULL; + mImpl = nullptr; } void LLMetrics::recordEvent(const std::string& location, const std::string& mesg, bool success) diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index f3615a12705..2472d487f29 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -254,7 +254,7 @@ class LL_COMMON_API LLScopedLock /** * @brief Constructor which accepts a mutex, and locks it. * - * @param mutex An allocated mutex. If you pass in NULL, + * @param mutex An allocated mutex. If you pass in nullptr, * this wrapper will not lock. */ LLScopedLock(std::mutex* mutex); diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h index 0c4cc4c04de..41ed4725e3c 100644 --- a/indra/llcommon/llnametable.h +++ b/indra/llcommon/llnametable.h @@ -91,7 +91,7 @@ class LLNameTable if (pair.second == data) return pair.first; } - return NULL; + return nullptr; } typedef std::map name_map_t; diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 706d539df2a..b9fb8aadff3 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -529,7 +529,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): // preserve existing semantics, we promise that mAttached defaults to the // same setting as mAutokill. mAttached(params.attached.isProvided()? params.attached : params.autokill), - mPool(NULL) + mPool(nullptr) { mPipes.resize(NSLOTS); @@ -547,7 +547,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): LLTHROW(LLProcessError(STRINGIZE("failed to create apr pool"))); } - apr_procattr_t *procattr = NULL; + apr_procattr_t *procattr = nullptr; chkapr(apr_procattr_create(&procattr, mPool)); // IQA-490, CHOP-900: On Windows, ask APR to jump through hoops to @@ -681,12 +681,12 @@ LLProcess::LLProcess(const LLSDOrParams& params): } // terminate with a null pointer - argv.push_back(NULL); + argv.push_back(nullptr); // Launch! The NULL would be the environment block, if we were passing // one. Hand-expand chkapr() macro so we can fill in the actual command // string instead of the variable names. - if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, + if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], nullptr, procattr, mPool))) { LLTHROW(LLProcessError(STRINGIZE(params << " failed"))); @@ -817,7 +817,7 @@ LLProcess::~LLProcess() if (mPool) { apr_pool_destroy(mPool); - mPool = NULL; + mPool = nullptr; } } @@ -1053,12 +1053,12 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) if (slot >= NSLOTS) { error = STRINGIZE(mDesc << " has no slot " << slot); - return NULL; + return nullptr; } if (!mPipes[slot]) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a monitored pipe"); - return NULL; + return nullptr; } // Make sure we dynamic_cast in pointer domain so we can test, rather than // accepting runtime's exception. @@ -1066,7 +1066,7 @@ PIPETYPE* LLProcess::getPipePtr(std::string& error, FILESLOT slot) if (! ppipe) { error = STRINGIZE(mDesc << ' ' << whichfile(slot) << " not a " << typeid(PIPETYPE).name()); - return NULL; + return nullptr; } error.clear(); @@ -1248,7 +1248,7 @@ void LLProcess::autokill() } // Attempt to reap a process ID -- returns true if the process has exited and been reaped, false otherwise. -static bool reap_pid(pid_t pid, LLProcess::Status* pstatus=NULL) +static bool reap_pid(pid_t pid, LLProcess::Status* pstatus=nullptr) { LLProcess::Status dummy; if (! pstatus) diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 37d1c60f91e..e324778c597 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -697,14 +697,14 @@ class LLProcessorInfoDarwinImpl : public LLProcessorInfoImpl char cpu_brand_string[0x40]; len = sizeof(cpu_brand_string); memset(cpu_brand_string, 0, len); - sysctlbyname("machdep.cpu.brand_string", (void*)cpu_brand_string, &len, NULL, 0); + sysctlbyname("machdep.cpu.brand_string", (void*)cpu_brand_string, &len, nullptr, 0); cpu_brand_string[0x3f] = 0; setInfo(eBrandName, cpu_brand_string); char cpu_vendor[0x20]; len = sizeof(cpu_vendor); memset(cpu_vendor, 0, len); - sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0); + sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, nullptr, 0); cpu_vendor[0x1f] = 0; // M series CPUs don't provide this field so if empty, just fall back to Apple. setInfo(eVendor, (cpu_vendor[0] != '\0') ? cpu_vendor : "Apple"); @@ -749,7 +749,7 @@ class LLProcessorInfoDarwinImpl : public LLProcessorInfoImpl char cpu_features[1024]; len = sizeof(cpu_features); memset(cpu_features, 0, len); - sysctlbyname("machdep.cpu.features", (void*)cpu_features, &len, NULL, 0); + sysctlbyname("machdep.cpu.features", (void*)cpu_features, &len, nullptr, 0); std::string cpu_features_str(cpu_features); cpu_features_str = " " + cpu_features_str + " "; @@ -847,16 +847,16 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl // /proc/cpuinfo on Linux looks like: // name\t*: value\n char* tabspot = strchr( line, '\t' ); - if (tabspot == NULL) + if (tabspot == nullptr) continue; char* colspot = strchr( tabspot, ':' ); - if (colspot == NULL) + if (colspot == nullptr) continue; char* spacespot = strchr( colspot, ' ' ); - if (spacespot == NULL) + if (spacespot == nullptr) continue; char* nlspot = strchr( line, '\n' ); - if (nlspot == NULL) + if (nlspot == nullptr) nlspot = line + strlen( line ); // Fallback to terminating NUL std::string linename( line, tabspot ); std::string llinename(linename); @@ -982,7 +982,7 @@ class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl ////////////////////////////////////////////////////// // Interface definition -LLProcessorInfo::LLProcessorInfo() : mImpl(NULL) +LLProcessorInfo::LLProcessorInfo() : mImpl(nullptr) { // *NOTE:Mani - not thread safe. if(!mImpl) diff --git a/indra/llcommon/llrand.h b/indra/llcommon/llrand.h index 625ae0f5f41..327be3bca3f 100644 --- a/indra/llcommon/llrand.h +++ b/indra/llcommon/llrand.h @@ -95,7 +95,7 @@ F64 LL_COMMON_API ll_drand(F64 val); * one, and one comparable in speed but higher periodicity without * outrageous memory requirements. * To use: - * LLRandLagFib607 foo((U32)time(NULL)); + * LLRandLagFib607 foo((U32)time(nullptr)); * double bar = foo(); */ @@ -117,7 +117,7 @@ typedef boost::lagged_fibonacci2281 LLRandLagFib2281; * * This fairly quickly generates U32 values * To use: - * LLRandMT19937 foo((U32)time(NULL)); + * LLRandMT19937 foo((U32)time(nullptr)); * U32 bar = foo(); * * lengh of cycle: 2^19,937-1 diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index 35335e12130..80a8bbe90f9 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -96,7 +96,7 @@ class LLRegistry { return &(found_it->second); } - return NULL; + return nullptr; } ptr_const_value_t getValue(ref_const_key_t key) const @@ -106,7 +106,7 @@ class LLRegistry { return &(found_it->second); } - return NULL; + return nullptr; } // if the registry is used to store pointers, and null values are valid entries @@ -144,7 +144,7 @@ class LLRegistry for(Registrar* scope : mActiveScopes) { ptr_value_t valuep = scope->getValue(key); - if (valuep != NULL) return valuep; + if (valuep != nullptr) return valuep; } return mDefaultRegistrar.getValue(key); } @@ -154,7 +154,7 @@ class LLRegistry for(const Registrar* scope : mActiveScopes) { ptr_const_value_t valuep = scope->getValue(key); - if (valuep != NULL) return valuep; + if (valuep != nullptr) return valuep; } return mDefaultRegistrar.getValue(key); } @@ -328,7 +328,7 @@ class LLRegistrySingleton protected: // DERIVED_TYPE needs to derive from LLRegistrySingleton LLRegistrySingleton() - : mStaticScope(NULL) + : mStaticScope(nullptr) {} virtual void initSingleton() diff --git a/indra/llcommon/llsafehandle.h b/indra/llcommon/llsafehandle.h index 1d7e4f8220e..4f93b8365ae 100644 --- a/indra/llcommon/llsafehandle.h +++ b/indra/llcommon/llsafehandle.h @@ -41,7 +41,7 @@ to reference the LLObjectSelection and LLParcelSelection classes, but do not apply LLSafeHandle to other classes, or declare new instances. Instead, use LLPointer or other smart pointer types with appropriate checks -for NULL. If you're certain the reference cannot (or must not) be NULL, +for NULL. If you're certain the reference cannot (or must not) be nullptr, consider storing a C++ reference instead -- or use (e.g.) LLCheckedHandle. When an LLSafeHandle containing NULL is dereferenced, it resolves to a @@ -62,18 +62,18 @@ class LLSafeHandle { public: LLSafeHandle() : - mPointer(NULL) + mPointer(nullptr) { } LLSafeHandle(Type* ptr) : - mPointer(NULL) + mPointer(nullptr) { assign(ptr); } LLSafeHandle(const LLSafeHandle& ptr) : - mPointer(NULL) + mPointer(nullptr) { assign(ptr.mPointer); } @@ -81,7 +81,7 @@ class LLSafeHandle // support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed. template LLSafeHandle(const LLSafeHandle& ptr) : - mPointer(NULL) + mPointer(nullptr) { assign(ptr.get()); } @@ -95,17 +95,17 @@ class LLSafeHandle Type* operator->() { return nonNull(mPointer); } Type* get() const { return mPointer; } - void clear() { assign(NULL); } + void clear() { assign(nullptr); } // we disallow these operations as they expose our null objects to direct manipulation // and bypass the reference counting semantics //const Type& operator*() const { return *nonNull(mPointer); } //Type& operator*() { return *nonNull(mPointer); } - operator BOOL() const { return mPointer != NULL; } - operator bool() const { return mPointer != NULL; } - bool operator!() const { return mPointer == NULL; } - bool isNull() const { return mPointer == NULL; } - bool notNull() const { return mPointer != NULL; } + operator BOOL() const { return mPointer != nullptr; } + operator bool() const { return mPointer != nullptr; } + bool operator!() const { return mPointer == nullptr; } + bool isNull() const { return mPointer == nullptr; } + bool notNull() const { return mPointer != nullptr; } operator Type*() const { return mPointer; } @@ -150,9 +150,9 @@ class LLSafeHandle if (mPointer) { Type *tempp = mPointer; - mPointer = NULL; + mPointer = nullptr; tempp->unref(); - if (mPointer != NULL) + if (mPointer != nullptr) { LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL; unref(); diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index ea6d6a308a5..aaf45b3a83e 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -1096,7 +1096,7 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) // sStorage will point to the result of the last call. This will actually // be one leak, but since this is used only when running under the // debugger, it should not be an issue. - static char *sStorage = NULL; + static char *sStorage = nullptr; delete[] sStorage; std::string out_string; { diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index d2b35488316..9068b3f6c5d 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -127,7 +127,7 @@ // mechanism must perform correct data ordering operations // as dictated by architecture. other_thread.sendMessageAndPointer("Take This", xfer_tree); - xfer_tree = NULL; + xfer_tree = nullptr; Avoid this pattern which provides half of a race condition: diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index caaac3d7629..a1c6fbab1ea 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -90,7 +90,7 @@ void LLParamSDParser::submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLIn void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) { - mCurReadSD = NULL; + mCurReadSD = nullptr; mNameStack.clear(); setParseSilently(silent); diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 447ba023276..d6336866fca 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -55,7 +55,7 @@ typedef LLInitParam::Parser parser_t; void writeSD(LLSD& sd, const BLOCK& block, const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), - const LLInitParam::BaseBlock* diff_block = NULL) + const LLInitParam::BaseBlock* diff_block = nullptr) { if (!diff_block && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 3cc960698eb..f63861b1460 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -90,7 +90,7 @@ S32 parse_using(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth= void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize type, LLSDFormatter::EFormatterOptions options) { - LLPointer f = NULL; + LLPointer f = nullptr; switch (type) { @@ -866,7 +866,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const { // We probably have a valid raw binary stream. determine // the size, and read it. - auto len = strtol(buf + 2, NULL, 0); + auto len = strtol(buf + 2, nullptr, 0); if(mCheckLimits && (len > mMaxBytesLeft)) return false; std::vector value; if(len) @@ -1803,7 +1803,7 @@ llssize deserialize_string_raw( // We probably have a valid raw string. determine // the size, and read it. // *FIX: This is memory inefficient. - auto len = strtol(buf + 1, NULL, 0); + auto len = strtol(buf + 1, nullptr, 0); if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE; std::vector buf; if(len) @@ -2172,7 +2172,7 @@ std::string zip_llsd(LLSD& data) strm.avail_in = narrow(source.size()); strm.next_in = (U8*) source.data(); - U8* output = NULL; + U8* output = nullptr; U32 cur_size = 0; @@ -2197,7 +2197,7 @@ std::string zip_llsd(LLSD& data) have = CHUNK-strm.avail_out; U8* new_output = (U8*) realloc(output, cur_size+have); - if (new_output == NULL) + if (new_output == nullptr) { LL_WARNS() << "Failed to compress LLSD block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL; deflateEnd(&strm); @@ -2249,7 +2249,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 size) { - U8* result = NULL; + U8* result = nullptr; llssize cur_size = 0; z_stream strm; @@ -2302,7 +2302,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 U32 have = CHUNK-strm.avail_out; U8* new_result = (U8*)realloc(result, cur_size + have); - if (new_result == NULL) + if (new_result == nullptr) { inflateEnd(&strm); if (result) @@ -2349,20 +2349,20 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size if (size == 0) { LL_WARNS() << "No data to unzip." << LL_ENDL; - return NULL; + return nullptr; } - U8* result = NULL; + U8* result = nullptr; U32 cur_size = 0; z_stream strm; const U32 CHUNK = 0x4000; U8 *in = new(std::nothrow) U8[size]; - if (in == NULL) + if (in == nullptr) { LL_WARNS() << "Memory allocation failure." << LL_ENDL; - return NULL; + return nullptr; } is.read((char*) in, size); @@ -2406,7 +2406,7 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size U32 have = CHUNK-strm.avail_out; U8* new_result = (U8*) realloc(result, cur_size + have); - if (new_result == NULL) + if (new_result == nullptr) { LL_WARNS() << "Failed to unzip LLSD NavMesh block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have @@ -2419,7 +2419,7 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size } delete[] in; valid = false; - return NULL; + return nullptr; } result = new_result; memcpy(result+cur_size, out, have); @@ -2434,7 +2434,7 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size { free(result); valid = false; - return NULL; + return nullptr; } //result now points to the decompressed LLSD block diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 6396caf8d53..fe9dfe9f6a9 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -323,7 +323,7 @@ class LLSDXMLParser::Impl LLSDXMLParser::Impl::Impl(bool emit_errors) : mEmitErrors(emit_errors) { - mParser = XML_ParserCreate(NULL); + mParser = XML_ParserCreate(nullptr); reset(); } @@ -365,7 +365,7 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) XML_Status status; static const int BUFFER_SIZE = 1024; - void* buffer = NULL; + void* buffer = nullptr; int count = 0; while (input.good() && !input.eof()) { @@ -538,7 +538,7 @@ void LLSDXMLParser::Impl::startSkipping() const XML_Char* LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs) { - while (NULL != pairs && NULL != *pairs) + while (nullptr != pairs && nullptr != *pairs) { if(0 == strcmp(name, *pairs)) { @@ -546,12 +546,12 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs) } pairs += 2; } - return NULL; + return nullptr; } void LLSDXMLParser::Impl::parsePart(const char* buf, llssize len) { - if ( buf != NULL + if ( buf != nullptr && len > 0 ) { XML_Status status = XML_Parse(mParser, buf, (int)len, 0); diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index fd014841289..fbb01649238 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -176,7 +176,7 @@ char* ll_pretty_print_sd_ptr(const LLSD* sd) { return ll_pretty_print_sd(*sd); } - return NULL; + return nullptr; } char* ll_pretty_print_sd(const LLSD& sd) diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 497c0ad3eb7..85f9612ec73 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -464,11 +464,11 @@ class LLSDParam: public LLSDParamBase { // By default, an isUndefined() LLSD object's asString() method // will produce an empty string. But for a function accepting - // const char*, it's often important to be able to pass NULL, and + // const char*, it's often important to be able to pass nullptr, and // isUndefined() seems like the best way. If you want to pass an // empty string, you can still pass LLSD(""). Without this special // case, though, no LLSD value could pass NULL. - return NULL; + return nullptr; } return value_.c_str(); } diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index c223c26bb01..477be0efc78 100644 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -58,7 +58,7 @@ bool ll_get_stack_trace(std::vector& lines) // load the symbols if they're not loaded if(!symbolsLoaded && firstCall) { - symbolsLoaded = SymInitialize(hProc, NULL, true); + symbolsLoaded = SymInitialize(hProc, nullptr, true); firstCall = false; } @@ -71,7 +71,7 @@ bool ll_get_stack_trace(std::vector& lines) S32 depth = 0; // get the addresses - depth = RtlCaptureStackBackTrace_fn(FRAME_SKIP, MAX_STACK_DEPTH, frames, NULL); + depth = RtlCaptureStackBackTrace_fn(FRAME_SKIP, MAX_STACK_DEPTH, frames, nullptr); IMAGEHLP_LINE64 line; memset(&line, 0, sizeof(IMAGEHLP_LINE64)); @@ -131,11 +131,11 @@ void ll_get_stack_trace_internal(std::vector& lines) const S32 STRING_NAME_LENGTH = 256; HANDLE process = GetCurrentProcess(); - SymInitialize( process, NULL, true ); + SymInitialize( process, nullptr, true ); void *stack[MAX_STACK_DEPTH]; - unsigned short frames = RtlCaptureStackBackTrace_fn( 0, MAX_STACK_DEPTH, stack, NULL ); + unsigned short frames = RtlCaptureStackBackTrace_fn( 0, MAX_STACK_DEPTH, stack, nullptr ); SYMBOL_INFO *symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + STRING_NAME_LENGTH * sizeof(char), 1); symbol->MaxNameLen = STRING_NAME_LENGTH-1; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index fb387a7b52c..5ba709ef952 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -110,7 +110,7 @@ struct DeletePairedPointer template void operator()(T &ptr) const { delete ptr.second; - ptr.second = NULL; + ptr.second = nullptr; } }; struct DeletePairedPointerArray @@ -118,7 +118,7 @@ struct DeletePairedPointerArray template void operator()(T &ptr) const { delete[] ptr.second; - ptr.second = NULL; + ptr.second = nullptr; } }; @@ -207,7 +207,7 @@ template void delete_and_clear(T*& ptr) { delete ptr; - ptr = NULL; + ptr = nullptr; } @@ -215,7 +215,7 @@ template void delete_and_clear_array(T*& ptr) { delete[] ptr; - ptr = NULL; + ptr = nullptr; } // Simple function to help with finding pointers in maps. @@ -225,7 +225,7 @@ void delete_and_clear_array(T*& ptr) // foo[18] = "there"; // foo[2] = "hello"; // const char* bar = get_ptr_in_map(foo, 2); // bar -> "hello" -// const char* baz = get_ptr_in_map(foo, 3); // baz == NULL +// const char* baz = get_ptr_in_map(foo, 3); // baz == nullptr template inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_type const& key) { @@ -234,7 +234,7 @@ inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_ty map_iter iter = inmap.find(key); if(iter == inmap.end()) { - return NULL; + return nullptr; } else { diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h index d756aca62b3..43b457e64df 100644 --- a/indra/llcommon/llstrider.h +++ b/indra/llcommon/llstrider.h @@ -37,7 +37,7 @@ template class LLStrider }; U32 mSkip; public: - LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); } + LLStrider() { mObjectp = nullptr; mSkip = sizeof(Object); } LLStrider(Object* first) { mObjectp = first; mSkip = sizeof(Object); } ~LLStrider() { } diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 07adf71d18f..68a4130d985 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -809,7 +809,7 @@ std::string ll_convert_wide_to_string(const wchar_t* in, size_t len_in, unsigned 0, in, static_cast(len_in), - NULL, + nullptr, 0, 0, 0); @@ -843,7 +843,7 @@ std::wstring ll_convert_string_to_wide(const char* in, size_t len, unsigned int // Normally, I'd call that sort of thing premature optimization, // but we *are* seeing string operations taking a bunch of time, especially when constructing widgets. -// int output_str_len = MultiByteToWideChar(code_page, 0, in.c_str(), in.length(), NULL, 0); +// int output_str_len = MultiByteToWideChar(code_page, 0, in.c_str(), in.length(), nullptr, 0); // reserve an output buffer that will be destroyed on exit, with a place // to put NULL terminator @@ -894,7 +894,7 @@ namespace void HeapFree_deleter(void* ptr) { // instead of LocalFree(), per https://stackoverflow.com/a/31541205 - HeapFree(GetProcessHeap(), NULL, ptr); + HeapFree(GetProcessHeap(), 0, ptr); } } // anonymous namespace @@ -918,12 +918,12 @@ std::wstring windows_message(DWORD error) FORMAT_MESSAGE_IGNORE_INSERTS | // ignore line breaks in message definition text FORMAT_MESSAGE_MAX_WIDTH_MASK, - NULL, // lpSource, unused with FORMAT_MESSAGE_FROM_SYSTEM + nullptr, // lpSource, unused with FORMAT_MESSAGE_FROM_SYSTEM error, // dwMessageId MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // dwLanguageId (LPWSTR)&rawptr, // lpBuffer: force-cast wchar_t** to wchar_t* 0, // nSize, unused with FORMAT_MESSAGE_ALLOCATE_BUFFER - NULL); // Arguments, unused + nullptr); // Arguments, unused // make a unique_ptr from rawptr so it gets cleaned up properly std::unique_ptr bufferptr(rawptr, HeapFree_deleter); @@ -1039,7 +1039,7 @@ void LLStringOps::setupDatetimeInfo (bool daylight) time_t nowT, localT, gmtT; struct tm * tmpT; - nowT = time (NULL); + nowT = time (nullptr); tmpT = gmtime (&nowT); gmtT = mktime (tmpT); @@ -1740,7 +1740,7 @@ void LLStringUtilBase::testHarness() { std::string s1; - llassert( s1.c_str() == NULL ); + llassert( s1.c_str() == nullptr ); llassert( s1.size() == 0 ); llassert( s1.empty() ); diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 7dd8256e72c..d9abfe21989 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1679,7 +1679,7 @@ void LLStringUtilBase::stripNonprintable(string_type& string) } size_t src_size = string.size(); char* c_string = new char[src_size + 1]; - if(c_string == NULL) + if(c_string == nullptr) { return; } diff --git a/indra/llcommon/llstringtable.cpp b/indra/llcommon/llstringtable.cpp index d28e1e22197..023fcd53c18 100644 --- a/indra/llcommon/llstringtable.cpp +++ b/indra/llcommon/llstringtable.cpp @@ -33,7 +33,7 @@ LLStringTable gStringTable(32768); LLStringTableEntry::LLStringTableEntry(const char *str) -: mString(NULL), mCount(1) +: mString(nullptr), mCount(1) { // Copy string U32 length = (U32)strlen(str) + 1; /*Flawfinder: ignore*/ @@ -75,7 +75,7 @@ LLStringTable::LLStringTable(int tablesize) // Clear strings for (i = 0; i < mMaxEntries; i++) { - mStringList[i] = NULL; + mStringList[i] = nullptr; } #endif } @@ -95,7 +95,7 @@ LLStringTable::~LLStringTable() delete mStringList[i]; } delete [] mStringList; - mStringList = NULL; + mStringList = nullptr; } #else // Need to clean up the string hash @@ -141,7 +141,7 @@ char* LLStringTable::checkString(const char *str) } else { - return NULL; + return nullptr; } } @@ -190,7 +190,7 @@ LLStringTableEntry* LLStringTable::checkStringEntry(const char *str) } #endif } - return NULL; + return nullptr; } char* LLStringTable::addString(const std::string& str) @@ -209,7 +209,7 @@ char* LLStringTable::addString(const char *str) } else { - return NULL; + return nullptr; } } @@ -222,7 +222,7 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str) { if (str) { - char *ret_val = NULL; + char *ret_val = nullptr; U32 hash_value = hash_my_string(str, mMaxEntries); #if STRING_TABLE_HASH_MAP LLStringTableEntry *entry; @@ -280,7 +280,7 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str) } else { - return NULL; + return nullptr; } } diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h index 97f95369e5d..f2c2f9ac715 100644 --- a/indra/llcommon/llstringtable.h +++ b/indra/llcommon/llstringtable.h @@ -160,7 +160,7 @@ class LL_COMMON_API LLStdStringTable { U32 hashval = makehash(s); LLStdStringHandle result = lookup(hashval, s); - if (result == NULL) + if (result == nullptr) { result = new std::string(s); mStringList[hashval].insert(result); @@ -195,7 +195,7 @@ class LL_COMMON_API LLStdStringTable } else { - return NULL; + return nullptr; } } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 9b5dd2df394..ca46587b553 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -183,7 +183,7 @@ LLOSInfo::LLOSInfo() : PGNSI pGNSI; //pointer object ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function - if (NULL != pGNSI) //check if it has failed + if (nullptr != pGNSI) //check if it has failed pGNSI(&si); //success else GetSystemInfo(&si); //if it fails get regular system info @@ -221,7 +221,7 @@ LLOSInfo::LLOSInfo() : LSTATUS ret_code = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), 0, KEY_READ, &key); if (ERROR_SUCCESS == ret_code) { - ret_code = RegQueryValueExW(key, L"UBR", 0, NULL, reinterpret_cast(&data), &cbData); + ret_code = RegQueryValueExW(key, L"UBR", 0, nullptr, reinterpret_cast(&data), &cbData); if (ERROR_SUCCESS == ret_code) { ubr = data; @@ -765,7 +765,7 @@ U32Kilobytes LLMemoryInfo::getHardwareMemSize() int mib[2] = { CTL_HW, HW_MEMSIZE }; size_t len = sizeof(phys); - sysctl(mib, 2, &phys, &len, NULL, 0); + sysctl(mib, 2, &phys, &len, nullptr, 0); return U64Bytes(phys); } @@ -1261,9 +1261,9 @@ bool gunzip_file(const std::string& srcfile, const std::string& dstfile) std::string tmpfile; const S32 UNCOMPRESS_BUFFER_SIZE = 32768; bool retval = false; - gzFile src = NULL; + gzFile src = nullptr; U8 buffer[UNCOMPRESS_BUFFER_SIZE]; - LLFILE *dst = NULL; + LLFILE *dst = nullptr; S32 bytes = 0; tmpfile = dstfile + ".t"; #ifdef LL_WINDOWS @@ -1286,12 +1286,12 @@ bool gunzip_file(const std::string& srcfile, const std::string& dstfile) } } while(gzeof(src) == 0); fclose(dst); - dst = NULL; + dst = nullptr; if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */ retval = true; err: - if (src != NULL) gzclose(src); - if (dst != NULL) fclose(dst); + if (src != nullptr) gzclose(src); + if (dst != nullptr) fclose(dst); return retval; } @@ -1301,8 +1301,8 @@ bool gzip_file(const std::string& srcfile, const std::string& dstfile) std::string tmpfile; bool retval = false; U8 buffer[COMPRESS_BUFFER_SIZE]; - gzFile dst = NULL; - LLFILE *src = NULL; + gzFile dst = nullptr; + LLFILE *src = nullptr; S32 bytes = 0; tmpfile = dstfile + ".t"; @@ -1321,7 +1321,7 @@ bool gzip_file(const std::string& srcfile, const std::string& dstfile) { if (gzwrite(dst, buffer, bytes) <= 0) { - LL_WARNS() << "gzwrite failed: " << gzerror(dst, NULL) << LL_ENDL; + LL_WARNS() << "gzwrite failed: " << gzerror(dst, nullptr) << LL_ENDL; goto err; } } @@ -1333,11 +1333,11 @@ bool gzip_file(const std::string& srcfile, const std::string& dstfile) } gzclose(dst); - dst = NULL; + dst = nullptr; if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */ retval = true; err: - if (src != NULL) fclose(src); - if (dst != NULL) gzclose(dst); + if (src != nullptr) fclose(src); + if (dst != nullptr) gzclose(dst); return retval; } diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index e1f0d531cf6..4db1e4b7bef 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -189,7 +189,7 @@ void LLThread::threadRun() delete mRecorder; - mRecorder = NULL; + mRecorder = nullptr; // We're done with the run function, this thread is done executing now. //NB: we are using this flag to sync across threads...we really need memory barriers here @@ -264,13 +264,13 @@ void LLThread::sehHandle() LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : mPaused(false), mName(name), - mThreadp(NULL), + mThreadp(nullptr), mStatus(STOPPED), - mRecorder(NULL) + mRecorder(nullptr) { mRunCondition = new LLCondition(); mDataLock = new LLMutex(); - mLocalAPRFilePoolp = NULL ; + mLocalAPRFilePoolp = nullptr; } @@ -286,7 +286,7 @@ LLThread::~LLThread() if(mLocalAPRFilePoolp) { delete mLocalAPRFilePoolp ; - mLocalAPRFilePoolp = NULL ; + mLocalAPRFilePoolp = nullptr; } } @@ -338,19 +338,19 @@ void LLThread::shutdown() #endif delete mRecorder; - mRecorder = NULL; + mRecorder = nullptr; mStatus = STOPPED; return; } delete mThreadp; - mThreadp = NULL; + mThreadp = nullptr; } delete mRunCondition; - mRunCondition = NULL; + mRunCondition = nullptr; delete mDataLock; - mDataLock = NULL; + mDataLock = nullptr; if (mRecorder) { diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b97d479abcc..b8fd326bd81 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -53,7 +53,7 @@ class LL_COMMON_API LLThread } EThreadStatus; typedef std::thread::id id_t; - LLThread(const std::string& name, apr_pool_t *poolp = NULL); + LLThread(const std::string& name, apr_pool_t *poolp = nullptr); virtual ~LLThread(); // Warning! You almost NEVER want to destroy a thread unless it's in the STOPPED state. virtual void shutdown(); // stops the thread diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index 151d8a666b9..0b8da361325 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -49,6 +49,6 @@ class LLThreadLocalSingletonPointer }; template -thread_local DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; +thread_local DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = nullptr; #endif // LL_LLTHREADLOCALSTORAGE_H diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index f36d2231005..e41c04ad6f1 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -52,7 +52,7 @@ const U64 SEC_TO_MICROSEC_U64 = 1000000; //--------------------------------------------------------------------------- S32 gUTCOffset = 0; // viewer's offset from server UTC, in seconds -LLTimer* LLTimer::sTimer = NULL; +LLTimer* LLTimer::sTimer = nullptr; // @@ -96,8 +96,8 @@ U32 micro_sleep(U64 us, U32 max_yields) LARGE_INTEGER ft; ft.QuadPart = -static_cast(us * 10); // '-' using relative time - HANDLE timer = CreateWaitableTimer(NULL, true, NULL); - SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); + HANDLE timer = CreateWaitableTimer(nullptr, true, nullptr); + SetWaitableTimer(timer, &ft, 0, nullptr, nullptr, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); #else @@ -244,7 +244,7 @@ U64 get_clock_count() { // Linux clocks are in microseconds struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); return tv.tv_sec*SEC_TO_MICROSEC_U64 + tv.tv_usec; } #endif @@ -286,7 +286,7 @@ U64MicrosecondsImplicit totalTime() // Unix platforms use gettimeofday so they are synced, although this probably isn't a good assumption to // make in the future. - get_timer_info().mTotalTimeClockCount = (U64)(time(NULL) * get_timer_info().mClockFrequency); + get_timer_info().mTotalTimeClockCount = (U64)(time(nullptr) * get_timer_info().mClockFrequency); #endif // Update the last clock count @@ -340,7 +340,7 @@ void LLTimer::initClass() // static void LLTimer::cleanupClass() { - delete sTimer; sTimer = NULL; + delete sTimer; sTimer = nullptr; } // static @@ -479,7 +479,7 @@ bool LLTimer::knownBadTimer() L"\0" }; - HKEY hKey = NULL; + HKEY hKey = nullptr; LONG nResult = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\\CurrentControlSet\\Enum\\PCI", 0, KEY_EXECUTE | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey); @@ -494,7 +494,7 @@ bool LLTimer::knownBadTimer() while (nResult == ERROR_SUCCESS) { - nResult = ::RegEnumKeyEx(hKey, key_num++, name, &name_len, NULL, NULL, NULL, &scrap); + nResult = ::RegEnumKeyEx(hKey, key_num++, name, &name_len, nullptr, nullptr, nullptr, &scrap); if (nResult == ERROR_SUCCESS) { @@ -526,7 +526,7 @@ bool LLTimer::knownBadTimer() time_t time_corrected() { - return time(NULL) + gUTCOffset; + return time(nullptr) + gUTCOffset; } @@ -534,7 +534,7 @@ time_t time_corrected() // observing daylight savings time? bool is_daylight_savings() { - time_t now = time(NULL); + time_t now = time(nullptr); // Internal buffer to local server time struct tm* internal_time = localtime(&now); diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index d79f2505856..f76876efd01 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -134,7 +134,7 @@ LL_COMMON_API U64 get_clock_count(); LL_COMMON_API void ms_sleep(U32 ms); LL_COMMON_API U32 micro_sleep(U64 us, U32 max_yields = 0xFFFFFFFF); -// Returns the correct UTC time in seconds, like time(NULL). +// Returns the correct UTC time in seconds, like time(nullptr). // Useful on the viewer, which may have its local clock set wrong. LL_COMMON_API time_t time_corrected(); diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 440529b8e88..25570560aab 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -38,7 +38,7 @@ StatBase::StatBase( const char* name, const char* description ) mDescription(description ? description : "") { #ifndef LL_RELEASE_FOR_DOWNLOAD - if (LLTrace::get_thread_recorder() != NULL) + if (LLTrace::get_thread_recorder() != nullptr) { LL_ERRS() << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << LL_ENDL; } @@ -51,8 +51,8 @@ const char* StatBase::getUnitLabel() const } TimeBlockTreeNode::TimeBlockTreeNode() -: mBlock(NULL), - mParent(NULL), +: mBlock(nullptr), + mParent(nullptr), mNeedsSorting(false), mCollapsed(true) {} @@ -61,7 +61,7 @@ void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent ) { LL_PROFILE_ZONE_SCOPED; llassert_always(parent != mBlock); - llassert_always(parent != NULL); + llassert_always(parent != nullptr); TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(narrow(parent->getIndex())); if (!parent_tree_node) return; diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index edb010b0a4d..6624ad95b92 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -126,7 +126,7 @@ class EventStatHandle typedef StatType stat_t; typedef EventStatHandle self_t; - EventStatHandle(const char* name, const char* description = NULL) + EventStatHandle(const char* name, const char* description = nullptr) : stat_t(name, description) {} @@ -152,7 +152,7 @@ class SampleStatHandle typedef StatType stat_t; typedef SampleStatHandle self_t; - SampleStatHandle(const char* name, const char* description = NULL) + SampleStatHandle(const char* name, const char* description = nullptr) : stat_t(name, description) {} @@ -177,7 +177,7 @@ class CountStatHandle typedef StatType stat_t; typedef CountStatHandle self_t; - CountStatHandle(const char* name, const char* description = NULL) + CountStatHandle(const char* name, const char* description = nullptr) : stat_t(name, description) {} diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index dc9a87eb805..35e060e4130 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -122,10 +122,10 @@ void AccumulatorBufferGroup::merge(const AccumulatorBufferGroup& other) void AccumulatorBufferGroup::reset(AccumulatorBufferGroup* other) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - mCounts.reset(other ? &other->mCounts : NULL); - mSamples.reset(other ? &other->mSamples : NULL); - mEvents.reset(other ? &other->mEvents : NULL); - mStackTimers.reset(other ? &other->mStackTimers : NULL); + mCounts.reset(other ? &other->mCounts : nullptr); + mSamples.reset(other ? &other->mSamples : nullptr); + mEvents.reset(other ? &other->mEvents : nullptr); + mStackTimers.reset(other ? &other->mStackTimers : nullptr); } void AccumulatorBufferGroup::sync() diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index 0a2e2bf997a..bf23454f55a 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -57,13 +57,13 @@ namespace LLTrace AccumulatorBuffer(StaticAllocationMarker m) : mStorageSize(0), - mStorage(NULL) + mStorage(nullptr) {} public: AccumulatorBuffer() : mStorageSize(0), - mStorage(NULL) + mStorage(nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; const AccumulatorBuffer& other = *getDefaultBuffer(); @@ -79,7 +79,7 @@ namespace LLTrace LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; if (isCurrent()) { - LLThreadLocalSingletonPointer::setInstance(NULL); + LLThreadLocalSingletonPointer::setInstance(nullptr); } delete[] mStorage; } @@ -97,7 +97,7 @@ namespace LLTrace AccumulatorBuffer(const AccumulatorBuffer& other) : mStorageSize(0), - mStorage(NULL) + mStorage(nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; resize(sNextStorageSlot); @@ -127,13 +127,13 @@ namespace LLTrace } } - void reset(const AccumulatorBuffer* other = NULL) + void reset(const AccumulatorBuffer* other = nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; llassert(mStorageSize >= sNextStorageSlot); for (size_t i = 0; i < sNextStorageSlot; i++) { - mStorage[i].reset(other ? &other->mStorage[i] : NULL); + mStorage[i].reset(other ? &other->mStorage[i] : nullptr); } } @@ -159,7 +159,7 @@ namespace LLTrace static void clearCurrent() { - LLThreadLocalSingletonPointer::setInstance(NULL); + LLThreadLocalSingletonPointer::setInstance(nullptr); } // NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned @@ -241,7 +241,7 @@ namespace LLTrace }; template size_t AccumulatorBuffer::sNextStorageSlot = 0; - template AccumulatorBuffer* AccumulatorBuffer::sDefaultBuffer = NULL; + template AccumulatorBuffer* AccumulatorBuffer::sDefaultBuffer = nullptr; class EventAccumulator { @@ -540,7 +540,7 @@ namespace LLTrace void append(const AccumulatorBufferGroup& other); void merge(const AccumulatorBufferGroup& other); - void reset(AccumulatorBufferGroup* other = NULL); + void reset(AccumulatorBufferGroup* other = nullptr); void sync(); AccumulatorBuffer mCounts; diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index f010f0e9615..8225e26f619 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -41,7 +41,7 @@ namespace LLTrace Recording::Recording(EPlayState state) : mElapsedSeconds(0), - mActiveBuffers(NULL) + mActiveBuffers(nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; mBuffers = new AccumulatorBufferGroup(); @@ -49,7 +49,7 @@ Recording::Recording(EPlayState state) } Recording::Recording( const Recording& other ) -: mActiveBuffers(NULL) +: mActiveBuffers(nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; *this = other; @@ -82,7 +82,7 @@ Recording::~Recording() // allow recording destruction without thread recorder running, // otherwise thread shutdown could crash if a recording outlives the thread recorder // besides, recording construction and destruction is fine without a recorder...just don't attempt to start one - if (isStarted() && LLTrace::get_thread_recorder() != NULL) + if (isStarted() && LLTrace::get_thread_recorder() != nullptr) { LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); } @@ -98,10 +98,10 @@ void Recording::update() mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); // must have - llassert(mActiveBuffers != NULL - && LLTrace::get_thread_recorder() != NULL); + llassert(mActiveBuffers != nullptr + && LLTrace::get_thread_recorder() != nullptr); - if (!mActiveBuffers->isCurrent() && LLTrace::get_thread_recorder() != NULL) + if (!mActiveBuffers->isCurrent() && LLTrace::get_thread_recorder() != nullptr) { AccumulatorBufferGroup* buffers = mBuffers.write(); LLTrace::get_thread_recorder()->deactivate(buffers); @@ -131,7 +131,7 @@ void Recording::handleStart() mSamplingTimer.reset(); mBuffers.setStayUnique(true); // must have thread recorder running on this thread - llassert(LLTrace::get_thread_recorder() != NULL); + llassert(LLTrace::get_thread_recorder() != nullptr); mActiveBuffers = LLTrace::get_thread_recorder()->activate(mBuffers.write()); #endif } @@ -142,9 +142,9 @@ void Recording::handleStop() #if LL_TRACE_ENABLED mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); // must have thread recorder running on this thread - llassert(LLTrace::get_thread_recorder() != NULL); + llassert(LLTrace::get_thread_recorder() != nullptr); LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); - mActiveBuffers = NULL; + mActiveBuffers = nullptr; mBuffers.setStayUnique(false); #endif } @@ -170,7 +170,7 @@ bool Recording::hasValue(const StatType& stat) { update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); } @@ -178,7 +178,7 @@ F64Seconds Recording::getSum(const StatType& stat) { update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return F64Seconds((F64)(accumulator.mTotalTimeCounter) + (F64)(active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) / (F64)LLTrace::BlockTimer::countsPerSecond(); } @@ -187,7 +187,7 @@ F64Seconds Recording::getSum(const StatType { update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return F64Seconds(((F64)(accumulator.mSelfTimeCounter) + (F64)(active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) / (F64)LLTrace::BlockTimer::countsPerSecond()); } @@ -195,7 +195,7 @@ S32 Recording::getSum(const StatType& stat { update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0); } @@ -203,7 +203,7 @@ F64Seconds Recording::getPerSec(const StatType& stat) { update(); const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return F64Seconds((F64)(accumulator.mTotalTimeCounter + (active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); @@ -213,7 +213,7 @@ F64Seconds Recording::getPerSec(const StatTypemStackTimers[stat.getIndex()]; - const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : nullptr; return F64Seconds((F64)(accumulator.mSelfTimeCounter + (active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); @@ -231,7 +231,7 @@ bool Recording::hasValue(const StatType& stat) { update(); const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; - const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : nullptr; return accumulator.hasValue() || (active_accumulator ? active_accumulator->hasValue() : false); } @@ -239,7 +239,7 @@ F64 Recording::getSum(const StatType& stat) { update(); const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; - const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : nullptr; return accumulator.getSum() + (active_accumulator ? active_accumulator->getSum() : 0); } @@ -247,7 +247,7 @@ F64 Recording::getPerSec( const StatType& stat ) { update(); const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; - const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : nullptr; F64 sum = accumulator.getSum() + (active_accumulator ? active_accumulator->getSum() : 0); return sum / mElapsedSeconds.value(); } @@ -256,7 +256,7 @@ S32 Recording::getSampleCount( const StatType& stat ) { update(); const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; - const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : nullptr; return accumulator.getSampleCount() + (active_accumulator ? active_accumulator->getSampleCount() : 0); } @@ -264,7 +264,7 @@ bool Recording::hasValue(const StatType& stat) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); } @@ -272,7 +272,7 @@ F64 Recording::getMin( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; return llmin(accumulator.getMin(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMin() : F32_MAX); } @@ -280,7 +280,7 @@ F64 Recording::getMax( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; return llmax(accumulator.getMax(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMax() : F32_MIN); } @@ -288,7 +288,7 @@ F64 Recording::getMean( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; if (active_accumulator && active_accumulator->hasValue()) { F64 t = 0.0; @@ -309,7 +309,7 @@ F64 Recording::getStandardDeviation( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; if (active_accumulator && active_accumulator->hasValue()) { @@ -326,7 +326,7 @@ F64 Recording::getLastValue( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; return (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getLastValue() : accumulator.getLastValue()); } @@ -334,7 +334,7 @@ S32 Recording::getSampleCount( const StatType& stat ) { update(); const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; - const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : nullptr; return accumulator.getSampleCount() + (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getSampleCount() : 0); } @@ -342,7 +342,7 @@ bool Recording::hasValue(const StatType& stat) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); } @@ -350,7 +350,7 @@ F64 Recording::getSum( const StatType& stat) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return (F64)(accumulator.getSum() + (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getSum() : 0)); } @@ -358,7 +358,7 @@ F64 Recording::getMin( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return llmin(accumulator.getMin(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMin() : F32_MAX); } @@ -366,7 +366,7 @@ F64 Recording::getMax( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return llmax(accumulator.getMax(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMax() : F32_MIN); } @@ -374,7 +374,7 @@ F64 Recording::getMean( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; if (active_accumulator && active_accumulator->hasValue()) { F64 t = 0.0; @@ -395,7 +395,7 @@ F64 Recording::getStandardDeviation( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; if (active_accumulator && active_accumulator->hasValue()) { @@ -412,7 +412,7 @@ F64 Recording::getLastValue( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return active_accumulator ? active_accumulator->getLastValue() : accumulator.getLastValue(); } @@ -420,7 +420,7 @@ S32 Recording::getSampleCount( const StatType& stat ) { update(); const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; - const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : nullptr; return accumulator.getSampleCount() + (active_accumulator ? active_accumulator->getSampleCount() : 0); } diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 375cb050cc7..094a019ed0a 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -34,14 +34,14 @@ namespace LLTrace { //extern MemStatHandle gTraceMemStat; -static ThreadRecorder* sMasterThreadRecorder = NULL; +static ThreadRecorder* sMasterThreadRecorder = nullptr; /////////////////////////////////////////////////////////////////////// // ThreadRecorder /////////////////////////////////////////////////////////////////////// ThreadRecorder::ThreadRecorder() -: mParentRecorder(NULL) +: mParentRecorder(nullptr) { init(); } @@ -56,7 +56,7 @@ void ThreadRecorder::init() BlockTimerStackRecord* timer_stack = LLThreadLocalSingletonPointer::getInstance(); timer_stack->mTimeBlock = &root_time_block; - timer_stack->mActiveTimer = NULL; + timer_stack->mActiveTimer = nullptr; mNumTimeBlockTreeNodes = AccumulatorBuffer::getDefaultBuffer()->size(); @@ -99,7 +99,7 @@ ThreadRecorder::ThreadRecorder( ThreadRecorder& parent ) ThreadRecorder::~ThreadRecorder() { #if LL_TRACE_ENABLED - LLThreadLocalSingletonPointer::setInstance(NULL); + LLThreadLocalSingletonPointer::setInstance(nullptr); //disclaim_alloc(gTraceMemStat, this); //disclaim_alloc(gTraceMemStat, sizeof(BlockTimer)); @@ -115,7 +115,7 @@ ThreadRecorder::~ThreadRecorder() mActiveRecordings.clear(); } - set_thread_recorder(NULL); + set_thread_recorder(nullptr); delete[] mTimeBlockTreeNodes; if (mParentRecorder) @@ -133,7 +133,7 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( size_t index ) return &mTimeBlockTreeNodes[index]; } #endif - return NULL; + return nullptr; } AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* recording) @@ -152,7 +152,7 @@ AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* record mActiveRecordings.back()->mPartialRecording.makeCurrent(); return &active_recording->mPartialRecording; #else - return NULL; + return nullptr; #endif } diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index cc13955d2f4..ae41011a49b 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -97,7 +97,7 @@ class LLBaseIter: public boost::iterator_facade typename LLPtrTo::type LLNullNextFunctor(const typename LLPtrTo::type&) { diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 4aae90626e0..b33a4ccbd1b 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -49,7 +49,7 @@ const LLUUID LLUUID::null; const LLTransactionID LLTransactionID::tnull; // static -LLMutex* LLUUID::mMutex = NULL; +LLMutex* LLUUID::mMutex = nullptr; @@ -512,7 +512,7 @@ S32 LLUUID::getNodeID(unsigned char* node_id) S32 LLUUID::getNodeID(unsigned char* node_id) { int i; - unsigned char* a = NULL; + unsigned char* a = nullptr; struct ifaddrs* ifap, * ifa; int rv; S32 result = 0; @@ -521,12 +521,12 @@ S32 LLUUID::getNodeID(unsigned char* node_id) { return -1; } - if (ifap == NULL) + if (ifap == nullptr) { return -1; } - for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) + for (ifa = ifap; ifa != nullptr; ifa = ifa->ifa_next) { // printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family); for (i = 0; i < ifa->ifa_addr->sa_len; i++) @@ -874,7 +874,7 @@ U32 LLUUID::getRandomSeed() bool LLUUID::parseUUID(const std::string& buf, LLUUID* value) { - if (buf.empty() || value == NULL) + if (buf.empty() || value == nullptr) { return false; } diff --git a/indra/llcommon/tests/llbase64_test.cpp b/indra/llcommon/tests/llbase64_test.cpp index 69b062fc0ce..bbebdedcb4d 100644 --- a/indra/llcommon/tests/llbase64_test.cpp +++ b/indra/llcommon/tests/llbase64_test.cpp @@ -48,7 +48,7 @@ namespace tut { std::string result; - result = LLBase64::encode(NULL, 0); + result = LLBase64::encode(nullptr, 0); ensure("encode nothing", (result == "") ); LLUUID nothing; diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 8b206f7b14c..e33faa9ac6d 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -178,13 +178,13 @@ struct Vars void methodna(NPARAMSa) { DEBUG; - // Because our const char* param cp might be NULL, and because we + // Because our const char* param cp might be nullptr, and because we // intend to capture the value in a std::string, have to distinguish // between the NULL value and any non-NULL value. Use a convention // easy for a human reader: enclose any non-NULL value in single // quotes, reserving the unquoted string "NULL" to represent a NULL ptr. std::string vcp; - if (cp == NULL) + if (cp == nullptr) vcp = "NULL"; else vcp = std::string("'") + cp + "'"; @@ -413,14 +413,14 @@ namespace tut addf("free1_req", "free1", &g); work.add(name, desc, free1, required); // Subclass non-const method with/out required params - addf("Dmethod1", "method1", NULL); + addf("Dmethod1", "method1", nullptr); work.add(name, desc, &Dispatcher::method1); - addf("Dmethod1_req", "method1", NULL); + addf("Dmethod1_req", "method1", nullptr); work.add(name, desc, &Dispatcher::method1, required); // Subclass const method with/out required params - addf("Dcmethod1", "cmethod1", NULL); + addf("Dcmethod1", "cmethod1", nullptr); work.add(name, desc, &Dispatcher::cmethod1); - addf("Dcmethod1_req", "cmethod1", NULL); + addf("Dcmethod1_req", "cmethod1", nullptr); work.add(name, desc, &Dispatcher::cmethod1, required); // Non-subclass method with/out required params addf("method1", "method1", &v); diff --git a/indra/llcommon/tests/llpounceable_test.cpp b/indra/llcommon/tests/llpounceable_test.cpp index b3024966c5f..ad9fef9cbe8 100644 --- a/indra/llcommon/tests/llpounceable_test.cpp +++ b/indra/llcommon/tests/llpounceable_test.cpp @@ -210,7 +210,7 @@ namespace tut data, "abc"); std::string data2; - pounceable = NULL; + pounceable = nullptr; pounceable.callWhenReady(boost::bind(append, _1, "d")); pounceable.callWhenReady(boost::bind(append, _1, "e")); pounceable.callWhenReady(boost::bind(append, _1, "f")); diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index cdf9f70b6e1..50790d8727b 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -426,7 +426,7 @@ namespace tut history.push_back(Item()); // Run the child process. - apr_procattr_t *procattr = NULL; + apr_procattr_t *procattr = nullptr; aprchk(apr_procattr_create(&procattr, pool.getAPRPool())); aprchk(apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK)); aprchk(apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH)); @@ -442,11 +442,11 @@ namespace tut // will persist. std::string scriptname(script.getName()); argv.push_back(scriptname.c_str()); - argv.push_back(NULL); + argv.push_back(nullptr); aprchk(apr_proc_create(&child, argv[0], &argv[0], - NULL, // if we wanted to pass explicit environment + nullptr, // if we wanted to pass explicit environment procattr, pool.getAPRPool())); diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index ee315051d8d..5a0ed8edd97 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1810,7 +1810,7 @@ namespace tut std::string qPYTHON(q + PYTHON + q); std::string qscript(q + scriptfile.getName() + q); int rc = (int)_spawnl(_P_WAIT, PYTHON.c_str(), qPYTHON.c_str(), qscript.c_str(), - std::forward(args)..., NULL); + std::forward(args)..., nullptr); if (rc == -1) { char buffer[256]; diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp index 3c9d8071ac6..061b2096174 100644 --- a/indra/llcommon/tests/llstring_test.cpp +++ b/indra/llcommon/tests/llstring_test.cpp @@ -416,8 +416,8 @@ namespace tut template<> template<> void string_index_object_t::test<26>() { - const char* str1 = NULL; - const char* str2 = NULL; + const char* str1 = nullptr; + const char* str2 = nullptr; ensure("1: compareStrings failed", LLStringUtil::compareStrings(str1, str2) == 0); str2 = "A"; @@ -435,8 +435,8 @@ namespace tut template<> template<> void string_index_object_t::test<27>() { - const char* str1 = NULL; - const char* str2 = NULL; + const char* str1 = nullptr; + const char* str2 = nullptr; ensure("1: compareInsensitive failed", LLStringUtil::compareInsensitive(str1, str2) == 0); str2 = "A"; diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 6734596d257..758135c8144 100644 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp @@ -210,7 +210,7 @@ bool verify(const std::string& desc, NODERANGE noderange, STRINGRANGE expected) class PlainNode { public: - PlainNode(const std::string& name, PlainNode* next=NULL): + PlainNode(const std::string& name, PlainNode* next = nullptr) : mName(name), mNext(next) {} @@ -242,7 +242,7 @@ namespace tut // std::cout << desc1 << ":\n"; // Try instantiating an iterator with NULL. This test is less about // "did we iterate once?" than "did we avoid blowing up?" - for (LLLinkedIter pni(NULL, boost::bind(&PlainNode::mNext, _1)), end; + for (LLLinkedIter pni(nullptr, boost::bind(&PlainNode::mNext, _1)), end; pni != end; ++pni) { // std::cout << (*pni)->name() << '\n'; diff --git a/indra/llcommon/u64.h b/indra/llcommon/u64.h index d70477feb01..17de5861fe9 100644 --- a/indra/llcommon/u64.h +++ b/indra/llcommon/u64.h @@ -47,7 +47,7 @@ LL_COMMON_API std::string U64_to_str(U64 value); * * The client of this function is expected to provide an allocated * buffer. The function then snprintf() into that buffer, so providing - * NULL has undefined behavior. Providing a buffer which is too small + * nullptr has undefined behavior. Providing a buffer which is too small * will truncate the printable value, so usually you want to declare * the buffer: * From 17da73318d65b5ae369a2940c5984f91579dedf0 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 01:30:48 -0500 Subject: [PATCH 02/11] Replace legacy NULL with nullptr in llappearance --- indra/llappearance/llavatarappearance.cpp | 24 ++--- indra/llappearance/llavatarjoint.h | 2 +- indra/llappearance/llavatarjointmesh.cpp | 28 +++--- indra/llappearance/lldriverparam.cpp | 24 ++--- indra/llappearance/lldriverparam.h | 2 +- indra/llappearance/lllocaltextureobject.cpp | 12 +-- indra/llappearance/llpolymesh.cpp | 52 +++++------ indra/llappearance/llpolymesh.h | 6 +- indra/llappearance/llpolymorph.cpp | 90 +++++++++---------- .../llappearance/llpolyskeletaldistortion.cpp | 2 +- indra/llappearance/llpolyskeletaldistortion.h | 4 +- indra/llappearance/lltexglobalcolor.cpp | 6 +- indra/llappearance/lltexlayer.cpp | 56 ++++++------ indra/llappearance/lltexlayerparams.cpp | 22 ++--- indra/llappearance/lltexlayerparams.h | 12 +-- indra/llappearance/llviewervisualparam.cpp | 2 +- indra/llappearance/llwearable.cpp | 14 +-- indra/llappearance/llwearabledata.cpp | 24 ++--- 18 files changed, 191 insertions(+), 191 deletions(-) diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index dab18c240d5..a3198429bff 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -166,9 +166,9 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo() //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -LLAvatarSkeletonInfo* LLAvatarAppearance::sAvatarSkeletonInfo = NULL; -LLAvatarAppearance::LLAvatarXmlInfo* LLAvatarAppearance::sAvatarXmlInfo = NULL; -LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAvatarDictionary = NULL; +LLAvatarSkeletonInfo* LLAvatarAppearance::sAvatarSkeletonInfo = nullptr; +LLAvatarAppearance::LLAvatarXmlInfo* LLAvatarAppearance::sAvatarXmlInfo = nullptr; +LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* LLAvatarAppearance::sAvatarDictionary = nullptr; LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : @@ -180,7 +180,7 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) { mBakedTextureDatas[i].mLastTextureID = IMG_DEFAULT_AVATAR; - mBakedTextureDatas[i].mTexLayerSet = NULL; + mBakedTextureDatas[i].mTexLayerSet = nullptr; mBakedTextureDatas[i].mIsLoaded = false; mBakedTextureDatas[i].mIsUsed = false; mBakedTextureDatas[i].mMaskTexName = 0; @@ -601,7 +601,7 @@ bool LLAvatarAppearance::parseSkeletonFile(const std::string& filename, LLXmlTre //----------------------------------------------------------------------------- bool LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &volume_num, S32 &joint_num) { - LLJoint* joint = NULL; + LLJoint* joint = nullptr; LL_DEBUGS("BVH") << "bone info: name " << info->mName << " isJoint " << info->mIsJoint @@ -679,7 +679,7 @@ bool LLAvatarAppearance::allocateCharacterJoints( U32 num ) if (mSkeleton.size() != num) { clearSkeleton(); - mSkeleton = avatar_joint_list_t(num,NULL); + mSkeleton = avatar_joint_list_t(num, nullptr); mNumBones = num; } @@ -715,7 +715,7 @@ bool LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) S32 current_volume_num = 0; for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList) { - if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num)) + if (!setupBone(bone_info, nullptr, current_volume_num, current_joint_num)) { LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL; return false; @@ -796,7 +796,7 @@ void LLAvatarAppearance::buildCharacter() { for (LLAvatarJointMesh* mesh : joint->mMeshParts) { - mesh->setMesh(NULL); + mesh->setMesh(nullptr); } } @@ -1084,7 +1084,7 @@ bool LLAvatarAppearance::loadMeshNodes() const std::string &type = info->mType; S32 lod = info->mLOD; - LLAvatarJointMesh* mesh = NULL; + LLAvatarJointMesh* mesh = nullptr; U8 mesh_id = 0; bool found_mesh_id = false; @@ -1128,7 +1128,7 @@ bool LLAvatarAppearance::loadMeshNodes() // Do not touch!!! mesh->setColor( LLColor4::white ); - LLPolyMesh *poly_mesh = NULL; + LLPolyMesh *poly_mesh = nullptr; if (!info->mReferenceMeshName.empty()) { @@ -1265,7 +1265,7 @@ LLJoint *LLAvatarAppearance::getCharacterJoint( U32 num ) if ((S32)num >= mSkeleton.size() || (S32)num < 0) { - return NULL; + return nullptr; } if (!mSkeleton[num]) { @@ -1295,7 +1295,7 @@ LLJoint* LLAvatarAppearance::findCollisionVolume(S32 volume_id) { if ((volume_id < 0) || (volume_id >= mNumCollisionVolumes)) { - return NULL; + return nullptr; } return &mCollisionVolumes[volume_id]; diff --git a/indra/llappearance/llavatarjoint.h b/indra/llappearance/llavatarjoint.h index 71fe4b61b6c..44bb2f3b48d 100644 --- a/indra/llappearance/llavatarjoint.h +++ b/indra/llappearance/llavatarjoint.h @@ -49,7 +49,7 @@ class alignas(16) LLAvatarJoint : LLAvatarJoint(); LLAvatarJoint(S32 joint_num); // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform* - LLAvatarJoint(const std::string &name, LLJoint *parent = NULL); + LLAvatarJoint(const std::string& name, LLJoint* parent = nullptr); virtual ~LLAvatarJoint(); // Gets the validity of this joint diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp index 69a90239946..e797bccfab3 100644 --- a/indra/llappearance/llavatarjointmesh.cpp +++ b/indra/llappearance/llavatarjointmesh.cpp @@ -87,7 +87,7 @@ LLVector3 totalSkinOffset(LLAvatarJoint *joint) //----------------------------------------------------------------------------- LLSkinJoint::LLSkinJoint() { - mJoint = NULL; + mJoint = nullptr; } //----------------------------------------------------------------------------- @@ -95,7 +95,7 @@ LLSkinJoint::LLSkinJoint() //----------------------------------------------------------------------------- LLSkinJoint::~LLSkinJoint() { - mJoint = NULL; + mJoint = nullptr; } @@ -138,8 +138,8 @@ LLColor4 LLAvatarJointMesh::sClothingInnerColor; //----------------------------------------------------------------------------- LLAvatarJointMesh::LLAvatarJointMesh() : - mTexture( NULL ), - mLayerSet( NULL ), + mTexture( nullptr ), + mLayerSet( nullptr ), mTestImageName( 0 ), mFaceIndexCount(0) { @@ -151,12 +151,12 @@ LLAvatarJointMesh::LLAvatarJointMesh() mShiny = 0.0f; mCullBackFaces = true; - mMesh = NULL; + mMesh = nullptr; mNumSkinJoints = 0; - mSkinJoints = NULL; + mSkinJoints = nullptr; - mFace = NULL; + mFace = nullptr; mMeshID = 0; mUpdateXform = false; @@ -173,8 +173,8 @@ LLAvatarJointMesh::LLAvatarJointMesh() //----------------------------------------------------------------------------- LLAvatarJointMesh::~LLAvatarJointMesh() { - mMesh = NULL; - mTexture = NULL; + mMesh = nullptr; + mTexture = nullptr; freeSkinData(); } @@ -196,7 +196,7 @@ void LLAvatarJointMesh::freeSkinData() { mNumSkinJoints = 0; delete [] mSkinJoints; - mSkinJoints = NULL; + mSkinJoints = nullptr; } //-------------------------------------------------------------------- @@ -245,7 +245,7 @@ void LLAvatarJointMesh::setTexture( LLGLTexture *texture ) // texture and dynamic_texture are mutually exclusive if( texture ) { - mLayerSet = NULL; + mLayerSet = nullptr; //texture->bindTexture(0); //texture->setClamp(true, true); } @@ -268,7 +268,7 @@ void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set ) // texture and dynamic_texture are mutually exclusive if( layer_set ) { - mTexture = NULL; + mTexture = nullptr; } } @@ -297,7 +297,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh ) // release any existing skin joints freeSkinData(); - if ( mMesh == NULL ) + if ( mMesh == nullptr ) { return; } @@ -371,7 +371,7 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint) // otherwise add our ancestor and ourselves else { - jrd.push_back(new LLJointRenderData(&ancestor->getWorldMatrix(), NULL)); + jrd.push_back(new LLJointRenderData(&ancestor->getWorldMatrix(), nullptr)); LL_DEBUGS("Avatar") << "add2 ancestor joint[" << (jrd.size()-1) << "] = " << ancestor->getName() << LL_ENDL; jrd.push_back(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js)); LL_DEBUGS("Avatar") << "add2 joint[" << (jrd.size()-1) << "] = " << current_joint->getName() << LL_ENDL; diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp index 2e933f93571..f687b07a198 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -37,7 +37,7 @@ //----------------------------------------------------------------------------- LLDriverParamInfo::LLDriverParamInfo() : - mDriverParam(NULL) + mDriverParam(nullptr) { } @@ -158,16 +158,16 @@ void LLDriverParamInfo::toStream(std::ostream &out) // LLDriverParam //----------------------------------------------------------------------------- -LLDriverParam::LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable /* = NULL */) +LLDriverParam::LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable /* = nullptr */) : LLViewerVisualParam(), mDefaultVec(), mDriven(), - mCurrentDistortionParam( NULL ), + mCurrentDistortionParam( nullptr ), mAvatarAppearance(appearance), mWearablep(wearable) { llassert(mAvatarAppearance); - llassert((mWearablep == NULL) || mAvatarAppearance->isSelf()); + llassert((mWearablep == nullptr) || mAvatarAppearance->isSelf()); mDefaultVec.clear(); } @@ -180,7 +180,7 @@ LLDriverParam::LLDriverParam(const LLDriverParam& pOther) mWearablep(pOther.mWearablep) { llassert(mAvatarAppearance); - llassert((mWearablep == NULL) || mAvatarAppearance->isSelf()); + llassert((mWearablep == nullptr) || mAvatarAppearance->isSelf()); } LLDriverParam::~LLDriverParam() @@ -189,7 +189,7 @@ LLDriverParam::~LLDriverParam() bool LLDriverParam::setInfo(LLDriverParamInfo *info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); if (info->mID < 0) return false; mInfo = info; @@ -357,8 +357,8 @@ LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { - mCurrentDistortionParam = NULL; - const LLVector4a* v = NULL; + mCurrentDistortionParam = nullptr; + const LLVector4a* v = nullptr; for(LLDrivenEntry& driven : mDriven) { v = driven.mParam->getFirstDistortion(index, poly_mesh); @@ -377,10 +377,10 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **po llassert( mCurrentDistortionParam ); if( !mCurrentDistortionParam ) { - return NULL; + return nullptr; } - LLDrivenEntry* driven = NULL; + LLDrivenEntry* driven = nullptr; entry_list_t::iterator iter; // Set mDriven iteration to the right point @@ -396,7 +396,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **po llassert(driven); if (!driven) { - return NULL; // shouldn't happen, but... + return nullptr; // shouldn't happen, but... } // We're already in the middle of a param's distortions, so get the next one. @@ -429,7 +429,7 @@ const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const { if (0 > index || index >= mDriven.size()) { - return NULL; + return nullptr; } return mDriven[index].mParam; } diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h index df8733dde7a..9bafcc71cdc 100644 --- a/indra/llappearance/lldriverparam.h +++ b/indra/llappearance/lldriverparam.h @@ -84,7 +84,7 @@ class alignas(16) LLDriverParam : public LLViewerVisualParam // Hide the default constructor. Force construction with LLAvatarAppearance. LLDriverParam() {} public: - LLDriverParam(LLAvatarAppearance* appearance, LLWearable* wearable = NULL); + LLDriverParam(LLAvatarAppearance* appearance, LLWearable* wearable = nullptr); ~LLDriverParam(); // Special: These functions are overridden by child classes diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index f743f7b5171..5c44a85c8ec 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -39,7 +39,7 @@ LLLocalTextureObject::LLLocalTextureObject() : mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1) { - mImage = NULL; + mImage = nullptr; } LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) : @@ -88,7 +88,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const { if (index >= getNumTexLayers()) { - return NULL; + return nullptr; } return mTexLayers[index]; @@ -104,7 +104,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) } } - return NULL; + return nullptr; } U32 LLLocalTextureObject::getNumTexLayers() const @@ -139,7 +139,7 @@ bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) return false; } - if (new_tex_layer == NULL) + if (new_tex_layer == nullptr) { return removeTexLayer(index); } @@ -158,7 +158,7 @@ bool LLLocalTextureObject::setTexLayer(LLTexLayer *new_tex_layer, U32 index) bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable) { - if (new_tex_layer == NULL) + if (new_tex_layer == nullptr) { return false; } @@ -171,7 +171,7 @@ bool LLLocalTextureObject::addTexLayer(LLTexLayer *new_tex_layer, LLWearable *we bool LLLocalTextureObject::addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable) { - if (new_tex_layer == NULL) + if (new_tex_layer == nullptr) { return false; } diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index d5323e0b846..de553e9691c 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -66,25 +66,25 @@ LLPolyMesh::LLPolyMeshSharedDataTable LLPolyMesh::sGlobalSharedMeshList; LLPolyMeshSharedData::LLPolyMeshSharedData() { mNumVertices = 0; - mBaseCoords = NULL; - mBaseNormals = NULL; - mBaseBinormals = NULL; - mTexCoords = NULL; - mDetailTexCoords = NULL; - mWeights = NULL; + mBaseCoords = nullptr; + mBaseNormals = nullptr; + mBaseBinormals = nullptr; + mTexCoords = nullptr; + mDetailTexCoords = nullptr; + mWeights = nullptr; mHasWeights = false; mHasDetailTexCoords = false; mNumFaces = 0; - mFaces = NULL; + mFaces = nullptr; mNumJointNames = 0; - mJointNames = NULL; + mJointNames = nullptr; - mTriangleIndices = NULL; + mTriangleIndices = nullptr; mNumTriangleIndices = 0; - mReferenceData = NULL; + mReferenceData = nullptr; mLastIndexOffset = -1; } @@ -129,34 +129,34 @@ void LLPolyMeshSharedData::freeMeshData() mNumVertices = 0; ll_aligned_free_16(mBaseCoords); - mBaseCoords = NULL; + mBaseCoords = nullptr; ll_aligned_free_16(mBaseNormals); - mBaseNormals = NULL; + mBaseNormals = nullptr; ll_aligned_free_16(mBaseBinormals); - mBaseBinormals = NULL; + mBaseBinormals = nullptr; ll_aligned_free_16(mTexCoords); - mTexCoords = NULL; + mTexCoords = nullptr; ll_aligned_free_16(mDetailTexCoords); - mDetailTexCoords = NULL; + mDetailTexCoords = nullptr; ll_aligned_free_16(mWeights); - mWeights = NULL; + mWeights = nullptr; } mNumFaces = 0; delete [] mFaces; - mFaces = NULL; + mFaces = nullptr; mNumJointNames = 0; delete [] mJointNames; - mJointNames = NULL; + mJointNames = nullptr; delete [] mTriangleIndices; - mTriangleIndices = NULL; + mTriangleIndices = nullptr; // mVertFaceMap.deleteAllData(); } @@ -733,7 +733,7 @@ const S32 *LLPolyMeshSharedData::getSharedVert(S32 vert) { return &mSharedVerts[vert]; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -756,8 +756,8 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_ mSharedData = shared_data; mReferenceMesh = reference_mesh; - mAvatarp = NULL; - mVertexData = NULL; + mAvatarp = nullptr; + mVertexData = nullptr; mCurVertexCount = 0; mFaceIndexCount = 0; @@ -824,7 +824,7 @@ LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_m //------------------------------------------------------------------------- // search for an existing mesh by this name //------------------------------------------------------------------------- - LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL); + LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)nullptr); if (meshSharedData) { // LL_INFOS() << "Polymesh " << name << " found in global mesh table." << LL_ENDL; @@ -846,7 +846,7 @@ LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_m if ( ! mesh_data->loadMesh( full_path ) ) { delete mesh_data; - return NULL; + return nullptr; } LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh); @@ -996,7 +996,7 @@ void LLPolyMesh::initializeForMorph() LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) { if (!mSharedData) - return NULL; + return nullptr; for (LLPolyMorphData* morph_data : mSharedData->mMorphData) { if (morph_data->getName() == morph_name) @@ -1004,7 +1004,7 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) return morph_data; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h index 5f8b4eab026..2331863353d 100644 --- a/indra/llappearance/llpolymesh.h +++ b/indra/llappearance/llpolymesh.h @@ -138,7 +138,7 @@ class LLPolyMeshSharedData const S32 *getSharedVert(S32 vert); - bool isLOD() { return (mReferenceData != NULL); } + bool isLOD() { return (mReferenceData != nullptr); } }; @@ -166,7 +166,7 @@ class LLPolyMesh // Requests a mesh by name. // If the mesh already exists in the global mesh table, it is returned, // otherwise it is loaded from file, added to the table, and returned. - static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = NULL); + static LLPolyMesh *getMesh( const std::string &name, LLPolyMesh* reference_mesh = nullptr); // Frees all loaded meshes. // This should only be called once you know there are no outstanding @@ -314,7 +314,7 @@ class LLPolyMesh LLPolyMesh *getReferenceMesh() { return mReferenceMesh ? mReferenceMesh : this; } // Get indices - U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : NULL; } + U32* getIndices() { return mSharedData ? mSharedData->mTriangleIndices : nullptr; } bool isLOD() { return mSharedData && mSharedData->isLOD(); } diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 5ee66491641..55e881bc912 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -52,13 +52,13 @@ LLPolyMorphData::LLPolyMorphData(const std::string& morph_name) mTotalDistortion = 0.f; mAvgDistortion.clear(); mMaxDistortion = 0.f; - mVertexIndices = NULL; - mCoords = NULL; - mNormals = NULL; - mBinormals = NULL; - mTexCoords = NULL; + mVertexIndices = nullptr; + mCoords = nullptr; + mNormals = nullptr; + mBinormals = nullptr; + mTexCoords = nullptr; - mMesh = NULL; + mMesh = nullptr; } LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) : @@ -67,11 +67,11 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) : mTotalDistortion(rhs.mTotalDistortion), mAvgDistortion(rhs.mAvgDistortion), mMaxDistortion(rhs.mMaxDistortion), - mVertexIndices(NULL), - mCoords(NULL), - mNormals(NULL), - mBinormals(NULL), - mTexCoords(NULL) + mVertexIndices(nullptr), + mCoords(nullptr), + mNormals(nullptr), + mBinormals(nullptr), + mTexCoords(nullptr) { const S32 numVertices = mNumIndices; @@ -221,34 +221,34 @@ bool LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) //----------------------------------------------------------------------------- void LLPolyMorphData::freeData() { - if (mCoords != NULL) + if (mCoords != nullptr) { ll_aligned_free_16(mCoords); - mCoords = NULL; + mCoords = nullptr; } - if (mNormals != NULL) + if (mNormals != nullptr) { ll_aligned_free_16(mNormals); - mNormals = NULL; + mNormals = nullptr; } - if (mBinormals != NULL) + if (mBinormals != nullptr) { ll_aligned_free_16(mBinormals); - mBinormals = NULL; + mBinormals = nullptr; } - if (mTexCoords != NULL) + if (mTexCoords != nullptr) { delete [] mTexCoords; - mTexCoords = NULL; + mTexCoords = nullptr; } - if (mVertexIndices != NULL) + if (mVertexIndices != nullptr) { delete [] mVertexIndices; - mVertexIndices = NULL; + mVertexIndices = nullptr; } } @@ -280,12 +280,12 @@ bool LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) LLXmlTreeNode *paramNode = node->getChildByName("param_morph"); - if (NULL == paramNode) - { - LL_WARNS() << "Failed to getChildByName(\"param_morph\")" - << LL_ENDL; - return false; - } + if (nullptr == paramNode) + { + LL_WARNS() << "Failed to getChildByName(\"param_morph\")" + << LL_ENDL; + return false; + } for (LLXmlTreeNode* child_node = paramNode->getFirstChild(); child_node; @@ -318,9 +318,9 @@ bool LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) //----------------------------------------------------------------------------- LLPolyMorphTarget::LLPolyMorphTarget(LLPolyMesh *poly_mesh) : LLViewerVisualParam(), - mMorphData(NULL), + mMorphData(nullptr), mMesh(poly_mesh), - mVertMask(NULL), + mVertMask(nullptr), mLastSex(SEX_FEMALE), mNumMorphMasksPending(0), mVolumeMorphs() @@ -334,7 +334,7 @@ LLPolyMorphTarget::LLPolyMorphTarget(const LLPolyMorphTarget& pOther) : LLViewerVisualParam(pOther), mMorphData(pOther.mMorphData), mMesh(pOther.mMesh), - mVertMask(pOther.mVertMask == NULL ? NULL : new LLPolyVertexMask(*pOther.mVertMask)), + mVertMask(pOther.mVertMask == nullptr ? nullptr : new LLPolyVertexMask(*pOther.mVertMask)), mLastSex(pOther.mLastSex), mNumMorphMasksPending(pOther.mNumMorphMasksPending), mVolumeMorphs(pOther.mVolumeMorphs) @@ -347,7 +347,7 @@ LLPolyMorphTarget::LLPolyMorphTarget(const LLPolyMorphTarget& pOther) LLPolyMorphTarget::~LLPolyMorphTarget() { delete mVertMask; - mVertMask = NULL; + mVertMask = nullptr; } //----------------------------------------------------------------------------- @@ -355,7 +355,7 @@ LLPolyMorphTarget::~LLPolyMorphTarget() //----------------------------------------------------------------------------- bool LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); if (info->mID < 0) return false; mInfo = info; @@ -452,18 +452,18 @@ const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh * if (mMorphData->mNumIndices) { resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex]; - if (index != NULL) + if (index != nullptr) { *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex]; } - if (poly_mesh != NULL) + if (poly_mesh != nullptr) { *poly_mesh = mMesh; } return resultVec; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -478,17 +478,17 @@ const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh ** if (mMorphData->mCurrentIndex < mMorphData->mNumIndices) { resultVec = &mMorphData->mCoords[mMorphData->mCurrentIndex]; - if (index != NULL) + if (index != nullptr) { *index = mMorphData->mVertexIndices[mMorphData->mCurrentIndex]; } - if (poly_mesh != NULL) + if (poly_mesh != nullptr) { *poly_mesh = mMesh; } return resultVec; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- @@ -579,7 +579,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) LLVector4a *clothing_weights = mMesh->getWritableClothingWeights(); LLVector2 *tex_coords = mMesh->getWritableTexCoords(); - F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; + F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : nullptr; for(U32 vert_index_morph = 0; vert_index_morph < mMorphData->mNumIndices; vert_index_morph++) { @@ -661,7 +661,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) //----------------------------------------------------------------------------- void LLPolyMorphTarget::applyMask(const U8 *maskTextureData, S32 width, S32 height, S32 num_components, bool invert) { - LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; + LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : nullptr; if (!mVertMask) { @@ -671,7 +671,7 @@ void LLPolyMorphTarget::applyMask(const U8 *maskTextureData, S32 width, S32 h else { // remove effect of previous mask - F32 *maskWeights = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; + F32 *maskWeights = (mVertMask) ? mVertMask->getMorphMaskWeights() : nullptr; if (maskWeights) { @@ -751,7 +751,7 @@ LLPolyVertexMask::LLPolyVertexMask(LLPolyMorphData* morph_data) mMorphData(morph_data), mWeightsGenerated(false) { - llassert(mMorphData != NULL); + llassert(mMorphData != nullptr); llassert(mMorphData->mNumIndices > 0); } @@ -763,7 +763,7 @@ LLPolyVertexMask::LLPolyVertexMask(const LLPolyVertexMask& pOther) mMorphData(pOther.mMorphData), mWeightsGenerated(pOther.mWeightsGenerated) { - llassert(mMorphData != NULL); + llassert(mMorphData != nullptr); llassert(mMorphData->mNumIndices > 0); memcpy(mWeights, pOther.mWeights, sizeof(F32) * mMorphData->mNumIndices); } @@ -774,7 +774,7 @@ LLPolyVertexMask::LLPolyVertexMask(const LLPolyVertexMask& pOther) LLPolyVertexMask::~LLPolyVertexMask() { delete [] mWeights; - mWeights = NULL; + mWeights = nullptr; } //----------------------------------------------------------------------------- @@ -837,7 +837,7 @@ F32* LLPolyVertexMask::getMorphMaskWeights() { if (!mWeightsGenerated) { - return NULL; + return nullptr; } return mWeights; diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 7d62bb3a040..e6826f9d975 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -53,7 +53,7 @@ bool LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton"); - if (NULL == skeletalParam) + if (nullptr == skeletalParam) { LL_WARNS() << "Failed to getChildByName(\"param_skeleton\")" << LL_ENDL; diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index 37f35d50ba1..8f85d9884f3 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -105,8 +105,8 @@ class alignas(16) LLPolySkeletalDistortion : public LLViewerVisualParam /*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; } /*virtual*/ F32 getMaxDistortion() { return 0.1f; } /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);} - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = nullptr; return &mDefaultVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = nullptr; return nullptr;}; protected: LLPolySkeletalDistortion(const LLPolySkeletalDistortion& pOther); diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp index e39a856b787..356bdba53d9 100644 --- a/indra/llappearance/lltexglobalcolor.cpp +++ b/indra/llappearance/lltexglobalcolor.cpp @@ -38,7 +38,7 @@ class LLWearable; LLTexGlobalColor::LLTexGlobalColor(LLAvatarAppearance* appearance) : mAvatarAppearance(appearance), - mInfo(NULL) + mInfo(nullptr) { } @@ -50,7 +50,7 @@ LLTexGlobalColor::~LLTexGlobalColor() bool LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); mInfo = info; //mID = info->mID; // No ID @@ -60,7 +60,7 @@ bool LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this); if (!param_color->setInfo(color_info, true)) { - mInfo = NULL; + mInfo = nullptr; return false; } mParamGlobalColorList.push_back(param_color); diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 1bdaa814b7b..fec1494c591 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -258,7 +258,7 @@ LLTexLayerSet::LLTexLayerSet(LLAvatarAppearance* const appearance) : mAvatarAppearance( appearance ), mIsVisible( true ), mBakedTexIndex(LLAvatarAppearanceDefines::BAKED_HEAD), - mInfo( NULL ) + mInfo( nullptr ) { } @@ -279,14 +279,14 @@ LLTexLayerSet::~LLTexLayerSet() bool LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); mInfo = info; //mID = info->mID; // No ID mLayerList.reserve(info->mLayerInfoList.size()); for (LLTexLayerInfo* layer_info : info->mLayerInfoList) { - LLTexLayerInterface *layer = NULL; + LLTexLayerInterface *layer = nullptr; if (layer_info->isUserSettable()) { layer = new LLTexLayerTemplate( this, getAvatarAppearance() ); @@ -296,9 +296,9 @@ bool LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) layer = new LLTexLayer(this); } // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance - if (!layer->setInfo(layer_info, NULL)) + if (!layer->setInfo(layer_info, nullptr)) { - mInfo = NULL; + mInfo = nullptr; return false; } if (!layer->isVisibilityMask()) @@ -464,7 +464,7 @@ void LLTexLayerSet::destroyComposite() { if( mComposite ) { - mComposite = NULL; + mComposite = nullptr; } } @@ -770,14 +770,14 @@ bool LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) LLTexLayerInterface::LLTexLayerInterface(LLTexLayerSet* const layer_set): mTexLayerSet( layer_set ), mMorphMasksValid( false ), - mInfo(NULL), + mInfo(nullptr), mHasMorph(false) { } LLTexLayerInterface::LLTexLayerInterface(const LLTexLayerInterface &layer, LLWearable *wearable): mTexLayerSet( layer.mTexLayerSet ), - mInfo(NULL) + mInfo(nullptr) { // don't add visual params for cloned layers setInfo(layer.getInfo(), wearable); @@ -789,9 +789,9 @@ bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab { // setInfo should only be called once. Code is not robust enough to handle redefinition of a texlayer. // Not a critical warning, but could be useful for debugging later issues. -Nyx - if (mInfo != NULL) + if (mInfo != nullptr) { - LL_WARNS() << "mInfo != NULL" << LL_ENDL; + LL_WARNS() << "mInfo != nullptr" << LL_ENDL; } mInfo = info; //mID = info->mID; // No ID @@ -805,7 +805,7 @@ bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab param_color = new LLTexLayerParamColor(this); if (!param_color->setInfo(color_info, true)) { - mInfo = NULL; + mInfo = nullptr; return false; } } @@ -814,7 +814,7 @@ bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID()); if (!param_color) { - mInfo = NULL; + mInfo = nullptr; return false; } } @@ -830,7 +830,7 @@ bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab param_alpha = new LLTexLayerParamAlpha( this ); if (!param_alpha->setInfo(alpha_info, true)) { - mInfo = NULL; + mInfo = nullptr; return false; } } @@ -839,7 +839,7 @@ bool LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID()); if (!param_alpha) { - mInfo = NULL; + mInfo = nullptr; return false; } } @@ -930,7 +930,7 @@ void LLTexLayerInterface::invalidateMorphMasks() LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const { - LLViewerVisualParam *result = NULL; + LLViewerVisualParam *result = nullptr; for (LLTexLayerParamColor* param : mParamColorList) { if (param->getID() == index) @@ -964,13 +964,13 @@ LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const //----------------------------------------------------------------------------- LLTexLayer::LLTexLayer(LLTexLayerSet* const layer_set) : LLTexLayerInterface( layer_set ), - mLocalTextureObject(NULL) + mLocalTextureObject(nullptr) { } LLTexLayer::LLTexLayer(const LLTexLayer &layer, LLWearable *wearable) : LLTexLayerInterface( layer, wearable ), - mLocalTextureObject(NULL) + mLocalTextureObject(nullptr) { } @@ -1115,13 +1115,13 @@ bool LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) { { - LLGLTexture* tex = NULL; + LLGLTexture* tex = nullptr; if (mLocalTextureObject && mLocalTextureObject->getImage()) { tex = mLocalTextureObject->getImage(); if (mLocalTextureObject->getID() == IMG_DEFAULT_AVATAR) { - tex = NULL; + tex = nullptr; } } else @@ -1424,7 +1424,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } U32 cache_index = alpha_mask_crc.getCRC(); - U8* alpha_data = NULL; + U8* alpha_data = nullptr; // We believe we need to generate morph masks, do not assume that the cached version is accurate. // We can get bad morph masks during login, on minimize, and occasional gl errors. // We should only be doing this when we believe something has changed with respect to the user's appearance. @@ -1647,11 +1647,11 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const { if (mWearableCache.size() <= i) { - return NULL; + return nullptr; } LLWearable *wearable = mWearableCache[i]; - LLLocalTextureObject *lto = NULL; - LLTexLayer *layer = NULL; + LLLocalTextureObject *lto = nullptr; + LLTexLayer *layer = nullptr; if (wearable) { lto = wearable->getLocalTextureObject(mInfo->mLocalTexture); @@ -1674,8 +1674,8 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const updateWearableCache(); for (LLWearable* wearable : mWearableCache) { - LLLocalTextureObject *lto = NULL; - LLTexLayer *layer = NULL; + LLLocalTextureObject *lto = nullptr; + LLTexLayer *layer = nullptr; if (wearable) { lto = wearable->getLocalTextureObject(mInfo->mLocalTexture); @@ -1786,7 +1786,7 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name) return layer; } } - return NULL; + return nullptr; } void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable) @@ -1878,7 +1878,7 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) } else { - return NULL; + return nullptr; } } } @@ -1928,7 +1928,7 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, } else { - tex = NULL; + tex = nullptr; } } diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index dd2499cf374..b9e26a5f4c5 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -43,9 +43,9 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) : LLViewerVisualParam(), mTexLayer(layer), - mAvatarAppearance(NULL) + mAvatarAppearance(nullptr) { - if (mTexLayer != NULL) + if (mTexLayer != nullptr) { mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance(); } @@ -57,7 +57,7 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) LLTexLayerParam::LLTexLayerParam(LLAvatarAppearance *appearance) : LLViewerVisualParam(), - mTexLayer(NULL), + mTexLayer(nullptr), mAvatarAppearance(appearance) { } @@ -120,7 +120,7 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes) LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) : LLTexLayerParam(layer), - mCachedProcessedTexture(NULL), + mCachedProcessedTexture(nullptr), mStaticImageTGA(), mStaticImageRaw(), mNeedsCreateTexture(false), @@ -133,7 +133,7 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance) : LLTexLayerParam(appearance), - mCachedProcessedTexture(NULL), + mCachedProcessedTexture(nullptr), mStaticImageTGA(), mStaticImageRaw(), mNeedsCreateTexture(false), @@ -170,9 +170,9 @@ LLTexLayerParamAlpha::~LLTexLayerParamAlpha() void LLTexLayerParamAlpha::deleteCaches() { - mStaticImageTGA = NULL; // deletes image - mCachedProcessedTexture = NULL; - mStaticImageRaw = NULL; + mStaticImageTGA = nullptr; // deletes image + mCachedProcessedTexture = nullptr; + mStaticImageRaw = nullptr; mNeedsCreateTexture = false; } @@ -183,7 +183,7 @@ bool LLTexLayerParamAlpha::getMultiplyBlend() const void LLTexLayerParamAlpha::setWeight(F32 weight) { - if (mIsAnimating || mTexLayer == NULL) + if (mIsAnimating || mTexLayer == nullptr) { return; } @@ -325,7 +325,7 @@ bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) } // Applies domain and effective weight to data as it is decoded. Also resizes the raw image if needed. - mStaticImageRaw = NULL; + mStaticImageRaw = nullptr; mStaticImageRaw = new LLImageRaw; mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight); mNeedsCreateTexture = true; @@ -358,7 +358,7 @@ bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) // (It's not really a "cache" in that case, but the logic is the same) if (!mAvatarAppearance->isSelf()) { - mCachedProcessedTexture = NULL; + mCachedProcessedTexture = nullptr; } } else diff --git a/indra/llappearance/lltexlayerparams.h b/indra/llappearance/lltexlayerparams.h index 2c243d0e9ba..83acfb34a6c 100644 --- a/indra/llappearance/lltexlayerparams.h +++ b/indra/llappearance/lltexlayerparams.h @@ -71,7 +71,7 @@ class alignas(16) LLTexLayerParamAlpha : public LLTexLayerParam LLTexLayerParamAlpha( LLAvatarAppearance* appearance ); /*virtual*/ ~LLTexLayerParamAlpha(); - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; + /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = nullptr) const; // LLVisualParam Virtual functions ///*virtual*/ bool parseData(LLXmlTreeNode* node); @@ -85,8 +85,8 @@ class alignas(16) LLTexLayerParamAlpha : public LLTexLayerParam /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } /*virtual*/ F32 getMaxDistortion() { return 3.f; } /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f);} - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = nullptr; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = nullptr; return nullptr;}; // New functions bool render( S32 x, S32 y, S32 width, S32 height ); @@ -154,7 +154,7 @@ class alignas(16) LLTexLayerParamColor : public LLTexLayerParam /* virtual */ ~LLTexLayerParamColor(); - /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const; + /*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = nullptr) const; // LLVisualParam Virtual functions ///*virtual*/ bool parseData(LLXmlTreeNode* node); @@ -169,8 +169,8 @@ class alignas(16) LLTexLayerParamColor : public LLTexLayerParam /*virtual*/ const LLVector4a& getAvgDistortion() { return mAvgDistortionVec; } /*virtual*/ F32 getMaxDistortion() { return 3.f; } /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector4a(1.f, 1.f, 1.f); } - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = nullptr; return &mAvgDistortionVec;}; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = nullptr; return nullptr;}; // New functions LLColor4 getNetColor() const; diff --git a/indra/llappearance/llviewervisualparam.cpp b/indra/llappearance/llviewervisualparam.cpp index 00d6383ad0f..edf4f9500b4 100644 --- a/indra/llappearance/llviewervisualparam.cpp +++ b/indra/llappearance/llviewervisualparam.cpp @@ -148,7 +148,7 @@ LLViewerVisualParam::~LLViewerVisualParam() bool LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); if (info->mID < 0) return false; mInfo = info; diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 4acb0ef3d4a..2db23a0b196 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -65,7 +65,7 @@ LLWearable::~LLWearable() LLVisualParam* vp = vp_pair.second; vp->clearNextParam(); delete vp; - vp_pair.second = NULL; + vp_pair.second = nullptr; } destroyTextures(); @@ -178,7 +178,7 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp) void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) { - LLTexLayerSet *layer_set = NULL; + LLTexLayerSet *layer_set = nullptr; const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearance::getDictionary()->getTexture((ETextureIndex)te); if (texture_dict && texture_dict->mIsUsedByBakedTexture) { @@ -501,7 +501,7 @@ LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) LLLocalTextureObject* lto = iter->second; return lto; } - return NULL; + return nullptr; } const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const @@ -512,7 +512,7 @@ const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const const LLLocalTextureObject* lto = iter->second; return lto; } - return NULL; + return nullptr; } std::vector LLWearable::getLocalTextureListSeq() @@ -583,8 +583,8 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst) { te_map_t::const_iterator iter = src.find(te); LLUUID image_id; - LLGLTexture *image = NULL; - LLLocalTextureObject *lto = NULL; + LLGLTexture *image = nullptr; + LLLocalTextureObject *lto = nullptr; if(iter != src.end()) { // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. @@ -674,7 +674,7 @@ F32 LLWearable::getVisualParamWeight(S32 param_index) const LLVisualParam* LLWearable::getVisualParam(S32 index) const { visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index); - return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second; + return (iter == mVisualParamIndexMap.end()) ? nullptr : iter->second; } diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index 7598ed67f3c..a5cf5e8ccde 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -33,7 +33,7 @@ #include "lldriverparam.h" LLWearableData::LLWearableData() : - mAvatarAppearance(NULL) + mAvatarAppearance(nullptr) { } @@ -49,12 +49,12 @@ LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 in wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) { - return NULL; + return nullptr; } wearableentry_vec_t& wearable_vec = wearable_iter->second; if (index>=wearable_vec.size()) { - return NULL; + return nullptr; } else { @@ -95,7 +95,7 @@ void LLWearableData::pushWearable(const LLWearableType::EType type, LLWearable *wearable, bool trigger_updated /* = true */) { - if (wearable == NULL) + if (wearable == nullptr) { // no null wearables please! LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL; @@ -123,7 +123,7 @@ void LLWearableData::wearableUpdated(LLWearable *wearable, bool removed) void LLWearableData::eraseWearable(LLWearable *wearable) { - if (wearable == NULL) + if (wearable == nullptr) { // nothing to do here. move along. return; @@ -202,7 +202,7 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type) bool LLWearableData::getWearableIndex(const LLWearable *wearable, U32& index_found) const { - if (wearable == NULL) + if (wearable == nullptr) { return false; } @@ -271,12 +271,12 @@ const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) { - return NULL; + return nullptr; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; if (index>=wearable_vec.size()) { - return NULL; + return nullptr; } else { @@ -289,7 +289,7 @@ LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) U32 count = getWearableCount(type); if ( count == 0) { - return NULL; + return nullptr; } return getWearable(type, count-1); @@ -300,7 +300,7 @@ const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType typ U32 count = getWearableCount(type); if ( count == 0) { - return NULL; + return nullptr; } return getWearable(type, count-1); @@ -310,7 +310,7 @@ LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) { if (getWearableCount(type) == 0) { - return NULL; + return nullptr; } return getWearable(type, 0); @@ -320,7 +320,7 @@ const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType { if (getWearableCount(type) == 0) { - return NULL; + return nullptr; } return getWearable(type, 0); From 05529fe9ff11462fc9ffdb2bad077f89b9dec65d Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 01:34:19 -0500 Subject: [PATCH 03/11] Replace legacy NULL with nullptr in llaudio --- indra/llaudio/llaudiodecodemgr.cpp | 20 +++---- indra/llaudio/llaudioengine.cpp | 80 +++++++++++++------------- indra/llaudio/llaudioengine_openal.cpp | 18 +++--- indra/llaudio/llvorbisencode.cpp | 4 +- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index d8a6fffea6f..df560a3f88c 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -168,7 +168,7 @@ LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string & mValid = false; mBytesRead = -1; mUUID = uuid; - mInFilep = NULL; + mInFilep = nullptr; mCurrentSection = 0; mOutFilename = out_filename; mFileHandle = LLLFSThread::nullHandle(); @@ -183,7 +183,7 @@ LLVorbisDecodeState::~LLVorbisDecodeState() if (!mDone) { delete mInFilep; - mInFilep = NULL; + mInFilep = nullptr; } } @@ -203,11 +203,11 @@ bool LLVorbisDecodeState::initDecode() { LL_WARNS("AudioEngine") << "unable to open vorbis source vfile for reading" << LL_ENDL; delete mInFilep; - mInFilep = NULL; + mInFilep = nullptr; return false; } - S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, cache_callbacks); + S32 r = ov_open_callbacks(mInFilep, &mVF, nullptr, 0, cache_callbacks); if(r < 0) { LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL; @@ -259,7 +259,7 @@ bool LLVorbisDecodeState::initDecode() LL_WARNS("AudioEngine") << "Bad asset encoded by: " << comment->vendor << LL_ENDL; } delete mInFilep; - mInFilep = NULL; + mInFilep = nullptr; return false; } @@ -272,7 +272,7 @@ bool LLVorbisDecodeState::initDecode() { LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL; delete mInFilep; - mInFilep = NULL; + mInFilep = nullptr; return false; } @@ -606,7 +606,7 @@ void LLAudioDecodeMgr::Impl::startMoreDecodes() } // Kick off a decode - mDecodes[decode_id] = LLPointer(NULL); + mDecodes[decode_id] = LLPointer(nullptr); bool posted = main_queue->postTo( general_queue, [decode_id]() // Work done on general queue @@ -658,7 +658,7 @@ LLPointer beginDecodingAndWritingAudio(const LLUUID &decode if (!decode_state->initDecode()) { - return NULL; + return nullptr; } // Decode in a loop until we're done @@ -673,7 +673,7 @@ LLPointer beginDecodingAndWritingAudio(const LLUUID &decode // during decoding. LL_WARNS("AudioEngine") << decode_id << " has invalid vorbis data or decode has been canceled, aborting decode" << LL_ENDL; decode_state->flushBadFile(); - return NULL; + return nullptr; } if (!decode_state->isValid()) @@ -681,7 +681,7 @@ LLPointer beginDecodingAndWritingAudio(const LLUUID &decode // We had an error when decoding, abort. LL_WARNS("AudioEngine") << decode_id << " has invalid vorbis data, aborting decode" << LL_ENDL; decode_state->flushBadFile(); - return NULL; + return nullptr; } // Kick off the writing of the decoded audio to the disk cache. diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 613c4081571..41a7c1f71d9 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -44,7 +44,7 @@ // necessary for grabbing sounds from sim (implemented in viewer) extern void request_sound(const LLUUID &sound_guid); -LLAudioEngine* gAudiop = NULL; +LLAudioEngine* gAudiop = nullptr; // @@ -76,10 +76,10 @@ void LLAudioEngine::setDefaults() { mMaxWindGain = 1.f; - mListenerp = NULL; + mListenerp = nullptr; mMuted = false; - mUserData = NULL; + mUserData = nullptr; mLastStatus = 0; @@ -96,7 +96,7 @@ void LLAudioEngine::setDefaults() mInternalGain = -1.f; mNextWindUpdate = 0.f; - mStreamingAudioImpl = NULL; + mStreamingAudioImpl = nullptr; for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) mSecondaryGain[i] = 1.0f; @@ -141,14 +141,14 @@ void LLAudioEngine::shutdown() for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++) { delete mChannels[i]; - mChannels[i] = NULL; + mChannels[i] = nullptr; } // Clean up buffers for (i = 0; i < LL_MAX_AUDIO_BUFFERS; i++) { delete mBuffers[i]; - mBuffers[i] = NULL; + mBuffers[i] = nullptr; } } @@ -239,7 +239,7 @@ void LLAudioEngine::idle() } F32 max_priority = -1.f; - LLAudioSource *max_sourcep = NULL; // Maximum priority source without a channel + LLAudioSource *max_sourcep = nullptr; // Maximum priority source without a channel source_map::iterator iter; for (iter = mAllSources.begin(); iter != mAllSources.end();) { @@ -326,7 +326,7 @@ void LLAudioEngine::idle() { // This sound isn't playing, so we just process move the queue sourcep->mCurrentDatap = sourcep->mQueuedDatap; - sourcep->mQueuedDatap = NULL; + sourcep->mQueuedDatap = nullptr; // Reset the timer so the source doesn't die. sourcep->mAgeTimer.reset(); @@ -351,7 +351,7 @@ void LLAudioEngine::idle() if (!channelp->isPlaying()) { sourcep->mCurrentDatap = sourcep->mQueuedDatap; - sourcep->mQueuedDatap = NULL; + sourcep->mQueuedDatap = nullptr; // Reset the timer so the source doesn't die. sourcep->mAgeTimer.reset(); @@ -376,7 +376,7 @@ void LLAudioEngine::idle() if (channelp->mLoopedThisFrame) { sourcep->mCurrentDatap = sourcep->mQueuedDatap; - sourcep->mQueuedDatap = NULL; + sourcep->mQueuedDatap = nullptr; // Actually, should do a time sync so if we're a loop master/slave // we don't drift away. @@ -392,8 +392,8 @@ void LLAudioEngine::idle() updateChannels(); // Hack! For now, just use a global sync master; - LLAudioSource *sync_masterp = NULL; - LLAudioChannel *master_channelp = NULL; + LLAudioSource *sync_masterp = nullptr; + LLAudioChannel *master_channelp = nullptr; F32 max_sm_priority = -1.f; for (source_map::value_type& src_pair : mAllSources) { @@ -451,9 +451,9 @@ void LLAudioEngine::idle() if (!mBuffers[i]->mInUse && mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > 30.f) { //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL; - mBuffers[i]->mAudioDatap->mBufferp = NULL; + mBuffers[i]->mAudioDatap->mBufferp = nullptr; delete mBuffers[i]; - mBuffers[i] = NULL; + mBuffers[i] = nullptr; } } } @@ -564,12 +564,12 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer() { LL_DEBUGS() << "Taking over unused buffer " << buffer_id << LL_ENDL; //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL; - mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; + mBuffers[buffer_id]->mAudioDatap->mBufferp = nullptr; delete mBuffers[buffer_id]; mBuffers[buffer_id] = createBuffer(); return mBuffers[buffer_id]; } - return NULL; + return nullptr; } @@ -592,7 +592,7 @@ LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority) mChannels[i]->cleanup(); if (mChannels[i]->getSource()) { - mChannels[i]->getSource()->setChannel(NULL); + mChannels[i]->getSource()->setChannel(nullptr); } return mChannels[i]; } @@ -602,7 +602,7 @@ LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority) // All channels used, check priorities. // Find channel with lowest priority and see if we want to replace it. F32 min_priority = 10000.f; - LLAudioChannel *min_channelp = NULL; + LLAudioChannel *min_channelp = nullptr; for (i = 0; i < LL_MAX_AUDIO_CHANNELS; i++) { @@ -618,12 +618,12 @@ LLAudioChannel * LLAudioEngine::getFreeChannel(const F32 priority) if (min_priority > priority || !min_channelp) { // All playing channels have higher priority, return. - return NULL; + return nullptr; } // Flush the minimum priority channel, and return it. min_channelp->cleanup(); - min_channelp->getSource()->setChannel(NULL); + min_channelp->getSource()->setChannel(nullptr); return min_channelp; } @@ -636,7 +636,7 @@ void LLAudioEngine::cleanupBuffer(LLAudioBuffer *bufferp) if (mBuffers[i] == bufferp) { delete mBuffers[i]; - mBuffers[i] = NULL; + mBuffers[i] = nullptr; } } } @@ -914,7 +914,7 @@ LLAudioSource * LLAudioEngine::findAudioSource(const LLUUID &source_id) if (iter == mAllSources.end()) { - return NULL; + return nullptr; } else { @@ -1005,8 +1005,8 @@ void LLAudioEngine::startNextTransfer() // Pick one in the following order: LLUUID asset_id; S32 i; - LLAudioSource *asp = NULL; - LLAudioData *adp = NULL; + LLAudioSource *asp = nullptr; + LLAudioData *adp = nullptr; data_map::iterator data_iter; // Check all channels for currently playing sounds. @@ -1182,7 +1182,7 @@ void LLAudioEngine::startNextTransfer() mCurrentTransfer = asset_id; mCurrentTransferTimer.reset(); gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, - assetCallback, NULL); + assetCallback, nullptr); } else { @@ -1253,9 +1253,9 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 mPlayedOnce(false), mCorrupted(false), mType(type), - mChannelp(NULL), - mCurrentDatap(NULL), - mQueuedDatap(NULL) + mChannelp(nullptr), + mCurrentDatap(nullptr), + mQueuedDatap(nullptr) { } @@ -1265,8 +1265,8 @@ LLAudioSource::~LLAudioSource() if (mChannelp) { // Stop playback of this sound - mChannelp->setSource(NULL); - mChannelp = NULL; + mChannelp->setSource(nullptr); + mChannelp = nullptr; } } @@ -1395,11 +1395,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid) { if (getChannel()) { - getChannel()->setSource(NULL); - setChannel(NULL); + getChannel()->setSource(nullptr); + setChannel(nullptr); if (!isMuted()) { - mCurrentDatap = NULL; + mCurrentDatap = nullptr; } } return false; @@ -1629,7 +1629,7 @@ LLAudioBuffer * LLAudioSource::getCurrentBuffer() { if (!mCurrentDatap) { - return NULL; + return nullptr; } return mCurrentDatap->getBuffer(); @@ -1644,8 +1644,8 @@ LLAudioBuffer * LLAudioSource::getCurrentBuffer() LLAudioChannel::LLAudioChannel() : - mCurrentSourcep(NULL), - mCurrentBufferp(NULL), + mCurrentSourcep(nullptr), + mCurrentBufferp(nullptr), mLoopedThisFrame(false), mWaiting(false), mSecondaryGain(1.0f) @@ -1659,9 +1659,9 @@ LLAudioChannel::~LLAudioChannel() //LL_INFOS() << "Cleaning up audio channel" << LL_ENDL; if (mCurrentSourcep) { - mCurrentSourcep->setChannel(NULL); + mCurrentSourcep->setChannel(nullptr); } - mCurrentBufferp = NULL; + mCurrentBufferp = nullptr; } @@ -1674,7 +1674,7 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep) // Clearing the source for this channel, don't need to do anything. //LL_INFOS() << "Clearing source for channel" << LL_ENDL; cleanup(); - mCurrentSourcep = NULL; + mCurrentSourcep = nullptr; mWaiting = false; } else @@ -1756,7 +1756,7 @@ bool LLAudioChannel::updateBuffer() LLAudioData::LLAudioData(const LLUUID &uuid) : mID(uuid), - mBufferp(NULL), + mBufferp(nullptr), mHasLocalData(false), mHasDecodedData(false), mHasCompletedDecode(false), diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 755547bfaaf..b2a513ba674 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -36,8 +36,8 @@ const float LLAudioEngine_OpenAL::WIND_BUFFER_SIZE_SEC = 0.05f; LLAudioEngine_OpenAL::LLAudioEngine_OpenAL() : - mWindGen(NULL), - mWindBuf(NULL), + mWindGen(nullptr), + mWindBuf(nullptr), mWindBufFreq(0), mWindBufSamples(0), mWindBufBytes(0), @@ -54,10 +54,10 @@ LLAudioEngine_OpenAL::~LLAudioEngine_OpenAL() // virtual bool LLAudioEngine_OpenAL::init(void* userdata, const std::string &app_title) { - mWindGen = NULL; + mWindGen = nullptr; LLAudioEngine::init(userdata, app_title); - if(!alutInit(NULL, NULL)) + if (!alutInit(nullptr, nullptr)) { LL_WARNS() << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; return false; @@ -154,7 +154,7 @@ void LLAudioEngine_OpenAL::shutdown() LL_INFOS() << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << LL_ENDL; delete mListenerp; - mListenerp = NULL; + mListenerp = nullptr; } LLAudioBuffer *LLAudioEngine_OpenAL::createBuffer() @@ -192,7 +192,7 @@ void LLAudioChannelOpenAL::cleanup() alSourceStop(mALSource); alSourcei(mALSource, AL_BUFFER, AL_NONE); - mCurrentBufferp = NULL; + mCurrentBufferp = nullptr; } void LLAudioChannelOpenAL::play() @@ -408,7 +408,7 @@ bool LLAudioEngine_OpenAL::initWind() mWindBuf = new WIND_SAMPLE_T [mWindBufSamples * 2 /*stereo*/]; - if(mWindBuf==NULL) + if (mWindBuf == nullptr) { LL_ERRS() << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << LL_ENDL; return false; @@ -443,10 +443,10 @@ void LLAudioEngine_OpenAL::cleanupWind() } delete[] mWindBuf; - mWindBuf = NULL; + mWindBuf = nullptr; delete mWindGen; - mWindGen = NULL; + mWindGen = nullptr; } void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp index d115dc309d2..3e1afbda152 100644 --- a/indra/llaudio/llvorbisencode.cpp +++ b/indra/llaudio/llvorbisencode.cpp @@ -273,7 +273,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname // if (vorbis_encode_init(&vi, /* num_channels */ 1 ,sample_rate, -1, bitrate, -1)) if (vorbis_encode_init_vbr(&vi, /* num_channels */ 1 ,sample_rate, quality)) // if (vorbis_encode_setup_managed(&vi,1,sample_rate,-1,bitrate,-1) || -// vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) || +// vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,nullptr) || // vorbis_encode_setup_init(&vi)) { LL_WARNS() << "unable to initialize vorbis codec at quality " << quality << LL_ENDL; @@ -421,7 +421,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname /* analysis */ /* Do the main analysis, creating a packet */ - vorbis_analysis(&vb, NULL); + vorbis_analysis(&vb, nullptr); vorbis_bitrate_addblock(&vb); while(vorbis_bitrate_flushpacket(&vd, &op)) From 737288083be33a5cee287a800682f4a433dda8b9 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 03:32:30 -0500 Subject: [PATCH 04/11] Replace legacy NULL with nullptr in llcharacter --- indra/llcharacter/llanimationstates.cpp | 4 +-- indra/llcharacter/llbvhloader.cpp | 4 +-- indra/llcharacter/llcharacter.cpp | 6 ++--- indra/llcharacter/llcharacter.h | 4 +-- indra/llcharacter/lleditingmotion.cpp | 2 +- indra/llcharacter/llgesture.cpp | 4 +-- indra/llcharacter/llhandmotion.cpp | 2 +- indra/llcharacter/llheadrotmotion.cpp | 10 ++++---- indra/llcharacter/lljoint.cpp | 16 ++++++------ indra/llcharacter/lljoint.h | 4 +-- indra/llcharacter/lljointsolverrp3.cpp | 8 +++--- indra/llcharacter/lljointstate.h | 4 +-- indra/llcharacter/llkeyframefallmotion.cpp | 2 +- indra/llcharacter/llkeyframemotion.cpp | 18 ++++++------- indra/llcharacter/llkeyframemotion.h | 4 +-- indra/llcharacter/llkeyframemotionparam.cpp | 18 ++++++------- indra/llcharacter/llkeyframestandmotion.cpp | 16 ++++++------ indra/llcharacter/llkeyframewalkmotion.cpp | 2 +- indra/llcharacter/llmotion.cpp | 4 +-- indra/llcharacter/llmotioncontroller.cpp | 20 +++++++-------- indra/llcharacter/llmultigesture.h | 4 +-- indra/llcharacter/llpose.cpp | 14 +++++------ indra/llcharacter/llstatemachine.cpp | 28 ++++++++++----------- indra/llcharacter/lltargetingmotion.cpp | 2 +- indra/llcharacter/llvisualparam.cpp | 8 +++--- indra/llcharacter/tests/lljoint_test.cpp | 10 ++++---- 26 files changed, 109 insertions(+), 109 deletions(-) diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp index 7710589b064..f21871c0211 100644 --- a/indra/llcharacter/llanimationstates.cpp +++ b/indra/llcharacter/llanimationstates.cpp @@ -353,14 +353,14 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) { if (state.isNull()) { - return NULL; + return nullptr; } if (mAnimMap.count(state)) { return mAnimMap[state]; } - return NULL; + return nullptr; } diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 581e9f62d52..0273108b35c 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -1334,8 +1334,8 @@ bool LLBVHLoader::serialize(LLDataPacker& dp) // find mergechild and mergeparent joints, if specified LLQuaternion mergeParentRot; LLQuaternion mergeChildRot; - Joint *mergeParent = NULL; - Joint *mergeChild = NULL; + Joint *mergeParent = nullptr; + Joint *mergeChild = nullptr; for (Joint* mjoint : mJoints) { diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 8efcd9dd297..7baf97c981e 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -216,7 +216,7 @@ void LLCharacter::flushAllMotions() void LLCharacter::dumpCharacter( LLJoint* joint ) { // handle top level entry into recursion - if (joint == NULL) + if (joint == nullptr) { LL_INFOS() << "DEBUG: Dumping Character @" << this << LL_ENDL; dumpCharacter( getRootJoint() ); @@ -247,7 +247,7 @@ void LLCharacter::setAnimationData(std::string name, void *data) //----------------------------------------------------------------------------- void* LLCharacter::getAnimationData(std::string name) { - return get_if_there(mAnimationData, name, (void*)NULL); + return get_if_there(mAnimationData, name, (void*)nullptr); } //----------------------------------------------------------------------------- @@ -388,7 +388,7 @@ LLVisualParam* LLCharacter::getVisualParam(const char *param_name) return name_iter->second; } LL_WARNS() << "LLCharacter::getVisualParam() Invalid visual parameter: " << param_name << LL_ENDL; - return NULL; + return nullptr; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 079bcd132a6..664f4598331 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -173,13 +173,13 @@ class LLCharacter virtual void deactivateAllMotions(); // dumps information for debugging - virtual void dumpCharacter( LLJoint *joint = NULL ); + virtual void dumpCharacter( LLJoint *joint = nullptr ); virtual F32 getPreferredPelvisHeight() { return mPreferredPelvisHeight; } virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset) { return LLVector3::zero; } - virtual LLJoint* findCollisionVolume(S32 volume_id) { return NULL; } + virtual LLJoint* findCollisionVolume(S32 volume_id) { return nullptr; } virtual S32 getCollisionVolumeID(std::string &name) { return -1; } diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 9fb2a931f9b..27b75de0f10 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -49,7 +49,7 @@ S32 LLEditingMotion::sHandPosePriority = 3; //----------------------------------------------------------------------------- LLEditingMotion::LLEditingMotion( const LLUUID &id) : LLMotion(id) { - mCharacter = NULL; + mCharacter = nullptr; // create kinematic chain mParentJoint.addChild( &mShoulderJoint ); diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index b69462ce28b..b042d4403ce 100644 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -202,7 +202,7 @@ bool LLGestureList::triggerAndReviseString(const std::string &string, std::strin for(const std::string& cur_token : tokens) { - LLGesture* gesture = NULL; + LLGesture* gesture = nullptr; if( !found_gestures ) // Only pay attention to the first gesture in the string. { @@ -238,7 +238,7 @@ bool LLGestureList::triggerAndReviseString(const std::string &string, std::strin found_gestures = true; break; } - gesture = NULL; + gesture = nullptr; } } diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 2c03ded841e..29f5dbe1281 100644 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -63,7 +63,7 @@ const F32 HAND_MORPH_BLEND_TIME = 0.2f; //----------------------------------------------------------------------------- LLHandMotion::LLHandMotion(const LLUUID &id) : LLMotion(id) { - mCharacter = NULL; + mCharacter = nullptr; mLastTime = 0.f; mCurrentPose = HAND_POSE_RELAXED; mNewPose = HAND_POSE_RELAXED; diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 6169647423a..1c59407e5e9 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -69,9 +69,9 @@ const F32 EYE_BLINK_TIME_DELTA = 0.005f; // time between one eye starting a blin //----------------------------------------------------------------------------- LLHeadRotMotion::LLHeadRotMotion(const LLUUID &id) : LLMotion(id), - mCharacter(NULL), - mTorsoJoint(NULL), - mHeadJoint(NULL) + mCharacter(nullptr), + mTorsoJoint(nullptr), + mHeadJoint(nullptr) { mName = "head_rot"; @@ -269,7 +269,7 @@ void LLHeadRotMotion::onDeactivate() //----------------------------------------------------------------------------- LLEyeMotion::LLEyeMotion(const LLUUID &id) : LLMotion(id) { - mCharacter = NULL; + mCharacter = nullptr; mEyeJitterTime = 0.f; mEyeJitterYaw = 0.f; mEyeJitterPitch = 0.f; @@ -281,7 +281,7 @@ LLEyeMotion::LLEyeMotion(const LLUUID &id) : LLMotion(id) mEyeBlinkTime = 0.f; mEyesClosed = false; - mHeadJoint = NULL; + mHeadJoint = nullptr; mName = "eye_rot"; diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 405e62a38b7..d435804aacb 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -103,7 +103,7 @@ void LLVector3OverrideMap::clear() void LLJoint::init() { mName = "unnamed"; - mParent = NULL; + mParent = nullptr; mXform.setScaleChildOffset(true); mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY; @@ -231,7 +231,7 @@ void LLJoint::setJointNum(S32 joint_num) //----------------------------------------------------------------------------- LLJoint *LLJoint::getRoot() { - if ( getParent() == NULL ) + if ( getParent() == nullptr ) { return this; } @@ -284,8 +284,8 @@ void LLJoint::removeChild(LLJoint* joint) { mChildren.erase(iter); - joint->mXform.setParent(NULL); - joint->mParent = NULL; + joint->mXform.setParent(nullptr); + joint->mParent = nullptr; joint->touch(); } } @@ -300,8 +300,8 @@ void LLJoint::removeAllChildren() { if (joint) { - joint->mXform.setParent(NULL); - joint->mParent = NULL; + joint->mXform.setParent(nullptr); + joint->mParent = nullptr; joint->touch(); //delete joint; } @@ -758,7 +758,7 @@ LLVector3 LLJoint::getLastWorldPosition() //-------------------------------------------------------------------- void LLJoint::setWorldPosition( const LLVector3& pos ) { - if (mParent == NULL) + if (mParent == nullptr) { this->setPosition( pos ); return; @@ -830,7 +830,7 @@ LLQuaternion LLJoint::getLastWorldRotation() //-------------------------------------------------------------------- void LLJoint::setWorldRotation( const LLQuaternion& rot ) { - if (mParent == NULL) + if (mParent == nullptr) { this->setRotation( rot ); return; diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 481fb0a1bb9..2375bb54169 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -185,7 +185,7 @@ class alignas(16) LLJoint LLJoint(S32 joint_num); // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform* - LLJoint( const std::string &name, LLJoint *parent=NULL ); + LLJoint( const std::string &name, LLJoint *parent=nullptr ); virtual ~LLJoint(); private: @@ -193,7 +193,7 @@ class alignas(16) LLJoint public: // set name and parent - void setup( const std::string &name, LLJoint *parent=NULL ); + void setup(const std::string& name, LLJoint* parent = nullptr); void touch(U32 flags = ALL_DIRTY); diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp index 626029059e4..dacc8c7336e 100644 --- a/indra/llcharacter/lljointsolverrp3.cpp +++ b/indra/llcharacter/lljointsolverrp3.cpp @@ -46,10 +46,10 @@ //----------------------------------------------------------------------------- LLJointSolverRP3::LLJointSolverRP3() { - mJointA = NULL; - mJointB = NULL; - mJointC = NULL; - mJointGoal = NULL; + mJointA = nullptr; + mJointB = nullptr; + mJointC = nullptr; + mJointGoal = nullptr; mLengthAB = 1.0f; mLengthBC = 1.0f; mPoleVector.setVec( 1.0f, 0.0f, 0.0f ); diff --git a/indra/llcharacter/lljointstate.h b/indra/llcharacter/lljointstate.h index 1b174002007..45ec90c5b92 100644 --- a/indra/llcharacter/lljointstate.h +++ b/indra/llcharacter/lljointstate.h @@ -65,7 +65,7 @@ class LLJointState : public LLRefCount // Constructor LLJointState() : mUsage(0) - , mJoint(NULL) + , mJoint(nullptr) , mWeight(0.f) , mPriority(LLJoint::USE_MOTION_PRIORITY) {} @@ -80,7 +80,7 @@ class LLJointState : public LLRefCount // joint that this state is applied to LLJoint* getJoint() { return mJoint; } const LLJoint* getJoint() const { return mJoint; } - bool setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } + bool setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != nullptr; } // transform type (bitwise flags can be combined) // Note that these are set automatically when various diff --git a/indra/llcharacter/llkeyframefallmotion.cpp b/indra/llcharacter/llkeyframefallmotion.cpp index 82ffc878436..2fbc7facaa9 100644 --- a/indra/llcharacter/llkeyframefallmotion.cpp +++ b/indra/llcharacter/llkeyframefallmotion.cpp @@ -46,7 +46,7 @@ LLKeyframeFallMotion::LLKeyframeFallMotion(const LLUUID &id) : LLKeyframeMotion(id) { mVelocityZ = 0.f; - mCharacter = NULL; + mCharacter = nullptr; } diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index be1c74a9082..42cb09816b0 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -385,7 +385,7 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time, { // this value being 0 is the cause of https://jira.lindenlab.com/browse/SL-22678 but I haven't // managed to get a stack to see how it got here. Testing for 0 here will stop the crash. - if ( joint_state == NULL ) + if ( joint_state == nullptr ) { return; } @@ -572,7 +572,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact if (!anim_file || !anim_file->getSize()) { delete anim_file; - anim_file = NULL; + anim_file = nullptr; // request asset over network on next call to load mAssetStatus = ASSET_NEEDS_FETCH; @@ -592,7 +592,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact LL_WARNS() << "Failed to allocate buffer: " << anim_file_size << mID << LL_ENDL; } delete anim_file; - anim_file = NULL; + anim_file = nullptr; } if (!success) @@ -997,8 +997,8 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 } LLVector3 norm; - LLJoint *source_jointp = NULL; - LLJoint *target_jointp = NULL; + LLJoint *source_jointp = nullptr; + LLJoint *target_jointp = nullptr; if (shared_data->mConstraintType == CONSTRAINT_TYPE_PLANE) { @@ -1493,7 +1493,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo << " is outside of legal range [0-" << LL_CHARACTER_MAX_ANIMATED_JOINTS << ") for joint " << joint->getName() << " for animation " << asset() << LL_ENDL; - joint = NULL; + joint = nullptr; } } else @@ -2546,7 +2546,7 @@ LLKeyframeMotion::JointMotionList* LLKeyframeDataCache::getKeyframeData(const LL keyframe_data_map_t::iterator found_data = sKeyframeDataMap.find(id); if (found_data == sKeyframeDataMap.end()) { - return NULL; + return nullptr; } return found_data->second; } @@ -2576,8 +2576,8 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh mWeight = 0.f; mTotalLength = 0.f; mActive = false; - mSourceVolume = NULL; - mTargetVolume = NULL; + mSourceVolume = nullptr; + mTargetVolume = nullptr; mFixupDistanceRMS = 0.f; for (S32 i=0; igetAnimationData(paramName); - if (NULL == paramValue) // unexpected, but... + if (nullptr == paramValue) // unexpected, but... { - LL_WARNS() << "paramValue == NULL" << LL_ENDL; + LL_WARNS() << "paramValue == nullptr" << LL_ENDL; continue; } // DANGER! Do not modify mParameterizedMotions while using these pointers! - const ParameterizedMotion* firstMotion = NULL; - const ParameterizedMotion* secondMotion = NULL; + const ParameterizedMotion* firstMotion = nullptr; + const ParameterizedMotion* secondMotion = nullptr; motion_list_t& motionList = motion_pair.second; for (const ParameterizedMotion& paramMotion : motionList) @@ -216,12 +216,12 @@ bool LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) if (firstMotion) firstPose = firstMotion->mMotion->getPose(); else - firstPose = NULL; + firstPose = nullptr; if (secondMotion) secondPose = secondMotion->mMotion->getPose(); else - secondPose = NULL; + secondPose = nullptr; // now modify weight of the subanim (only if we are blending between two motions) if (firstMotion && secondMotion) @@ -339,7 +339,7 @@ bool LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- S32 fileSize = 0; LLAPRFile infile ; - infile.open(path, LL_APR_R, NULL, &fileSize); + infile.open(path, LL_APR_R, nullptr, &fileSize); apr_file_t* fp = infile.getFileHandle() ; if (!fp || fileSize == 0) { diff --git a/indra/llcharacter/llkeyframestandmotion.cpp b/indra/llcharacter/llkeyframestandmotion.cpp index a882ab3563c..80e1a20d9a7 100644 --- a/indra/llcharacter/llkeyframestandmotion.cpp +++ b/indra/llcharacter/llkeyframestandmotion.cpp @@ -47,7 +47,7 @@ const F32 POSITION_THRESHOLD = 0.1f; LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotion(id) { mFlipFeet = false; - mCharacter = NULL; + mCharacter = nullptr; // create kinematic hierarchy mPelvisJoint.addChild( &mHipLeftJoint ); @@ -57,15 +57,15 @@ LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotio mHipRightJoint.addChild( &mKneeRightJoint ); mKneeRightJoint.addChild( &mAnkleRightJoint ); - mPelvisState = NULL; + mPelvisState = nullptr; - mHipLeftState = NULL; - mKneeLeftState = NULL; - mAnkleLeftState = NULL; + mHipLeftState = nullptr; + mKneeLeftState = nullptr; + mAnkleLeftState = nullptr; - mHipRightState = NULL; - mKneeRightState = NULL; - mAnkleRightState = NULL; + mHipRightState = nullptr; + mKneeRightState = nullptr; + mAnkleRightState = nullptr; mTrackAnkles = true; diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index f8691b5f59b..83fcb2d5c5f 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -54,7 +54,7 @@ const F32 SPEED_ADJUST_TIME_CONSTANT = 0.1f; // time constant for speed adjus //----------------------------------------------------------------------------- LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id) : LLKeyframeMotion(id), - mCharacter(NULL), + mCharacter(nullptr), mCyclePhase(0.0f), mRealTimeLast(0.0f), mAdjTimeLast(0.0f), diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index a51857c9a1b..32c75cf63b5 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -162,8 +162,8 @@ void LLMotion::deactivate() if (mDeactivateCallback) { (*mDeactivateCallback)(mDeactivateCallbackUserData); - mDeactivateCallback = NULL; // only call callback once - mDeactivateCallbackUserData = NULL; + mDeactivateCallback = nullptr; // only call callback once + mDeactivateCallbackUserData = nullptr; } onDeactivate(); diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index c204c96f6cc..3be148ea97b 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -93,7 +93,7 @@ bool LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor con //----------------------------------------------------------------------------- void LLMotionRegistry::markBad( const LLUUID& id ) { - mMotionTable[id] = LLMotionConstructor(NULL); + mMotionTable[id] = LLMotionConstructor(nullptr); } //----------------------------------------------------------------------------- @@ -101,10 +101,10 @@ void LLMotionRegistry::markBad( const LLUUID& id ) //----------------------------------------------------------------------------- LLMotion *LLMotionRegistry::createMotion( const LLUUID &id ) { - LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(NULL)); - LLMotion* motion = NULL; + LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(nullptr)); + LLMotion* motion = nullptr; - if ( constructor == NULL ) + if ( constructor == nullptr ) { // *FIX: need to replace with a better default scheme. RN motion = LLKeyframeMotion::create(id); @@ -129,7 +129,7 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- LLMotionController::LLMotionController() : mTimeFactor(sCurrentTimeFactor), - mCharacter(NULL), + mCharacter(nullptr), mAnimTime(0.f), mPrevTimerElapsed(0.f), mLastTime(0.0f), @@ -350,7 +350,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) motion = sRegistry.createMotion(id); if (!motion) { - return NULL; + return nullptr; } // look up name for default motions @@ -368,7 +368,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) LL_INFOS() << "Motion " << id << " init failed." << LL_ENDL; sRegistry.markBad(id); delete motion; - return NULL; + return nullptr; case LLMotion::STATUS_HOLD: mLoadingMotions.insert(motion); break; @@ -404,7 +404,7 @@ bool LLMotionController::startMotion(const LLUUID &id, F32 start_offset) { deprecateMotionInstance(motion); // force creation of new instance - motion = NULL; + motion = nullptr; } // create new motion instance @@ -924,7 +924,7 @@ bool LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // It's not clear why the getWeight() line seems to be crashing this, but // hopefully this fixes it. - if (motion == NULL || motion->getPose() == NULL) + if (motion == nullptr || motion->getPose() == nullptr) { return false; } @@ -1039,7 +1039,7 @@ LLMotion* LLMotionController::findMotion(const LLUUID& id) const motion_map_t::const_iterator iter = mAllMotions.find(id); if(iter == mAllMotions.end()) { - return NULL; + return nullptr; } else { diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index 199ed5c543c..6679a4c3d38 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -100,8 +100,8 @@ class LLMultiGesture // Timer for waiting LLFrameTimer mWaitTimer; - void (*mDoneCallback)(LLMultiGesture* gesture, void* data) { NULL }; - void* mCallbackData { NULL }; + void (*mDoneCallback)(LLMultiGesture* gesture, void* data) { nullptr }; + void* mCallbackData { nullptr }; // Animations that we requested to start std::set mRequestedAnimIDs; diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp index 0652e9eb25b..f4ac7b93c67 100644 --- a/indra/llcharacter/llpose.cpp +++ b/indra/llcharacter/llpose.cpp @@ -54,7 +54,7 @@ LLJointState* LLPose::getFirstJointState() mListIter = mJointMap.begin(); if (mListIter == mJointMap.end()) { - return NULL; + return nullptr; } else { @@ -70,7 +70,7 @@ LLJointState *LLPose::getNextJointState() mListIter++; if (mListIter == mJointMap.end()) { - return NULL; + return nullptr; } else { @@ -117,7 +117,7 @@ LLJointState* LLPose::findJointState(LLJoint *joint) if (iter == mJointMap.end()) { - return NULL; + return nullptr; } else { @@ -134,7 +134,7 @@ LLJointState* LLPose::findJointState(const std::string &name) if (iter == mJointMap.end()) { - return NULL; + return nullptr; } else { @@ -179,7 +179,7 @@ LLJointStateBlender::LLJointStateBlender() { for(S32 i = 0; i < JSB_NUM_JOINT_STATES; i++) { - mJointStates[i] = NULL; + mJointStates[i] = nullptr; mPriorities[i] = S32_MIN; mAdditiveBlends[i] = false; } @@ -394,7 +394,7 @@ void LLJointStateBlender::blendJointStates(bool apply_now) // now clear joint states for(S32 i = 0; i < JSB_NUM_JOINT_STATES; i++) { - mJointStates[i] = NULL; + mJointStates[i] = nullptr; } } } @@ -430,7 +430,7 @@ void LLJointStateBlender::clear() // now clear joint states for(S32 i = 0; i < JSB_NUM_JOINT_STATES; i++) { - mJointStates[i] = NULL; + mJointStates[i] = nullptr; } } diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index 38e9ef444c1..642f04225b2 100644 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -48,7 +48,7 @@ bool operator!=(const LLUniqueID &a, const LLUniqueID &b) //----------------------------------------------------------------------------- LLStateDiagram::LLStateDiagram() { - mDefaultState = NULL; + mDefaultState = nullptr; mUseDefaultState = false; } @@ -69,7 +69,7 @@ bool LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_stat { StateMap::iterator state_it; state_it = mStates.find(&start_state); - Transitions* state_transitions = NULL; + Transitions* state_transitions = nullptr; if (state_it == mStates.end() ) { addState(&start_state); @@ -119,11 +119,11 @@ LLFSMState* LLStateDiagram::processTransition(LLFSMState& start_state, LLFSMTran { // look up transition //LLFSMState** dest_state = (mStates.getValue(&start_state))->getValue(&transition); - LLFSMState* dest_state = NULL; + LLFSMState* dest_state = nullptr; StateMap::iterator state_it = mStates.find(&start_state); if (state_it == mStates.end()) { - return NULL; + return nullptr; } Transitions::iterator transition_it = state_it->second.find(&transition); @@ -138,7 +138,7 @@ LLFSMState* LLStateDiagram::processTransition(LLFSMState& start_state, LLFSMTran } // if we have a destination state... - if (NULL != dest_state) + if (nullptr != dest_state) { // ...return it... return dest_state; @@ -197,7 +197,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) return state_pair.first; } } - return NULL; + return nullptr; } bool LLStateDiagram::saveDotFile(const std::string& filename) @@ -284,10 +284,10 @@ std::ostream& operator<<(std::ostream &s, LLStateDiagram &FSM) LLStateMachine::LLStateMachine() { // we haven't received a starting state yet - mCurrentState = NULL; - mLastState = NULL; - mLastTransition = NULL; - mStateDiagram = NULL; + mCurrentState = nullptr; + mLastState = nullptr; + mLastTransition = nullptr; + mStateDiagram = nullptr; } LLStateMachine::~LLStateMachine() @@ -348,17 +348,17 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d { llassert(mStateDiagram); - if (NULL == mCurrentState) + if (nullptr == mCurrentState) { - LL_WARNS() << "mCurrentState == NULL; aborting processTransition()" << LL_ENDL; + LL_WARNS() << "mCurrentState == nullptr; aborting processTransition()" << LL_ENDL; return; } LLFSMState* new_state = mStateDiagram->processTransition(*mCurrentState, transition); - if (NULL == new_state) + if (nullptr == new_state) { - LL_WARNS() << "new_state == NULL; aborting processTransition()" << LL_ENDL; + LL_WARNS() << "new_state == nullptr; aborting processTransition()" << LL_ENDL; return; } diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp index 0683a1125cf..9d65c67bffe 100644 --- a/indra/llcharacter/lltargetingmotion.cpp +++ b/indra/llcharacter/lltargetingmotion.cpp @@ -45,7 +45,7 @@ const F32 TORSO_TARGET_HALF_LIFE = 0.25f; //----------------------------------------------------------------------------- LLTargetingMotion::LLTargetingMotion(const LLUUID &id) : LLMotion(id) { - mCharacter = NULL; + mCharacter = nullptr; mName = "targeting"; mTorsoState = new LLJointState; diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 105b31de656..151a3d3b42b 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -162,7 +162,7 @@ void LLVisualParamInfo::toStream(std::ostream &out) LLVisualParam::LLVisualParam() : mCurWeight( 0.f ), mLastWeight( 0.f ), - mNext( NULL ), + mNext( nullptr ), mTargetWeight( 0.f ), mIsAnimating( false ), mIsDummy(false), @@ -194,7 +194,7 @@ LLVisualParam::LLVisualParam(const LLVisualParam& pOther) LLVisualParam::~LLVisualParam() { delete mNext; - mNext = NULL; + mNext = nullptr; } /* @@ -209,7 +209,7 @@ LLVisualParam::~LLVisualParam() bool LLVisualParam::setInfo(LLVisualParamInfo *info) { - llassert(mInfo == NULL); + llassert(mInfo == nullptr); if (info->mID < 0) return false; mInfo = info; @@ -305,7 +305,7 @@ void LLVisualParam::setNextParam( LLVisualParam *next ) //----------------------------------------------------------------------------- void LLVisualParam::clearNextParam() { - mNext = NULL; + mNext = nullptr; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/tests/lljoint_test.cpp b/indra/llcharacter/tests/lljoint_test.cpp index 5a813bac4a3..fa6822e6588 100644 --- a/indra/llcharacter/tests/lljoint_test.cpp +++ b/indra/llcharacter/tests/lljoint_test.cpp @@ -49,7 +49,7 @@ namespace tut { LLJoint lljoint; LLJoint* jnt = lljoint.getParent(); - ensure("getParent() failed ", (NULL == jnt)); + ensure("getParent() failed ", (nullptr == jnt)); ensure("getRoot() failed ", (&lljoint == lljoint.getRoot())); } @@ -181,14 +181,14 @@ namespace tut LLJoint lljoint3("child3"); lljoint.addChild(&lljoint3); - LLJoint* jnt = NULL; + LLJoint* jnt = nullptr; jnt = lljoint2.getParent(); ensure("addChild() failed ", (&lljoint == jnt)); LLJoint* jnt1 = lljoint.findJoint("child3"); ensure("findJoint() failed ", (&lljoint3 == jnt1)); lljoint.removeChild(&lljoint3); LLJoint* jnt2 = lljoint.findJoint("child3"); - ensure("removeChild() failed ", (NULL == jnt2)); + ensure("removeChild() failed ", (nullptr == jnt2)); lljointgp.addChild(&lljoint); ensure("GetParent() failed ", (&lljoint== lljoint2.getParent())); @@ -198,7 +198,7 @@ namespace tut lljointgp.removeAllChildren(); // parent removed from grandparent - so should not be able to locate child - ensure("removeAllChildren() failed ", (NULL == lljointgp.findJoint("child1"))); + ensure("removeAllChildren() failed ", (nullptr == lljointgp.findJoint("child1"))); // it should still exist in parent though ensure("removeAllChildren() failed ", (&lljoint1 == lljoint.findJoint("child1"))); } @@ -218,7 +218,7 @@ namespace tut llparent2.addChild(&lladoptedchild); ensure("1. addChild failed to remove prior parent", lladoptedchild.getParent() == &llparent2); - ensure("2. addChild failed to remove prior parent", llparent1.findJoint("child2") == NULL); + ensure("2. addChild failed to remove prior parent", llparent1.findJoint("child2") == nullptr); } From 1e2b51bbf4a0c265aa9ab6235718dd75667a8992 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 03:32:10 -0500 Subject: [PATCH 05/11] Replace legacy NULL with nullptr in llimage/llkdu/llimagej2coj --- .../llimage_libtest/llimage_libtest.cpp | 16 ++++----- indra/llimage/llimage.cpp | 24 ++++++------- indra/llimage/llimagebmp.cpp | 2 +- indra/llimage/llimagedimensionsinfo.cpp | 2 +- indra/llimage/llimagedxt.cpp | 2 +- indra/llimage/llimagefilter.cpp | 12 +++---- indra/llimage/llimagej2c.cpp | 10 +++--- indra/llimage/llimagej2c.h | 2 +- indra/llimage/llimagejpeg.cpp | 20 +++++------ indra/llimage/llimagepng.cpp | 2 +- indra/llimage/llimagetga.cpp | 4 +-- indra/llimage/llimageworker.cpp | 6 ++-- indra/llimage/llpngwrapper.cpp | 34 +++++++++---------- indra/llimage/llpngwrapper.h | 2 +- indra/llimage/tests/llimageworker_test.cpp | 20 +++++------ indra/llimagej2coj/llimagej2coj.h | 2 +- indra/llkdu/llimagej2ckdu.h | 4 +-- indra/llkdu/llkdumem.cpp | 22 ++++++------ indra/llkdu/tests/llimagej2ckdu_test.cpp | 32 ++++++++--------- 19 files changed, 109 insertions(+), 109 deletions(-) diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index b82ced2f8df..fdfe3434383 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -135,7 +135,7 @@ LLPointer load_image(const std::string &src_filename, int discard_le // Load the header if (!image->load(src_filename, 600)) { - return NULL; + return nullptr; } S32 h = ((LLImageJ2C*)(image.get()))->calcHeaderSize(); S32 d = (load_size > 0 ? ((LLImageJ2C*)(image.get()))->calcDiscardLevelBytes(load_size) : 0); @@ -153,7 +153,7 @@ LLPointer load_image(const std::string &src_filename, int discard_le // Load the requested byte range if (!image->load(src_filename, load_size)) { - return NULL; + return nullptr; } } else @@ -161,14 +161,14 @@ LLPointer load_image(const std::string &src_filename, int discard_le // This just loads the image file stream into a buffer. No decoding done. if (!image->load(src_filename)) { - return NULL; + return nullptr; } } if( (image->getComponents() != 3) && (image->getComponents() != 4) ) { std::cout << "Image files with less than 3 or more than 4 components are not supported\n"; - return NULL; + return nullptr; } if (output_stats) @@ -179,7 +179,7 @@ LLPointer load_image(const std::string &src_filename, int discard_le LLPointer raw_image = new LLImageRaw; // Set the image restriction on load in the case of a j2c image - if ((image->getCodec() == IMG_CODEC_J2C) && ((discard_level != -1) || (region != NULL))) + if ((image->getCodec() == IMG_CODEC_J2C) && ((discard_level != -1) || (region != nullptr))) { // That method doesn't exist (and likely, doesn't make sense) for any other image file format // hence the required cryptic cast. @@ -188,7 +188,7 @@ LLPointer load_image(const std::string &src_filename, int discard_le if (!image->decode(raw_image, 0.0f)) { - return NULL; + return nullptr; } return raw_image; @@ -356,7 +356,7 @@ int main(int argc, char** argv) // Other optional parsed arguments bool analyze_performance = false; bool image_stats = false; - int* region = NULL; + int* region = nullptr; int discard_level = -1; int load_size = 0; int precincts_size = -1; @@ -425,7 +425,7 @@ int main(int argc, char** argv) { std::cout << "--region arguments invalid" << std::endl; delete [] region; - region = NULL; + region = nullptr; } } else if (!strcmp(argv[arg], "--discard_level") || !strcmp(argv[arg], "-d")) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index ca8a4199e8e..cda9b543e58 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -618,8 +618,8 @@ void LLImage::setLastError(const std::string& message) // LLImageBase //--------------------------------------------------------------------------- -LLImageBase::LLImageBase() -: mData(NULL), +LLImageBase::LLImageBase() : + mData(nullptr), mDataSize(0), mWidth(0), mHeight(0), @@ -669,7 +669,7 @@ void LLImageBase::deleteData() { ll_aligned_free_16(mData); mDataSize = 0; - mData = NULL; + mData = nullptr; } // virtual @@ -721,7 +721,7 @@ U8* LLImageBase::allocateData(S32 size) if (mData) { deleteData(); // virtual - mData = NULL; + mData = nullptr; } } mDataSize = size; @@ -755,7 +755,7 @@ const U8* LLImageBase::getData() const if(mBadBufferAllocation) { LL_WARNS() << "Bad memory allocation for the image buffer!" << LL_ENDL ; - return NULL; + return nullptr; } return mData; @@ -766,7 +766,7 @@ U8* LLImageBase::getData() if(mBadBufferAllocation) { LL_WARNS() << "Bad memory allocation for the image buffer!" << LL_ENDL; - return NULL; + return nullptr; } return mData; @@ -774,7 +774,7 @@ U8* LLImageBase::getData() bool LLImageBase::isBufferInvalid() const { - return mBadBufferAllocation || mData == NULL; + return mBadBufferAllocation || mData == nullptr; } void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents) @@ -1614,7 +1614,7 @@ bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data ) if (new_data_size > 0) { U8 *new_data = (U8*)ll_aligned_malloc_16(new_data_size); - if(NULL == new_data) + if(nullptr == new_data) { return false; } @@ -2144,7 +2144,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip success = image->decode(this, 100000.0f); } - image = NULL; // deletes image + image = nullptr; // deletes image if (!success) { deleteData(); @@ -2224,7 +2224,7 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) image = new LLImageDXT(); break; default: - image = NULL; + image = nullptr; break; } return image; @@ -2279,7 +2279,7 @@ LLImageFormatted* LLImageFormatted::loadFromMemory(const U8* data_in, U32 size, if (!image->updateData()) { delete image; - image = NULL; + image = nullptr; } } return image; @@ -2472,7 +2472,7 @@ bool LLImageFormatted::load(const std::string &filename, int load_size) S32 file_size = 0; LLAPRFile infile ; - infile.open(filename, LL_APR_RB, NULL, &file_size); + infile.open(filename, LL_APR_RB, nullptr, &file_size); apr_file_t* apr_file = infile.getFileHandle(); if (!apr_file) { diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index c8f99380eae..080b9b0e6c0 100644 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp @@ -75,7 +75,7 @@ LLImageBMP::LLImageBMP() : LLImageFormatted(IMG_CODEC_BMP), mColorPaletteColors( 0 ), - mColorPalette( NULL ), + mColorPalette( nullptr ), mBitmapOffset( 0 ), mBitsPerPixel( 0 ), mOriginAtTop( false ) diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c896d60c852..f45a32c9c10 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -40,7 +40,7 @@ bool LLImageDimensionsInfo::load(const std::string& src_filename,U32 codec) mSrcFilename = src_filename; S32 file_size = 0; - apr_status_t s = mInfile.open(src_filename, LL_APR_RB, NULL, &file_size); + apr_status_t s = mInfile.open(src_filename, LL_APR_RB, nullptr, &file_size); if (s != APR_SUCCESS) { diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index c3fd0c5aa87..b5411e75d91 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -276,7 +276,7 @@ bool LLImageDXT::decode(LLImageRaw* raw_image, F32 time) S32 width = getWidth(), height = getHeight(); S32 ncomponents = getComponents(); - U8* data = NULL; + U8* data = nullptr; if (mDiscardLevel >= 0) { data = getData() + getMipOffset(mDiscardLevel); diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp index bfcb1f76de2..640d47142e9 100644 --- a/indra/llimage/llimagefilter.cpp +++ b/indra/llimage/llimagefilter.cpp @@ -42,11 +42,11 @@ LLImageFilter::LLImageFilter(const std::string& file_path) : mFilterData(LLSD::emptyArray()), - mImage(NULL), - mHistoRed(NULL), - mHistoGreen(NULL), - mHistoBlue(NULL), - mHistoBrightness(NULL), + mImage(nullptr), + mHistoRed(nullptr), + mHistoGreen(nullptr), + mHistoBlue(nullptr), + mHistoBrightness(nullptr), mStencilBlendMode(STENCIL_BLEND_MODE_BLEND), mStencilShape(STENCIL_SHAPE_UNIFORM), mStencilGamma(1.0), @@ -66,7 +66,7 @@ LLImageFilter::LLImageFilter(const std::string& file_path) : LLImageFilter::~LLImageFilter() { - mImage = NULL; + mImage = nullptr; ll_aligned_free_16(mHistoRed); ll_aligned_free_16(mHistoGreen); ll_aligned_free_16(mHistoBlue); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5a941dc958c..c2c1e0b17ab 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -39,7 +39,7 @@ LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); // Test data gathering handle -LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ; +LLImageCompressionTester* LLImageJ2C::sTesterp = nullptr ; const std::string sTesterName("ImageCompressionTester"); //static @@ -73,7 +73,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), if (!sTesterp->isValid()) { delete sTesterp; - sTesterp = NULL; + sTesterp = nullptr; } } } @@ -227,7 +227,7 @@ bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) { - return encode(raw_imagep, NULL, encode_time); + return encode(raw_imagep, nullptr, encode_time); } @@ -367,7 +367,7 @@ bool LLImageJ2C::loadAndValidate(const std::string &filename) S32 file_size = 0; LLAPRFile infile ; - infile.open(filename, LL_APR_RB, NULL, &file_size); + infile.open(filename, LL_APR_RB, nullptr, &file_size); apr_file_t* apr_file = infile.getFileHandle() ; if (!apr_file) { @@ -494,7 +494,7 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester LLImageCompressionTester::~LLImageCompressionTester() { outputTestResults(); - LLImageJ2C::sTesterp = NULL; + LLImageJ2C::sTesterp = nullptr; } //virtual diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 19744a7f87b..e923722e9b4 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -121,7 +121,7 @@ class LLImageJ2CImpl virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0; virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, bool reversible=false) = 0; - virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0; + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = nullptr) = 0; virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0) = 0; virtual std::string getEngineInfo() const = 0; diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index ab6c593fc2d..96e2cc8a80d 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -36,7 +36,7 @@ jmp_buf LLImageJPEG::sSetjmpBuffer ; #endif LLImageJPEG::LLImageJPEG(S32 quality) : LLImageFormatted(IMG_CODEC_JPEG), - mOutputBuffer( NULL ), + mOutputBuffer( nullptr ), mOutputBufferSize( 0 ), mEncodeQuality( quality ) // on a scale from 1 to 100 { @@ -97,7 +97,7 @@ bool LLImageJPEG::updateData() //////////////////////////////////////// // Step 2: specify data source // (Code is modified version of jpeg_stdio_src(); - if (cinfo.src == NULL) + if (cinfo.src == nullptr) { cinfo.src = (struct jpeg_source_mgr *) (*cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_PERMANENT, @@ -207,7 +207,7 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) } S32 row_stride = 0; - U8* raw_image_data = NULL; + U8* raw_image_data = nullptr; //////////////////////////////////////// // Step 1: allocate and initialize JPEG decompression object @@ -243,7 +243,7 @@ bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) //////////////////////////////////////// // Step 2: specify data source // (Code is modified version of jpeg_stdio_src(); - if (cinfo.src == NULL) + if (cinfo.src == nullptr) { cinfo.src = (struct jpeg_source_mgr *) (*cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_PERMANENT, @@ -525,14 +525,14 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) delete[] mOutputBuffer; mOutputBufferSize = getWidth() * getHeight() * getComponents() + 1024; mOutputBuffer = new(std::nothrow) U8[ mOutputBufferSize ]; - if (mOutputBuffer == NULL) + if (mOutputBuffer == nullptr) { mOutputBufferSize = 0; setLastError("Failed to allocate output buffer"); return false; } - const U8* raw_image_data = NULL; + const U8* raw_image_data = nullptr; S32 row_stride = 0; //////////////////////////////////////// @@ -566,7 +566,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // We need to clean up the JPEG object, close the input file, and return. jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; - mOutputBuffer = NULL; + mOutputBuffer = nullptr; mOutputBufferSize = 0; return false; } @@ -580,7 +580,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) //////////////////////////////////////// // Step 2: specify data destination // (code is a modified form of jpeg_stdio_dest() ) - if( cinfo.dest == NULL) + if( cinfo.dest == nullptr) { cinfo.dest = (struct jpeg_destination_mgr *) (*cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_PERMANENT, @@ -668,7 +668,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // After finish_compress, we can release the temp output buffer. delete[] mOutputBuffer; - mOutputBuffer = NULL; + mOutputBuffer = nullptr; mOutputBufferSize = 0; //////////////////////////////////////// @@ -680,7 +680,7 @@ bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) { jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; - mOutputBuffer = NULL; + mOutputBuffer = nullptr; mOutputBufferSize = 0; return false; } diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index d75084cf087..1237700ba18 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -72,7 +72,7 @@ bool LLImagePNG::updateData() } LLPngWrapper::ImageInfo infop; - if (!pngWrapper.readPng(getData(), getDataSize(), NULL, &infop)) + if (!pngWrapper.readPng(getData(), getDataSize(), nullptr, &infop)) { setLastError(pngWrapper.getErrorMessage()); return false; diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index 25232b77aa5..078a10f616f 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -57,7 +57,7 @@ inline void LLImageTGA::decodeTruecolorPixel15( U8* dst, const U8* src ) LLImageTGA::LLImageTGA() : LLImageFormatted(IMG_CODEC_TGA), - mColorMap( NULL ), + mColorMap( nullptr ), mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), @@ -90,7 +90,7 @@ LLImageTGA::LLImageTGA() LLImageTGA::LLImageTGA(const std::string& file_name) : LLImageFormatted(IMG_CODEC_TGA), - mColorMap( NULL ), + mColorMap( nullptr ), mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 46ab6a441eb..20b82ffe82f 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -145,9 +145,9 @@ ImageRequest::ImageRequest(const LLPointer& image, ImageRequest::~ImageRequest() { - mDecodedImageRaw = NULL; - mDecodedImageAux = NULL; - mFormattedImage = NULL; + mDecodedImageRaw = nullptr; + mDecodedImageAux = nullptr; + mFormattedImage = nullptr; } //---------------------------------------------------------------------------- diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index 79c201b1f41..cc910c86664 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -46,11 +46,11 @@ struct PngError: public LLContinueError // --------------------------------------------------------------------------- LLPngWrapper::LLPngWrapper() - : mReadPngPtr( NULL ), - mReadInfoPtr( NULL ), - mWritePngPtr( NULL ), - mWriteInfoPtr( NULL ), - mRowPointers( NULL ), + : mReadPngPtr( nullptr ), + mReadInfoPtr( nullptr ), + mWritePngPtr( nullptr ), + mWriteInfoPtr( nullptr ), + mRowPointers( nullptr ), mWidth( 0 ), mHeight( 0 ), mBitDepth( 0 ), @@ -140,8 +140,8 @@ bool LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf { // Create and initialize the png structures mReadPngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, - this, &errorHandler, NULL); - if (mReadPngPtr == NULL) + this, &errorHandler, nullptr); + if (mReadPngPtr == nullptr) { LLTHROW(PngError("Problem creating png read structure")); } @@ -171,7 +171,7 @@ bool LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf // If a raw object is supplied, read the PNG image into its // data space - if (rawImage != NULL) + if (rawImage != nullptr) { LLImageDataLock lock(rawImage); @@ -193,11 +193,11 @@ bool LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInf png_read_image(mReadPngPtr, mRowPointers); // Finish up, ensures all metadata are updated - png_read_end(mReadPngPtr, NULL); + png_read_end(mReadPngPtr, nullptr); } // If an info object is supplied, copy the relevant info - if (infop != NULL) + if (infop != nullptr) { infop->mHeight = static_cast(mHeight); infop->mWidth = static_cast(mWidth); @@ -319,7 +319,7 @@ bool LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest, size_t destSiz } mWritePngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - NULL, &errorHandler, NULL); + nullptr, &errorHandler, nullptr); if (!mWritePngPtr) { LLTHROW(PngError("Problem creating png write structure")); @@ -383,22 +383,22 @@ void LLPngWrapper::releaseResources() { if (mReadPngPtr || mReadInfoPtr) { - png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, NULL); - mReadPngPtr = NULL; - mReadInfoPtr = NULL; + png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, nullptr); + mReadPngPtr = nullptr; + mReadInfoPtr = nullptr; } if (mWritePngPtr || mWriteInfoPtr) { png_destroy_write_struct(&mWritePngPtr, &mWriteInfoPtr); - mWritePngPtr = NULL; - mWriteInfoPtr = NULL; + mWritePngPtr = nullptr; + mWriteInfoPtr = nullptr; } if (mRowPointers) { delete[] mRowPointers; - mRowPointers = NULL; + mRowPointers = nullptr; } } diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index 3ada8ac7c2c..c9308ebd860 100644 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -44,7 +44,7 @@ class LLPngWrapper }; bool isValidPng(U8* src); - bool readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = NULL); + bool readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = nullptr); bool writePng(const LLImageRaw* rawImage, U8* dst, size_t destSize); U32 getFinalSize(); const std::string& getErrorMessage(); diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index 36be8859127..6dff658f5c7 100644 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp @@ -45,7 +45,7 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. LLImageBase::LLImageBase() -: mData(NULL), +: mData(nullptr), mDataSize(0), mWidth(0), mHeight(0), @@ -58,16 +58,16 @@ LLImageBase::~LLImageBase() {} void LLImageBase::dump() { } void LLImageBase::sanityCheck() { } void LLImageBase::deleteData() { } -U8* LLImageBase::allocateData(S32 size) { return NULL; } -U8* LLImageBase::reallocateData(S32 size) { return NULL; } +U8* LLImageBase::allocateData(S32 size) { return nullptr; } +U8* LLImageBase::reallocateData(S32 size) { return nullptr; } LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) { } LLImageRaw::~LLImageRaw() { } void LLImageRaw::deleteData() { } -U8* LLImageRaw::allocateData(S32 size) { return NULL; } -U8* LLImageRaw::reallocateData(S32 size) { return NULL; } -const U8* LLImageBase::getData() const { return NULL; } -U8* LLImageBase::getData() { return NULL; } +U8* LLImageRaw::allocateData(S32 size) { return nullptr; } +U8* LLImageRaw::reallocateData(S32 size) { return nullptr; } +const U8* LLImageBase::getData() const { return nullptr; } +U8* LLImageBase::getData() { return nullptr; } const std::string& LLImage::getLastThreadError() { static std::string msg; return msg; } // End Stubbing @@ -118,7 +118,7 @@ namespace tut // Constructor and destructor of the test wrapper imagedecodethread_test() { - mThread = NULL; + mThread = nullptr; } ~imagedecodethread_test() { @@ -148,10 +148,10 @@ namespace tut { // Test a *threaded* instance of the class mThread = new LLImageDecodeThread(true); - ensure("LLImageDecodeThread: threaded constructor failed", mThread != NULL); + ensure("LLImageDecodeThread: threaded constructor failed", mThread != nullptr); // Insert something in the queue bool done = false; - LLImageDecodeThread::handle_t decodeHandle = mThread->decodeImage(NULL, 0, false, new responder_test(&done)); + LLImageDecodeThread::handle_t decodeHandle = mThread->decodeImage(nullptr, 0, false, new responder_test(&done)); // Verifies we get back a valid handle ensure("LLImageDecodeThread: threaded decodeImage(), returned handle is null", decodeHandle != 0); // Wait till the thread has time to handle the work order (though it doesn't do much per work order...) diff --git a/indra/llimagej2coj/llimagej2coj.h b/indra/llimagej2coj/llimagej2coj.h index da495973023..f8c0130ecc7 100644 --- a/indra/llimagej2coj/llimagej2coj.h +++ b/indra/llimagej2coj/llimagej2coj.h @@ -41,7 +41,7 @@ class LLImageJ2COJ : public LLImageJ2CImpl virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, bool reversible = false); - virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = nullptr); virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); virtual std::string getEngineInfo() const; }; diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h index c9aa0c52508..54d094abff1 100644 --- a/indra/llkdu/llimagej2ckdu.h +++ b/indra/llkdu/llimagej2ckdu.h @@ -64,12 +64,12 @@ class LLImageJ2CKDU : public LLImageJ2CImpl virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, bool reversible=false); - virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = nullptr); virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); virtual std::string getEngineInfo() const; private: - bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL); + bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = nullptr); void setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode); void cleanupCodeStream(); diff --git a/indra/llkdu/llkdumem.cpp b/indra/llkdu/llkdumem.cpp index 04ab0330930..1ba45acb0c6 100644 --- a/indra/llkdu/llkdumem.cpp +++ b/indra/llkdu/llkdumem.cpp @@ -62,8 +62,8 @@ LLKDUMemIn::LLKDUMemIn(const U8 *data, siz->set(Ssigned,n,0,false); siz->set(Sprecision,n,0,8); } - incomplete_lines = NULL; - free_lines = NULL; + incomplete_lines = nullptr; + free_lines = nullptr; num_unread_rows = rows; mData = data; @@ -73,7 +73,7 @@ LLKDUMemIn::LLKDUMemIn(const U8 *data, LLKDUMemIn::~LLKDUMemIn() { - if ((num_unread_rows > 0) || (incomplete_lines != NULL)) + if ((num_unread_rows > 0) || (incomplete_lines != nullptr)) { kdu_warning w; w << "Not all rows of image components " @@ -82,12 +82,12 @@ LLKDUMemIn::~LLKDUMemIn() << " were consumed!"; } image_line_buf *tmp; - while ((tmp=incomplete_lines) != NULL) + while ((tmp=incomplete_lines) != nullptr) { incomplete_lines = tmp->next; delete tmp; } - while ((tmp=free_lines) != NULL) + while ((tmp=free_lines) != nullptr) { free_lines = tmp->next; delete tmp; @@ -100,8 +100,8 @@ bool LLKDUMemIn::get(int comp_idx, kdu_line_buf &line, int x_tnum) int idx = comp_idx - this->first_comp_idx; assert((idx >= 0) && (idx < num_components)); x_tnum = x_tnum*num_components+idx; - image_line_buf *scan, *prev=NULL; - for (scan = incomplete_lines; scan != NULL; prev = scan, scan = scan->next) + image_line_buf *scan, *prev=nullptr; + for (scan = incomplete_lines; scan != nullptr; prev = scan, scan = scan->next) { assert(scan->next_x_tnum >= x_tnum); if (scan->next_x_tnum == x_tnum) @@ -109,19 +109,19 @@ bool LLKDUMemIn::get(int comp_idx, kdu_line_buf &line, int x_tnum) break; } } - if (scan == NULL) + if (scan == nullptr) { // Need to read a new image line. assert(x_tnum == 0); // Must consume in very specific order. if (num_unread_rows == 0) { return false; } - if ((scan = free_lines) == NULL) + if ((scan = free_lines) == nullptr) { scan = new image_line_buf(cols+3,num_components); } free_lines = scan->next; - if (prev == NULL) + if (prev == nullptr) { incomplete_lines = scan; } @@ -145,7 +145,7 @@ bool LLKDUMemIn::get(int comp_idx, kdu_line_buf &line, int x_tnum) kdu_byte *sp = scan->buf+num_components*scan->accessed_samples + comp_offset; int n=line.get_width(); - if (line.get_buf32() != NULL) + if (line.get_buf32() != nullptr) { kdu_sample32 *dp = line.get_buf32(); if (line.is_absolute()) diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 09425fc001f..e15c993179b 100644 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -57,13 +57,13 @@ LLImageRaw::LLImageRaw() { } LLImageRaw::~LLImageRaw() { } -U8* LLImageRaw::allocateData(S32 ) { return NULL; } +U8* LLImageRaw::allocateData(S32 ) { return nullptr; } void LLImageRaw::deleteData() { } -U8* LLImageRaw::reallocateData(S32 ) { return NULL; } +U8* LLImageRaw::reallocateData(S32 ) { return nullptr; } bool LLImageRaw::resize(U16, U16, S8) { return true; } // this method always returns true... LLImageBase::LLImageBase() -: mData(NULL), +: mData(nullptr), mDataSize(0), mWidth(0), mHeight(0), @@ -72,12 +72,12 @@ mBadBufferAllocation(false), mAllowOverSize(false) { } LLImageBase::~LLImageBase() { } -U8* LLImageBase::allocateData(S32 ) { return NULL; } +U8* LLImageBase::allocateData(S32 ) { return nullptr; } void LLImageBase::deleteData() { } void LLImageBase::dump() { } -const U8* LLImageBase::getData() const { return NULL; } -U8* LLImageBase::getData() { return NULL; } -U8* LLImageBase::reallocateData(S32 ) { return NULL; } +const U8* LLImageBase::getData() const { return nullptr; } +U8* LLImageBase::getData() { return nullptr; } +U8* LLImageBase::reallocateData(S32 ) { return nullptr; } void LLImageBase::sanityCheck() { } void LLImageBase::setSize(S32 , S32 , S32 ) { } bool LLImageBase::isBufferInvalid() const { return false; } @@ -86,14 +86,14 @@ LLImageJ2CImpl::~LLImageJ2CImpl() { } LLImageFormatted::LLImageFormatted(S8 ) { } LLImageFormatted::~LLImageFormatted() { } -U8* LLImageFormatted::allocateData(S32 ) { return NULL; } +U8* LLImageFormatted::allocateData(S32 ) { return nullptr; } S32 LLImageFormatted::calcDataSize(S32 ) { return 0; } S32 LLImageFormatted::calcDiscardLevelBytes(S32 ) { return 0; } bool LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return false; } bool LLImageFormatted::copyData(U8 *, S32) { return true; } // this method always returns true... void LLImageFormatted::deleteData() { } void LLImageFormatted::dump() { } -U8* LLImageFormatted::reallocateData(S32 ) { return NULL; } +U8* LLImageFormatted::reallocateData(S32 ) { return nullptr; } void LLImageFormatted::resetLastError() { } void LLImageFormatted::sanityCheck() { } void LLImageFormatted::setLastError(const std::string& , const std::string& ) { } @@ -157,8 +157,8 @@ bool kdu_params::parse_string(const char*) { return false; } bool kdu_params::get(const char*, int, int, bool&, bool, bool, bool) { return false; } bool kdu_params::get(const char*, int, int, float&, bool, bool, bool) { return false; } bool kdu_params::get(const char*, int, int, int&, bool, bool, bool) { return false; } -kdu_params* kdu_params::access_relation(int, int, int, bool) { return NULL; } -kdu_params* kdu_params::access_cluster(const char*) { return NULL; } +kdu_params* kdu_params::access_relation(int, int, int, bool) { return nullptr; } +kdu_params* kdu_params::access_cluster(const char*) { return nullptr; } void kdu_codestream::set_fast() { } void kdu_codestream::set_fussy() { } void kdu_codestream::get_dims(int, kdu_dims&, bool ) const { } @@ -190,13 +190,13 @@ void kdu_codestream::share_buffering(kdu_codestream ) { } int kdu_codestream::get_num_tparts() const { return 0; } int kdu_codestream::trans_out(kdu_long, kdu_long*, int, bool, kdu_thread_env* ) { return 0; } bool kdu_codestream::ready_for_flush(kdu_thread_env*) { return false; } -siz_params* kdu_codestream::access_siz() { return NULL; } +siz_params* kdu_codestream::access_siz() { return nullptr; } kdu_tile kdu_codestream::open_tile(kdu_coords , kdu_thread_env* ) { kdu_tile a; return a; } kdu_codestream_comment kdu_codestream::add_comment(kdu_thread_env*) { kdu_codestream_comment a; return a; } kdu_codestream_comment kdu_codestream::get_comment(kdu_codestream_comment) { kdu_codestream_comment a; return a; }; void kdu_subband::close_block(kdu_block*, kdu_thread_env*) { } void kdu_subband::get_valid_blocks(kdu_dims &indices) const { } -kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return NULL; } +kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return nullptr; } bool kdu_codestream_comment::put_text(const char*) { return false; } const char *kdu_codestream_comment::get_text() { return nullptr; }; void kdu_customize_warnings(kdu_message*) { } @@ -213,8 +213,8 @@ kdu_long kdu_multi_analysis::create( const kdu_push_pull_params*, kdu_membroker*) { return kdu_long(0); } void kdu_multi_analysis::destroy(kdu_thread_env *) {} -siz_params::siz_params() : kdu_params(NULL, false, false, false, false, false) { } -siz_params::siz_params(kd_core_local::kd_coremem*) : kdu_params(NULL, false, false, false, false, false) { } +siz_params::siz_params() : kdu_params(nullptr, false, false, false, false, false) { } +siz_params::siz_params(kd_core_local::kd_coremem*) : kdu_params(nullptr, false, false, false, false, false) { } siz_params::~siz_params() {} void siz_params::finalize(bool ) { } void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { } @@ -320,7 +320,7 @@ namespace tut { LLImageJ2C* image = new LLImageJ2C(); LLImageRaw* raw = new LLImageRaw(); - bool res = mImage->callEncodeImpl(*image, *raw, NULL); + bool res = mImage->callEncodeImpl(*image, *raw, nullptr); // Encoding returns true unless an exception was raised, so we'll get true here though nothing really was done ensure("encodeImpl() test failed", res); } From 4d89a0a75b8a288a29350cedd8e756f4bdeaf4e6 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 03:31:55 -0500 Subject: [PATCH 06/11] Replace legacy NULL with nullptr in llfilesystem llinventory llmath llmeshoptimizer llphysicsextensionsos and test --- .../llimage_libtest/llimage_libtest.cpp | 2 +- .../llui_libtest/llui_libtest.cpp | 2 +- indra/llfilesystem/lldir_linux.cpp | 10 +- indra/llfilesystem/lldir_mac.cpp | 10 +- indra/llfilesystem/lldir_win32.cpp | 14 +- indra/llfilesystem/lllfsthread.cpp | 12 +- indra/llfilesystem/tests/lldir_test.cpp | 2 +- indra/llinventory/llcategory.cpp | 2 +- indra/llinventory/lllandmark.cpp | 2 +- indra/llinventory/llparcel.cpp | 2 +- indra/llinventory/llsaleinfo.cpp | 2 +- .../llinventory/tests/inventorymisc_test.cpp | 6 +- indra/llmath/llcalc.cpp | 4 +- indra/llmath/llcamera.h | 4 +- indra/llmath/lloctree.h | 12 +- indra/llmath/llquaternion.cpp | 4 +- indra/llmath/llrigginginfo.cpp | 4 +- indra/llmath/lltreenode.h | 2 +- indra/llmath/llvolume.cpp | 132 +++++++++--------- indra/llmath/llvolumemgr.cpp | 10 +- indra/llmath/llvolumeoctree.cpp | 8 +- indra/llmath/xform.h | 2 +- indra/llmeshoptimizer/llmeshoptimizer.cpp | 2 +- indra/llmeshoptimizer/llmeshoptimizer.h | 4 +- .../LLPathingLibStubImpl.cpp | 2 +- indra/llphysicsextensionsos/llpathinglib.cpp | 2 +- .../llphysicsextensions.cpp | 2 +- indra/test/io.cpp | 46 +++--- indra/test/llbuffer_tut.cpp | 12 +- indra/test/llhttpdate_tut.cpp | 6 +- indra/test/llhttpnode_tut.cpp | 20 +-- indra/test/lliohttpserver_tut.cpp | 10 +- indra/test/llmessagetemplateparser_tut.cpp | 4 +- indra/test/llsd_new_tut.cpp | 4 +- indra/test/llsdmessagebuilder_tut.cpp | 4 +- indra/test/lltemplatemessagebuilder_tut.cpp | 2 +- indra/test/lltut.h | 4 +- indra/test/llxorcipher_tut.cpp | 6 +- indra/test/message_tut.cpp | 4 +- indra/test/mock_http_client.h | 4 +- indra/test/test.cpp | 8 +- 41 files changed, 197 insertions(+), 197 deletions(-) diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index fdfe3434383..6b1897e8282 100644 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -368,7 +368,7 @@ int main(int argc, char** argv) // Init whatever is necessary ll_init_apr(); LLImage::initClass(); - LogThread* fast_timer_log_thread = NULL; // For performance and metric gathering + LogThread* fast_timer_log_thread = nullptr; // For performance and metric gathering // Analyze command line arguments for (int arg = 1; arg < argc; ++arg) diff --git a/indra/integration_tests/llui_libtest/llui_libtest.cpp b/indra/integration_tests/llui_libtest/llui_libtest.cpp index efb9c47a916..c83609f1ea1 100644 --- a/indra/integration_tests/llui_libtest/llui_libtest.cpp +++ b/indra/integration_tests/llui_libtest/llui_libtest.cpp @@ -59,7 +59,7 @@ class TestUIImage : public LLUIImage { public: TestUIImage() - : LLUIImage( std::string(), NULL ) // NULL ImageGL, don't deref! + : LLUIImage( std::string(), nullptr ) // NULL ImageGL, don't deref! { } /*virtual*/ S32 getWidth() const diff --git a/indra/llfilesystem/lldir_linux.cpp b/indra/llfilesystem/lldir_linux.cpp index b13b42c954d..d53f908efc3 100644 --- a/indra/llfilesystem/lldir_linux.cpp +++ b/indra/llfilesystem/lldir_linux.cpp @@ -43,7 +43,7 @@ static std::string getCurrentUserHome(char* fallback) struct passwd *pw; pw = getpwuid(uid); - if ((pw != NULL) && (pw->pw_dir != NULL)) + if ((pw != nullptr) && (pw->pw_dir != nullptr)) { return pw->pw_dir; } @@ -67,10 +67,10 @@ LLDir_Linux::LLDir_Linux() mDirDelimiter = "/"; mCurrentDirIndex = -1; mCurrentDirCount = -1; - mDirp = NULL; + mDirp = nullptr; char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - if (getcwd(tmp_str, LL_MAX_PATH) == NULL) + if (getcwd(tmp_str, LL_MAX_PATH) == nullptr) { strcpy(tmp_str, "/tmp"); LL_WARNS() << "Could not get current directory; changing to " @@ -217,7 +217,7 @@ U32 LLDir_Linux::countFilesInDir(const std::string &dirname, const std::string & tmp_str = dirname; tmp_str += mask; - if(glob(tmp_str.c_str(), GLOB_NOSORT, NULL, &g) == 0) + if(glob(tmp_str.c_str(), GLOB_NOSORT, nullptr, &g) == 0) { file_count = g.gl_pathc; @@ -230,7 +230,7 @@ U32 LLDir_Linux::countFilesInDir(const std::string &dirname, const std::string & std::string LLDir_Linux::getCurPath() { char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ - if (getcwd(tmp_str, LL_MAX_PATH) == NULL) + if (getcwd(tmp_str, LL_MAX_PATH) == nullptr) { LL_WARNS() << "Could not get current directory" << LL_ENDL; tmp_str[0] = '\0'; diff --git a/indra/llfilesystem/lldir_mac.cpp b/indra/llfilesystem/lldir_mac.cpp index 2db1b6ec5d4..c17a07dfb81 100644 --- a/indra/llfilesystem/lldir_mac.cpp +++ b/indra/llfilesystem/lldir_mac.cpp @@ -121,10 +121,10 @@ LLDir_Mac::LLDir_Mac() mOSUserDir = rootdir; // Create our sub-dirs - CreateDirectory(rootdir, std::string("data"), NULL); - CreateDirectory(rootdir, std::string("logs"), NULL); - CreateDirectory(rootdir, std::string("user_settings"), NULL); - CreateDirectory(rootdir, std::string("browser_profile"), NULL); + CreateDirectory(rootdir, std::string("data"), nullptr); + CreateDirectory(rootdir, std::string("logs"), nullptr); + CreateDirectory(rootdir, std::string("user_settings"), nullptr); + CreateDirectory(rootdir, std::string("browser_profile"), nullptr); } //mOSCacheDir @@ -133,7 +133,7 @@ LLDir_Mac::LLDir_Mac() { mOSCacheDir = cachedir; //TODO: This changes from ~/Library/Cache/Secondlife to ~/Library/Cache/com.app.secondlife/Secondlife. Last dir level could go away. - CreateDirectory(mOSCacheDir, secondLifeString, NULL); + CreateDirectory(mOSCacheDir, secondLifeString, nullptr); } // mOSUserAppDir diff --git a/indra/llfilesystem/lldir_win32.cpp b/indra/llfilesystem/lldir_win32.cpp index 9624b1197f6..e548e41d260 100644 --- a/indra/llfilesystem/lldir_win32.cpp +++ b/indra/llfilesystem/lldir_win32.cpp @@ -113,9 +113,9 @@ LLDir_Win32::LLDir_Win32() if (mOSUserDir.empty() || ! fileExists(mOSUserDir)) { PRELOG("APPDATA does not exist"); - //HRESULT okay = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, w_str); - wchar_t *pwstr = NULL; - HRESULT okay = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &pwstr); + //HRESULT okay = SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, 0, w_str); + wchar_t* pwstr = nullptr; + HRESULT okay = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pwstr); PRELOG("SHGetKnownFolderPath(FOLDERID_RoamingAppData) returned " << okay); if (SUCCEEDED(okay) && pwstr) { @@ -149,9 +149,9 @@ LLDir_Win32::LLDir_Win32() if (mOSCacheDir.empty() || ! fileExists(mOSCacheDir)) { PRELOG("LOCALAPPDATA does not exist"); - //HRESULT okay = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, w_str); - wchar_t *pwstr = NULL; - HRESULT okay = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pwstr); + //HRESULT okay = SHGetFolderPath(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, w_str); + wchar_t* pwstr = nullptr; + HRESULT okay = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pwstr); PRELOG("SHGetKnownFolderPath(FOLDERID_LocalAppData) returned " << okay); if (SUCCEEDED(okay) && pwstr) { @@ -228,7 +228,7 @@ LLDir_Win32::LLDir_Win32() mWorkingDir = ll_convert(std::wstring(w_str)); // Set the executable directory - S32 size = GetModuleFileName(NULL, w_str, MAX_PATH); + S32 size = GetModuleFileName(nullptr, w_str, MAX_PATH); if (size) { w_str[size] = '\0'; diff --git a/indra/llfilesystem/lllfsthread.cpp b/indra/llfilesystem/lllfsthread.cpp index 6a882f64a85..dc21f83d68b 100644 --- a/indra/llfilesystem/lllfsthread.cpp +++ b/indra/llfilesystem/lllfsthread.cpp @@ -31,14 +31,14 @@ //============================================================================ -/*static*/ LLLFSThread* LLLFSThread::sLocal = NULL; +/*static*/ LLLFSThread* LLLFSThread::sLocal = nullptr; //============================================================================ // Run on MAIN thread //static void LLLFSThread::initClass(bool local_is_threaded) { - llassert(sLocal == NULL); + llassert(sLocal == nullptr); sLocal = new LLLFSThread(local_is_threaded); } @@ -51,7 +51,7 @@ S32 LLLFSThread::updateClass(U32 ms_elapsed) //static void LLLFSThread::cleanupClass() { - llassert(sLocal != NULL); + llassert(sLocal != nullptr); sLocal->setQuitting(); while (sLocal->getPending()) { @@ -59,7 +59,7 @@ void LLLFSThread::cleanupClass() } sLocal->shutdown(); delete sLocal; - sLocal = NULL; + sLocal = nullptr; } //---------------------------------------------------------------------------- @@ -157,7 +157,7 @@ void LLLFSThread::Request::finishRequest(bool completed) if (mResponder.notNull()) { mResponder->completed(completed ? mBytesRead : 0); - mResponder = NULL; + mResponder = nullptr; } } @@ -171,7 +171,7 @@ void LLLFSThread::Request::deleteRequest() if (mResponder.notNull()) { mResponder->completed(0); - mResponder = NULL; + mResponder = nullptr; } LLQueuedThread::QueuedRequest::deleteRequest(); } diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index a2104d1ef9a..fce956fa753 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -406,7 +406,7 @@ namespace tut { std::string path = dir + file; LLFILE* handle = LLFile::fopen( path, "w" ); - ensure("failed to open test file '"+path+"'", handle != NULL ); + ensure("failed to open test file '" + path + "'", handle != nullptr); // Harbison & Steele, 4th ed., p. 366: "If an error occurs, fputs // returns EOF; otherwise, it returns some other, nonnegative value." ensure("failed to write to test file '"+path+"'", EOF != fputs("test file", handle) ); diff --git a/indra/llinventory/llcategory.cpp b/indra/llinventory/llcategory.cpp index 26b3ee76c28..e09d092a5d4 100644 --- a/indra/llinventory/llcategory.cpp +++ b/indra/llinventory/llcategory.cpp @@ -66,7 +66,7 @@ const char* CATEGORY_NAME[] = "Sound", "Landmark", "Component", // object - NULL + nullptr }; ///---------------------------------------------------------------------------- diff --git a/indra/llinventory/lllandmark.cpp b/indra/llinventory/lllandmark.cpp index bfc0a4f5113..b30b99ce8a8 100644 --- a/indra/llinventory/lllandmark.cpp +++ b/indra/llinventory/lllandmark.cpp @@ -111,7 +111,7 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer, const S32 buffer U32 version = 0; bool bad_block = false; - LLLandmark* result = NULL; + LLLandmark* result = nullptr; // read version count = sscanf( buffer, "Landmark version %u\n%n", &version, &chars_read ); diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 71dc8cff346..bfdd135e098 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -996,7 +996,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, bool is_buyer_group) mSaleTimerExpires.start(); mSaleTimerExpires.setTimerExpirySec(U64Microseconds(DEFAULT_USEC_SALE_TIMEOUT)); mStatus = OS_LEASE_PENDING; - mClaimDate = time(NULL); + mClaimDate = time(nullptr); setAuctionID(0); // clear the autoreturn whenever land changes hands setCleanOtherTime(0); diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index b4d64bb4fb6..0b0c632e990 100644 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -263,7 +263,7 @@ const char* LLSaleInfo::lookup(EForSale type) } else { - return NULL; + return nullptr; } } diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp index f11a4c3bf71..2781f7ca1cd 100644 --- a/indra/llinventory/tests/inventorymisc_test.cpp +++ b/indra/llinventory/tests/inventorymisc_test.cpp @@ -89,7 +89,7 @@ LLPointer create_random_inventory_item() S32 price = rand(); LLSaleInfo sale_info(LLSaleInfo::FS_COPY, price); U32 flags = rand(); - S32 creation = (S32)time(NULL); + S32 creation = (S32)time(nullptr); LLPointer item = new LLInventoryItem( item_id, @@ -225,7 +225,7 @@ namespace tut src->setSaleInfo(new_sale_info); U32 new_flags = rand(); - S32 new_creation = (S32)time(NULL); + S32 new_creation = (S32)time(nullptr); LLPermissions new_perm; @@ -296,7 +296,7 @@ namespace tut src->setSaleInfo(new_sale_info); U32 new_flags = rand(); - S32 new_creation = (S32)time(NULL); + S32 new_creation = (S32)time(nullptr); LLPermissions new_perm; diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index 311e1e70599..c0d98b35f51 100644 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -67,7 +67,7 @@ const char* LLCalc::TEX_TRANSPARENCY = "TRNS"; const char* LLCalc::TEX_GLOW = "GLOW"; -LLCalc* LLCalc::sInstance = NULL; +LLCalc* LLCalc::sInstance = nullptr; LLCalc::LLCalc() : mLastErrorPos(0) { @@ -91,7 +91,7 @@ LLCalc::~LLCalc() void LLCalc::cleanUp() { delete sInstance; - sInstance = NULL; + sInstance = nullptr; } //static diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 3863588407f..441cc742258 100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -197,9 +197,9 @@ class alignas(16) LLCamera S32 sphereInFrustum(const LLVector3 ¢er, const F32 radius) const; S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); } S32 sphereInFrustumFull(const LLVector3 ¢er, const F32 radius) const { return sphereInFrustum(center, radius); } - S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = nullptr); S32 AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius); - S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = nullptr); S32 AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); //does a quick 'n dirty sphere-sphere check diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index eaa2763d2d5..97024827f52 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -136,7 +136,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode for (U32 i = 0; i < element_count; ++i) { mData[i]->setBinIndex(-1); - mData[i] = NULL; + mData[i] = nullptr; } mData.clear(); @@ -208,7 +208,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode bool contains(F32 radius) { - if (mParent == NULL) + if (mParent == nullptr) { //root node contains nothing return false; } @@ -312,7 +312,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode { //LL_PROFILE_ZONE_NAMED_COLOR("Octree::insert()",OCTREE_DEBUG_COLOR_INSERT); - if (data == NULL || data->getBinIndex() != -1) + if (data == nullptr || data->getBinIndex() != -1) { OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << LL_ENDL; return false; @@ -333,7 +333,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode else { //find a child to give it to - oct_node* child = NULL; + oct_node* child = nullptr; for (U32 i = 0; i < getChildCount(); i++) { child = getChild(i); @@ -435,7 +435,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode mData[i]->setBinIndex(i); } - mData[new_element_count] = NULL; + mData[new_element_count] = nullptr; mData.pop_back(); } else @@ -481,7 +481,7 @@ class alignas(16) LLOctreeNode : public LLTreeNode oct_node* parent = getOctParent(); oct_node* node = this; - while (parent != NULL) + while (parent != nullptr) { node = parent; parent = node->getOctParent(); diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index 3a6748bdb3e..b697547ec18 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -789,7 +789,7 @@ LLQuaternion mayaQ(F32 xRot, F32 yRot, F32 zRot, LLQuaternion::Order order) const char *OrderToString( const LLQuaternion::Order order ) { - const char *p = NULL; + const char *p = nullptr; switch( order ) { default: @@ -960,7 +960,7 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec ) bool LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) { - if( buf.empty() || value == NULL) + if( buf.empty() || value == nullptr) { return false; } diff --git a/indra/llmath/llrigginginfo.cpp b/indra/llmath/llrigginginfo.cpp index 2f59f685d53..73a8816e1d6 100644 --- a/indra/llmath/llrigginginfo.cpp +++ b/indra/llmath/llrigginginfo.cpp @@ -83,7 +83,7 @@ void LLJointRiggingInfo::merge(const LLJointRiggingInfo& other) } LLJointRiggingInfoTab::LLJointRiggingInfoTab(): - mRigInfoPtr(NULL), + mRigInfoPtr(nullptr), mSize(0), mNeedsUpdate(true) { @@ -115,7 +115,7 @@ void LLJointRiggingInfoTab::clear() if (mRigInfoPtr) { delete[](mRigInfoPtr); - mRigInfoPtr = NULL; + mRigInfoPtr = nullptr; mSize = 0; } } diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h index e3d30206b79..655c841793e 100644 --- a/indra/llmath/lltreenode.h +++ b/indra/llmath/lltreenode.h @@ -64,7 +64,7 @@ class LLTreeNode { return mListeners[index]; } - return NULL; + return nullptr; } virtual void addListener(LLTreeListener* listener) { mListeners.push_back(listener); } diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index dfad66040ed..e195496eb7c 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1024,7 +1024,7 @@ bool LLProfileParams::importFile(LLFILE *fp) while (!feof(fp)) { - if (fgets(buffer, BUFSIZE, fp) == NULL) + if (fgets(buffer, BUFSIZE, fp) == nullptr) { buffer[0] = '\0'; } @@ -1626,7 +1626,7 @@ bool LLPathParams::importFile(LLFILE *fp) while (!feof(fp)) { - if (fgets(buffer, BUFSIZE, fp) == NULL) + if (fgets(buffer, BUFSIZE, fp) == nullptr) { buffer[0] = '\0'; } @@ -2018,14 +2018,14 @@ LLVolume::~LLVolume() delete mProfilep; - mPathp = NULL; - mProfilep = NULL; + mPathp = nullptr; + mProfilep = nullptr; mVolumeFaces.clear(); ll_aligned_free_16(mHullPoints); - mHullPoints = NULL; + mHullPoints = nullptr; ll_aligned_free_16(mHullIndices); - mHullIndices = NULL; + mHullIndices = nullptr; } bool LLVolume::generate() @@ -2153,13 +2153,13 @@ void LLVolumeFace::VertexData::init() LLVolumeFace::VertexData::VertexData() { - mData = NULL; + mData = nullptr; init(); } LLVolumeFace::VertexData::VertexData(const VertexData& rhs) { - mData = NULL; + mData = nullptr; *this = rhs; } @@ -2177,7 +2177,7 @@ const LLVolumeFace::VertexData& LLVolumeFace::VertexData::operator=(const LLVolu LLVolumeFace::VertexData::~VertexData() { ll_aligned_free_16(mData); - mData = NULL; + mData = nullptr; } LLVector4a& LLVolumeFace::VertexData::getPosition() @@ -3184,7 +3184,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, bool data_is_empty = false; - if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components < 3 || sculpt_data == NULL) + if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components < 3 || sculpt_data == nullptr) { sculpt_level = -1; data_is_empty = true; @@ -4257,7 +4257,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en if (LLLineSegmentBoxIntersect(start, end, box_center, box_size)) { - if (tangent_out != NULL) // if the caller wants tangents, we may need to generate them + if (tangent_out != nullptr) // if the caller wants tangents, we may need to generate them { genTangents(i); } @@ -4288,7 +4288,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en closest_t = t; hit_face = i; - if (intersection != NULL) + if (intersection != nullptr) { LLVector4a intersect = dir; intersect.mul(closest_t); @@ -4297,7 +4297,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en } - if (tex_coord != NULL) + if (tex_coord != nullptr) { LLVector2* tc = (LLVector2*) face.mTexCoords; *tex_coord = ((1.f - a - b) * tc[idx0] + @@ -4306,7 +4306,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en } - if (normal!= NULL) + if (normal!= nullptr) { LLVector4a* norm = face.mNormals; @@ -4326,7 +4326,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en *normal = n1; } - if (tangent_out != NULL) + if (tangent_out != nullptr) { LLVector4a* tangents = face.mTangents; @@ -4480,7 +4480,7 @@ bool LLVolumeParams::importFile(LLFILE *fp) while (!feof(fp)) { - if (fgets(buffer, BUFSIZE, fp) == NULL) + if (fgets(buffer, BUFSIZE, fp) == nullptr) { buffer[0] = '\0'; } @@ -4900,19 +4900,19 @@ LLVolumeFace::LLVolumeFace() : mNumVertices(0), mNumAllocatedVertices(0), mNumIndices(0), - mPositions(NULL), - mNormals(NULL), - mTangents(NULL), - mTexCoords(NULL), - mIndices(NULL), - mWeights(NULL), + mPositions(nullptr), + mNormals(nullptr), + mTangents(nullptr), + mTexCoords(nullptr), + mIndices(nullptr), + mWeights(nullptr), #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS - mJustWeights(NULL), - mJointIndices(NULL), + mJustWeights(nullptr), + mJointIndices(nullptr), #endif mWeightsScrubbed(false), - mOctree(NULL), - mOctreeTriangles(NULL), + mOctree(nullptr), + mOctreeTriangles(nullptr), mOptimized(false) { mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3); @@ -4931,19 +4931,19 @@ LLVolumeFace::LLVolumeFace(const LLVolumeFace& src) mNumVertices(0), mNumAllocatedVertices(0), mNumIndices(0), - mPositions(NULL), - mNormals(NULL), - mTangents(NULL), - mTexCoords(NULL), - mIndices(NULL), - mWeights(NULL), + mPositions(nullptr), + mNormals(nullptr), + mTangents(nullptr), + mTexCoords(nullptr), + mIndices(nullptr), + mWeights(nullptr), #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS - mJustWeights(NULL), - mJointIndices(NULL), + mJustWeights(nullptr), + mJointIndices(nullptr), #endif mWeightsScrubbed(false), - mOctree(NULL), - mOctreeTriangles(NULL) + mOctree(nullptr), + mOctreeTriangles(nullptr) { mExtents = (LLVector4a*) ll_aligned_malloc_16(sizeof(LLVector4a)*3); mCenter = mExtents+2; @@ -5001,7 +5001,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) else { ll_aligned_free_16(mTangents); - mTangents = NULL; + mTangents = nullptr; } if (src.mWeights) @@ -5014,7 +5014,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) else { ll_aligned_free_16(mWeights); - mWeights = NULL; + mWeights = nullptr; mWeightsScrubbed = false; } @@ -5028,7 +5028,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) else*/ { ll_aligned_free_16(mJointIndices); - mJointIndices = NULL; + mJointIndices = nullptr; } #endif @@ -5043,7 +5043,7 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) else { ll_aligned_free_16(mIndices); - mIndices = NULL; + mIndices = nullptr; } mOptimized = src.mOptimized; @@ -5056,8 +5056,8 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) LLVolumeFace::~LLVolumeFace() { ll_aligned_free_16(mExtents); - mExtents = NULL; - mCenter = NULL; + mExtents = nullptr; + mCenter = nullptr; freeData(); } @@ -5065,24 +5065,24 @@ LLVolumeFace::~LLVolumeFace() void LLVolumeFace::freeData() { ll_aligned_free<64>(mPositions); - mPositions = NULL; + mPositions = nullptr; //normals and texture coordinates are part of the same buffer as mPositions, do not free them separately - mNormals = NULL; - mTexCoords = NULL; + mNormals = nullptr; + mTexCoords = nullptr; ll_aligned_free_16(mIndices); - mIndices = NULL; + mIndices = nullptr; ll_aligned_free_16(mTangents); - mTangents = NULL; + mTangents = nullptr; ll_aligned_free_16(mWeights); - mWeights = NULL; + mWeights = nullptr; #if USE_SEPARATE_JOINT_INDICES_AND_WEIGHTS ll_aligned_free_16(mJointIndices); - mJointIndices = NULL; + mJointIndices = nullptr; ll_aligned_free_16(mJustWeights); - mJustWeights = NULL; + mJustWeights = nullptr; #endif destroyOctree(); @@ -5195,7 +5195,7 @@ void LLVolumeFace::remap() // Tangets are now invalid ll_aligned_free_16(mTangents); - mTangents = NULL; + mTangents = nullptr; // Assign new values mIndices = remap_indices; @@ -5290,14 +5290,14 @@ void LLVolumeFace::optimize(F32 angle_cutoff) { // Now alloc'd with positions //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!mTexCoords) { // Now alloc'd with positions //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } // Only swap data if we've actually optimized the mesh @@ -5341,7 +5341,7 @@ class LLVCacheTriangleData { mActive = true; mScore = 0.0; - mVertex[0] = mVertex[1] = mVertex[2] = NULL; + mVertex[0] = mVertex[1] = mVertex[2] = nullptr; } void complete() @@ -5413,7 +5413,7 @@ class LLVCacheFIFO mMisses = 0; for (U32 i = 0; i < MaxSizeVertexCache; ++i) { - mCache[i] = NULL; + mCache[i] = nullptr; } } @@ -5458,10 +5458,10 @@ class LLVCacheLRU { for (U32 i = 0; i < MaxSizeVertexCache+3; ++i) { - mCache[i] = NULL; + mCache[i] = nullptr; } - mBestTriangle = NULL; + mBestTriangle = nullptr; mMisses = 0; } @@ -5529,7 +5529,7 @@ class LLVCacheLRU } } - mBestTriangle = NULL; + mBestTriangle = nullptr; //update triangle scores data_iter = mCache; end_data = mCache+MaxSizeVertexCache+3; @@ -5566,7 +5566,7 @@ class LLVCacheLRU if (data) { llassert(data->mCacheTag == -1); - *data_iter = NULL; + *data_iter = nullptr; } ++data_iter; } @@ -6564,7 +6564,7 @@ void LLVolumeFace::resizeVertices(S32 num_verts) //DO NOT free mNormals and mTexCoords as they are part of mPositions buffer ll_aligned_free_16(mTangents); - mTangents = NULL; + mTangents = nullptr; if (num_verts) { @@ -6579,9 +6579,9 @@ void LLVolumeFace::resizeVertices(S32 num_verts) } else { - mPositions = NULL; - mNormals = NULL; - mTexCoords = NULL; + mPositions = nullptr; + mNormals = nullptr; + mTexCoords = nullptr; } @@ -6628,7 +6628,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con mNormals = mPositions+new_verts; mTexCoords = (LLVector2*) (mNormals+new_verts); - if (old_buf != NULL) + if (old_buf != nullptr) { // copy old positions into new buffer LLVector4a::memcpyNonAliased16((F32*)mPositions, (F32*)old_buf, old_vsize); @@ -6642,7 +6642,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con // just clear tangents ll_aligned_free_16(mTangents); - mTangents = NULL; + mTangents = nullptr; ll_aligned_free<64>(old_buf); mNumAllocatedVertices = new_verts; @@ -6696,7 +6696,7 @@ void LLVolumeFace::resizeIndices(S32 num_indices) } else { - mIndices = NULL; + mIndices = nullptr; } if (mIndices) diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index bb0c94d513c..7df3de61f4d 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -44,7 +44,7 @@ F32 LLVolumeLODGroup::mDetailScales[NUM_LODS] = {1.f, 1.5f, 2.5f, 4.f}; //============================================================================ LLVolumeMgr::LLVolumeMgr() -: mDataMutex(NULL) +: mDataMutex(nullptr) { // the LLMutex magic interferes with easy unit testing, // so you now must manually call useMutex() to use it @@ -56,7 +56,7 @@ LLVolumeMgr::~LLVolumeMgr() cleanup(); delete mDataMutex; - mDataMutex = NULL; + mDataMutex = nullptr; } bool LLVolumeMgr::cleanup() @@ -115,7 +115,7 @@ LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 // virtual LLVolumeLODGroup* LLVolumeMgr::getGroup( const LLVolumeParams& volume_params ) const { - LLVolumeLODGroup* volgroupp = NULL; + LLVolumeLODGroup* volgroupp = nullptr; if (mDataMutex) { mDataMutex->lock(); @@ -278,7 +278,7 @@ bool LLVolumeLODGroup::cleanupRefs() { LL_WARNS() << " LOD " << i << " refs = " << mLODRefs[i] << LL_ENDL; mLODRefs[i] = 0; - mVolumeLODs[i] = NULL; + mVolumeLODs[i] = nullptr; } } LL_WARNS() << *getVolumeParams() << LL_ENDL; @@ -314,7 +314,7 @@ bool LLVolumeLODGroup::derefLOD(LLVolume *volumep) #if 0 // SJB: Possible opt: keep other lods around if (!mLODRefs[i]) { - mVolumeLODs[i] = NULL; + mVolumeLODs[i] = nullptr; } #endif return true; diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 141317ee8df..1fd92c06a02 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -141,7 +141,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNodemIndex[1]; U32 idx2 = tri->mIndex[2]; - if (mTexCoord != NULL && mFace->mTexCoords) + if (mTexCoord != nullptr && mFace->mTexCoords) { LLVector2* tc = (LLVector2*) mFace->mTexCoords; *mTexCoord = ((1.f - a - b) * tc[idx0] + @@ -162,7 +162,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNodemNormals) + if (mNormal != nullptr && mFace->mNormals) { LLVector4a* norm = mFace->mNormals; @@ -182,7 +182,7 @@ void LLOctreeTriangleRayIntersect::visit(const LLOctreeNodemTangents) + if (mTangent != nullptr && mFace->mTangents) { LLVector4a* tangents = mFace->mTangents; diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index fa45fffeaee..f7bd416f734 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -71,7 +71,7 @@ class LLXform void init() { - mParent = NULL; + mParent = nullptr; mChanged = UNCHANGED; mPosition.setVec(0,0,0); mRotation.loadIdentity(); diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp index 73394543672..7509ae3ab2e 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.cpp +++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp @@ -185,7 +185,7 @@ size_t LLMeshOptimizer::generateRemapMultiU16( U64 vertex_count) { S32 out_of_range_count = 0; - U32* indices_u32 = NULL; + U32* indices_u32 = nullptr; if (indices) { indices_u32 = (U32*)ll_aligned_malloc_32(index_count * sizeof(U32)); diff --git a/indra/llmeshoptimizer/llmeshoptimizer.h b/indra/llmeshoptimizer/llmeshoptimizer.h index 59a2f86b4c6..46a450ad437 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.h +++ b/indra/llmeshoptimizer/llmeshoptimizer.h @@ -120,7 +120,7 @@ class LLMeshOptimizer // returns amount of indices in destiantion // sloppy engages a variant of a mechanizm that does not respect topology as much // but is much more efective for simpler models - // result_error returns how far from original the model is in % if not NULL + // result_error returns how far from original the model is in % if not nullptr // Works with U32 indices (LLFace uses U16 indices) static U64 simplifyU32( U32 *destination, @@ -137,7 +137,7 @@ class LLMeshOptimizer // Returns amount of indices in destiantion // sloppy engages a variant of a mechanizm that does not respect topology as much // but is much better for simpler models - // result_error returns how far from original the model is in % if not NULL + // result_error returns how far from original the model is in % if not nullptr // Meant for U16 indices (LLFace uses U16 indices) static U64 simplify( U16 *destination, diff --git a/indra/llphysicsextensionsos/LLPathingLibStubImpl.cpp b/indra/llphysicsextensionsos/LLPathingLibStubImpl.cpp index 9830fd1ad01..b1b18582e57 100644 --- a/indra/llphysicsextensionsos/LLPathingLibStubImpl.cpp +++ b/indra/llphysicsextensionsos/LLPathingLibStubImpl.cpp @@ -44,7 +44,7 @@ LLPathingLibImpl::~LLPathingLibImpl() LLPathingLib* LLPathingLibImpl::getInstance() { - return NULL; + return nullptr; } diff --git a/indra/llphysicsextensionsos/llpathinglib.cpp b/indra/llphysicsextensionsos/llpathinglib.cpp index f41cb9c45fb..e0817cb992b 100644 --- a/indra/llphysicsextensionsos/llpathinglib.cpp +++ b/indra/llphysicsextensionsos/llpathinglib.cpp @@ -47,7 +47,7 @@ { if ( !s_isInitialized ) { - return NULL; + return nullptr; } else { diff --git a/indra/llphysicsextensionsos/llphysicsextensions.cpp b/indra/llphysicsextensionsos/llphysicsextensions.cpp index 3bb8ffbf1a5..71fb112a21a 100644 --- a/indra/llphysicsextensionsos/llphysicsextensions.cpp +++ b/indra/llphysicsextensionsos/llphysicsextensions.cpp @@ -50,7 +50,7 @@ { if ( !s_isInitialized ) { - return NULL; + return nullptr; } else { diff --git a/indra/test/io.cpp b/indra/test/io.cpp index f77402065a7..0e7ceeb2142 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -50,7 +50,7 @@ namespace tut { struct heap_buffer_data { - heap_buffer_data() : mBuffer(NULL) {} + heap_buffer_data() : mBuffer(nullptr) {} ~heap_buffer_data() { if(mBuffer) delete mBuffer; } LLHeapBuffer* mBuffer; }; @@ -158,7 +158,7 @@ namespace tut const S32 str_len = static_cast(strlen(HELLO_WORLD)); LLChannelDescriptors ch = mBuffer.nextChannel(); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); - S32 count = mBuffer.countAfter(ch.in(), NULL); + S32 count = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("total append size", count, str_len); LLBufferArray::segment_iterator_t it = mBuffer.beginSegment(); U8* first = (*it).data(); @@ -174,7 +174,7 @@ namespace tut LLChannelDescriptors ch = mBuffer.nextChannel(); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); mBuffer.append(ch.in(), (U8*)HELLO_WORLD, str_len); - S32 count = mBuffer.countAfter(ch.in(), NULL); + S32 count = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("total append size", count, 2 * str_len); LLBufferArray::segment_iterator_t it = mBuffer.beginSegment(); U8* first = (*it).data(); @@ -194,7 +194,7 @@ namespace tut mBuffer.append(ch.in(), (U8*)TWO, 3); char buffer[255]; /* Flawfinder: ignore */ S32 len = 6; - mBuffer.readAfter(ch.in(), NULL, (U8*)buffer, len); + mBuffer.readAfter(ch.in(), nullptr, (U8*)buffer, len); ensure_equals(len, 6); buffer[len] = '\0'; std::string actual(buffer); @@ -213,7 +213,7 @@ namespace tut mBuffer.prepend(ch.in(), (U8*)ONE, 3); char buffer[255]; /* Flawfinder: ignore */ S32 len = 6; - mBuffer.readAfter(ch.in(), NULL, (U8*)buffer, len); + mBuffer.readAfter(ch.in(), nullptr, (U8*)buffer, len); ensure_equals(len, 6); buffer[len] = '\0'; std::string actual(buffer); @@ -251,7 +251,7 @@ namespace tut LLChannelDescriptors ch = mBuffer.nextChannel(); mBuffer.append(ch.in(), (U8*)request.c_str(), static_cast(request.length())); mBuffer.append(ch.out(), (U8*)response.c_str(), static_cast(response.length())); - S32 count = mBuffer.countAfter(ch.out(), NULL); + S32 count = mBuffer.countAfter(ch.out(), nullptr); std::ostringstream header; header << "ContentLength: " << count << "\r\n\r\n"; std::string head(header.str()); @@ -259,7 +259,7 @@ namespace tut char buffer[1024]; /* Flawfinder: ignore */ S32 len = static_cast(response.size() + head.length()); ensure_equals("same length", len, (S32)expected.str().length()); - mBuffer.readAfter(ch.out(), NULL, (U8*)buffer, len); + mBuffer.readAfter(ch.out(), nullptr, (U8*)buffer, len); buffer[len] = '\0'; std::string actual(buffer); ensure_equals("threaded writes", actual, expected.str()); @@ -286,7 +286,7 @@ namespace tut const S32 BUFFER_LEN = 1024; char buf[BUFFER_LEN]; S32 len; - U8* last = NULL; + U8* last = nullptr; std::string last_line; for(i = 0; i < LINE_COUNT; ++i) { @@ -313,10 +313,10 @@ namespace tut buffer.append(ch.in(), (U8*)"2", 1); mBuffer.takeContents(buffer); mBuffer.append(ch.in(), (U8*)"3", 1); - S32 count = mBuffer.countAfter(ch.in(), NULL); + S32 count = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("buffer size", count, 3); U8* temp = new U8[count]; - mBuffer.readAfter(ch.in(), NULL, temp, count); + mBuffer.readAfter(ch.in(), nullptr, temp, count); ensure("buffer content", (0 == memcmp(temp, (void*)"123", 3))); delete[] temp; } @@ -332,7 +332,7 @@ namespace tut mBuffer.append(ch.in(), temp, capacity - 1); capacity = mBuffer.capacity(); ensure("has capacity when full", capacity > 0); - S32 used = mBuffer.countAfter(ch.in(), NULL); + S32 used = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("used equals capacity", used, capacity); LLBufferArray::segment_iterator_t iter = mBuffer.beginSegment(); @@ -341,7 +341,7 @@ namespace tut mBuffer.eraseSegment(iter++); } - used = mBuffer.countAfter(ch.in(), NULL); + used = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("used is zero", used, 0); S32 capacity2 = mBuffer.capacity(); ensure_equals("capacity the same after erase", capacity2, capacity); @@ -479,7 +479,7 @@ namespace tut const S32 BUF_LEN = 128; char buf[BUF_LEN]; S32 len = 7; - U8* last = mBuffer.readAfter(CHANNEL, NULL, (U8*)buf, len); + U8* last = mBuffer.readAfter(CHANNEL, nullptr, (U8*)buf, len); mBuffer.splitAfter(last); LLBufferArray::segment_iterator_t it = mBuffer.beginSegment(); LLBufferArray::segment_iterator_t end = mBuffer.endSegment(); @@ -507,7 +507,7 @@ namespace tut char buf[BUF_LEN]; S32 actual_len = BUF_LEN; S32 expected_len = static_cast(h1.size() + h2.size()); - (void) mBuffer.readAfter(ch.out(), NULL, (U8*)buf, actual_len); + (void) mBuffer.readAfter(ch.out(), nullptr, (U8*)buf, actual_len); ensure_equals("streamed size", actual_len, expected_len); buf[actual_len] = '\0'; std::string actual(buf); @@ -551,7 +551,7 @@ namespace tut const S32 BUF_LEN = 512; char buf[BUF_LEN]; /* Flawfinder: ignore */ S32 actual_len = BUF_LEN; - (void) mBuffer.readAfter(ch.out(), NULL, (U8*)buf, actual_len); + (void) mBuffer.readAfter(ch.out(), nullptr, (U8*)buf, actual_len); buf[actual_len] = '\0'; std::string actual(buf); std::string expected(ostr.str()); @@ -566,19 +566,19 @@ namespace tut LLBufferStream bstr(ch, &mBuffer); bstr << "1"; bstr.flush(); - S32 count = mBuffer.countAfter(ch.out(), NULL); + S32 count = mBuffer.countAfter(ch.out(), nullptr); ensure_equals("buffer size 1", count, 1); LLBufferArray buffer; buffer.append(ch.out(), (U8*)"2", 1); mBuffer.takeContents(buffer); - count = mBuffer.countAfter(ch.out(), NULL); + count = mBuffer.countAfter(ch.out(), nullptr); ensure_equals("buffer size 2", count, 2); bstr << "3"; bstr.flush(); - count = mBuffer.countAfter(ch.out(), NULL); + count = mBuffer.countAfter(ch.out(), nullptr); ensure_equals("buffer size 3", count, 3); U8* temp = new U8[count]; - mBuffer.readAfter(ch.out(), NULL, temp, count); + mBuffer.readAfter(ch.out(), nullptr, temp, count); ensure("buffer content", (0 == memcmp(temp, (void*)"123", 3))); delete[] temp; } @@ -624,7 +624,7 @@ namespace tut // now that we have a bunch of data on a stream, parse it all. ch = mBuffer.nextChannel(); - S32 count = mBuffer.countAfter(ch.in(), NULL); + S32 count = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("size of buffer", count, total_size); LLBufferStream istr(ch, &mBuffer); LLSD data; @@ -689,7 +689,7 @@ namespace tut // now that we have a bunch of data on a stream, parse it all. ch = mBuffer.nextChannel(); - S32 count = mBuffer.countAfter(ch.in(), NULL); + S32 count = mBuffer.countAfter(ch.in(), nullptr); ensure_equals("size of buffer", count, total_size); LLBufferStream istr(ch, &mBuffer); LLSD data; @@ -829,7 +829,7 @@ namespace tut public: PumpAndChainTestData() { - apr_pool_create(&mPool, NULL); + apr_pool_create(&mPool, nullptr); mPump = new LLPumpIO(mPool); } @@ -909,7 +909,7 @@ namespace tut pipe_and_pump_fitness() { LLFrameTimer::updateFrameTime(); - apr_pool_create(&mPool, NULL); + apr_pool_create(&mPool, nullptr); mPump = new LLPumpIO(mPool); mSocket = LLSocket::create( mPool, diff --git a/indra/test/llbuffer_tut.cpp b/indra/test/llbuffer_tut.cpp index 330a4f288f9..56f70180d3a 100644 --- a/indra/test/llbuffer_tut.cpp +++ b/indra/test/llbuffer_tut.cpp @@ -59,7 +59,7 @@ namespace tut void buffer_object_t::test<2>() { LLSegment segment; - ensure("LLSegment get functions failed", (0 == segment.getChannel() && NULL == segment.data() && 0 == segment.size())); + ensure("LLSegment get functions failed", (0 == segment.getChannel() && nullptr == segment.data() && 0 == segment.size())); segment.setChannel(50); ensure_equals("LLSegment setChannel() function failed", segment.getChannel(), 50); ensure("LLSegment isOnChannel() function failed", (true == segment.isOnChannel(50))); @@ -131,7 +131,7 @@ namespace tut S32 len = static_cast(strlen(array)); LLChannelDescriptors channelDescriptors = bufferArray.nextChannel(); bufferArray.append(channelDescriptors.in(), (U8*)array, len); - S32 count = bufferArray.countAfter(channelDescriptors.in(), NULL); + S32 count = bufferArray.countAfter(channelDescriptors.in(), nullptr); ensure_equals("Appended size is:", count, len); } @@ -153,7 +153,7 @@ namespace tut bufferArray.prepend(channelDescriptors.in(), (U8*)array1, len1); char buf[100]; S32 len2 = 20; - bufferArray.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + bufferArray.readAfter(channelDescriptors.in(), nullptr, (U8*)buf, len2); ensure_equals("readAfter length failed", len2, 20); buf[len2] = '\0'; @@ -178,7 +178,7 @@ namespace tut bufferArray.append(channelDescriptors.in(), (U8*)array1, len1); char buf[100]; S32 len2 = 20; - bufferArray.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + bufferArray.readAfter(channelDescriptors.in(), nullptr, (U8*)buf, len2); ensure_equals("readAfter length failed", len2, 20); buf[len2] = '\0'; @@ -199,7 +199,7 @@ namespace tut char buf[100]; S32 len2 = len; - bufferArray1.readAfter(channelDescriptors.in(), NULL, (U8*)buf, len2); + bufferArray1.readAfter(channelDescriptors.in(), nullptr, (U8*)buf, len2); ensure_equals("takeContents failed to copy", buf, str); } @@ -265,7 +265,7 @@ namespace tut LLBufferArray::segment_iterator_t it; LLSegment segment; LLBufferArray::segment_iterator_t end = bufferArray.endSegment(); - it = bufferArray.constructSegmentAfter(NULL, segment); + it = bufferArray.constructSegmentAfter(nullptr, segment); ensure("constructSegmentAfter() function failed", (it == end)); } } diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp index b580b09a9f2..a1f9782083a 100644 --- a/indra/test/llhttpdate_tut.cpp +++ b/indra/test/llhttpdate_tut.cpp @@ -116,12 +116,12 @@ namespace tut const char *fr_locale = "fr_FR.UTF-8"; std::string prev_locale = LLStringUtil::getLocale(); - std::string prev_clocale = std::string(setlocale(LC_TIME, NULL)); + std::string prev_clocale = std::string(setlocale(LC_TIME, nullptr)); time_t test_time = 1252374030; // 8 Sep 2009 01:40:01 struct tm *t = gmtime(&test_time); setlocale(LC_TIME, en_locale); - if (strcmp(setlocale(LC_TIME, NULL), en_locale) != 0) + if (strcmp(setlocale(LC_TIME, nullptr), en_locale) != 0) { setlocale(LC_TIME, prev_clocale.c_str()); skip("Cannot set English locale"); @@ -139,7 +139,7 @@ namespace tut test_date_string(en_locale, t, "%B", "september"); setlocale(LC_TIME, fr_locale); - if (strcmp(setlocale(LC_TIME, NULL), fr_locale) != 0) + if (strcmp(setlocale(LC_TIME, nullptr), fr_locale) != 0) { LLStringUtil::setLocale(prev_locale); setlocale(LC_TIME, prev_clocale.c_str()); diff --git a/indra/test/llhttpnode_tut.cpp b/indra/test/llhttpnode_tut.cpp index c38dee120b2..8cb315e7948 100644 --- a/indra/test/llhttpnode_tut.cpp +++ b/indra/test/llhttpnode_tut.cpp @@ -93,7 +93,7 @@ namespace tut { mContext.clear(); const LLHTTPNode* node = mRoot.traverse(path, mContext); - ensure(path + " found", node != NULL); + ensure(path + " found", node != nullptr); ResponsePtr response = Response::create(); node->get(LLHTTPNode::ResponsePtr(response), mContext); @@ -104,7 +104,7 @@ namespace tut { mContext.clear(); const LLHTTPNode* node = mRoot.traverse(path, mContext); - ensure(path + " found", node != NULL); + ensure(path + " found", node != nullptr); ResponsePtr response = Response::create(); node->post(LLHTTPNode::ResponsePtr(response), mContext, input); @@ -152,8 +152,8 @@ namespace tut ensureRootTraversal("", &mRoot, ""); ensureRootTraversal("/", &mRoot, ""); - ensureRootTraversal("foo", NULL, "foo"); - ensureRootTraversal("foo/bar", NULL, "foo/bar"); + ensureRootTraversal("foo", nullptr, "foo"); + ensureRootTraversal("foo/bar", nullptr, "foo/bar"); ensure_equals("root of root", mRoot.rootNode(), &mRoot); } @@ -171,7 +171,7 @@ namespace tut ensureRootTraversal("hello/", helloNode, ""); ensureRootTraversal("/hello/", helloNode, ""); - ensureRootTraversal("hello/there", NULL, "there"); + ensureRootTraversal("hello/there", nullptr, "there"); ensure_equals("root of hello", helloNode->rootNode(), &mRoot); } @@ -199,7 +199,7 @@ namespace tut ensureRootTraversal("greek/alpha", alphaNode, ""); ensureRootTraversal("greek/beta", betaNode, ""); - ensureRootTraversal("greek/delta", NULL, "delta"); + ensureRootTraversal("greek/delta", nullptr, "delta"); ensureRootTraversal("greek/gamma", gammaNode, ""); ensureRootTraversal("hebrew/aleph", alephNode, ""); @@ -233,7 +233,7 @@ namespace tut ensureRootTraversal("greek/alpha", alphaNode, ""); ensureRootTraversal("greek/beta", betaNode, ""); - ensureRootTraversal("greek/delta", NULL, "delta"); + ensureRootTraversal("greek/delta", nullptr, "delta"); ensureRootTraversal("greek/gamma", gammaNode, ""); ensureRootTraversal("hebrew/aleph", alephNode, ""); @@ -302,7 +302,7 @@ namespace tut ensure_equals("stored integer", context()["extra"]["value"].asInteger(), 42); - ensureRootTraversal("test/bob", NULL, "bob"); + ensureRootTraversal("test/bob", nullptr, "bob"); ensure("nothing stored", context()["extra"]["value"].isUndefined()); @@ -349,8 +349,8 @@ namespace tut ensureRootTraversal("test/alpha", aNode, ""); ensureRootTraversal("test/alpha/abe", aNode, "abe"); ensureRootTraversal("test/alpha/abe/amy", aNode, "abe/amy"); - ensureRootTraversal("test/alpha/abe/bea", NULL, "abe/bea"); - ensureRootTraversal("test/alpha/bob", NULL, "bob"); + ensureRootTraversal("test/alpha/abe/bea", nullptr, "abe/bea"); + ensureRootTraversal("test/alpha/bob", nullptr, "bob"); ensureRootTraversal("test/alpha/zebra", zNode, ""); } diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp index 7034f4a0633..992f884dd4c 100644 --- a/indra/test/lliohttpserver_tut.cpp +++ b/indra/test/lliohttpserver_tut.cpp @@ -50,7 +50,7 @@ namespace tut void post(ResponsePtr response, const LLSD& context, const LLSD& input) const { - ensure("response already set", mTester->mResponse == ResponsePtr(NULL)); + ensure("response already set", mTester->mResponse == ResponsePtr(nullptr)); mTester->mResponse = response; mTester->mResult = input; } @@ -75,7 +75,7 @@ namespace tut }; HTTPServiceTestData() - : mResponse(NULL) + : mResponse(nullptr) { LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(mRoot); @@ -110,7 +110,7 @@ namespace tut LLPipeStringExtractor* extractor = new LLPipeStringExtractor(); apr_pool_t* pool; - apr_pool_create(&pool, NULL); + apr_pool_create(&pool, nullptr); LLPumpIO* pump; pump = new LLPumpIO(pool); @@ -128,7 +128,7 @@ namespace tut if(mResponse.notNull() && (! timeout)) { mResponse->result(mResult); - mResponse = NULL; + mResponse = nullptr; } pumpPipe(pump, 10); @@ -141,7 +141,7 @@ namespace tut if(mResponse.notNull() && timeout) { mResponse->result(mResult); - mResponse = NULL; + mResponse = nullptr; } return httpResult; diff --git a/indra/test/llmessagetemplateparser_tut.cpp b/indra/test/llmessagetemplateparser_tut.cpp index f665fdde4dd..33e5912d3c3 100644 --- a/indra/test/llmessagetemplateparser_tut.cpp +++ b/indra/test/llmessagetemplateparser_tut.cpp @@ -63,7 +63,7 @@ namespace tut { const LLMessageBlock * block = message->getBlock(prehash(name)); identifier = identifier + ":" + message->mName + ":" + name + " block"; - ensure(identifier + " exists", block != NULL); + ensure(identifier + " exists", block != nullptr); ensure_equals(identifier + " name", block->mName, prehash(name)); ensure_equals(identifier + " type", block->mType, type); ensure_equals(identifier + " number", block->mNumber, number); @@ -78,7 +78,7 @@ namespace tut { const LLMessageVariable * var = block->getVariable(prehash(name)); identifier = identifier + ":" + block->mName + ":" + name + " variable"; - ensure(identifier + " exists", var != NULL); + ensure(identifier + " exists", var != nullptr); ensure_equals( identifier + " name", var->getName(), prehash(name)); ensure_equals( diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp index cc084df045e..e5a6fa5cc5a 100644 --- a/indra/test/llsd_new_tut.cpp +++ b/indra/test/llsd_new_tut.cpp @@ -804,10 +804,10 @@ namespace tut template<> template<> void SDTestObject::test<14>() - // make sure that assignment of char* NULL in a string does not crash. + // make sure that assignment of char* nullptr in a string does not crash. { LLSD v; - v = (const char*)NULL; + v = (const char*)nullptr; ensure("type is a string", v.isString()); } diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index 6804c3e29e6..c0766d75d00 100644 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -48,8 +48,8 @@ namespace tut { static LLTemplateMessageBuilder::message_template_name_map_t templateNameMap; - LLMsgData* messageData = NULL; - LLMsgBlkData* messageBlockData = NULL; + LLMsgData* messageData = nullptr; + LLMsgBlkData* messageBlockData = nullptr; struct LLSDMessageBuilderTestData { diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index ddf1c3dbcc8..b77635cae4f 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -63,7 +63,7 @@ namespace tut 0, false, "notasharedsecret", - NULL, + nullptr, false, circuit_heartbeat_interval, circuit_timeout); diff --git a/indra/test/lltut.h b/indra/test/lltut.h index fdc1cd7dfed..c7effd7e1a9 100644 --- a/indra/test/lltut.h +++ b/indra/test/lltut.h @@ -109,7 +109,7 @@ namespace tut inline void ensure_approximately_equals(F32 actual, F32 expected, U32 frac_bits) { - ensure_approximately_equals(NULL, actual, expected, frac_bits); + ensure_approximately_equals(nullptr, actual, expected, frac_bits); } inline void ensure_approximately_equals_range(const char *msg, F32 actual, F32 expected, F32 delta) @@ -152,7 +152,7 @@ namespace tut template void ensure_not_equals(const Q& actual,const T& expected) { - ensure_not_equals(NULL, actual, expected); + ensure_not_equals(nullptr, actual, expected); } } diff --git a/indra/test/llxorcipher_tut.cpp b/indra/test/llxorcipher_tut.cpp index 9acac53604b..09eb39f3f81 100644 --- a/indra/test/llxorcipher_tut.cpp +++ b/indra/test/llxorcipher_tut.cpp @@ -119,13 +119,13 @@ namespace tut LLNullCipher nullCipher; LLNullCipher nullCipher1; - U32 length = nullCipher.requiredEncryptionSpace(50); + U32 length = nullptrCipher.requiredEncryptionSpace(50); ensure("LLNullCipher::requiredEncryptionSpace() function failed", (length == 50)); - U32 len1 = nullCipher.encrypt((U8 *) str, str_len, encrypted, str_len); + U32 len1 = nullptrCipher.encrypt((U8 *) str, str_len, encrypted, str_len); ensure_memory_matches("LLNullCipher - Source transformed during encryption.", encrypted, len1, str, str_len); - U32 len2 = nullCipher1.decrypt(encrypted, str_len, decrypted, str_len); + U32 len2 = nullptrCipher1.decrypt(encrypted, str_len, decrypted, str_len); ensure_memory_matches("LLNullCipher - Decryption failed", decrypted, len2, str, str_len); } } diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp index 11cd710ef6a..33cf62ebb8a 100644 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -77,7 +77,7 @@ namespace tut 0, false, "notasharedsecret", - NULL, + nullptr, false, circuit_heartbeat_interval, circuit_timeout @@ -104,7 +104,7 @@ namespace tut { // not end_messaging_system() delete static_cast(gMessageSystem); - gMessageSystem = NULL; + gMessageSystem = nullptr; // rm contents of temp dir std::ostringstream ostr; diff --git a/indra/test/mock_http_client.h b/indra/test/mock_http_client.h index ef268abc6ec..7253487f151 100644 --- a/indra/test/mock_http_client.h +++ b/indra/test/mock_http_client.h @@ -38,7 +38,7 @@ namespace tut public: MockHttpClient() { - apr_pool_create(&mPool, NULL); + apr_pool_create(&mPool, nullptr); mServerPump = new LLPumpIO(mPool); mClientPump = new LLPumpIO(mPool); @@ -83,7 +83,7 @@ namespace tut void killServer() { delete mServerPump; - mServerPump = NULL; + mServerPump = nullptr; } private: diff --git a/indra/test/test.cpp b/indra/test/test.cpp index fd8034b8112..766fffd9a9b 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -505,7 +505,7 @@ void wouldHaveCrashed(const std::string& message) tut::fail("llerrs message: " + message); } -static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; +static LLTrace::ThreadRecorder* sMasterThreadRecorder = nullptr; int main(int argc, char **argv) { @@ -515,7 +515,7 @@ int main(int argc, char **argv) LL_PROFILER_SET_THREAD_NAME("App"); ll_init_apr(); - apr_getopt_t* os = NULL; + apr_getopt_t* os = nullptr; if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) { std::cerr << "apr_getopt_init() failed" << std::endl; @@ -533,10 +533,10 @@ int main(int argc, char **argv) // values used for options parsing apr_status_t apr_err; - const char* opt_arg = NULL; + const char* opt_arg = nullptr; int opt_id = 0; std::unique_ptr output; - const char *touch = NULL; + const char *touch = nullptr; while(true) { From 8e836e19601fa1724b1529c49dd1e6b43bf98991 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 02:08:25 -0500 Subject: [PATCH 07/11] Replace legacy NULL with nullptr in plugins --- indra/llplugin/llpluginclassmedia.cpp | 10 ++--- indra/llplugin/llpluginclassmedia.h | 4 +- indra/llplugin/llplugininstance.cpp | 12 ++--- indra/llplugin/llpluginmessage.cpp | 10 ++--- indra/llplugin/llpluginmessagepipe.cpp | 16 +++---- indra/llplugin/llpluginprocesschild.cpp | 24 +++++----- indra/llplugin/llpluginprocessparent.cpp | 44 +++++++++---------- indra/llplugin/llpluginsharedmemory.cpp | 36 +++++++-------- indra/llplugin/llpluginsharedmemory.h | 2 +- indra/llplugin/slplugin/slplugin-objc.mm | 8 ++-- indra/llplugin/slplugin/slplugin.cpp | 2 +- .../media_plugins/base/media_plugin_base.cpp | 4 +- .../media_plugins/cef/mac_volume_catcher.cpp | 10 ++--- indra/media_plugins/cef/media_plugin_cef.cpp | 2 +- .../cef/windows_volume_catcher.cpp | 2 +- .../example/media_plugin_example.cpp | 4 +- .../libvlc/media_plugin_libvlc.cpp | 6 +-- 17 files changed, 98 insertions(+), 98 deletions(-) diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 803574f9fa1..04d4412268c 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -173,7 +173,7 @@ void LLPluginClassMedia::idle(void) mPlugin->idle(); } - if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()) || (mOwner == NULL)) + if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == nullptr) || (mPlugin->isBlocked()) || (mOwner == nullptr)) { // Can't process a size change at this time } @@ -300,8 +300,8 @@ int LLPluginClassMedia::getTextureHeight() const unsigned char* LLPluginClassMedia::getBitsData() { - unsigned char *result = NULL; - if((mPlugin != NULL) && !mTextureSharedMemoryName.empty()) + unsigned char *result = nullptr; + if((mPlugin != nullptr) && !mTextureSharedMemoryName.empty()) { result = (unsigned char*)mPlugin->getSharedMemoryAddress(mTextureSharedMemoryName); } @@ -403,7 +403,7 @@ bool LLPluginClassMedia::textureValid(void) mMediaHeight <= 0 || mRequestedMediaWidth != mMediaWidth || mRequestedMediaHeight != mMediaHeight || - getBitsData() == NULL + getBitsData() == nullptr ) return false; @@ -414,7 +414,7 @@ bool LLPluginClassMedia::getDirty(LLRect *dirty_rect) { bool result = !mDirtyRect.isEmpty(); - if(dirty_rect != NULL) + if(dirty_rect != nullptr) { *dirty_rect = mDirtyRect; } diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index bfede4e9c1d..eac86e70a61 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -69,7 +69,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner int getFullHeight() const { return mFullMediaHeight; }; F64 getZoomFactor() const { return mZoomFactor; }; - // This may return NULL. Callers need to check for and handle this case. + // This may return nullptr. Callers need to check for and handle this case. unsigned char* getBitsData(); // gets the format details of the texture data @@ -95,7 +95,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner // until you call idle() again. bool textureValid(void); - bool getDirty(LLRect *dirty_rect = NULL); + bool getDirty(LLRect *dirty_rect = nullptr); void resetDirty(void); typedef enum diff --git a/indra/llplugin/llplugininstance.cpp b/indra/llplugin/llplugininstance.cpp index 67c12820e8f..3f745488400 100644 --- a/indra/llplugin/llplugininstance.cpp +++ b/indra/llplugin/llplugininstance.cpp @@ -52,9 +52,9 @@ const char *LLPluginInstance::PLUGIN_INIT_FUNCTION_NAME = "LLPluginInitEntryPoin * @param[in] owner Plugin instance. TODO:DOC is this a good description of what "owner" is? */ LLPluginInstance::LLPluginInstance(LLPluginInstanceMessageListener *owner) : - mDSOHandle(NULL), - mPluginUserData(NULL), - mPluginSendMessageFunction(NULL) + mDSOHandle(nullptr), + mPluginUserData(nullptr), + mPluginSendMessageFunction(nullptr) { mOwner = owner; } @@ -64,10 +64,10 @@ LLPluginInstance::LLPluginInstance(LLPluginInstanceMessageListener *owner) : */ LLPluginInstance::~LLPluginInstance() { - if(mDSOHandle != NULL) + if(mDSOHandle != nullptr) { apr_dso_unload(mDSOHandle); - mDSOHandle = NULL; + mDSOHandle = nullptr; } } @@ -79,7 +79,7 @@ LLPluginInstance::~LLPluginInstance() */ int LLPluginInstance::load(const std::string& plugin_dir, std::string &plugin_file) { - pluginInitFunction init_function = NULL; + pluginInitFunction init_function = nullptr; if ( plugin_dir.length() ) { diff --git a/indra/llplugin/llpluginmessage.cpp b/indra/llplugin/llpluginmessage.cpp index 188d71227b0..fa336e4fced 100644 --- a/indra/llplugin/llpluginmessage.cpp +++ b/indra/llplugin/llpluginmessage.cpp @@ -283,7 +283,7 @@ U32 LLPluginMessage::getValueU32(const std::string &key) const { std::string value = mMessage["params"][key].asString(); - result = (U32)strtoul(value.c_str(), NULL, 16); + result = (U32)strtoul(value.c_str(), nullptr, 16); } return result; @@ -328,21 +328,21 @@ F64 LLPluginMessage::getValueReal(const std::string &key) const } /** - * Gets the value of a key as a pointer. If the key does not exist, NULL will be returned. + * Gets the value of a key as a pointer. If the key does not exist, nullptr will be returned. * * @param[in] key Key * - * @return Pointer value if key exists, NULL otherwise. + * @return Pointer value if key exists, nullptr otherwise. */ void* LLPluginMessage::getValuePointer(const std::string &key) const { - void* result = NULL; + void* result = nullptr; if(mMessage["params"].has(key)) { std::string value = mMessage["params"][key].asString(); - result = (void*)llstrtou64(value.c_str(), NULL, 16); + result = (void*)llstrtou64(value.c_str(), nullptr, 16); } return result; diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 085afc09446..b194dc58b02 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -36,7 +36,7 @@ static const char MESSAGE_DELIMITER = '\0'; LLPluginMessagePipeOwner::LLPluginMessagePipeOwner() : - mMessagePipe(NULL), + mMessagePipe(nullptr), mSocketError(APR_SUCCESS) { } @@ -63,13 +63,13 @@ void LLPluginMessagePipeOwner::setMessagePipe(LLPluginMessagePipe *read_pipe) bool LLPluginMessagePipeOwner::canSendMessage(void) { - return (mMessagePipe != NULL); + return (mMessagePipe != nullptr); } bool LLPluginMessagePipeOwner::writeMessageRaw(const std::string &message) { bool result = true; - if(mMessagePipe != NULL) + if(mMessagePipe != nullptr) { result = mMessagePipe->addMessage(message); } @@ -84,10 +84,10 @@ bool LLPluginMessagePipeOwner::writeMessageRaw(const std::string &message) void LLPluginMessagePipeOwner::killMessagePipe(void) { - if(mMessagePipe != NULL) + if(mMessagePipe != nullptr) { delete mMessagePipe; - mMessagePipe = NULL; + mMessagePipe = nullptr; } } @@ -103,9 +103,9 @@ LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSock LLPluginMessagePipe::~LLPluginMessagePipe() { - if(mOwner != NULL) + if(mOwner != nullptr) { - mOwner->setMessagePipe(NULL); + mOwner->setMessagePipe(nullptr); } } @@ -130,7 +130,7 @@ bool LLPluginMessagePipe::addMessage(const std::string &message) void LLPluginMessagePipe::clearOwner(void) { // The owner is done with this pipe. The next call to process_impl should send any remaining data and exit. - mOwner = NULL; + mOwner = nullptr; } void LLPluginMessagePipe::setSocketTimeout(apr_interval_time_t timeout_usec) diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index a854ced7aa6..76f334b158c 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -40,7 +40,7 @@ static const F32 PLUGIN_IDLE_SECONDS = 1.0f / 100.0f; // Each call to idle will LLPluginProcessChild::LLPluginProcessChild() { mState = STATE_UNINITIALIZED; - mInstance = NULL; + mInstance = nullptr; mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz mCPUElapsed = 0.0f; @@ -50,7 +50,7 @@ LLPluginProcessChild::LLPluginProcessChild() LLPluginProcessChild::~LLPluginProcessChild() { - if (mInstance != NULL) + if (mInstance != nullptr) { sendMessageToPlugin(LLPluginMessage("base", "cleanup")); @@ -60,7 +60,7 @@ LLPluginProcessChild::~LLPluginProcessChild() // process as well as a bunch of plugin specific files are locked and cannot be overwritten. exit(0); //delete mInstance; - //mInstance = NULL; + //mInstance = nullptr; } } @@ -96,7 +96,7 @@ void LLPluginProcessChild::idle(void) setState(STATE_ERROR); } - if ((mState > STATE_INITIALIZED) && (mMessagePipe == NULL)) + if ((mState > STATE_INITIALIZED) && (mMessagePipe == nullptr)) { // The pipe has been closed -- we're done. // TODO: This could be slightly more subtle, but I'm not sure it needs to be. @@ -110,7 +110,7 @@ void LLPluginProcessChild::idle(void) // When in doubt, don't do it. idle_again = false; - if (mInstance != NULL) + if (mInstance != nullptr) { // Provide some time to the plugin mInstance->idle(); @@ -172,7 +172,7 @@ void LLPluginProcessChild::idle(void) break; case STATE_RUNNING: - if (mInstance != NULL) + if (mInstance != nullptr) { // Provide some time to the plugin LLPluginMessage message("base", "idle"); @@ -207,7 +207,7 @@ void LLPluginProcessChild::idle(void) setState(STATE_UNLOADING); mWaitGoodbye.setTimerExpirySec(GOODBYE_SECONDS); - if (mInstance != NULL) + if (mInstance != nullptr) { sendMessageToPlugin(LLPluginMessage("base", "cleanup")); } @@ -218,7 +218,7 @@ void LLPluginProcessChild::idle(void) if (mWaitGoodbye.hasExpired()) { LL_WARNS() << "Wait for goodbye expired. Advancing to UNLOADED" << LL_ENDL; - if (mInstance != NULL) + if (mInstance != nullptr) { // Something went wrong, at least make sure plugin will terminate sendMessageToPlugin(LLPluginMessage("base", "force_exit")); @@ -242,7 +242,7 @@ void LLPluginProcessChild::idle(void) case STATE_UNLOADED: killSockets(); delete mInstance; - mInstance = NULL; + mInstance = nullptr; setState(STATE_DONE); break; @@ -329,7 +329,7 @@ void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message) } else { - LL_WARNS("Plugin") << "mInstance == NULL" << LL_ENDL; + LL_WARNS("Plugin") << "mInstance == nullptr" << LL_ENDL; } } @@ -472,7 +472,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message) } } - if (passMessage && mInstance != NULL) + if (passMessage && mInstance != nullptr) { LLTimer elapsed; @@ -577,7 +577,7 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message) // The plugin wants to block and wait for a response to this message. sleep(mSleepTime); // this will pump the message pipe and process messages - if (mBlockingResponseReceived || mSocketError != APR_SUCCESS || (mMessagePipe == NULL)) + if (mBlockingResponseReceived || mSocketError != APR_SUCCESS || (mMessagePipe == nullptr)) { // Response has been received, or we've hit an error state. Stop waiting. mBlockingRequest = false; diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 4f55d75e7d5..e295ea5b028 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -46,11 +46,11 @@ LLPluginProcessParentOwner::~LLPluginProcessParentOwner() } bool LLPluginProcessParent::sUseReadThread = false; -apr_pollset_t *LLPluginProcessParent::sPollSet = NULL; +apr_pollset_t *LLPluginProcessParent::sPollSet = nullptr; bool LLPluginProcessParent::sPollsetNeedsRebuild = false; LLCoros::Mutex *LLPluginProcessParent::sInstancesMutex = nullptr; LLPluginProcessParent::mapInstances_t LLPluginProcessParent::sInstances; -LLThread *LLPluginProcessParent::sReadThread = NULL; +LLThread *LLPluginProcessParent::sReadThread = nullptr; class LLPluginProcessParentPollThread: public LLThread @@ -99,7 +99,7 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner): mDebug = false; mBlocked = false; mPolledInput = false; - mPollFD.client_data = NULL; + mPollFD.client_data = nullptr; mPluginLaunchTimeout = 60.0f; mPluginLockupTimeout = 15.0f; @@ -120,7 +120,7 @@ LLPluginProcessParent::~LLPluginProcessParent() // destroy the shared memory region iter->second->destroy(); delete iter->second; - iter->second = NULL; + iter->second = nullptr; // and remove it from our map mSharedMemoryRegions.erase(iter); @@ -173,7 +173,7 @@ void LLPluginProcessParent::shutdown() && state != STATE_ERROR) { (*it).second->setState(STATE_GOODBYE); - (*it).second->mOwner = NULL; + (*it).second->mOwner = nullptr; } if (state != STATE_DONE) { @@ -187,7 +187,7 @@ void LLPluginProcessParent::shutdown() void LLPluginProcessParent::requestShutdown() { setState(STATE_GOODBYE); - mOwner = NULL; + mOwner = nullptr; if (LLApp::isQuitting()) { // if we're quitting, run the idle once more @@ -287,7 +287,7 @@ bool LLPluginProcessParent::accept() bool result = false; apr_status_t status = APR_EGENERAL; - apr_socket_t *new_socket = NULL; + apr_socket_t *new_socket = nullptr; status = apr_socket_accept( &new_socket, @@ -301,7 +301,7 @@ bool LLPluginProcessParent::accept() // Success. Create a message pipe on the new socket // we MUST create a new pool for the LLSocket, since it will take ownership of it and delete it in its destructor! - apr_pool_t* new_pool = NULL; + apr_pool_t* new_pool = nullptr; status = apr_pool_create(&new_pool, gAPRPoolp); mSocket = LLSocket::create(new_socket, new_pool); @@ -397,7 +397,7 @@ void LLPluginProcessParent::idle(void) { apr_status_t status = APR_SUCCESS; - apr_sockaddr_t* addr = NULL; + apr_sockaddr_t* addr = nullptr; mListenSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); mBoundPort = 0; if (!mListenSocket) @@ -436,7 +436,7 @@ void LLPluginProcessParent::idle(void) // Get the actual port the socket was bound to { - apr_sockaddr_t* bound_addr = NULL; + apr_sockaddr_t* bound_addr = nullptr; if(ll_apr_warn_status(apr_socket_addr_get(&bound_addr, APR_LOCAL, mListenSocket->getSocket()))) { killSockets(); @@ -671,7 +671,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_LAUNCH_FAILURE: - if(mOwner != NULL) + if(mOwner != nullptr) { mOwner->pluginLaunchFailed(); } @@ -679,7 +679,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_ERROR: - if(mOwner != NULL) + if(mOwner != nullptr) { mOwner->pluginDied(); } @@ -781,12 +781,12 @@ void LLPluginProcessParent::setMessagePipe(LLPluginMessagePipe *message_pipe) if(mMessagePipe) { // Unsetting an existing message pipe -- remove from the pollset - mPollFD.client_data = NULL; + mPollFD.client_data = nullptr; // pollset needs an update update_pollset = true; } - if(message_pipe != NULL) + if(message_pipe != nullptr) { // Set up the apr_pollfd_t mPollFD.p = gAPRPoolp; @@ -835,7 +835,7 @@ void LLPluginProcessParent::updatePollset() LL_DEBUGS("PluginPoll") << "destroying pollset " << sPollSet << LL_ENDL; // delete the existing pollset. apr_pollset_destroy(sPollSet); - sPollSet = NULL; + sPollSet = nullptr; } mapInstances_t::iterator iter; @@ -863,7 +863,7 @@ void LLPluginProcessParent::updatePollset() { #endif // APR_POLLSET_NOCOPY LL_WARNS("PluginPoll") << "Couldn't create pollset. Falling back to non-pollset mode." << LL_ENDL; - sPollSet = NULL; + sPollSet = nullptr; #ifdef APR_POLLSET_NOCOPY } else @@ -919,7 +919,7 @@ void LLPluginProcessParent::setUseReadThread(bool use_read_thread) // shut down the read thread LL_INFOS("PluginPoll") << "destroying read thread " << LL_ENDL; delete sReadThread; - sReadThread = NULL; + sReadThread = nullptr; } } @@ -1013,7 +1013,7 @@ void LLPluginProcessParent::servicePoll() apr_pollset_remove(sPollSet, &mPollFD); // and tell the code not to re-add it - mPollFD.client_data = NULL; + mPollFD.client_data = nullptr; } } @@ -1057,7 +1057,7 @@ void LLPluginProcessParent::receiveMessageEarly(const LLPluginMessage &message) { // Call out to the owner and see if they to reply // TODO: Should this only happen when blocked? - if(mOwner != NULL) + if(mOwner != nullptr) { handled = mOwner->receivePluginMessageEarly(message); } @@ -1146,7 +1146,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) // destroy the shared memory region iter->second->destroy(); delete iter->second; - iter->second = NULL; + iter->second = nullptr; // and remove it from our map mSharedMemoryRegions.erase(iter); @@ -1159,7 +1159,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) } else { - if(mOwner != NULL) + if(mOwner != nullptr) { mOwner->receivePluginMessage(message); } @@ -1225,7 +1225,7 @@ size_t LLPluginProcessParent::getSharedMemorySize(const std::string &name) } void *LLPluginProcessParent::getSharedMemoryAddress(const std::string &name) { - void *result = NULL; + void *result = nullptr; sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name); if(iter != mSharedMemoryRegions.end()) diff --git a/indra/llplugin/llpluginsharedmemory.cpp b/indra/llplugin/llpluginsharedmemory.cpp index 28a0f0bf4e7..34cc8fad2bf 100644 --- a/indra/llplugin/llpluginsharedmemory.cpp +++ b/indra/llplugin/llpluginsharedmemory.cpp @@ -117,7 +117,7 @@ class LLPluginSharedMemoryPlatformImpl LLPluginSharedMemory::LLPluginSharedMemory() { mSize = 0; - mMappedAddress = NULL; + mMappedAddress = nullptr; mNeedsDestroy = false; mImpl = new LLPluginSharedMemoryPlatformImpl; @@ -143,7 +143,7 @@ LLPluginSharedMemory::~LLPluginSharedMemory() LLPluginSharedMemoryPlatformImpl::LLPluginSharedMemoryPlatformImpl() { - mAprSharedMemory = NULL; + mAprSharedMemory = nullptr; } LLPluginSharedMemoryPlatformImpl::~LLPluginSharedMemoryPlatformImpl() @@ -154,7 +154,7 @@ LLPluginSharedMemoryPlatformImpl::~LLPluginSharedMemoryPlatformImpl() bool LLPluginSharedMemory::map(void) { mMappedAddress = apr_shm_baseaddr_get(mImpl->mAprSharedMemory); - if(mMappedAddress == NULL) + if(mMappedAddress == nullptr) { return false; } @@ -208,7 +208,7 @@ bool LLPluginSharedMemory::destroy(void) { // TODO: Is this a fatal error? I think not... } - mImpl->mAprSharedMemory = NULL; + mImpl->mAprSharedMemory = nullptr; } return true; @@ -239,7 +239,7 @@ bool LLPluginSharedMemory::detach(void) { // TODO: Is this a fatal error? I think not... } - mImpl->mAprSharedMemory = NULL; + mImpl->mAprSharedMemory = nullptr; } return true; @@ -260,8 +260,8 @@ LLPluginSharedMemoryPlatformImpl::~LLPluginSharedMemoryPlatformImpl() bool LLPluginSharedMemory::map(void) { - mMappedAddress = ::mmap(NULL, mSize, PROT_READ | PROT_WRITE, MAP_SHARED, mImpl->mSharedMemoryFD, 0); - if(mMappedAddress == NULL) + mMappedAddress = ::mmap(nullptr, mSize, PROT_READ | PROT_WRITE, MAP_SHARED, mImpl->mSharedMemoryFD, 0); + if(mMappedAddress == nullptr) { return false; } @@ -273,7 +273,7 @@ bool LLPluginSharedMemory::map(void) bool LLPluginSharedMemory::unmap(void) { - if(mMappedAddress != NULL) + if(mMappedAddress != nullptr) { LL_DEBUGS("Plugin") << "calling munmap(" << mMappedAddress << ", " << mSize << ")" << LL_ENDL; if(::munmap(mMappedAddress, mSize) == -1) @@ -281,7 +281,7 @@ bool LLPluginSharedMemory::unmap(void) // TODO: Is this a fatal error? I think not... } - mMappedAddress = NULL; + mMappedAddress = nullptr; } return true; @@ -382,7 +382,7 @@ bool LLPluginSharedMemory::detach(void) LLPluginSharedMemoryPlatformImpl::LLPluginSharedMemoryPlatformImpl() { - mMapFile = NULL; + mMapFile = nullptr; } LLPluginSharedMemoryPlatformImpl::~LLPluginSharedMemoryPlatformImpl() @@ -399,7 +399,7 @@ bool LLPluginSharedMemory::map(void) 0, mSize); - if(mMappedAddress == NULL) + if(mMappedAddress == nullptr) { LL_WARNS("Plugin") << "MapViewOfFile failed: " << GetLastError() << LL_ENDL; return false; @@ -412,10 +412,10 @@ bool LLPluginSharedMemory::map(void) bool LLPluginSharedMemory::unmap(void) { - if(mMappedAddress != NULL) + if(mMappedAddress != nullptr) { UnmapViewOfFile(mMappedAddress); - mMappedAddress = NULL; + mMappedAddress = nullptr; } return true; @@ -423,10 +423,10 @@ bool LLPluginSharedMemory::unmap(void) bool LLPluginSharedMemory::close(void) { - if(mImpl->mMapFile != NULL) + if(mImpl->mMapFile != nullptr) { CloseHandle(mImpl->mMapFile); - mImpl->mMapFile = NULL; + mImpl->mMapFile = nullptr; } return true; @@ -447,13 +447,13 @@ bool LLPluginSharedMemory::create(size_t size) mImpl->mMapFile = CreateFileMappingA( INVALID_HANDLE_VALUE, // use paging file - NULL, // default security + nullptr, // default security PAGE_READWRITE, // read/write access 0, // max. object size static_cast(mSize), // buffer size mName.c_str()); // name of mapping object - if(mImpl->mMapFile == NULL) + if(mImpl->mMapFile == nullptr) { LL_WARNS("Plugin") << "CreateFileMapping failed: " << GetLastError() << LL_ENDL; return false; @@ -481,7 +481,7 @@ bool LLPluginSharedMemory::attach(const std::string &name, size_t size) false, // do not inherit the name mName.c_str()); // name of mapping object - if(mImpl->mMapFile == NULL) + if(mImpl->mMapFile == nullptr) { LL_WARNS("Plugin") << "OpenFileMapping failed: " << GetLastError() << LL_ENDL; return false; diff --git a/indra/llplugin/llpluginsharedmemory.h b/indra/llplugin/llpluginsharedmemory.h index a0aa885a586..45adec54af3 100644 --- a/indra/llplugin/llpluginsharedmemory.h +++ b/indra/llplugin/llpluginsharedmemory.h @@ -82,7 +82,7 @@ class LLPluginSharedMemory * * @return True if memory address is non-null, false otherwise. */ - bool isMapped(void) const { return (mMappedAddress != NULL); }; + bool isMapped(void) const { return (mMappedAddress != nullptr); }; /** * Get pointer to shared memory. * diff --git a/indra/llplugin/slplugin/slplugin-objc.mm b/indra/llplugin/slplugin/slplugin-objc.mm index adde594b59a..f12166a6660 100644 --- a/indra/llplugin/slplugin/slplugin-objc.mm +++ b/indra/llplugin/slplugin/slplugin-objc.mm @@ -66,7 +66,7 @@ } } -static NSAutoreleasePool *sPool = NULL; +static NSAutoreleasePool *sPool = nullptr; void LLCocoaPlugin::createAutoReleasePool() { @@ -81,7 +81,7 @@ if(sPool) { [sPool release]; - sPool = NULL; + sPool = nullptr; } } @@ -131,7 +131,7 @@ // if ( current_window == parent_window ) parent_is_front_process = true; // if ( current_window == mPluginWindow ) this_is_front_process = true; // -// if (current_window != NULL && mFrontWindow == NULL) +// if (current_window != nullptr && mFrontWindow == nullptr) // { // // Opening the first window // @@ -151,7 +151,7 @@ // [NSApp activateIgnoringOtherApps:YES]; // } // -// else if (( current_window == NULL) && (mFrontWindow != NULL)) +// else if (( current_window == nullptr) && (mFrontWindow != nullptr)) // { // // Closing the last window // diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index 81a27cf2e55..257b798fd1e 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -119,7 +119,7 @@ bool checkExceptionHandler() } else { - LL_WARNS("AppInit") << "Our exception handler (" << (void *)myWin32ExceptionHandler << ") replaced with NULL!" << LL_ENDL; + LL_WARNS("AppInit") << "Our exception handler (" << (void *)myWin32ExceptionHandler << ") replaced with nullptr!" << LL_ENDL; } } diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index 2e1e43d9e84..3513b8ad6ed 100644 --- a/indra/media_plugins/base/media_plugin_base.cpp +++ b/indra/media_plugins/base/media_plugin_base.cpp @@ -108,7 +108,7 @@ void MediaPluginBase::staticReceiveMessage(const char *message_string, void **us { MediaPluginBase *self = (MediaPluginBase*)*user_data; - if(self != NULL) + if(self != nullptr) { self->receiveMessage(message_string); @@ -116,7 +116,7 @@ void MediaPluginBase::staticReceiveMessage(const char *message_string, void **us if(self->mDeleteMe) { delete self; - *user_data = NULL; + *user_data = nullptr; } } } diff --git a/indra/media_plugins/cef/mac_volume_catcher.cpp b/indra/media_plugins/cef/mac_volume_catcher.cpp index 54ebbfe1c70..b439e317c0a 100644 --- a/indra/media_plugins/cef/mac_volume_catcher.cpp +++ b/indra/media_plugins/cef/mac_volume_catcher.cpp @@ -72,7 +72,7 @@ class VolumeCatcherImpl F32 mPan; }; -VolumeCatcherImpl *VolumeCatcherImpl::sInstance = NULL;; +VolumeCatcherImpl *VolumeCatcherImpl::sInstance = nullptr;; struct VolumeCatcherStorage { @@ -107,10 +107,10 @@ VolumeCatcherImpl::VolumeCatcherImpl() desc.componentFlagsMask = 0; // Find the original default output component - mOriginalDefaultOutput = FindNextComponent(NULL, &desc); + mOriginalDefaultOutput = FindNextComponent(nullptr, &desc); // Register our own output component with the same parameters - mVolumeAdjuster = RegisterComponent(&desc, NewComponentRoutineUPP(volume_catcher_component_entry), 0, NULL, NULL, NULL); + mVolumeAdjuster = RegisterComponent(&desc, NewComponentRoutineUPP(volume_catcher_component_entry), 0, nullptr, nullptr, nullptr); // Capture the original component, so we always get found instead. CaptureComponent(mOriginalDefaultOutput, mVolumeAdjuster); @@ -152,7 +152,7 @@ static ComponentResult volume_catcher_component_open(VolumeCatcherStorage *stora storage = new VolumeCatcherStorage; storage->self = self; - storage->delegate = NULL; + storage->delegate = nullptr; result = OpenAComponent(impl->mOriginalDefaultOutput, &(storage->delegate)); @@ -187,7 +187,7 @@ static ComponentResult volume_catcher_component_close(VolumeCatcherStorage *stor if(storage->delegate) { CloseComponent(storage->delegate); - storage->delegate = NULL; + storage->delegate = nullptr; } VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance(); diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 5693420bb6d..6fa7bad01ae 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -591,7 +591,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) { if (mPixels == iter->second.mAddress) { - mPixels = NULL; + mPixels = nullptr; mTextureSegmentName.clear(); } mSharedSegments.erase(iter); diff --git a/indra/media_plugins/cef/windows_volume_catcher.cpp b/indra/media_plugins/cef/windows_volume_catcher.cpp index 1e52fee9ded..c92b8e8bf16 100644 --- a/indra/media_plugins/cef/windows_volume_catcher.cpp +++ b/indra/media_plugins/cef/windows_volume_catcher.cpp @@ -65,7 +65,7 @@ void VolumeCatcherImpl::setVolume(F32 volume) DWORD left_channel = (DWORD)(mVolume * 65535.0f); DWORD right_channel = (DWORD)(mVolume * 65535.0f); DWORD hw_volume = left_channel << 16 | right_channel; - ::waveOutSetVolume(NULL, hw_volume); + ::waveOutSetVolume(nullptr, hw_volume); } void VolumeCatcherImpl::setPan(F32 pan) diff --git a/indra/media_plugins/example/media_plugin_example.cpp b/indra/media_plugins/example/media_plugin_example.cpp index 0b22b7833ff..ba2e1a72b66 100644 --- a/indra/media_plugins/example/media_plugin_example.cpp +++ b/indra/media_plugins/example/media_plugin_example.cpp @@ -152,7 +152,7 @@ void mediaPluginExample::receiveMessage(const char* message_string) if (mPixels == iter->second.mAddress) { // This is the currently active pixel buffer. Make sure we stop drawing to it. - mPixels = NULL; + mPixels = nullptr; mTextureSegmentName.clear(); } mSharedSegments.erase(iter); @@ -286,7 +286,7 @@ void mediaPluginExample::update(F64 milliseconds) mFirstTime = false; }; - if (time(NULL) > mLastUpdateTime + 3) + if (time(nullptr) > mLastUpdateTime + 3) { const int num_squares = rand() % 20 + 4; int sqr1_r = rand() % 0x80 + 0x20; diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp index 2356236d167..c84a88704aa 100644 --- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp +++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp @@ -142,7 +142,7 @@ void* MediaPluginLibVLC::lock(void* data, void** p_pixels) *p_pixels = context->texture_pixels; - return NULL; + return nullptr; } ///////////////////////////////////////////////////////////////////////////////// @@ -442,7 +442,7 @@ void MediaPluginLibVLC::setVolumeVLC() DWORD left_channel = (DWORD)(mCurVolume * 65535.0f); DWORD right_channel = (DWORD)(mCurVolume * 65535.0f); DWORD hw_volume = left_channel << 16 | right_channel; - waveOutSetVolume(NULL, hw_volume); + waveOutSetVolume(nullptr, hw_volume); #endif } else @@ -531,7 +531,7 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string) libvlc_media_player_release(mLibVLCMediaPlayer); mLibVLCMediaPlayer = 0; - mPixels = NULL; + mPixels = nullptr; mTextureSegmentName.clear(); } mSharedSegments.erase(iter); From 92e92ddfa966c987ec3dd846b63b84d237489e0b Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 02:11:53 -0500 Subject: [PATCH 08/11] Replace legacy NULL with nullptr in llprimitive --- indra/llprimitive/lldaeloader.cpp | 74 ++++++++++---------- indra/llprimitive/llmaterialid.cpp | 2 +- indra/llprimitive/llmaterialtable.cpp | 12 ++-- indra/llprimitive/llmediaentry.cpp | 8 +-- indra/llprimitive/llmodel.cpp | 12 ++-- indra/llprimitive/llmodel.h | 8 +-- indra/llprimitive/llmodelloader.h | 2 +- indra/llprimitive/llprimitive.cpp | 10 +-- indra/llprimitive/llprimtexturelist.cpp | 6 +- indra/llprimitive/lltextureentry.cpp | 40 +++++------ indra/llprimitive/lltextureentry.h | 4 +- indra/llprimitive/tests/llprimitive_test.cpp | 14 ++-- 12 files changed, 96 insertions(+), 96 deletions(-) diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 71fc2b4fc08..8da7554339d 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -158,9 +158,9 @@ LLModel::EModelStatus load_face_from_dom_triangles( S32 tc_offset = -1; S32 norm_offset = -1; - domSource* pos_source = NULL; - domSource* tc_source = NULL; - domSource* norm_source = NULL; + domSource* pos_source = nullptr; + domSource* tc_source = nullptr; + domSource* norm_source = nullptr; S32 idx_stride = 0; @@ -313,13 +313,13 @@ LLModel::EModelStatus load_face_from_dom_triangles( if (!norm_source) { //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!tc_source) { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } face = LLVolumeFace(); @@ -350,13 +350,13 @@ LLModel::EModelStatus load_face_from_dom_triangles( if (!norm_source) { //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!tc_source) { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } } @@ -386,9 +386,9 @@ LLModel::EModelStatus load_face_from_dom_polylist( S32 tc_offset = -1; S32 norm_offset = -1; - domSource* pos_source = NULL; - domSource* tc_source = NULL; - domSource* norm_source = NULL; + domSource* pos_source = nullptr; + domSource* tc_source = nullptr; + domSource* norm_source = nullptr; S32 idx_stride = 0; @@ -594,13 +594,13 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!norm_source) { //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!tc_source) { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } face = LLVolumeFace(); @@ -631,13 +631,13 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!norm_source) { //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!tc_source) { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } } @@ -656,9 +656,9 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac S32 n_offset = -1; S32 t_offset = -1; - domListOfFloats* v = NULL; - domListOfFloats* n = NULL; - domListOfFloats* t = NULL; + domListOfFloats* v = nullptr; + domListOfFloats* n = nullptr; + domListOfFloats* t = nullptr; U32 stride = 0; for (U32 i = 0; i < inputs.getCount(); ++i) @@ -857,13 +857,13 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac if (!n) { //ll_aligned_free_16(new_face.mNormals); - new_face.mNormals = NULL; + new_face.mNormals = nullptr; } if (!t) { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } } @@ -976,7 +976,7 @@ bool LLDAELoader::OpenFile(const std::string& filename) daeDatabase* db = dae.getDatabase(); - daeInt count = db->getElementCount(NULL, COLLADA_TYPE_MESH); + daeInt count = db->getElementCount(nullptr, COLLADA_TYPE_MESH); daeDocument* doc = dae.getDoc(uri_filename); if (!doc) @@ -1000,12 +1000,12 @@ bool LLDAELoader::OpenFile(const std::string& filename) //Verify some basic properties of the dae //1. Basic validity check on controller - U32 controllerCount = db->getElementCount(NULL, "controller"); + U32 controllerCount = db->getElementCount(nullptr, "controller"); bool result = false; for (U32 i = 0; i < controllerCount; ++i) { - domController* pController = NULL; - db->getElement( (daeElement**) &pController, i , NULL, "controller" ); + domController* pController = nullptr; + db->getElement( (daeElement**) &pController, i , nullptr, "controller" ); result = verifyController( pController ); if (!result) { @@ -1061,8 +1061,8 @@ bool LLDAELoader::OpenFile(const std::string& filename) U32 submodel_limit = count > 0 ? mGeneratedModelLimit/count : 0; for (daeInt idx = 0; idx < count; ++idx) { //build map of domEntities to LLModel - domMesh* mesh = NULL; - db->getElement((daeElement**) &mesh, idx, NULL, COLLADA_TYPE_MESH); + domMesh* mesh = nullptr; + db->getElement((daeElement**) &mesh, idx, nullptr, COLLADA_TYPE_MESH); if (mesh) { @@ -1112,11 +1112,11 @@ bool LLDAELoader::OpenFile(const std::string& filename) model_iter++; } - count = db->getElementCount(NULL, COLLADA_TYPE_SKIN); + count = db->getElementCount(nullptr, COLLADA_TYPE_SKIN); for (daeInt idx = 0; idx < count; ++idx) { //add skinned meshes as instances - domSkin* skin = NULL; - db->getElement((daeElement**) &skin, idx, NULL, COLLADA_TYPE_SKIN); + domSkin* skin = nullptr; + db->getElement((daeElement**) &skin, idx, nullptr, COLLADA_TYPE_SKIN); if (skin) { @@ -1251,7 +1251,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //Some collada setup for accessing the skeleton - U32 skeleton_count = dae->getDatabase()->getElementCount( NULL, "skeleton" ); + U32 skeleton_count = dae->getDatabase()->getElementCount( nullptr, "skeleton" ); std::vector skeletons; for (U32 i = 0; i < skeleton_count; i++) { @@ -1260,7 +1260,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do //Try to get at the skeletal instance controller domInstance_controller::domSkeleton* pSkeleton = daeSafeCast( pElement ); - daeElement* pSkeletonRootNode = NULL; + daeElement* pSkeletonRootNode = nullptr; if (pSkeleton) { pSkeletonRootNode = pSkeleton->getValue().getElement(); @@ -1599,7 +1599,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if (weights) { domInputLocalOffset_Array& inputs = weights->getInput_array(); - domFloat_array* vertex_weights = NULL; + domFloat_array* vertex_weights = nullptr; for (size_t i = 0; i < inputs.getCount(); ++i) { if (strcmp(inputs[i]->getSemantic(), COMMON_PROFILE_INPUT_WEIGHT) == 0) @@ -1735,7 +1735,7 @@ void LLDAELoader::processJointToNodeMapping( domNode* pNode ) } else { - LL_INFOS()<<"Node is NULL"<getName() ) { - LL_INFOS()<<"Created node is NULL or invalid"<getName() == NULL) + if (pNode->getName() == nullptr) { LL_WARNS() << "nameless node, can't process" << LL_ENDL; return; @@ -2003,7 +2003,7 @@ daeElement* LLDAELoader::getChildFromElement( daeElement* pElement, std::string return pChildOfElement; } LL_DEBUGS("Mesh")<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << LL_ENDL; - return NULL; + return nullptr; } void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* dae) @@ -2208,7 +2208,7 @@ std::map LLDAELoader::getMaterials(LLModel* model { LLImportMaterial import_material; - domInstance_material* instance_mat = NULL; + domInstance_material* instance_mat = nullptr; domBind_material::domTechnique_common* technique = daeSafeCast(instance_geo->getDescendant(daeElement::matchType(domBind_material::domTechnique_common::ID()))); @@ -2304,7 +2304,7 @@ LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE } else if (texture->getTexture()) { - domImage* image = NULL; + domImage* image = nullptr; dae->getDatabase()->getElement((daeElement**) &image, 0, texture->getTexture(), COLLADA_TYPE_IMAGE); if (image) { diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index b417f095ca5..61d97169785 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -103,7 +103,7 @@ const U8* LLMaterialID::get() const void LLMaterialID::set(const void* pMemory) { - llassert(pMemory != NULL); + llassert(pMemory != nullptr); // assumes that the required size of memory is available memcpy(mID, pMemory, MATERIAL_ID_SIZE * sizeof(U8)); diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 44c97d63e7a..d4a29a69e05 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -86,9 +86,9 @@ F32 const LLMaterialTable::DEFAULT_FRICTION = 0.5f; F32 const LLMaterialTable::DEFAULT_RESTITUTION = 0.4f; LLMaterialTable::LLMaterialTable() - : mCollisionSoundMatrix(NULL), - mSlidingSoundMatrix(NULL), - mRollingSoundMatrix(NULL) + : mCollisionSoundMatrix(nullptr), + mSlidingSoundMatrix(nullptr), + mRollingSoundMatrix(nullptr) { } @@ -102,19 +102,19 @@ LLMaterialTable::~LLMaterialTable() if (mCollisionSoundMatrix) { delete [] mCollisionSoundMatrix; - mCollisionSoundMatrix = NULL; + mCollisionSoundMatrix = nullptr; } if (mSlidingSoundMatrix) { delete [] mSlidingSoundMatrix; - mSlidingSoundMatrix = NULL; + mSlidingSoundMatrix = nullptr; } if (mRollingSoundMatrix) { delete [] mRollingSoundMatrix; - mRollingSoundMatrix = NULL; + mRollingSoundMatrix = nullptr; } for_each(mMaterialInfoList.begin(), mMaterialInfoList.end(), DeletePointer()); diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp index 48c6ba1fa5d..424864bc3a6 100644 --- a/indra/llprimitive/llmediaentry.cpp +++ b/indra/llprimitive/llmediaentry.cpp @@ -93,12 +93,12 @@ LLMediaEntry::LLMediaEntry() : // mWhiteList mPermsInteract(PERM_ALL), mPermsControl(PERM_ALL), - mMediaIDp(NULL) + mMediaIDp(nullptr) { } LLMediaEntry::LLMediaEntry(const LLMediaEntry &rhs) : - mMediaIDp(NULL) + mMediaIDp(nullptr) { // "general" fields mAltImageEnable = rhs.mAltImageEnable; @@ -124,7 +124,7 @@ LLMediaEntry::LLMediaEntry(const LLMediaEntry &rhs) : LLMediaEntry::~LLMediaEntry() { - if (NULL != mMediaIDp) + if (nullptr != mMediaIDp) { delete mMediaIDp; } @@ -585,7 +585,7 @@ U32 LLMediaEntry::setHeightPixels(U16 height) const LLUUID &LLMediaEntry::getMediaID() const { // Lazily generate media ID - if (NULL == mMediaIDp) + if (nullptr == mMediaIDp) { mMediaIDp = new LLUUID(); mMediaIDp->generate(); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 8055bffd32a..a7826f8c6fd 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -567,7 +567,7 @@ void LLModel::setVolumeFaceData( else { //ll_aligned_free_16(face.mNormals); - face.mNormals = NULL; + face.mNormals = nullptr; } if (tc.get()) @@ -578,7 +578,7 @@ void LLModel::setVolumeFaceData( else { //ll_aligned_free_16(face.mTexCoords); - face.mTexCoords = NULL; + face.mTexCoords = nullptr; } U32 size = (num_indices*2+0xF)&~0xF; @@ -743,7 +743,7 @@ void LLModel::generateNormals(F32 angle_cutoff) else { //ll_aligned_free_16(new_face.mTexCoords); - new_face.mTexCoords = NULL; + new_face.mTexCoords = nullptr; } //generate normals for new face @@ -851,7 +851,7 @@ LLSD LLModel::writeModel( mdl["physics_convex"] = decomp.asLLSD(); if (!decomp.mHull.empty() && !as_slm) { //convex decomposition exists, physics mesh will not be used (unless this is an slm file) - model[LLModel::LOD_PHYSICS] = NULL; + model[LLModel::LOD_PHYSICS] = nullptr; } } else if (submodel_id) @@ -860,7 +860,7 @@ LLSD LLModel::writeModel( mdl["secondary"] = true; mdl["submodel_id"] = submodel_id; mdl["physics_convex"] = fake_decomp.asLLSD(); - model[LLModel::LOD_PHYSICS] = NULL; + model[LLModel::LOD_PHYSICS] = nullptr; } if (as_slm) @@ -873,7 +873,7 @@ LLSD LLModel::writeModel( for (U32 idx = 0; idx < MODEL_NAMES_LENGTH; ++idx) { - if (model[idx] && (model[idx]->getNumVolumeFaces() > 0) && model[idx]->getVolumeFace(0).mPositions != NULL) + if (model[idx] && (model[idx]->getNumVolumeFaces() > 0) && model[idx]->getVolumeFace(0).mPositions != nullptr) { LLVector3 min_pos = LLVector3(model[idx]->getVolumeFace(0).mPositions[0].getF32ptr()); LLVector3 max_pos = min_pos; diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index d624b6dc7ad..f4b03b410d8 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -205,7 +205,7 @@ class alignas(16) LLModel : public LLVolume void sortVolumeFacesByMaterialName(); void normalizeVolumeFaces(); void normalizeVolumeFacesAndWeights(); - void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL); + void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = nullptr); void remapVolumeFaces(); void optimizeVolumeFaces(); void offsetMesh( const LLVector3& pivotPoint ); @@ -388,16 +388,16 @@ class LLModelInstanceBase } LLModelInstanceBase() - : mModel(NULL) + : mModel(nullptr) { } virtual ~LLModelInstanceBase() { - mModel = NULL; + mModel = nullptr; for (int j = 0; j < LLModel::NUM_LODS; ++j) { - mLOD[j] = NULL; + mLOD[j] = nullptr; } }; }; diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index 8acc75b1bef..b69aac8a4e6 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -194,7 +194,7 @@ class LLModelLoader : public LLThread //----------------------------------------------------------------------------- bool isNodeAJoint(const char* name) { - return name != NULL && mJointMap.find(name) != mJointMap.end(); + return name != nullptr && mJointMap.find(name) != mJointMap.end(); } const LLSD logOut() const { return mWarningsArray; } diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index c5d6076b984..4993e62157b 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -157,14 +157,14 @@ const U8 material_id_type::s_null_id[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; //static // LEGACY: by default we use the LLVolumeMgr::gVolumeMgr global // TODO -- eliminate this global from the codebase! -LLVolumeMgr* LLPrimitive::sVolumeManager = NULL; +LLVolumeMgr* LLPrimitive::sVolumeManager = nullptr; // static void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager ) { if ( !volume_manager || sVolumeManager ) { - LL_ERRS() << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << LL_ENDL; + LL_ERRS() << "LLPrimitive::sVolumeManager attempting to be set to nullptr or it already has been set." << LL_ENDL; } sVolumeManager = volume_manager; } @@ -177,7 +177,7 @@ bool LLPrimitive::cleanupVolumeManager() { res = sVolumeManager->cleanup(); delete sVolumeManager; - sVolumeManager = NULL; + sVolumeManager = nullptr; } return res; } @@ -193,7 +193,7 @@ LLPrimitive::LLPrimitive() mPrimitiveCode = 0; mMaterial = LL_MCODE_STONE; - mVolumep = NULL; + mVolumep = nullptr; mChanged = UNCHANGED; @@ -216,7 +216,7 @@ LLPrimitive::~LLPrimitive() { sVolumeManager->unrefVolume(mVolumep); } - mVolumep = NULL; + mVolumep = nullptr; } void LLPrimitive::clearTextureList() diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index c70a8f6483f..905be5f8452 100644 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -31,7 +31,7 @@ #include "lltextureentry.h" // static -//int (TMyClass::*pt2Member)(float, char, char) = NULL; // C++ +//int (TMyClass::*pt2Member)(float, char, char) = nullptr; // C++ LLTextureEntry* (*LLPrimTextureList::sNewTextureEntryCallback)() = &(LLTextureEntry::newTextureEntry); // static @@ -70,7 +70,7 @@ void LLPrimTextureList::clear() while (itr != mEntryList.end()) { delete (*itr); - (*itr) = NULL; + (*itr) = nullptr; ++itr; } mEntryList.clear(); @@ -173,7 +173,7 @@ LLTextureEntry* LLPrimTextureList::getTexture(const U8 index) const { return mEntryList[index]; } - return NULL; + return nullptr; } //virtual diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index ac482ffbf9c..1c240296d78 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -60,7 +60,7 @@ LLTextureEntry* LLTextureEntry::newTextureEntry() //=============================================================== LLTextureEntry::LLTextureEntry() - : mMediaEntry(NULL) + : mMediaEntry(nullptr) , mSelected(false) , mMaterialUpdatePending(false) { @@ -68,7 +68,7 @@ LLTextureEntry::LLTextureEntry() } LLTextureEntry::LLTextureEntry(const LLUUID& tex_id) - : mMediaEntry(NULL) + : mMediaEntry(nullptr) , mSelected(false) , mMaterialUpdatePending(false) { @@ -76,7 +76,7 @@ LLTextureEntry::LLTextureEntry(const LLUUID& tex_id) } LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs) - : mMediaEntry(NULL) + : mMediaEntry(nullptr) , mSelected(false) , mMaterialUpdatePending(false) { @@ -99,15 +99,15 @@ LLTextureEntry &LLTextureEntry::operator=(const LLTextureEntry &rhs) mGlow = rhs.mGlow; mMaterialID = rhs.mMaterialID; mMaterial = rhs.mMaterial; - if (mMediaEntry != NULL) { + if (mMediaEntry != nullptr) { delete mMediaEntry; } - if (rhs.mMediaEntry != NULL) { + if (rhs.mMediaEntry != nullptr) { // Make a copy mMediaEntry = new LLMediaEntry(*rhs.mMediaEntry); } else { - mMediaEntry = NULL; + mMediaEntry = nullptr; } mMaterialID = rhs.mMaterialID; @@ -150,10 +150,10 @@ void LLTextureEntry::init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 of mMaterialID.clear(); setColor(LLColor4(1.f, 1.f, 1.f, 1.f)); - if (mMediaEntry != NULL) { + if (mMediaEntry != nullptr) { delete mMediaEntry; } - mMediaEntry = NULL; + mMediaEntry = nullptr; } LLTextureEntry::~LLTextureEntry() @@ -161,13 +161,13 @@ LLTextureEntry::~LLTextureEntry() if(mMediaEntry) { delete mMediaEntry; - mMediaEntry = NULL; + mMediaEntry = nullptr; } if (mGLTFMaterial) { mGLTFMaterial->removeTextureEntry(this); - mGLTFMaterial = NULL; + mGLTFMaterial = nullptr; } } @@ -225,7 +225,7 @@ void LLTextureEntry::asLLSD(LLSD& sd) const sd["media_flags"] = mMediaFlags; if (hasMedia()) { LLSD mediaData; - if (NULL != getMediaData()) { + if (nullptr != getMediaData()) { getMediaData()->asLLSD(mediaData); } sd[TEXTURE_MEDIA_DATA_KEY] = mediaData; @@ -623,14 +623,14 @@ S32 LLTextureEntry::setMediaFlags(U8 media_flags) mMediaFlags |= media_flags; // Special code for media handling - if( hasMedia() && mMediaEntry == NULL) + if( hasMedia() && mMediaEntry == nullptr) { mMediaEntry = new LLMediaEntry; } - else if ( ! hasMedia() && mMediaEntry != NULL) + else if ( ! hasMedia() && mMediaEntry != nullptr) { delete mMediaEntry; - mMediaEntry = NULL; + mMediaEntry = nullptr; } return TEM_CHANGE_MEDIA; @@ -692,7 +692,7 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams) void LLTextureEntry::setMediaData(const LLMediaEntry &media_entry) { mMediaFlags |= MF_HAS_MEDIA; - if (NULL != mMediaEntry) + if (nullptr != mMediaEntry) { delete mMediaEntry; } @@ -709,7 +709,7 @@ bool LLTextureEntry::updateMediaData(const LLSD& media_data) } else { mMediaFlags |= MF_HAS_MEDIA; - if (mMediaEntry == NULL) + if (mMediaEntry == nullptr) { mMediaEntry = new LLMediaEntry; } @@ -723,16 +723,16 @@ bool LLTextureEntry::updateMediaData(const LLSD& media_data) void LLTextureEntry::clearMediaData() { mMediaFlags &= ~MF_HAS_MEDIA; - if (mMediaEntry != NULL) { + if (mMediaEntry != nullptr) { delete mMediaEntry; } - mMediaEntry = NULL; + mMediaEntry = nullptr; } void LLTextureEntry::mergeIntoMediaData(const LLSD& media_fields) { mMediaFlags |= MF_HAS_MEDIA; - if (mMediaEntry == NULL) + if (mMediaEntry == nullptr) { mMediaEntry = new LLMediaEntry; } @@ -767,7 +767,7 @@ U32 LLTextureEntry::getVersionFromMediaVersionString(const std::string &version_ { found = version_string.find_first_of("/", found); std::string v = version_string.substr(MEDIA_VERSION_STRING_PREFIX.length(), found); - version = strtoul(v.c_str(),NULL,10); + version = strtoul(v.c_str(), nullptr, 10); } } return version; diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h index 78c61b4d654..dd5e3944a84 100644 --- a/indra/llprimitive/lltextureentry.h +++ b/indra/llprimitive/lltextureentry.h @@ -163,9 +163,9 @@ class LLTextureEntry const LLMaterialID& getMaterialID() const { return mMaterialID; }; const LLMaterialPtr getMaterialParams() const { return mMaterial; }; - // *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL. + // *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return nullptr. // CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData() - // to NOT return NULL. + // to NOT return nullptr. bool hasMedia() const { return (bool)(mMediaFlags & MF_HAS_MEDIA); } LLMediaEntry* getMediaData() const { return mMediaEntry; } diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 75c3613eceb..9208d43539d 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -35,7 +35,7 @@ class DummyVolumeMgr : public LLVolumeMgr { public: - DummyVolumeMgr() : LLVolumeMgr(), mVolumeTest(NULL), mCurrDetailTest(0) {} + DummyVolumeMgr() : LLVolumeMgr(), mVolumeTest(nullptr), mCurrDetailTest(0) {} ~DummyVolumeMgr() { } @@ -61,7 +61,7 @@ class DummyVolumeMgr : public LLVolumeMgr { if (mVolumeTest == volumep) { - mVolumeTest = NULL; + mVolumeTest = nullptr; } } @@ -170,7 +170,7 @@ namespace tut set_test_name("Test Static llprimitive constructor and initer."); LLPCode code = 1; LLPrimitive * primitive = LLPrimitive::createPrimitive(code); - ensure(primitive != NULL); + ensure(primitive != nullptr); ensure_equals(primitive->getPCode(), code); } @@ -182,7 +182,7 @@ namespace tut LLVolumeParams params; // Make sure volume starts off null - ensure(primitive.getVolume() == NULL); + ensure(primitive.getVolume() == nullptr); // Make sure we have no texture entries before setting the volume ensure_equals(primitive.getNumTEs(), 0); @@ -195,7 +195,7 @@ namespace tut LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created - ensure(new_volume != NULL); + ensure(new_volume != nullptr); // Make sure that now that we've set the volume we have texture entries ensure_not_equals(primitive.getNumTEs(), 0); @@ -227,7 +227,7 @@ namespace tut LLVolumeParams params; // Make sure volume starts off null - ensure(primitive.getVolume() == NULL); + ensure(primitive.getVolume() == nullptr); // Make sure we have no texture entries before setting the volume ensure_equals(primitive.getNumTEs(), 0); @@ -241,7 +241,7 @@ namespace tut LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created - ensure(new_volume != NULL); + ensure(new_volume != nullptr); // Make sure that now that we've set the volume we have texture entries ensure_not_equals(primitive.getNumTEs(), 0); From 534eb4fec9be190c23b964a642ae2747737fa251 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 02:57:04 -0500 Subject: [PATCH 09/11] Replace legacy NULL with nullptr in llcorehttp and llmessage --- indra/llcorehttp/README.Linden | 10 +- indra/llcorehttp/_httplibcurl.cpp | 36 ++--- indra/llcorehttp/_httpoprequest.cpp | 56 ++++---- indra/llcorehttp/_httppolicy.cpp | 2 +- indra/llcorehttp/_httprequestqueue.cpp | 4 +- indra/llcorehttp/_httpservice.cpp | 16 +-- indra/llcorehttp/bufferarray.cpp | 2 +- indra/llcorehttp/bufferstream.cpp | 14 +- indra/llcorehttp/bufferstream.h | 2 +- .../llcorehttp/examples/http_texture_load.cpp | 28 ++-- indra/llcorehttp/httpcommon.cpp | 8 +- indra/llcorehttp/httpcommon.h | 6 +- indra/llcorehttp/httpheaders.cpp | 2 +- indra/llcorehttp/httprequest.cpp | 6 +- indra/llcorehttp/httpresponse.cpp | 4 +- indra/llcorehttp/httpresponse.h | 6 +- indra/llcorehttp/tests/llcorehttp_test.cpp | 2 +- indra/llcorehttp/tests/test_allocator.cpp | 4 +- indra/llcorehttp/tests/test_bufferarray.hpp | 4 +- indra/llcorehttp/tests/test_bufferstream.hpp | 22 +-- indra/llcorehttp/tests/test_httpheaders.hpp | 50 +++---- indra/llcorehttp/tests/test_httprequest.hpp | 136 +++++++++--------- indra/llmessage/llassetstorage.cpp | 22 +-- indra/llmessage/llavatarnamecache.cpp | 2 +- indra/llmessage/llbuffer.cpp | 36 ++--- indra/llmessage/llbuffer.h | 2 +- indra/llmessage/llbufferstream.cpp | 8 +- indra/llmessage/llcachename.cpp | 12 +- indra/llmessage/llchainio.cpp | 4 +- indra/llmessage/llcircuit.cpp | 10 +- indra/llmessage/llcorehttputil.cpp | 4 +- indra/llmessage/lldatapacker.cpp | 2 +- indra/llmessage/lldatapacker.h | 28 ++-- indra/llmessage/lldispatcher.cpp | 2 +- indra/llmessage/llhttpnode.cpp | 8 +- indra/llmessage/llhttpnode.h | 2 +- indra/llmessage/llhttpsdhandler.cpp | 2 +- indra/llmessage/llinstantmessage.cpp | 2 +- indra/llmessage/lliobuffer.cpp | 6 +- indra/llmessage/lliohttpserver.cpp | 20 +-- indra/llmessage/lliohttpserver.h | 2 +- indra/llmessage/lliopipe.h | 2 +- indra/llmessage/lliosocket.cpp | 36 ++--- indra/llmessage/lliosocket.h | 6 +- indra/llmessage/llmessagetemplate.h | 22 +-- indra/llmessage/llmessagetemplateparser.cpp | 14 +- indra/llmessage/llnamevalue.cpp | 54 +++---- indra/llmessage/llpacketack.cpp | 10 +- indra/llmessage/llpacketack.h | 10 +- indra/llmessage/llpacketbuffer.cpp | 2 +- indra/llmessage/llproxy.cpp | 6 +- indra/llmessage/llpumpio.cpp | 44 +++--- indra/llmessage/llsdhttpserver.cpp | 2 +- indra/llmessage/llsdmessagebuilder.cpp | 4 +- indra/llmessage/llsdmessagereader.cpp | 6 +- indra/llmessage/llservice.cpp | 4 +- indra/llmessage/llservice.h | 2 +- indra/llmessage/lltemplatemessagebuilder.cpp | 36 ++--- indra/llmessage/lltemplatemessagereader.cpp | 14 +- indra/llmessage/lltransfermanager.cpp | 42 +++--- indra/llmessage/lltransfersourceasset.cpp | 6 +- indra/llmessage/lltransfersourcefile.cpp | 6 +- indra/llmessage/lltransfertargetfile.cpp | 6 +- indra/llmessage/lltransfertargetvfile.cpp | 4 +- indra/llmessage/lluseroperation.cpp | 8 +- indra/llmessage/llxfer.cpp | 10 +- indra/llmessage/llxfer_file.cpp | 18 +-- indra/llmessage/llxfer_mem.cpp | 2 +- indra/llmessage/llxfer_vfile.cpp | 16 +-- indra/llmessage/llxfermanager.cpp | 28 ++-- indra/llmessage/llxorcipher.cpp | 14 +- indra/llmessage/message.cpp | 88 ++++++------ indra/llmessage/message.h | 12 +- indra/llmessage/net.cpp | 14 +- indra/llmessage/net.h | 2 +- indra/llmessage/partsyspacket.cpp | 2 +- indra/llmessage/tests/llhttpclient_test.cpp | 2 +- indra/llmessage/tests/llhttpnode_stub.cpp | 10 +- indra/llmessage/tests/llnamevalue_test.cpp | 8 +- .../lltemplatemessagedispatcher_test.cpp | 8 +- indra/llmessage/tests/networkio.h | 4 +- 81 files changed, 589 insertions(+), 589 deletions(-) diff --git a/indra/llcorehttp/README.Linden b/indra/llcorehttp/README.Linden index c3aaa9158d0..d2f91ca8c95 100644 --- a/indra/llcorehttp/README.Linden +++ b/indra/llcorehttp/README.Linden @@ -41,7 +41,7 @@ // Our request object. Allocate during initialiation. - static LLCore::HttpRequest * my_request(NULL); + static LLCore::HttpRequest * my_request(nullptr); // The policy class for HTTP traffic. // Use HttpRequest::DEFAULT_POLICY_ID, but DO NOT SHIP WITH THIS VALUE!! @@ -70,8 +70,8 @@ handle = my_request->requestGet(my_policy, my_priority, "http://www.example.com/", - NULL, - NULL, + nullptr, + nullptr, my_handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { @@ -275,7 +275,7 @@ << LL_ENDL; delete my_handler; // No longer needed. - my_handler = NULL; + my_handler = nullptr; } @@ -526,7 +526,7 @@ HttpOperation::addAsReply: TRACE, ToReplyQueue, Handle: 086D3148 // And don't forget to release the BufferArray. data->release(); - data = NULL; + data = nullptr; There are now helper functions in llmessage/llcorehttputil.h to diff --git a/indra/llcorehttp/_httplibcurl.cpp b/indra/llcorehttp/_httplibcurl.cpp index 6a15f080119..f79c2e68ff2 100644 --- a/indra/llcorehttp/_httplibcurl.cpp +++ b/indra/llcorehttp/_httplibcurl.cpp @@ -62,9 +62,9 @@ HttpLibcurl::HttpLibcurl(HttpService * service) : mService(service), mHandleCache(), mPolicyCount(0), - mMultiHandles(NULL), - mActiveHandles(NULL), - mDirtyPolicy(NULL) + mMultiHandles(nullptr), + mActiveHandles(nullptr), + mDirtyPolicy(nullptr) {} @@ -72,7 +72,7 @@ HttpLibcurl::~HttpLibcurl() { shutdown(); - mService = NULL; + mService = nullptr; } @@ -98,13 +98,13 @@ void HttpLibcurl::shutdown() } delete [] mMultiHandles; - mMultiHandles = NULL; + mMultiHandles = nullptr; delete [] mActiveHandles; - mActiveHandles = NULL; + mActiveHandles = nullptr; delete [] mDirtyPolicy; - mDirtyPolicy = NULL; + mDirtyPolicy = nullptr; } mPolicyCount = 0; @@ -124,7 +124,7 @@ void HttpLibcurl::start(int policy_count) for (unsigned int policy_class(0); policy_class < mPolicyCount; ++policy_class) { - if (NULL == (mMultiHandles[policy_class] = curl_multi_init())) + if (nullptr == (mMultiHandles[policy_class] = curl_multi_init())) { LL_ERRS(LOG_CORE) << "Failed to allocate multi handle in libcurl." << LL_ENDL; @@ -177,7 +177,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport() while (0 != running && CURLM_CALL_MULTI_PERFORM == status); // Run completion on anything done - CURLMsg * msg(NULL); + CURLMsg * msg(nullptr); int msgs_in_queue(0); { LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("httppt - curl_multi_info_read"); @@ -189,7 +189,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport() CURLcode result(msg->data.result); completeRequest(mMultiHandles[policy_class], handle, result); - handle = NULL; // No longer valid on return + handle = nullptr; // No longer valid on return ret = HttpService::NORMAL; // If anything completes, we may have a free slot. // Turning around quickly reduces connection gap by 7-10mS. } @@ -222,7 +222,7 @@ void HttpLibcurl::addOp(const HttpOpRequest::ptr_t &op) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; llassert_always(op->mReqPolicy < mPolicyCount); - llassert_always(mMultiHandles[op->mReqPolicy] != NULL); + llassert_always(mMultiHandles[op->mReqPolicy] != nullptr); // Create standard handle if (! op->prepareRequest(mService)) @@ -297,7 +297,7 @@ void HttpLibcurl::cancelRequest(const HttpOpRequest::ptr_t &op) // Detach from multi and recycle handle curl_multi_remove_handle(mMultiHandles[op->mReqPolicy], op->mCurlHandle); mHandleCache.freeHandle(op->mCurlHandle); - op->mCurlHandle = NULL; + op->mCurlHandle = nullptr; // Tracing if (op->mTracing > HTTP_TRACE_OFF) @@ -318,7 +318,7 @@ void HttpLibcurl::cancelRequest(const HttpOpRequest::ptr_t &op) bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode status) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - HttpHandle ophandle(NULL); + HttpHandle ophandle(nullptr); CURLcode ccode(CURLE_OK); @@ -375,7 +375,7 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode { if (http_status >= 100 && http_status <= 999) { - char * cont_type(NULL); + char * cont_type(nullptr); ccode = curl_easy_getinfo(handle, CURLINFO_CONTENT_TYPE, &cont_type); if (ccode == CURLE_OK) { @@ -421,7 +421,7 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode << std::hex << multi_handle << " h:" << std::hex << handle << std::dec << LL_ENDL; } - op->mCurlHandle = NULL; + op->mCurlHandle = nullptr; // Tracing if (op->mTracing > HTTP_TRACE_OFF) @@ -533,7 +533,7 @@ void HttpLibcurl::policyUpdated(unsigned int policy_class) // --------------------------------------- HttpLibcurl::HandleCache::HandleCache() - : mHandleTemplate(NULL) + : mHandleTemplate(nullptr) { mCache.reserve(50); } @@ -544,7 +544,7 @@ HttpLibcurl::HandleCache::~HandleCache() if (mHandleTemplate) { curl_easy_cleanup(mHandleTemplate); - mHandleTemplate = NULL; + mHandleTemplate = nullptr; } for (handle_cache_t::iterator it(mCache.begin()); mCache.end() != it; ++it) @@ -557,7 +557,7 @@ HttpLibcurl::HandleCache::~HandleCache() CURL * HttpLibcurl::HandleCache::getHandle() { - CURL * ret(NULL); + CURL * ret(nullptr); if (! mCache.empty()) { diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 9704486791c..eb8e6803a28 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -130,19 +130,19 @@ HttpOpRequest::HttpOpRequest() : HttpOperation(), mProcFlags(0U), mReqMethod(HOR_GET), - mReqBody(NULL), + mReqBody(nullptr), mReqOffset(0), mReqLength(0), mReqHeaders(), mReqOptions(), mCurlActive(false), - mCurlHandle(NULL), - mCurlService(NULL), - mCurlHeaders(NULL), + mCurlHandle(nullptr), + mCurlService(nullptr), + mCurlHeaders(nullptr), mCurlBodyPos(0), - mCurlTemp(NULL), + mCurlTemp(nullptr), mCurlTempLen(0), - mReplyBody(NULL), + mReplyBody(nullptr), mReplyOffset(0), mReplyLength(0), mReplyFullLength(0), @@ -166,7 +166,7 @@ HttpOpRequest::~HttpOpRequest() if (mReqBody) { mReqBody->release(); - mReqBody = NULL; + mReqBody = nullptr; } if (mCurlHandle) @@ -174,25 +174,25 @@ HttpOpRequest::~HttpOpRequest() // Uncertain of thread context so free using // safest method. curl_easy_cleanup(mCurlHandle); - mCurlHandle = NULL; + mCurlHandle = nullptr; } - mCurlService = NULL; + mCurlService = nullptr; if (mCurlHeaders) { curl_slist_free_all(mCurlHeaders); - mCurlHeaders = NULL; + mCurlHeaders = nullptr; } delete [] mCurlTemp; - mCurlTemp = NULL; + mCurlTemp = nullptr; mCurlTempLen = 0; if (mReplyBody) { mReplyBody->release(); - mReplyBody = NULL; + mReplyBody = nullptr; } } @@ -239,12 +239,12 @@ void HttpOpRequest::stageFromActive(HttpService * service) // threads. curl_slist_free_all(mCurlHeaders); - mCurlHeaders = NULL; + mCurlHeaders = nullptr; } // Also not needed on the other side delete [] mCurlTemp; - mCurlTemp = NULL; + mCurlTemp = nullptr; mCurlTempLen = 0; addAsReply(); @@ -311,7 +311,7 @@ HttpStatus HttpOpRequest::setupGet(HttpRequest::policy_t policy_id, const HttpHeaders::ptr_t & headers) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - setupCommon(policy_id, url, NULL, options, headers); + setupCommon(policy_id, url, nullptr, options, headers); mReqMethod = HOR_GET; return HttpStatus(); @@ -326,7 +326,7 @@ HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id, const HttpHeaders::ptr_t & headers) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - setupCommon(policy_id, url, NULL, options, headers); + setupCommon(policy_id, url, nullptr, options, headers); mReqMethod = HOR_GET; mReqOffset = static_cast(offset); mReqLength = len; @@ -373,7 +373,7 @@ HttpStatus HttpOpRequest::setupDelete(HttpRequest::policy_t policy_id, const HttpHeaders::ptr_t & headers) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - setupCommon(policy_id, url, NULL, options, headers); + setupCommon(policy_id, url, nullptr, options, headers); mReqMethod = HOR_DELETE; return HttpStatus(); @@ -400,7 +400,7 @@ HttpStatus HttpOpRequest::setupCopy(HttpRequest::policy_t policy_id, const HttpHeaders::ptr_t &headers) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - setupCommon(policy_id, url, NULL, options, headers); + setupCommon(policy_id, url, nullptr, options, headers); mReqMethod = HOR_COPY; return HttpStatus(); @@ -413,7 +413,7 @@ HttpStatus HttpOpRequest::setupMove(HttpRequest::policy_t policy_id, const HttpHeaders::ptr_t &headers) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - setupCommon(policy_id, url, NULL, options, headers); + setupCommon(policy_id, url, nullptr, options, headers); mReqMethod = HOR_MOVE; return HttpStatus(); @@ -472,19 +472,19 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; // Scrub transport and result data for retried op case mCurlActive = false; - mCurlHandle = NULL; - mCurlService = NULL; + mCurlHandle = nullptr; + mCurlService = nullptr; if (mCurlHeaders) { curl_slist_free_all(mCurlHeaders); - mCurlHeaders = NULL; + mCurlHeaders = nullptr; } mCurlBodyPos = 0; if (mReplyBody) { mReplyBody->release(); - mReplyBody = NULL; + mReplyBody = nullptr; } mReplyOffset = 0; mReplyLength = 0; @@ -622,7 +622,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) { data_size = static_cast(mReqBody->size()); } - check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast(NULL)); + check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, static_cast(nullptr)); check_curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDSIZE, data_size); mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); } @@ -1031,13 +1031,13 @@ CURLcode HttpOpRequest::curlSslCtxCallback(CURL *curl, void *sslctx, void *userd if (op->mReqOptions && op->mReqOptions->getSSLVerifyPeer()) { // verification for ssl certs - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL); + SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, nullptr); } else { // disable any default verification for server certs // Ex: setting urls (assume non-SL) for parcel media in LLFloaterURLEntry - SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL); + SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr); } // set the verification callback. SSL_CTX_set_cert_verify_callback(ctx, sslCertVerifyCallback, userdata); @@ -1189,14 +1189,14 @@ int parse_content_range_header(char * buffer, { static const char * const hdr_whitespace(" \t"); - char * tok_state(NULL), * tok(NULL); + char * tok_state(nullptr), * tok(nullptr); bool match(true); if (! (tok = os_strtok_r(buffer, hdr_whitespace, &tok_state))) match = false; else match = (0 == os_strcasecmp("bytes", tok)); - if (match && ! (tok = os_strtok_r(NULL, hdr_whitespace, &tok_state))) + if (match && ! (tok = os_strtok_r(nullptr, hdr_whitespace, &tok_state))) match = false; if (match) { diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index a39d2f21a91..e311fc3cc78 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -92,7 +92,7 @@ HttpPolicy::~HttpPolicy() } mClasses.clear(); - mService = NULL; + mService = nullptr; } diff --git a/indra/llcorehttp/_httprequestqueue.cpp b/indra/llcorehttp/_httprequestqueue.cpp index df89fb85ec2..58e16a04ae1 100644 --- a/indra/llcorehttp/_httprequestqueue.cpp +++ b/indra/llcorehttp/_httprequestqueue.cpp @@ -35,7 +35,7 @@ using namespace LLCoreInt; namespace LLCore { -HttpRequestQueue * HttpRequestQueue::sInstance(NULL); +HttpRequestQueue * HttpRequestQueue::sInstance(nullptr); HttpRequestQueue::HttpRequestQueue() @@ -63,7 +63,7 @@ void HttpRequestQueue::term() if (sInstance) { sInstance->release(); - sInstance = NULL; + sInstance = nullptr; } } diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index e14a5334794..a60b8bc1196 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -64,14 +64,14 @@ const HttpService::OptionDescriptor HttpService::sOptionDesc[] = { true, true, false, true, false }, // PO_THROTTLE_RATE { false, false, true, false, true } // PO_SSL_VERIFY_CALLBACK }; -HttpService * HttpService::sInstance(NULL); +HttpService * HttpService::sInstance(nullptr); volatile HttpService::EState HttpService::sState(NOT_INITIALIZED); HttpService::HttpService() - : mRequestQueue(NULL), + : mRequestQueue(nullptr), mExitRequested(0U), - mPolicy(NULL), - mTransport(NULL), + mPolicy(nullptr), + mTransport(nullptr), mLastPolicy(0) {} @@ -118,14 +118,14 @@ HttpService::~HttpService() if (mRequestQueue) { mRequestQueue->release(); - mRequestQueue = NULL; + mRequestQueue = nullptr; } delete mTransport; - mTransport = NULL; + mTransport = nullptr; delete mPolicy; - mPolicy = NULL; + mPolicy = nullptr; mThread.reset(); } @@ -167,7 +167,7 @@ void HttpService::term() } delete sInstance; - sInstance = NULL; + sInstance = nullptr; } sState = NOT_INITIALIZED; } diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index 46c03f991d5..aab504e1dbe 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -104,7 +104,7 @@ BufferArray::~BufferArray() ++it) { delete *it; - *it = NULL; + *it = nullptr; } mBlocks.clear(); } diff --git a/indra/llcorehttp/bufferstream.cpp b/indra/llcorehttp/bufferstream.cpp index ea92f2f71dc..23e3b2f1461 100644 --- a/indra/llcorehttp/bufferstream.cpp +++ b/indra/llcorehttp/bufferstream.cpp @@ -36,9 +36,9 @@ BufferArrayStreamBuf::BufferArrayStreamBuf(BufferArray * array) : mBufferArray(array), mReadCurPos(0), mReadCurBlock(-1), - mReadBegin(NULL), - mReadCur(NULL), - mReadEnd(NULL), + mReadBegin(nullptr), + mReadCur(nullptr), + mReadEnd(nullptr), mWriteCurPos(0) { if (array) @@ -54,7 +54,7 @@ BufferArrayStreamBuf::~BufferArrayStreamBuf() if (mBufferArray) { mBufferArray->release(); - mBufferArray = NULL; + mBufferArray = nullptr; } } @@ -71,7 +71,7 @@ BufferArrayStreamBuf::int_type BufferArrayStreamBuf::underflow() // Find the next block with actual data or leave // mCurBlock/mCur/mEnd unchanged if we're at the end // of any block chain. - const char * new_begin(NULL), * new_end(NULL); + const char * new_begin(nullptr), * new_end(nullptr); int new_cur_block(mReadCurBlock + 1); while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) @@ -121,7 +121,7 @@ BufferArrayStreamBuf::int_type BufferArrayStreamBuf::pbackfail(int_type ch) // Find the previous block with actual data or leave // mCurBlock/mBegin/mCur/mEnd unchanged if we're at the // beginning of any block chain. - const char * new_begin(NULL), * new_end(NULL); + const char * new_begin(nullptr), * new_end(nullptr); int new_cur_block(mReadCurBlock - 1); while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) @@ -226,7 +226,7 @@ std::streampos BufferArrayStreamBuf::seekoff(std::streamoff off, int block(mBufferArray->findBlock(pos, &ba_offset)); if (block < 0) return ret; - const char * start(NULL), * end(NULL); + const char * start(nullptr), * end(nullptr); if (! mBufferArray->getBlockStartEnd(block, &start, &end)) return ret; mReadCurBlock = block; diff --git a/indra/llcorehttp/bufferstream.h b/indra/llcorehttp/bufferstream.h index ba84821df30..68db90f2bc7 100644 --- a/indra/llcorehttp/bufferstream.h +++ b/indra/llcorehttp/bufferstream.h @@ -57,7 +57,7 @@ /// LLSDSerialize::toXML(llsd, bas); /// operationOnBufferArray(ba); /// ba->release(); -/// ba = NULL; +/// ba = nullptr; /// // operationOnBufferArray and bas are each holding /// // references to the ba instance at this point. /// diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp index 986e675d00e..415ad05f57d 100644 --- a/indra/llcorehttp/examples/http_texture_load.cpp +++ b/indra/llcorehttp/examples/http_texture_load.cpp @@ -67,7 +67,7 @@ static char url_format[1024] = "http://example.com/some/path?texture_id=%s.textu #define strtok_r(_a, _b, _c) strtok_s(_a, _b, _c) int getopt(int argc, char * const argv[], const char *optstring); -char *optarg(NULL); +char *optarg(nullptr); int optind(1); #endif @@ -277,24 +277,24 @@ int main(int argc, char** argv) LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_CONNECTION_LIMIT, LLCore::HttpRequest::DEFAULT_POLICY_ID, concurrency_limit, - NULL); + nullptr); LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_PER_HOST_CONNECTION_LIMIT, LLCore::HttpRequest::DEFAULT_POLICY_ID, concurrency_limit, - NULL); + nullptr); if (pipeline_depth) { LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_PIPELINING_DEPTH, LLCore::HttpRequest::DEFAULT_POLICY_ID, pipeline_depth, - NULL); + nullptr); } if (tracing) { LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_TRACE, LLCore::HttpRequest::DEFAULT_POLICY_ID, tracing, - NULL); + nullptr); } LLCore::HttpRequest::startThread(); @@ -577,7 +577,7 @@ void WorkingSet::loadAssetUuids(FILE * in) while (fgets(buffer, sizeof(buffer), in)) { WorkingSet::Spec asset; - char * state(NULL); + char * state(nullptr); char * token = strtok_r(buffer, " \t\n,", &state); if (token && 36 == strlen(token)) { @@ -651,7 +651,7 @@ int getopt(int argc, char * const argv[], const char *optstring) } else { - optarg = NULL; + optarg = nullptr; ++pos; } return *thing; @@ -814,7 +814,7 @@ class Metrics::MetricsImpl { public: MetricsImpl() - : mProcFS(NULL), + : mProcFS(nullptr), mUsecsPerTick(U64L(0)) {} @@ -824,7 +824,7 @@ class Metrics::MetricsImpl if (mProcFS) { fclose(mProcFS); - mProcFS = NULL; + mProcFS = nullptr; } } @@ -849,7 +849,7 @@ class Metrics::MetricsImpl } U64 utime, stime; - if (scanProcFS(&utime, &stime, NULL)) + if (scanProcFS(&utime, &stime, nullptr)) { metrics->mStartSTime = stime; metrics->mStartUTime = utime; @@ -863,7 +863,7 @@ class Metrics::MetricsImpl void sample(Metrics * metrics) { U64 vsz; - if (scanProcFS(NULL, NULL, &vsz)) + if (scanProcFS(nullptr, nullptr, &vsz)) { metrics->mMaxVSZ = (std::max)(metrics->mMaxVSZ, vsz); metrics->mMinVSZ = (std::min)(metrics->mMinVSZ, vsz); @@ -874,7 +874,7 @@ class Metrics::MetricsImpl void term(Metrics * metrics) { U64 utime, stime; - if (scanProcFS(&utime, &stime, NULL)) + if (scanProcFS(&utime, &stime, nullptr)) { metrics->mEndSTime = stime; metrics->mEndUTime = utime; @@ -886,7 +886,7 @@ class Metrics::MetricsImpl if (mProcFS) { fclose(mProcFS); - mProcFS = NULL; + mProcFS = nullptr; } } @@ -986,7 +986,7 @@ Metrics::Metrics() Metrics::~Metrics() { delete mImpl; - mImpl = NULL; + mImpl = nullptr; } diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp index 315ff15ebbd..8be613afc50 100644 --- a/indra/llcorehttp/httpcommon.cpp +++ b/indra/llcorehttp/httpcommon.cpp @@ -272,12 +272,12 @@ namespace { CURL *getCurlTemplateHandle() { - static CURL *curlpTemplateHandle = NULL; + static CURL *curlpTemplateHandle = nullptr; - if (curlpTemplateHandle == NULL) + if (curlpTemplateHandle == nullptr) { // Late creation of the template curl handle curlpTemplateHandle = curl_easy_init(); - if (curlpTemplateHandle == NULL) + if (curlpTemplateHandle == nullptr) { LL_WARNS() << "curl error calling curl_easy_init()" << LL_ENDL; } @@ -316,7 +316,7 @@ CURL *getCurlTemplateHandle() LLMutex *getCurlMutex() { - static LLMutex* sHandleMutexp = NULL; + static LLMutex* sHandleMutexp = nullptr; if (!sHandleMutexp) { diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h index 1c003a0966c..9823c157c75 100644 --- a/indra/llcorehttp/httpcommon.h +++ b/indra/llcorehttp/httpcommon.h @@ -135,8 +135,8 @@ /// hr->requestGet(HttpRequest::DEFAULT_POLICY_ID, /// 0, // Priority, not used yet /// url, -/// NULL, // options -/// NULL, // additional headers +/// nullptr, // options +/// nullptr, // additional headers /// handler); /// /// If that returns a value other than LLCORE_HTTP_HANDLE_INVALID, @@ -207,7 +207,7 @@ namespace LLCore typedef void * HttpHandle; -#define LLCORE_HTTP_HANDLE_INVALID (NULL) +#define LLCORE_HTTP_HANDLE_INVALID (nullptr) /// For internal scheduling and metrics, we use a microsecond /// timebase compatible with the environment. diff --git a/indra/llcorehttp/httpheaders.cpp b/indra/llcorehttp/httpheaders.cpp index 6f1d0db370d..03e0b01d776 100644 --- a/indra/llcorehttp/httpheaders.cpp +++ b/indra/llcorehttp/httpheaders.cpp @@ -114,7 +114,7 @@ const std::string * HttpHeaders::find(const std::string &name) const return &(*iter).second; } } - return NULL; + return nullptr; } void HttpHeaders::remove(const char *name) diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index d8fcd6a03fe..800c58d6dc0 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -55,7 +55,7 @@ namespace LLCore HttpRequest::HttpRequest() : mReplyQueue(), - mRequestQueue(NULL) + mRequestQueue(nullptr) { mRequestQueue = HttpRequestQueue::instanceOf(); mRequestQueue->addRef(); @@ -71,7 +71,7 @@ HttpRequest::~HttpRequest() if (mRequestQueue) { mRequestQueue->release(); - mRequestQueue = NULL; + mRequestQueue = nullptr; } mReplyQueue.reset(); @@ -437,7 +437,7 @@ HttpStatus HttpRequest::update(long usecs) replies.end() != iter; ++iter) { - // Swap op pointer for NULL; + // Swap op pointer for nullptr; op.reset(); op.swap(*iter); diff --git a/indra/llcorehttp/httpresponse.cpp b/indra/llcorehttp/httpresponse.cpp index 1436054c0ba..fd0bfddf6b7 100644 --- a/indra/llcorehttp/httpresponse.cpp +++ b/indra/llcorehttp/httpresponse.cpp @@ -38,7 +38,7 @@ HttpResponse::HttpResponse() mReplyOffset(0U), mReplyLength(0U), mReplyFullLength(0U), - mBufferArray(NULL), + mBufferArray(nullptr), mHeaders(), mRetries(0U), m503Retries(0U), @@ -48,7 +48,7 @@ HttpResponse::HttpResponse() HttpResponse::~HttpResponse() { - setBody(NULL); + setBody(nullptr); //setHeaders(); } diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index ed2d76c10f7..256a67476e3 100644 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -95,7 +95,7 @@ class HttpResponse : public LLCoreInt::RefCounted /// Simple getter for the response body returned as a scatter/gather /// buffer. If the operation doesn't produce data (such as the Null - /// or StopThread operations), this may be NULL. + /// or StopThread operations), this may be nullptr. /// /// Caller can hold onto the response by incrementing the reference /// count of the returned object. @@ -110,13 +110,13 @@ class HttpResponse : public LLCoreInt::RefCounted /// Set the response data in the instance. Will drop the reference /// count to any existing data and increment the count of that passed - /// in. It is legal to set the data to NULL. + /// in. It is legal to set the data to nullptr. void setBody(BufferArray * ba); /// And a getter for the headers. And as with @see getResponse(), /// if headers aren't available because the operation doesn't produce /// any or delivery of headers wasn't requested in the options, this - /// will be NULL. + /// will be nullptr. /// /// Caller can hold onto the headers by incrementing the reference /// count of the returned object. diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp index c7c50e61664..f8714f3fee3 100755 --- a/indra/llcorehttp/tests/llcorehttp_test.cpp +++ b/indra/llcorehttp/tests/llcorehttp_test.cpp @@ -95,7 +95,7 @@ std::string get_base_url() { std::cerr << "LL_TEST_PORT environment variable missing." << std::endl; std::cerr << "Test expects to run in test_llcorehttp_peer.py script." << std::endl; - tut::ensure("LL_TEST_PORT set in environment", NULL != env); + tut::ensure("LL_TEST_PORT set in environment", nullptr != env); } int port(atoi(env)); diff --git a/indra/llcorehttp/tests/test_allocator.cpp b/indra/llcorehttp/tests/test_allocator.cpp index 757736acbb0..2a19f7f2669 100644 --- a/indra/llcorehttp/tests/test_allocator.cpp +++ b/indra/llcorehttp/tests/test_allocator.cpp @@ -77,8 +77,8 @@ static bool CAS(void * volatile * ptr, void * expected, void * new_value) static void * GetMem(std::size_t size) { // TRACE_MSG(size); - volatile Block * pBlock = NULL; - volatile Block * pNewNext = NULL; + volatile Block * pBlock = nullptr; + volatile Block * pNewNext = nullptr; // do a lock-free update of the global next pointer do diff --git a/indra/llcorehttp/tests/test_bufferarray.hpp b/indra/llcorehttp/tests/test_bufferarray.hpp index 2a272e73d77..4d48246aab4 100644 --- a/indra/llcorehttp/tests/test_bufferarray.hpp +++ b/indra/llcorehttp/tests/test_bufferarray.hpp @@ -351,11 +351,11 @@ void BufferArrayTestObjectType::test<8>() // zero-length allocate (we allow this with a valid pointer returned) void * out_buf(ba->appendBufferAlloc(0)); - ensure("Buffer from zero-length appendBufferAlloc non-NULL", NULL != out_buf); + ensure("Buffer from zero-length appendBufferAlloc non-NULL", nullptr != out_buf); // Do it again void * out_buf2(ba->appendBufferAlloc(0)); - ensure("Buffer from zero-length appendBufferAlloc non-NULL.2", NULL != out_buf2); + ensure("Buffer from zero-length appendBufferAlloc non-NULL.2", nullptr != out_buf2); ensure("Two zero-length appendBufferAlloc buffers distinct", out_buf != out_buf2); // And some final writes diff --git a/indra/llcorehttp/tests/test_bufferstream.hpp b/indra/llcorehttp/tests/test_bufferstream.hpp index 556abf45a25..a6f0b5e33c1 100644 --- a/indra/llcorehttp/tests/test_bufferstream.hpp +++ b/indra/llcorehttp/tests/test_bufferstream.hpp @@ -58,7 +58,7 @@ void BufferStreamTestObjectType::test<1>() set_test_name("BufferArrayStreamBuf construction with NULL BufferArray"); // create a new ref counted object with an implicit reference - BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(NULL); + BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(nullptr); // Not much will work with a NULL ensure("underflow() on NULL fails", tst_traits_t::eof() == bsb->underflow()); @@ -71,7 +71,7 @@ void BufferStreamTestObjectType::test<1>() // release the implicit reference, causing the object to be released delete bsb; - bsb = NULL; + bsb = nullptr; } @@ -81,7 +81,7 @@ void BufferStreamTestObjectType::test<2>() set_test_name("BufferArrayStream construction with NULL BufferArray"); // create a new ref counted object with an implicit reference - BufferArrayStream * bas = new BufferArrayStream(NULL); + BufferArrayStream * bas = new BufferArrayStream(nullptr); // Not much will work with a NULL here ensure("eof() is false on NULL", ! bas->eof()); @@ -90,7 +90,7 @@ void BufferStreamTestObjectType::test<2>() // release the implicit reference, causing the object to be released delete bas; - bas = NULL; + bas = nullptr; } @@ -105,11 +105,11 @@ void BufferStreamTestObjectType::test<3>() // I can release my ref on the BA ba->release(); - ba = NULL; + ba = nullptr; // release the implicit reference, causing the object to be released delete bsb; - bsb = NULL; + bsb = nullptr; } @@ -128,7 +128,7 @@ void BufferStreamTestObjectType::test<4>() // release the implicit reference, causing the object to be released ba->release(); - ba = NULL; + ba = nullptr; } @@ -148,7 +148,7 @@ void BufferStreamTestObjectType::test<5>() // I can release my ref on the BA ba->release(); - ba = NULL; + ba = nullptr; // Various static state ensure("underflow() returns 'T'", bsb->underflow() == 'T'); @@ -171,7 +171,7 @@ void BufferStreamTestObjectType::test<5>() // release the implicit reference, causing the object to be released delete bsb; - bsb = NULL; + bsb = nullptr; } @@ -201,7 +201,7 @@ void BufferStreamTestObjectType::test<6>() // release the implicit reference, causing the object to be released ba->release(); - ba = NULL; + ba = nullptr; } @@ -242,7 +242,7 @@ void BufferStreamTestObjectType::test<7>() // release the implicit reference, causing the object to be released ba->release(); - ba = NULL; + ba = nullptr; } diff --git a/indra/llcorehttp/tests/test_httpheaders.hpp b/indra/llcorehttp/tests/test_httpheaders.hpp index d8eff78ca5e..68bf7089c48 100644 --- a/indra/llcorehttp/tests/test_httpheaders.hpp +++ b/indra/llcorehttp/tests/test_httpheaders.hpp @@ -112,22 +112,22 @@ void HttpHeadersTestObjectType::test<3>() ensure("Headers retained", 3 == headers->size()); - const std::string * result(NULL); + const std::string * result(nullptr); // Find a header result = headers->find("TRES"); - ensure("Found the last item", result != NULL); - ensure("Last item is a nice", result != NULL && str3v == *result); + ensure("Found the last item", result != nullptr); + ensure("Last item is a nice", result != nullptr && str3v == *result); // appends above are raw and find is case sensitive result = headers->find("TReS"); - ensure("Last item not found due to case", result == NULL); + ensure("Last item not found due to case", result == nullptr); result = headers->find("TRE"); - ensure("Last item not found due to prefixing (1)", result == NULL); + ensure("Last item not found due to prefixing (1)", result == nullptr); result = headers->find("TRESS"); - ensure("Last item not found due to prefixing (2)", result == NULL); + ensure("Last item not found due to prefixing (2)", result == nullptr); } // release the implicit reference, causing the object to be released @@ -149,26 +149,26 @@ void HttpHeadersTestObjectType::test<4>() ensure("First append worked in some fashion", 1 == headers->size()); - const std::string * result(NULL); + const std::string * result(nullptr); // Find a header result = headers->find("accept"); - ensure("Found 'accept'", result != NULL); - ensure("accept value has face", result != NULL && *result == line1v); + ensure("Found 'accept'", result != nullptr); + ensure("accept value has face", result != nullptr && *result == line1v); // Left-clean on value static char line2[] = " next : \t\tlinejunk \t"; headers->appendNormal(line2, sizeof(line2) - 1); ensure("Second append worked", 2 == headers->size()); result = headers->find("next"); - ensure("Found 'next'", result != NULL); - ensure("next value is left-clean", result != NULL && + ensure("Found 'next'", result != nullptr); + ensure("next value is left-clean", result != nullptr && *result == "linejunk \t"); // First value unmolested result = headers->find("accept"); - ensure("Found 'accept' again", result != NULL); - ensure("accept value has face", result != NULL && *result == line1v); + ensure("Found 'accept' again", result != nullptr); + ensure("accept value has face", result != nullptr && *result == line1v); // Colons in value are okay static char line3[] = "FancY-PANTs::plop:-neuf-=vleem="; @@ -176,16 +176,16 @@ void HttpHeadersTestObjectType::test<4>() headers->appendNormal(line3, sizeof(line3) - 1); ensure("Third append worked", 3 == headers->size()); result = headers->find("fancy-pants"); - ensure("Found 'fancy-pants'", result != NULL); - ensure("fancy-pants value has colons", result != NULL && *result == line3v); + ensure("Found 'fancy-pants'", result != nullptr); + ensure("fancy-pants value has colons", result != nullptr && *result == line3v); // Zero-length value static char line4[] = "all-talk-no-walk:"; headers->appendNormal(line4, sizeof(line4) - 1); ensure("Fourth append worked", 4 == headers->size()); result = headers->find("all-talk-no-walk"); - ensure("Found 'all-talk'", result != NULL); - ensure("al-talk value is zero-length", result != NULL && result->size() == 0); + ensure("Found 'all-talk'", result != nullptr); + ensure("al-talk value is zero-length", result != nullptr && result->size() == 0); // Zero-length name static char line5[] = ":all-talk-no-walk"; @@ -193,8 +193,8 @@ void HttpHeadersTestObjectType::test<4>() headers->appendNormal(line5, sizeof(line5) - 1); ensure("Fifth append worked", 5 == headers->size()); result = headers->find(""); - ensure("Found no-name", result != NULL); - ensure("no-name value is something", result != NULL && *result == line5v); + ensure("Found no-name", result != nullptr); + ensure("no-name value is something", result != nullptr && *result == line5v); // Lone colon is still something headers->clear(); @@ -202,24 +202,24 @@ void HttpHeadersTestObjectType::test<4>() headers->appendNormal(line6, sizeof(line6) - 1); ensure("Sixth append worked", 1 == headers->size()); result = headers->find(""); - ensure("Found 2nd no-name", result != NULL); - ensure("2nd no-name value is nothing", result != NULL && result->size() == 0); + ensure("Found 2nd no-name", result != nullptr); + ensure("2nd no-name value is nothing", result != nullptr && result->size() == 0); // Line without colons is taken as-is and unstripped in name static char line7[] = " \toskdgioasdghaosdghoowg28342908tg8902hg0hwedfhqew890v7qh0wdebv78q0wdevbhq>?M>BNM?NZ? \t"; headers->appendNormal(line7, sizeof(line7) - 1); ensure("Seventh append worked", 2 == headers->size()); result = headers->find(line7); - ensure("Found whatsit line", result != NULL); - ensure("Whatsit line has no value", result != NULL && result->size() == 0); + ensure("Found whatsit line", result != nullptr); + ensure("Whatsit line has no value", result != nullptr && result->size() == 0); // Normaling interface heeds the byte count, doesn't look for NUL-terminator static char line8[] = "binary:ignorestuffontheendofthis"; headers->appendNormal(line8, 13); ensure("Eighth append worked", 3 == headers->size()); result = headers->find("binary"); - ensure("Found 'binary'", result != NULL); - ensure("binary value was limited to 'ignore'", result != NULL && + ensure("Found 'binary'", result != nullptr); + ensure("binary value was limited to 'ignore'", result != nullptr && *result == "ignore"); } diff --git a/indra/llcorehttp/tests/test_httprequest.hpp b/indra/llcorehttp/tests/test_httprequest.hpp index 77ed8df066a..c50038a0e5e 100644 --- a/indra/llcorehttp/tests/test_httprequest.hpp +++ b/indra/llcorehttp/tests/test_httprequest.hpp @@ -94,7 +94,7 @@ class TestHandler2 : public LLCore::HttpHandler { ensure("Expected handle received in handler", mExpectHandle == handle); } - ensure("Handler got a response", NULL != response); + ensure("Handler got a response", nullptr != response); if (response && mState) { const HttpStatus actual_status(response->getStatus()); @@ -109,9 +109,9 @@ class TestHandler2 : public LLCore::HttpHandler } if (! mHeadersRequired.empty() || ! mHeadersDisallowed.empty()) { - ensure("Response required with header check", response != NULL); + ensure("Response required with header check", response != nullptr); HttpHeaders::ptr_t header(response->getHeaders()); // Will not hold onto this - ensure("Some quantity of headers returned", header != NULL); + ensure("Some quantity of headers returned", header != nullptr); if (! mHeadersRequired.empty()) { @@ -168,7 +168,7 @@ class TestHandler2 : public LLCore::HttpHandler if (! mCheckContentType.empty()) { - ensure("Response required with content type check", response != NULL); + ensure("Response required with content type check", response != nullptr); std::string con_type(response->getContentType()); ensure("Content-Type as expected (" + mCheckContentType + ")", mCheckContentType == con_type); @@ -196,7 +196,7 @@ void HttpRequestTestObjectType::test<1>() set_test_name("HttpRequest construction"); - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -208,7 +208,7 @@ void HttpRequestTestObjectType::test<1>() // release the request object delete req; - req = NULL; + req = nullptr; HttpRequest::destroyService(); } @@ -227,7 +227,7 @@ void HttpRequestTestObjectType::test<2>() set_test_name("HttpRequest and Null Op queued"); - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -243,7 +243,7 @@ void HttpRequestTestObjectType::test<2>() // release the request object delete req; - req = NULL; + req = nullptr; // Request queue should have two references: global singleton & service object ensure("Two references to request queue", 2 == HttpRequestQueue::instanceOf()->getRefCount()); @@ -279,7 +279,7 @@ void HttpRequestTestObjectType::test<3>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -334,7 +334,7 @@ void HttpRequestTestObjectType::test<3>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -366,8 +366,8 @@ void HttpRequestTestObjectType::test<4>() LLCore::HttpHandler::ptr_t handler2p(&handler2, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req1 = NULL; - HttpRequest * req2 = NULL; + HttpRequest * req1 = nullptr; + HttpRequest * req2 = nullptr; try { @@ -432,9 +432,9 @@ void HttpRequestTestObjectType::test<4>() // release the request object delete req1; - req1 = NULL; + req1 = nullptr; delete req2; - req2 = NULL; + req2 = nullptr; // Shut down service HttpRequest::destroyService(); @@ -469,7 +469,7 @@ void HttpRequestTestObjectType::test<5>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -503,7 +503,7 @@ void HttpRequestTestObjectType::test<5>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -534,7 +534,7 @@ void HttpRequestTestObjectType::test<6>() TestHandler2 handler(this, "handler"); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -570,7 +570,7 @@ void HttpRequestTestObjectType::test<6>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -600,7 +600,7 @@ void HttpRequestTestObjectType::test<7>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t opts; try @@ -670,7 +670,7 @@ void HttpRequestTestObjectType::test<7>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -705,7 +705,7 @@ void HttpRequestTestObjectType::test<8>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -766,7 +766,7 @@ void HttpRequestTestObjectType::test<8>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -800,7 +800,7 @@ void HttpRequestTestObjectType::test<9>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -863,7 +863,7 @@ void HttpRequestTestObjectType::test<9>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -897,7 +897,7 @@ void HttpRequestTestObjectType::test<10>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; BufferArray * body = new BufferArray; try @@ -962,11 +962,11 @@ void HttpRequestTestObjectType::test<10>() // Lose the request body body->release(); - body = NULL; + body = nullptr; // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1003,7 +1003,7 @@ void HttpRequestTestObjectType::test<11>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; BufferArray * body = new BufferArray; try @@ -1068,11 +1068,11 @@ void HttpRequestTestObjectType::test<11>() // Lose the request body body->release(); - body = NULL; + body = nullptr; // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1109,7 +1109,7 @@ void HttpRequestTestObjectType::test<12>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -1117,7 +1117,7 @@ void HttpRequestTestObjectType::test<12>() HttpRequest::createService(); // Enable tracing - HttpRequest::setStaticPolicyOption(HttpRequest::PO_TRACE, HttpRequest::DEFAULT_POLICY_ID, 2, NULL); + HttpRequest::setStaticPolicyOption(HttpRequest::PO_TRACE, HttpRequest::DEFAULT_POLICY_ID, 2, nullptr); // Start threading early so that thread memory is invariant // over the test. @@ -1175,7 +1175,7 @@ void HttpRequestTestObjectType::test<12>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1214,7 +1214,7 @@ void HttpRequestTestObjectType::test<13>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t opts; try @@ -1223,7 +1223,7 @@ void HttpRequestTestObjectType::test<13>() HttpRequest::createService(); // Enable tracing - HttpRequest::setStaticPolicyOption(HttpRequest::PO_TRACE, HttpRequest::DEFAULT_POLICY_ID, 2, NULL); + HttpRequest::setStaticPolicyOption(HttpRequest::PO_TRACE, HttpRequest::DEFAULT_POLICY_ID, 2, nullptr); // Start threading early so that thread memory is invariant // over the test. @@ -1291,7 +1291,7 @@ void HttpRequestTestObjectType::test<13>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1324,7 +1324,7 @@ void HttpRequestTestObjectType::test<14>() std::string url_base(get_base_url() + "/sleep/"); // path to a 30-second sleep mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t opts; try @@ -1395,7 +1395,7 @@ void HttpRequestTestObjectType::test<14>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1435,7 +1435,7 @@ void HttpRequestTestObjectType::test<15>() handler.mCheckContentType.clear(); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -1498,7 +1498,7 @@ void HttpRequestTestObjectType::test<15>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1536,7 +1536,7 @@ void HttpRequestTestObjectType::test<16>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; @@ -1734,7 +1734,7 @@ void HttpRequestTestObjectType::test<16>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1773,10 +1773,10 @@ void HttpRequestTestObjectType::test<17>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; - BufferArray * ba = NULL; + BufferArray * ba = nullptr; try { @@ -1866,7 +1866,7 @@ void HttpRequestTestObjectType::test<17>() handlerp); ensure("Valid handle returned for get request", handle != LLCORE_HTTP_HANDLE_INVALID); ba->release(); - ba = NULL; + ba = nullptr; // Run the notification pump. int count(0); @@ -1913,7 +1913,7 @@ void HttpRequestTestObjectType::test<17>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -1924,7 +1924,7 @@ void HttpRequestTestObjectType::test<17>() if (ba) { ba->release(); - ba = NULL; + ba = nullptr; } options.reset(); headers.reset(); @@ -1957,10 +1957,10 @@ void HttpRequestTestObjectType::test<18>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; - BufferArray * ba = NULL; + BufferArray * ba = nullptr; try { @@ -2051,7 +2051,7 @@ void HttpRequestTestObjectType::test<18>() handlerp); ensure("Valid handle returned for get request", handle != LLCORE_HTTP_HANDLE_INVALID); ba->release(); - ba = NULL; + ba = nullptr; // Run the notification pump. int count(0); @@ -2098,7 +2098,7 @@ void HttpRequestTestObjectType::test<18>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -2109,7 +2109,7 @@ void HttpRequestTestObjectType::test<18>() if (ba) { ba->release(); - ba = NULL; + ba = nullptr; } options.reset(); headers.reset(); @@ -2153,7 +2153,7 @@ void HttpRequestTestObjectType::test<19>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; @@ -2293,7 +2293,7 @@ void HttpRequestTestObjectType::test<19>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -2343,10 +2343,10 @@ void HttpRequestTestObjectType::test<20>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; - BufferArray * ba = NULL; + BufferArray * ba = nullptr; try { @@ -2457,7 +2457,7 @@ void HttpRequestTestObjectType::test<20>() handlerp); ensure("Valid handle returned for get request", handle != LLCORE_HTTP_HANDLE_INVALID); ba->release(); - ba = NULL; + ba = nullptr; // Run the notification pump. int count(0); @@ -2504,7 +2504,7 @@ void HttpRequestTestObjectType::test<20>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -2515,7 +2515,7 @@ void HttpRequestTestObjectType::test<20>() if (ba) { ba->release(); - ba = NULL; + ba = nullptr; } options.reset(); headers.reset(); @@ -2558,10 +2558,10 @@ void HttpRequestTestObjectType::test<21>() LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor); mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t options; HttpHeaders::ptr_t headers; - BufferArray * ba = NULL; + BufferArray * ba = nullptr; try { @@ -2665,7 +2665,7 @@ void HttpRequestTestObjectType::test<21>() handlerp); ensure("Valid handle returned for get request", handle != LLCORE_HTTP_HANDLE_INVALID); ba->release(); - ba = NULL; + ba = nullptr; // Run the notification pump. int count(0); @@ -2712,7 +2712,7 @@ void HttpRequestTestObjectType::test<21>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -2723,7 +2723,7 @@ void HttpRequestTestObjectType::test<21>() if (ba) { ba->release(); - ba = NULL; + ba = nullptr; } options.reset(); headers.reset(); @@ -2759,7 +2759,7 @@ void HttpRequestTestObjectType::test<22>() mHandlerCalls = 0; HttpOptions::ptr_t options; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; try { @@ -2903,7 +2903,7 @@ void HttpRequestTestObjectType::test<22>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); @@ -2945,7 +2945,7 @@ void HttpRequestTestObjectType::test<23>() std::string url_base(get_base_url() + "/503/"); // path to 503 generators mHandlerCalls = 0; - HttpRequest * req = NULL; + HttpRequest * req = nullptr; HttpOptions::ptr_t opts; try @@ -3027,7 +3027,7 @@ void HttpRequestTestObjectType::test<23>() // release the request object delete req; - req = NULL; + req = nullptr; // Shut down service HttpRequest::destroyService(); diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 10fd56a68ee..84169a22306 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -51,8 +51,8 @@ #include "llmetrics.h" #include "lltrace.h" -LLAssetStorage *gAssetStorage = NULL; -LLMetrics *LLAssetStorage::metric_recipient = NULL; +LLAssetStorage *gAssetStorage = nullptr; +LLMetrics *LLAssetStorage::metric_recipient = nullptr; static LLTrace::CountStatHandle<> sFailedDownloadCount("faileddownloads", "Number of times LLAssetStorage::getAssetData() has failed"); @@ -196,7 +196,7 @@ LLBaseDownloadRequest::LLBaseDownloadRequest(const LLUUID &uuid, const LLAssetTy : mUUID(uuid), mType(type), mDownCallback(), - mUserData(NULL), + mUserData(nullptr), mHost(), mIsTemp(false), mIsPriority(false), @@ -227,7 +227,7 @@ LLBaseDownloadRequest* LLBaseDownloadRequest::getCopy() LLAssetRequest::LLAssetRequest(const LLUUID &uuid, const LLAssetType::EType type) : LLBaseDownloadRequest(uuid, type), mUpCallback(), - mInfoCallback( NULL ), + mInfoCallback( nullptr ), mIsLocal(false), mIsUserWaiting(false), mTimeout(LL_ASSET_STORAGE_TIMEOUT), @@ -362,7 +362,7 @@ LLAssetStorage::~LLAssetStorage() { // Warning! This won't work if there's more than one asset storage. // unregister our callbacks with the message system - gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, NULL, NULL); + gMessageSystem->setHandlerFuncFast(_PREHASH_AssetUploadComplete, nullptr, nullptr); } // Clear the toxic asset map @@ -447,7 +447,7 @@ bool LLAssetStorage::findInCacheAndInvokeCallback(const LLUUID& uuid, LLAssetTyp if (user_data) { // The *user_data should not be passed without a callback to clean it up. - llassert(callback != NULL); + llassert(callback != nullptr); } bool exists = LLFileSystem::getExists(uuid, type); @@ -493,7 +493,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, if (user_data) { // The *user_data should not be passed without a callback to clean it up. - llassert(callback != NULL); + llassert(callback != nullptr); } if (mShutDown) @@ -1081,7 +1081,7 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E return &mPendingLocalUploads; default: LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL; - return NULL; + return nullptr; } } @@ -1097,7 +1097,7 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor return &mPendingLocalUploads; default: LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL; - return NULL; + return nullptr; } } @@ -1204,7 +1204,7 @@ const LLAssetRequest* LLAssetStorage::findRequest(const LLAssetStorage::request_ } } } - return NULL; + return nullptr; } // static @@ -1227,7 +1227,7 @@ LLAssetRequest* LLAssetStorage::findRequest(LLAssetStorage::request_list_t* requ } } } - return NULL; + return nullptr; } diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index ebafc53a4de..be89eafecff 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -340,7 +340,7 @@ void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName& mSignalMap.erase(agent_id); delete signal; - signal = NULL; + signal = nullptr; } diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp index 3a4b493b264..c73271468ee 100644 --- a/indra/llmessage/llbuffer.cpp +++ b/indra/llmessage/llbuffer.cpp @@ -42,7 +42,7 @@ */ LLSegment::LLSegment() : mChannel(0), - mData(NULL), + mData(nullptr), mSize(0) { } @@ -97,9 +97,9 @@ bool LLSegment::operator==(const LLSegment& rhs) const * LLHeapBuffer */ LLHeapBuffer::LLHeapBuffer() : - mBuffer(NULL), + mBuffer(nullptr), mSize(0), - mNextFree(NULL), + mNextFree(nullptr), mReclaimedBytes(0) { const S32 DEFAULT_HEAP_BUFFER_SIZE = 16384; @@ -107,18 +107,18 @@ LLHeapBuffer::LLHeapBuffer() : } LLHeapBuffer::LLHeapBuffer(S32 size) : - mBuffer(NULL), + mBuffer(nullptr), mSize(0), - mNextFree(NULL), + mNextFree(nullptr), mReclaimedBytes(0) { allocate(size); } LLHeapBuffer::LLHeapBuffer(const U8* src, S32 len) : - mBuffer(NULL), + mBuffer(nullptr), mSize(0), - mNextFree(NULL), + mNextFree(nullptr), mReclaimedBytes(0) { if((len > 0) && src) @@ -135,9 +135,9 @@ LLHeapBuffer::LLHeapBuffer(const U8* src, S32 len) : LLHeapBuffer::~LLHeapBuffer() { delete[] mBuffer; - mBuffer = NULL; + mBuffer = nullptr; mSize = 0; - mNextFree = NULL; + mNextFree = nullptr; } S32 LLHeapBuffer::bytesLeft() const @@ -220,7 +220,7 @@ void LLHeapBuffer::allocate(S32 size) */ LLBufferArray::LLBufferArray() : mNextBaseChannel(0), - mMutexp(NULL) + mMutexp(nullptr) { } @@ -274,7 +274,7 @@ void LLBufferArray::setThreaded(bool threaded) if(mMutexp) { delete mMutexp ; - mMutexp = NULL ; + mMutexp = nullptr; } } } @@ -492,7 +492,7 @@ LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment( /* U8* LLBufferArray::getAddressAfter(U8* address) { - U8* rv = NULL; + U8* rv = nullptr; segment_iterator_t it = getSegment(address); segment_iterator_t end = mSegments.end(); if(it != end) @@ -655,12 +655,12 @@ U8* LLBufferArray::seek( it = getSegment(start); if((it == end) || !(*it).isOnChannel(channel)) { - rv = NULL; + rv = nullptr; } } else { - // Start is NULL, so return the very first byte on the + // Start is nullptr, so return the very first byte on the // channel, or NULL. it = mSegments.begin(); while((it != end) && !(*it).isOnChannel(channel)) @@ -699,8 +699,8 @@ U8* LLBufferArray::seek( else if(delta < 0) { // start is NULL, and delta indicates seeking backwards - - // return NULL. - return NULL; + // return nullptr. + return nullptr; } else { @@ -729,7 +729,7 @@ U8* LLBufferArray::seek( if(delta && (it == end)) { // Whoops - sought past end. - rv = NULL; + rv = nullptr; } } else //if(delta < 0) @@ -760,7 +760,7 @@ U8* LLBufferArray::seek( if(delta && (rit == rend)) { // sought past the beginning. - rv = NULL; + rv = nullptr; } } return rv; diff --git a/indra/llmessage/llbuffer.h b/indra/llmessage/llbuffer.h index 89229ea9d10..bc5eaf42b19 100644 --- a/indra/llmessage/llbuffer.h +++ b/indra/llmessage/llbuffer.h @@ -415,7 +415,7 @@ class LLBufferArray */ S32 count(S32 channel) const { - return countAfter(channel, NULL); + return countAfter(channel, nullptr); } /** diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp index cb5a4c1824c..f26eb563e9c 100644 --- a/indra/llmessage/llbufferstream.cpp +++ b/indra/llmessage/llbufferstream.cpp @@ -204,7 +204,7 @@ int LLBufferStreamBuf::sync() // set the put pointer so that we force an overflow on the next // write. U8* address = (U8*)pptr(); - setp(NULL, NULL); + setp(nullptr, nullptr); // *NOTE: I bet we could just --address if address is not NULL. // Need to think about that. @@ -245,10 +245,10 @@ LLBufferStreamBuf::pos_type LLBufferStreamBuf::seekoff( { return -1; } - U8* address = NULL; + U8* address = nullptr; if(which & std::ios::in) { - U8* base_addr = NULL; + U8* base_addr = nullptr; switch(way) { case std::ios::end: @@ -281,7 +281,7 @@ LLBufferStreamBuf::pos_type LLBufferStreamBuf::seekoff( } if(which & std::ios::out) { - U8* base_addr = NULL; + U8* base_addr = nullptr; switch(way) { case std::ios::end: diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 56dfaef873a..aa883efc03c 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -52,7 +52,7 @@ static const std::string NAME("name"); const U32 PENDING_TIMEOUT_SECS = 5 * 60; // Globals -LLCacheName* gCacheName = NULL; +LLCacheName* gCacheName = nullptr; /// --------------------------------------------------------------------------- /// class LLCacheNameEntry @@ -312,7 +312,7 @@ bool LLCacheName::importFile(std::istream& istr) } // We'll expire entries more than a week old - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); const U32 SECS_PER_DAY = 60 * 60 * 24; U32 delete_before_time = now - (7 * SECS_PER_DAY); @@ -464,7 +464,7 @@ bool LLCacheName::getGroupName(const LLUUID& id, std::string& group) // this group name was loaded from a name cache that did not // bother to save the group name ==> we must ask for it LL_DEBUGS() << "LLCacheName queuing HACK group request: " << id << LL_ENDL; - entry = NULL; + entry = nullptr; } if (entry) @@ -685,7 +685,7 @@ void LLCacheName::processPending() void LLCacheName::deleteEntriesOlderThan(S32 secs) { - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); U32 expire_time = now - secs; for(Cache::iterator iter = impl.mCache.begin(); iter != impl.mCache.end(); ) { @@ -864,7 +864,7 @@ void LLCacheName::Impl::sendRequest( bool LLCacheName::Impl::isRequestPending(const LLUUID& id) { - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); U32 expire_time = now - PENDING_TIMEOUT_SECS; PendingQueue::iterator iter = mPendingQueue.find(id); @@ -952,7 +952,7 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) mPendingQueue.erase(id); entry->mIsGroup = isGroup; - entry->mCreateTime = (U32)time(NULL); + entry->mCreateTime = (U32)time(nullptr); if (!isGroup) { msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); diff --git a/indra/llmessage/llchainio.cpp b/indra/llmessage/llchainio.cpp index 78dff246cbf..a928112fb6e 100644 --- a/indra/llmessage/llchainio.cpp +++ b/indra/llmessage/llchainio.cpp @@ -73,8 +73,8 @@ bool LLChainIOFactory::build(LLIOPipe* in, LLIOPipe* out) const { return false; } - LLIOPipe* first = NULL; - LLIOPipe* last = NULL; + LLIOPipe* first = nullptr; + LLIOPipe* last = nullptr; if(build_impl(first, last) && first && last) { in->connect(first); diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index c2b1a2f069a..6f4b22d5b4d 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -126,7 +126,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, LLCircuitData::~LLCircuitData() { - LLReliablePacket *packetp = NULL; + LLReliablePacket *packetp = nullptr; // Clean up all pending transfers. gTransferManager.cleanupConnection(mHost); @@ -427,7 +427,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64Seconds now) LLCircuit::LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout) -: mLastCircuit(NULL), +: mLastCircuit(nullptr), mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout) {} @@ -457,7 +457,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id) void LLCircuit::removeCircuitData(const LLHost &host) { LL_INFOS() << "LLCircuit::removeCircuitData for " << host << LL_ENDL; - mLastCircuit = NULL; + mLastCircuit = nullptr; circuit_data_map::iterator it = mCircuitData.find(host); if(it != mCircuitData.end()) { @@ -485,7 +485,7 @@ void LLCircuit::removeCircuitData(const LLHost &host) // this circuit, and the setting of mLastCircuit. We don't check // if the host matches, but we don't really care because mLastCircuit // is an optimization, and this happens VERY rarely. - mLastCircuit = NULL; + mLastCircuit = nullptr; } void LLCircuitData::setAlive(bool b_alive) @@ -625,7 +625,7 @@ LLCircuitData* LLCircuit::findCircuit(const LLHost& host) const circuit_data_map::const_iterator it = mCircuitData.find(host); if(it == mCircuitData.end()) { - return NULL; + return nullptr; } mLastCircuit = it->second; return mLastCircuit; diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index b24e5e4fccd..0b537ed28cb 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -417,7 +417,7 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: { // Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml' LLCore::HttpHeaders::ptr_t headers(response->getHeaders()); - const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : NULL; + const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : nullptr; if (contentType && (HTTP_CONTENT_LLSD_XML == *contentType)) { @@ -436,7 +436,7 @@ LLSD HttpCoroLLSDHandler::handleSuccess(LLCore::HttpResponse * response, LLCore: #if 1 // Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml' LLCore::HttpHeaders::ptr_t headers(response->getHeaders()); - const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : NULL; + const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : nullptr; if (contentType && (HTTP_CONTENT_LLSD_XML == *contentType)) { diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index e911150787c..a3565021aef 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -2127,7 +2127,7 @@ bool LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v return false; } - if (fgets(buffer, DP_BUFSIZE, mFP) == NULL) + if (fgets(buffer, DP_BUFSIZE, mFP) == nullptr) { buffer[0] = '\0'; } diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 167c102b438..62a44f65659 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -125,8 +125,8 @@ class LLDataPackerBinaryBuffer : public LLDataPacker LLDataPackerBinaryBuffer() : LLDataPacker(), - mBufferp(NULL), - mCurBufferp(NULL), + mBufferp(nullptr), + mCurBufferp(nullptr), mBufferSize(0) { } @@ -180,9 +180,9 @@ class LLDataPackerBinaryBuffer : public LLDataPacker S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp); } S32 getBufferSize() const { return mBufferSize; } const U8* getBuffer() const { return mBufferp; } - void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } + void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != nullptr); } void shift(S32 offset) { reset(); mCurBufferp += offset;} - void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = false; } + void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = nullptr; mBufferSize = 0; mWriteEnabled = false; } void assignBuffer(U8 *bufferp, S32 size) { if(mBufferp && mBufferp != bufferp) @@ -234,8 +234,8 @@ class LLDataPackerAsciiBuffer : public LLDataPacker LLDataPackerAsciiBuffer() { - mBufferp = NULL; - mCurBufferp = NULL; + mBufferp = nullptr; + mCurBufferp = nullptr; mBufferSize = 0; mPassFlags = 0; mIncludeNames = false; @@ -294,7 +294,7 @@ class LLDataPackerAsciiBuffer : public LLDataPacker S32 getCurrentSize() const { return (S32)(mCurBufferp - mBufferp) + 1; } S32 getBufferSize() const { return mBufferSize; } - /*virtual*/ void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } + /*virtual*/ void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != nullptr); } /*virtual*/ bool hasNext() const { return getCurrentSize() < getBufferSize(); } @@ -318,7 +318,7 @@ class LLDataPackerAsciiBuffer : public LLDataPacker inline void LLDataPackerAsciiBuffer::freeBuffer() { delete [] mBufferp; - mBufferp = mCurBufferp = NULL; + mBufferp = mCurBufferp = nullptr; mBufferSize = 0; mWriteEnabled = false; } @@ -350,17 +350,17 @@ class LLDataPackerAsciiFile : public LLDataPacker : LLDataPacker(), mIndent(indent), mFP(fp), - mOutputStream(NULL), - mInputStream(NULL) + mOutputStream(nullptr), + mInputStream(nullptr) { } LLDataPackerAsciiFile(std::ostream& output_stream, const S32 indent = 2) : LLDataPacker(), mIndent(indent), - mFP(NULL), + mFP(nullptr), mOutputStream(&output_stream), - mInputStream(NULL) + mInputStream(nullptr) { mWriteEnabled = true; } @@ -368,8 +368,8 @@ class LLDataPackerAsciiFile : public LLDataPacker LLDataPackerAsciiFile(std::istream& input_stream, const S32 indent = 2) : LLDataPacker(), mIndent(indent), - mFP(NULL), - mOutputStream(NULL), + mFP(nullptr), + mOutputStream(nullptr), mInputStream(&input_stream) { } diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index f02a5fd37fe..df871120fe2 100644 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -84,7 +84,7 @@ LLDispatchHandler* LLDispatcher::addHandler( const key_t& name, LLDispatchHandler* func) { dispatch_map_t::iterator it = mHandlers.find(name); - LLDispatchHandler* old_handler = NULL; + LLDispatchHandler* old_handler = nullptr; if(it != mHandlers.end()) { old_handler = (*it).second; diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index 65bdfaff7e3..1c86ab99f78 100644 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -56,7 +56,7 @@ class LLHTTPNode::Impl std::string mWildcardKey; LLHTTPNode* mParentNode; - Impl() : mWildcardChild(NULL), mParentNode(NULL) { } + Impl() : mWildcardChild(nullptr), mParentNode(nullptr) { } LLHTTPNode* findNamedChild(const std::string& name) const; }; @@ -221,7 +221,7 @@ LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const return impl.mWildcardChild; } - return NULL; + return nullptr; } @@ -266,7 +266,7 @@ const LLHTTPNode* LLHTTPNode::traverse( remainder.append(*iter); } - return node->handles(remainder, context) ? node : NULL; + return node->handles(remainder, context) ? node : nullptr; } @@ -431,7 +431,7 @@ void LLHTTPNode::describe(Description& desc) const const LLChainIOFactory* LLHTTPNode::getProtocolHandler() const { - return NULL; + return nullptr; } diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h index b7b6053f480..cac0ef7f7ff 100644 --- a/indra/llmessage/llhttpnode.h +++ b/indra/llmessage/llhttpnode.h @@ -283,7 +283,7 @@ class LLHTTPNode virtual const LLChainIOFactory* getProtocolHandler() const; /**< Return a factory object for handling wire protocols. - * The base class returns NULL, as it doesn't know about + * The base class returns nullptr, as it doesn't know about * wire protocols at all. This is okay for most nodes * as LLIOHTTPServer is smart enough to use a default * wire protocol for HTTP for such nodes. Specialized diff --git a/indra/llmessage/llhttpsdhandler.cpp b/indra/llmessage/llhttpsdhandler.cpp index 1c5928e1870..8a63ccc661e 100644 --- a/indra/llmessage/llhttpsdhandler.cpp +++ b/indra/llmessage/llhttpsdhandler.cpp @@ -60,7 +60,7 @@ void LLHttpSDHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons { // Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml' LLCore::HttpHeaders::ptr_t headers(response->getHeaders()); - const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : NULL; + const std::string *contentType = (headers) ? headers->find(HTTP_IN_HEADER_CONTENT_TYPE) : nullptr; if (contentType && (HTTP_CONTENT_LLSD_XML == *contentType)) { diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 4c62c07fcb3..d74f949cf22 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -145,7 +145,7 @@ void pack_instant_message_block( } else { - msg->addStringFast(_PREHASH_Message, NULL); + msg->addStringFast(_PREHASH_Message, nullptr); } const U8* bb; if(binary_bucket) diff --git a/indra/llmessage/lliobuffer.cpp b/indra/llmessage/lliobuffer.cpp index 4f5821b15f6..3ae4b7d0442 100644 --- a/indra/llmessage/lliobuffer.cpp +++ b/indra/llmessage/lliobuffer.cpp @@ -33,10 +33,10 @@ // LLIOBuffer // LLIOBuffer::LLIOBuffer() : - mBuffer(NULL), + mBuffer(nullptr), mBufferSize(0L), - mReadHead(NULL), - mWriteHead(NULL) + mReadHead(nullptr), + mWriteHead(nullptr) { } diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index edc431e538c..070d3d28231 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -52,18 +52,18 @@ static const char HTTP_VERSION_STR[] = "HTTP/1.0"; -static LLIOHTTPServer::timing_callback_t sTimingCallback = NULL; -static void* sTimingCallbackData = NULL; +static LLIOHTTPServer::timing_callback_t sTimingCallback = nullptr; +static void* sTimingCallbackData = nullptr; class LLHTTPPipe : public LLIOPipe { public: LLHTTPPipe(const LLHTTPNode& node) : mNode(node), - mResponse(NULL), + mResponse(nullptr), mState(STATE_INVOKE), mChainLock(0), - mLockedPump(NULL), + mLockedPump(nullptr), mStatusCode(0) { } virtual ~LLHTTPPipe() @@ -101,7 +101,7 @@ class LLHTTPPipe : public LLIOPipe void nullPipe(); private: - Response() : mPipe(NULL) {} // Must be accessed through LLPointer. + Response() : mPipe(nullptr) {} // Must be accessed through LLPointer. LLHTTPPipe* mPipe; }; friend class Response; @@ -318,7 +318,7 @@ LLHTTPPipe::Response::~Response() void LLHTTPPipe::Response::nullPipe() { - mPipe = NULL; + mPipe = nullptr; } // virtual @@ -398,7 +398,7 @@ void LLHTTPPipe::unlockChain() if (mChainLock == 0) { return; } mLockedPump->clearLock(mChainLock); - mLockedPump = NULL; + mLockedPump = nullptr; mChainLock = 0; } @@ -471,7 +471,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n"; - S32 content_length = buffer->countAfter(channels.in(), NULL); + S32 content_length = buffer->countAfter(channels.in(), nullptr); if(0 < content_length) { ostr << HTTP_OUT_HEADER_CONTENT_LENGTH << ": " << content_length << "\r\n"; @@ -594,7 +594,7 @@ class LLHTTPResponder : public LLIOPipe LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx) : mBuildContext(ctx), mState(STATE_NOTHING), - mLastRead(NULL), + mLastRead(nullptr), mContentLength(0), mRootNode(tree) { @@ -766,7 +766,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( break; } char* pos_colon = strchr(buf, ':'); - if(NULL == pos_colon) + if(nullptr == pos_colon) { keep_parsing = false; LL_DEBUGS() << "bad header: " << buf << LL_ENDL; diff --git a/indra/llmessage/lliohttpserver.h b/indra/llmessage/lliohttpserver.h index a1ae8736b70..22fef193af9 100644 --- a/indra/llmessage/lliohttpserver.h +++ b/indra/llmessage/lliohttpserver.h @@ -44,7 +44,7 @@ class LLIOHTTPServer * Returns the root node of the new server. Add LLHTTPNode instances * to this root. * - * Nodes that return NULL for getProtocolHandler(), will use the + * Nodes that return nullptr for getProtocolHandler(), will use the * default handler that interprets HTTP on the wire and converts * it into calls to get(), put(), post(), del() with appropriate * LLSD arguments and results. diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h index b40539f38c4..8a873a42bf4 100644 --- a/indra/llmessage/lliopipe.h +++ b/indra/llmessage/lliopipe.h @@ -194,7 +194,7 @@ class LLIOPipe * * @param data The data processed * @param eos True if this function call is the last because end of stream. - * @param pump The pump which is calling process. May be NULL. + * @param pump The pump which is calling process. May be nullptr. * @param context Shared meta-data for the process. * @return Returns a status code from the operation. */ diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index f2192acee06..2fb26eb13e4 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -104,8 +104,8 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock) LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port, const char *hostname) { LLSocket::ptr_t rv; - apr_socket_t* socket = NULL; - apr_pool_t* new_pool = NULL; + apr_socket_t* socket = nullptr; + apr_pool_t* new_pool = nullptr; apr_status_t status = APR_EGENERAL; // create a pool for the socket @@ -150,7 +150,7 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port, const c rv = ptr_t(new LLSocket(socket, new_pool)); if(port > 0) { - apr_sockaddr_t* sa = NULL; + apr_sockaddr_t* sa = nullptr; status = apr_sockaddr_info_get( &sa, hostname, @@ -218,7 +218,7 @@ LLSocket::ptr_t LLSocket::create(apr_socket_t* socket, apr_pool_t* pool) bool LLSocket::blockingConnect(const LLHost& host) { if(!mSocket) return false; - apr_sockaddr_t* sa = NULL; + apr_sockaddr_t* sa = nullptr; std::string ip_address; ip_address = host.getIPString(); if(ll_apr_warn_status(apr_sockaddr_info_get( @@ -253,7 +253,7 @@ LLSocket::~LLSocket() { ll_debug_socket("Destroying socket", mSocket); apr_socket_close(mSocket); - mSocket = NULL; + mSocket = nullptr; } if(mPool) { @@ -323,12 +323,12 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketReader." << LL_ENDL; apr_pollfd_t poll_fd; - poll_fd.p = NULL; + poll_fd.p = nullptr; poll_fd.desc_type = APR_POLL_SOCKET; poll_fd.reqevents = APR_POLLIN; poll_fd.rtnevents = 0x0; poll_fd.desc.s = mSource->getSocket(); - poll_fd.client_data = NULL; + poll_fd.client_data = nullptr; pump->setConditional(this, &poll_fd); } } @@ -358,7 +358,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( // *FIX: Should we shut down the socket read? if(pump) { - pump->setConditional(this, NULL); + pump->setConditional(this, nullptr); } rv = STATUS_DONE; eos = true; @@ -388,7 +388,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( LLIOSocketWriter::LLIOSocketWriter(LLSocket::ptr_t socket) : mDestination(socket), - mLastWritten(NULL), + mLastWritten(nullptr), mInitialized(false) { } @@ -421,12 +421,12 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketWriter." << LL_ENDL; apr_pollfd_t poll_fd; - poll_fd.p = NULL; + poll_fd.p = nullptr; poll_fd.desc_type = APR_POLL_SOCKET; poll_fd.reqevents = APR_POLLOUT; poll_fd.rtnevents = 0x0; poll_fd.desc.s = mDestination->getSocket(); - poll_fd.client_data = NULL; + poll_fd.client_data = nullptr; pump->setConditional(this, &poll_fd); } } @@ -442,7 +442,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( LLSegment segment; it = buffer->constructSegmentAfter(mLastWritten, segment); /* - if(NULL == mLastWritten) + if(nullptr == mLastWritten) { it = buffer->beginSegment(); segment = (*it); @@ -577,12 +577,12 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( LL_DEBUGS() << "Initializing poll descriptor for LLIOServerSocket." << LL_ENDL; apr_pollfd_t poll_fd; - poll_fd.p = NULL; + poll_fd.p = nullptr; poll_fd.desc_type = APR_POLL_SOCKET; poll_fd.reqevents = APR_POLLIN; poll_fd.rtnevents = 0x0; poll_fd.desc.s = mListenSocket->getSocket(); - poll_fd.client_data = NULL; + poll_fd.client_data = nullptr; pump->setConditional(this, &poll_fd); mInitialized = true; return STATUS_OK; @@ -593,7 +593,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( LL_DEBUGS() << "accepting socket" << LL_ENDL; PUMP_DEBUG; - apr_pool_t* new_pool = NULL; + apr_pool_t* new_pool = nullptr; apr_status_t status = apr_pool_create(&new_pool, mPool); if(ll_apr_warn_status(status)) { @@ -604,7 +604,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( return STATUS_ERROR; } - apr_socket_t* socket = NULL; + apr_socket_t* socket = nullptr; status = apr_socket_accept( &socket, mListenSocket->getSocket(), @@ -655,11 +655,11 @@ LLIODataSocket::LLIODataSocket( U16 suggested_port, U16 start_discovery_port, apr_pool_t* pool) : - mSocket(NULL) + mSocket(nullptr) { if(!pool || (PORT_INVALID == suggested_port)) return; if(ll_apr_warn_status(apr_socket_create(&mSocket, APR_INET, SOCK_DGRAM, APR_PROTO_UDP, pool))) return; - apr_sockaddr_t* sa = NULL; + apr_sockaddr_t* sa = nullptr; if(ll_apr_warn_status(apr_sockaddr_info_get(&sa, APR_ANYADDR, APR_UNSPEC, suggested_port, 0, pool))) return; apr_status_t status = apr_socket_bind(mSocket, sa); if((start_discovery_port > 0) && is_addr_in_use(status)) diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 4b79c77b56a..4b905da86ed 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -216,11 +216,11 @@ class LLIOSocketReader : public LLIOPipe * unless if they are not known. * If a STATUS_STOP returned by the next link in the chain, this * reader will turn of the socket polling. - * @param buffer Pointer to a buffer which needs processing. Probably NULL. + * @param buffer Pointer to a buffer which needs processing. Probably nullptr. * @param bytes Number of bytes to in buffer to process. Probably 0. * @param eos True if this function is the last. Almost always false. * @param read Number of bytes actually processed. - * @param pump The pump which is calling process. May be NULL. + * @param pump The pump which is calling process. May be nullptr. * @param context A data structure to pass structured data * @return STATUS_OK unless the preconditions are not met. */ @@ -266,7 +266,7 @@ class LLIOSocketWriter : public LLIOPipe * @param bytes Number of bytes to in buffer to process. * @param eos True if this function is the last. * @param read Number of bytes actually processed. - * @param pump The pump which is calling process. May be NULL. + * @param pump The pump which is calling process. May be nullptr. * @param context A data structure to pass structured data * @return A return code for the write. */ diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index e91d4346b6a..db08f988dd9 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -34,11 +34,11 @@ class LLMsgVarData { public: - LLMsgVarData() : mName(NULL), mSize(-1), mDataSize(-1), mData(NULL), mType(MVT_U8) + LLMsgVarData() : mName(nullptr), mSize(-1), mDataSize(-1), mData(nullptr), mType(MVT_U8) { } - LLMsgVarData(const char *name, EMsgVariableType type) : mSize(-1), mDataSize(-1), mData(NULL), mType(type) + LLMsgVarData(const char *name, EMsgVariableType type) : mSize(-1), mDataSize(-1), mData(nullptr), mType(type) { mName = (char *)name; } @@ -51,7 +51,7 @@ class LLMsgVarData void deleteData() { delete[] mData; - mData = NULL; + mData = nullptr; } void addData(const void *indata, S32 size, EMsgVariableType type, S32 data_size = -1); @@ -139,7 +139,7 @@ class LLMsgData class LLMessageVariable { public: - LLMessageVariable() : mName(NULL), mType(MVT_NULL), mSize(-1) + LLMessageVariable() : mName(nullptr), mType(MVT_NULL), mSize(-1) { } @@ -192,7 +192,7 @@ class LLMessageBlock void addVariable(char *name, const EMsgVariableType type, const S32 size) { LLMessageVariable** varp = &mMemberVariables[name]; - if (*varp != NULL) + if (*varp != nullptr) { LL_ERRS() << name << " has already been used as a variable name!" << LL_ENDL; } @@ -221,7 +221,7 @@ class LLMessageBlock const LLMessageVariable* getVariable(char* name) const { message_variable_map_t::const_iterator iter = mMemberVariables.find(name); - return iter != mMemberVariables.end()? *iter : NULL; + return iter != mMemberVariables.end()? *iter : nullptr; } friend std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg); @@ -270,7 +270,7 @@ class LLMessageTemplate LLMessageTemplate(const char *name, U32 message_number, EMsgFrequency freq) : //mMemberBlocks(), - mName(NULL), + mName(nullptr), mFrequency(freq), mTrust(MT_NOTRUST), mEncoding(ME_ZEROCODED), @@ -286,8 +286,8 @@ class LLMessageTemplate mMaxDecodeTimePerMsg(0.f), mBanFromTrusted(false), mBanFromUntrusted(false), - mHandlerFunc(NULL), - mUserData(NULL) + mHandlerFunc(nullptr), + mUserData(nullptr) { mName = LLMessageStringTable::getInstance()->getString(name); } @@ -300,7 +300,7 @@ class LLMessageTemplate void addBlock(LLMessageBlock *blockp) { LLMessageBlock** member_blockp = &mMemberBlocks[blockp->mName]; - if (*member_blockp != NULL) + if (*member_blockp != nullptr) { LL_ERRS() << "Block " << blockp->mName << "has already been used as a block name!" << LL_ENDL; @@ -388,7 +388,7 @@ class LLMessageTemplate const LLMessageBlock* getBlock(char* name) const { message_block_map_t::const_iterator iter = mMemberBlocks.find(name); - return iter != mMemberBlocks.end()? *iter : NULL; + return iter != mMemberBlocks.end()? *iter : nullptr; } public: diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index cf1f49116e9..6dc8ea1789b 100644 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -429,10 +429,10 @@ LLTemplateParser::message_iterator LLTemplateParser::getMessagesEnd() const // static LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) { - LLMessageTemplate *templatep = NULL; + LLMessageTemplate *templatep = nullptr; if(!tokens.want("{")) { - return NULL; + return nullptr; } // name first @@ -465,7 +465,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) } // TODO more explicit checking here pls - U32 message_number = strtoul(tokens.next().c_str(),NULL,0); + U32 message_number = strtoul(tokens.next().c_str(), nullptr, 0); switch (frequency) { case MFT_HIGH: @@ -553,11 +553,11 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) // static LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) { - LLMessageBlock * blockp = NULL; + LLMessageBlock * blockp = nullptr; if(!tokens.want("{")) { - return NULL; + return nullptr; } // name first @@ -627,10 +627,10 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) // static LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens) { - LLMessageVariable * varp = NULL; + LLMessageVariable * varp = nullptr; if(!tokens.want("{")) { - return NULL; + return nullptr; } std::string var_name = tokens.next(); diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 853ae7df825..c11d15d0781 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -90,8 +90,8 @@ void LLNameValue::baseInit() { mNVNameTable = &gNVNameTable; - mName = NULL; - mNameValueReference.string = NULL; + mName = nullptr; + mNameValueReference.string = nullptr; mType = NVT_NULL; mStringType = NameValueTypeStrings[NVT_NULL]; @@ -297,37 +297,37 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass if (!strcmp(mStringType, "STRING")) { mType = NVT_STRING; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; } else if (!strcmp(mStringType, "F32")) { mType = NVT_F32; - mNameValueReference.f32 = NULL; + mNameValueReference.f32 = nullptr; } else if (!strcmp(mStringType, "S32")) { mType = NVT_S32; - mNameValueReference.s32 = NULL; + mNameValueReference.s32 = nullptr; } else if (!strcmp(mStringType, "VEC3")) { mType = NVT_VEC3; - mNameValueReference.vec3 = NULL; + mNameValueReference.vec3 = nullptr; } else if (!strcmp(mStringType, "U32")) { mType = NVT_U32; - mNameValueReference.u32 = NULL; + mNameValueReference.u32 = nullptr; } else if (!strcmp(mStringType, "U64")) { mType = NVT_U64; - mNameValueReference.u64 = NULL; + mNameValueReference.u64 = nullptr; } else if(!strcmp(mStringType, (const char*)NameValueTypeStrings[NVT_ASSET])) { mType = NVT_ASSET; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; } else { @@ -535,41 +535,41 @@ LLNameValue::LLNameValue(const char *data) LLNameValue::~LLNameValue() { mNVNameTable->removeString(mName); - mName = NULL; + mName = nullptr; switch(mType) { case NVT_STRING: case NVT_ASSET: delete [] mNameValueReference.string; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; break; case NVT_F32: delete mNameValueReference.f32; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; break; case NVT_S32: delete mNameValueReference.s32; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; break; case NVT_VEC3: delete mNameValueReference.vec3; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; break; case NVT_U32: delete mNameValueReference.u32; - mNameValueReference.u32 = NULL; + mNameValueReference.u32 = nullptr; break; case NVT_U64: delete mNameValueReference.u64; - mNameValueReference.u64 = NULL; + mNameValueReference.u64 = nullptr; break; default: break; } delete[] mNameValueReference.string; - mNameValueReference.string = NULL; + mNameValueReference.string = nullptr; } char *LLNameValue::getString() @@ -581,7 +581,7 @@ char *LLNameValue::getString() else { LL_ERRS() << mName << " not a string!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -594,7 +594,7 @@ const char *LLNameValue::getAsset() const else { LL_ERRS() << mName << " not an asset!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -607,7 +607,7 @@ F32 *LLNameValue::getF32() else { LL_ERRS() << mName << " not a F32!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -620,7 +620,7 @@ S32 *LLNameValue::getS32() else { LL_ERRS() << mName << " not a S32!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -633,7 +633,7 @@ U32 *LLNameValue::getU32() else { LL_ERRS() << mName << " not a U32!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -646,7 +646,7 @@ U64 *LLNameValue::getU64() else { LL_ERRS() << mName << " not a U64!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -671,7 +671,7 @@ LLVector3 *LLNameValue::getVec3() else { LL_ERRS() << mName << " not a Vec3!" << LL_ENDL; - return NULL; + return nullptr; } } @@ -705,7 +705,7 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) delete [] mNameValueReference.string; mNameValueReference.string = new char [strlen(a.mNameValueReference.string) + 1]; /* Flawfinder: ignore */ - if(mNameValueReference.string != NULL) + if(mNameValueReference.string != nullptr) { strcpy(mNameValueReference.string, a.mNameValueReference.string); /* Flawfinder: ignore */ } @@ -749,7 +749,7 @@ void LLNameValue::setString(const char *a) } mNameValueReference.string = new char [strlen(a) + 1]; /* Flawfinder: ignore */ - if(mNameValueReference.string != NULL) + if(mNameValueReference.string != nullptr) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } @@ -786,7 +786,7 @@ void LLNameValue::setAsset(const char *a) delete [] mNameValueReference.string; } mNameValueReference.string = new char [strlen(a) + 1]; /* Flawfinder: ignore */ - if(mNameValueReference.string != NULL) + if(mNameValueReference.string != nullptr) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp index e66e8b02856..bccd3171363 100644 --- a/indra/llmessage/llpacketack.cpp +++ b/indra/llmessage/llpacketack.cpp @@ -42,7 +42,7 @@ LLReliablePacket::LLReliablePacket( U8* buf_ptr, S32 buf_len, LLReliablePacketParams* params) : - mBuffer(NULL), + mBuffer(nullptr), mBufferLength(0) { if (params) @@ -60,9 +60,9 @@ LLReliablePacket::LLReliablePacket( mRetries = 0; mPingBasedRetry = true; mTimeout = F32Seconds(0.f); - mCallback = NULL; - mCallbackData = NULL; - mMessageName = NULL; + mCallback = nullptr; + mCallbackData = nullptr; + mMessageName = nullptr; } mExpirationTime = (F64Seconds)totalTime() + mTimeout; @@ -72,7 +72,7 @@ LLReliablePacket::LLReliablePacket( if (mRetries) { mBuffer = new U8[buf_len]; - if (mBuffer != NULL) + if (mBuffer != nullptr) { memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/ mBufferLength = buf_len; diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index 0903c01e141..e2ad1e976ac 100644 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -55,9 +55,9 @@ class LLReliablePacketParams mRetries = 0; mPingBasedRetry = true; mTimeout = F32Seconds(0.f); - mCallback = NULL; - mCallbackData = NULL; - mMessageName = NULL; + mCallback = nullptr; + mCallbackData = nullptr; + mMessageName = nullptr; }; void set( @@ -88,9 +88,9 @@ class LLReliablePacket LLReliablePacketParams* params); ~LLReliablePacket() { - mCallback = NULL; + mCallback = nullptr; delete [] mBuffer; - mBuffer = NULL; + mBuffer = nullptr; }; friend class LLCircuitData; diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp index 0b04a560be5..b7f647fbb35 100644 --- a/indra/llmessage/llpacketbuffer.cpp +++ b/indra/llmessage/llpacketbuffer.cpp @@ -43,7 +43,7 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32 } else { - if (datap != NULL) + if (datap != nullptr) { memcpy(mData, datap, size); mSize = size; diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index d79d5c3a117..9f07ce73134 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -40,7 +40,7 @@ // incoming packet just to do a simple bool test. The getter for this // member is also static bool LLProxy::sUDPProxyEnabled = false; -LLProxy* LLProxy::sProxyInstance = NULL; +LLProxy* LLProxy::sProxyInstance = nullptr; // Some helpful TCP static functions. static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataout, apr_size_t outlen, char * datain, apr_size_t maxinlen); // Do a TCP data handshake @@ -70,7 +70,7 @@ LLProxy::~LLProxy() // The primary safety of sProxyInstance is the fact that by the // point SUBSYSTEM_CLEANUP(LLProxy) gets called, nothing should // be capable of using proxy - sProxyInstance = NULL; + sProxyInstance = nullptr; } void LLProxy::initSingleton() @@ -534,7 +534,7 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou */ static LLSocket::ptr_t tcp_open_channel(LLHost host) { - LLSocket::ptr_t socket = LLSocket::create(NULL, LLSocket::STREAM_TCP); + LLSocket::ptr_t socket = LLSocket::create(nullptr, LLSocket::STREAM_TCP); bool connected = socket->blockingConnect(host); if (!connected) { diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index e1cd70b2165..d55febb858a 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -159,11 +159,11 @@ struct ll_delete_apr_pollset_fd_client_data LLPumpIO::LLPumpIO(apr_pool_t* pool) : mState(LLPumpIO::NORMAL), mRebuildPollset(false), - mPollset(NULL), + mPollset(nullptr), mPollsetClientID(0), mNextLock(0), - mPool(NULL), - mCurrentPool(NULL), + mPool(nullptr), + mCurrentPool(nullptr), mCurrentPoolReallocCount(0), mCurrentChain(mRunningChains.end()) { @@ -502,7 +502,7 @@ void LLPumpIO::pump(const S32& poll_timeout) PUMP_DEBUG; typedef std::map signal_client_t; signal_client_t signalled_client; - const apr_pollfd_t* poll_fd = NULL; + const apr_pollfd_t* poll_fd = nullptr; if(mPollset) { PUMP_DEBUG; @@ -709,7 +709,7 @@ void LLPumpIO::pump(const S32& poll_timeout) bool LLPumpIO::respond(LLIOPipe* pipe) { - if(NULL == pipe) return false; + if(nullptr == pipe) return false; LLChainInfo info; LLLinkInfo link; @@ -794,14 +794,14 @@ void LLPumpIO::cleanup() { // LL_DEBUGS() << "cleaning up pollset" << LL_ENDL; apr_pollset_destroy(mPollset); - mPollset = NULL; + mPollset = nullptr; } if(mCurrentPool) { apr_pool_destroy(mCurrentPool); - mCurrentPool = NULL; + mCurrentPool = nullptr; } - mPool = NULL; + mPool = nullptr; } void LLPumpIO::rebuildPollset() @@ -811,7 +811,7 @@ void LLPumpIO::rebuildPollset() { //LL_DEBUGS() << "destroying pollset" << LL_ENDL; apr_pollset_destroy(mPollset); - mPollset = NULL; + mPollset = nullptr; } U32 size = 0; running_chains_t::iterator run_it = mRunningChains.begin(); @@ -829,7 +829,7 @@ void LLPumpIO::rebuildPollset() && (0 == (++mCurrentPoolReallocCount % POLLSET_POOL_RECYCLE_COUNT))) { apr_pool_destroy(mCurrentPool); - mCurrentPool = NULL; + mCurrentPool = nullptr; mCurrentPoolReallocCount = 0; } if(!mCurrentPool) @@ -876,21 +876,21 @@ void LLPumpIO::processChain(LLChainInfo& chain) #if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN if(chain.mData) { - char* buf = NULL; - S32 bytes = chain.mData->countAfter((*it).mChannels.in(), NULL); + char* buf = nullptr; + S32 bytes = chain.mData->countAfter((*it).mChannels.in(), nullptr); if(bytes) { buf = new char[bytes + 1]; chain.mData->readAfter( (*it).mChannels.in(), - NULL, + nullptr, (U8*)buf, bytes); buf[bytes] = '\0'; LL_INFOS() << "CHANNEL IN(" << (*it).mChannels.in() << "): " << buf << LL_ENDL; delete[] buf; - buf = NULL; + buf = nullptr; } else { @@ -909,21 +909,21 @@ void LLPumpIO::processChain(LLChainInfo& chain) #if LL_DEBUG_SPEW_BUFFER_CHANNEL_OUT if(chain.mData) { - char* buf = NULL; - S32 bytes = chain.mData->countAfter((*it).mChannels.out(), NULL); + char* buf = nullptr; + S32 bytes = chain.mData->countAfter((*it).mChannels.out(), nullptr); if(bytes) { buf = new char[bytes + 1]; chain.mData->readAfter( (*it).mChannels.out(), - NULL, + nullptr, (U8*)buf, bytes); buf[bytes] = '\0'; LL_INFOS() << "CHANNEL OUT(" << (*it).mChannels.out()<< "): " << buf << LL_ENDL; delete[] buf; - buf = NULL; + buf = nullptr; } else { @@ -991,22 +991,22 @@ void LLPumpIO::processChain(LLChainInfo& chain) #if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN_ON_ERROR if(chain.mData) { - char* buf = NULL; + char* buf = nullptr; S32 bytes = chain.mData->countAfter( (*it).mChannels.in(), - NULL); + nullptr); if(bytes) { buf = new char[bytes + 1]; chain.mData->readAfter( (*it).mChannels.in(), - NULL, + nullptr, (U8*)buf, bytes); buf[bytes] = '\0'; LL_INFOS() << "Input After Error: " << buf << LL_ENDL; delete[] buf; - buf = NULL; + buf = nullptr; } else { diff --git a/indra/llmessage/llsdhttpserver.cpp b/indra/llmessage/llsdhttpserver.cpp index 35f3a45ed64..86c0d01c034 100644 --- a/indra/llmessage/llsdhttpserver.cpp +++ b/indra/llmessage/llsdhttpserver.cpp @@ -104,7 +104,7 @@ class LLAPIService : public LLHTTPNode virtual bool handles(const LLSD& remainder, LLSD& context) const { - return followRemainder(remainder) != NULL; + return followRemainder(remainder) != nullptr; } virtual void get(ResponsePtr response, const LLSD& context) const diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 8d7d51e13fe..4f77dcd0c30 100644 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -41,7 +41,7 @@ LLSDMessageBuilder::LLSDMessageBuilder() : mCurrentMessage(LLSD::emptyMap()), - mCurrentBlock(NULL), + mCurrentBlock(nullptr), mCurrentMessageName(""), mCurrentBlockName(""), mbSBuilt(false), @@ -233,7 +233,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) // copy the blocks // counting variables used to encode multiple block info S32 block_count = 0; - char* block_name = NULL; + char* block_name = nullptr; // loop through msg blocks to loop through variables, totalling up size // data and filling the new (send) message diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 6ade7c0dad9..16d47750314 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -41,7 +41,7 @@ #include "v4color.h" LLSDMessageReader::LLSDMessageReader() : - mMessageName(NULL) + mMessageName(nullptr) { } @@ -55,12 +55,12 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum { // babbage: log error to LL_ERRS() if variable not found to mimic // LLTemplateMessageReader::getData behaviour - if(NULL == block) + if(nullptr == block) { LL_ERRS() << "NULL block name" << LL_ENDL; return LLSD(); } - if(NULL == var) + if(nullptr == var) { LL_ERRS() << "NULL var name" << LL_ENDL; return LLSD(); diff --git a/indra/llmessage/llservice.cpp b/indra/llmessage/llservice.cpp index 47027dcfceb..fcb5a71ea92 100644 --- a/indra/llmessage/llservice.cpp +++ b/indra/llmessage/llservice.cpp @@ -65,10 +65,10 @@ LLIOPipe* LLService::activate( if(name.empty()) { LL_INFOS() << "LLService::activate - no service specified." << LL_ENDL; - return NULL; + return nullptr; } creators_t::iterator it = sCreatorFunctors.find(name); - LLIOPipe* rv = NULL; + LLIOPipe* rv = nullptr; if(it != sCreatorFunctors.end()) { if((*it).second->build(chain, context)) diff --git a/indra/llmessage/llservice.h b/indra/llmessage/llservice.h index 7853e357f91..08727bf43cb 100644 --- a/indra/llmessage/llservice.h +++ b/indra/llmessage/llservice.h @@ -70,7 +70,7 @@ class LLService : public LLIOPipe * @param name The name of the service to connect to. * @param chain The constructed chain including the service instance. * @param context Context for the activation. - * @return An instance of the service for use or NULL on failure. + * @return An instance of the service for use or nullptr on failure. */ static LLIOPipe* activate( const std::string& name, diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index 758d6d343fd..08bfe62eb76 100644 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -37,11 +37,11 @@ #include "v4math.h" LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_map_t& name_template_map) : - mCurrentSMessageData(NULL), - mCurrentSMessageTemplate(NULL), - mCurrentSDataBlock(NULL), - mCurrentSMessageName(NULL), - mCurrentSBlockName(NULL), + mCurrentSMessageData(nullptr), + mCurrentSMessageTemplate(nullptr), + mCurrentSDataBlock(nullptr), + mCurrentSMessageName(nullptr), + mCurrentSBlockName(nullptr), mbSBuilt(false), mbSClear(true), mCurrentSendTotal(0), @@ -53,7 +53,7 @@ LLTemplateMessageBuilder::LLTemplateMessageBuilder(const message_template_name_m LLTemplateMessageBuilder::~LLTemplateMessageBuilder() { delete mCurrentSMessageData; - mCurrentSMessageData = NULL; + mCurrentSMessageData = nullptr; } // virtual @@ -65,7 +65,7 @@ void LLTemplateMessageBuilder::newMessage(const char *name) mCurrentSendTotal = 0; delete mCurrentSMessageData; - mCurrentSMessageData = NULL; + mCurrentSMessageData = nullptr; char* namep = (char*)name; if (mMessageTemplates.count(namep) > 0) @@ -73,8 +73,8 @@ void LLTemplateMessageBuilder::newMessage(const char *name) mCurrentSMessageTemplate = mMessageTemplates.find(name)->second; mCurrentSMessageData = new LLMsgData(namep); mCurrentSMessageName = namep; - mCurrentSDataBlock = NULL; - mCurrentSBlockName = NULL; + mCurrentSDataBlock = nullptr; + mCurrentSBlockName = nullptr; // add at one of each block const LLMessageTemplate* msg_template = mMessageTemplates.find(name)->second; @@ -108,14 +108,14 @@ void LLTemplateMessageBuilder::clearMessage() mCurrentSendTotal = 0; - mCurrentSMessageTemplate = NULL; + mCurrentSMessageTemplate = nullptr; delete mCurrentSMessageData; - mCurrentSMessageData = NULL; + mCurrentSMessageData = nullptr; - mCurrentSMessageName = NULL; - mCurrentSDataBlock = NULL; - mCurrentSBlockName = NULL; + mCurrentSMessageName = nullptr; + mCurrentSDataBlock = nullptr; + mCurrentSBlockName = nullptr; } // virtual @@ -456,7 +456,7 @@ void LLTemplateMessageBuilder::addString(const char* varname, const char* s) if (s) addData( varname, (void *)s, MVT_VARIABLE, (S32)strlen(s) + 1); /* Flawfinder: ignore */ else - addData( varname, NULL, MVT_VARIABLE, 0); + addData( varname, nullptr, MVT_VARIABLE, 0); } void LLTemplateMessageBuilder::addString(const char* varname, const std::string& s) @@ -464,7 +464,7 @@ void LLTemplateMessageBuilder::addString(const char* varname, const std::string& if (s.size()) addData( varname, (void *)s.c_str(), MVT_VARIABLE, (S32)(s.size()) + 1); else - addData( varname, NULL, MVT_VARIABLE, 0); + addData( varname, nullptr, MVT_VARIABLE, 0); } void LLTemplateMessageBuilder::addVector3(const char *varname, const LLVector3& vec) @@ -704,7 +704,7 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat } // if there is any data to pack, pack it - if((mvci.getData() != NULL) && mvci.getSize()) + if((mvci.getData() != nullptr) && mvci.getSize()) { if(result + mvci.getSize() < buffer_size) { @@ -831,7 +831,7 @@ void LLTemplateMessageBuilder::copyFromMessageData(const LLMsgData& data) // copy the blocks // counting variables used to encode multiple block info S32 block_count = 0; - char *block_name = NULL; + char *block_name = nullptr; // loop through msg blocks to loop through variables, totalling up size // data and filling the new (send) message diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 850d73e9109..300046e030a 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -41,8 +41,8 @@ LLTemplateMessageReader::LLTemplateMessageReader(message_template_number_map_t& number_template_map) : mReceiveSize(0), - mCurrentRMessageTemplate(NULL), - mCurrentRMessageData(NULL), + mCurrentRMessageTemplate(nullptr), + mCurrentRMessageData(nullptr), mMessageNumbers(number_template_map) { } @@ -51,16 +51,16 @@ LLTemplateMessageReader::LLTemplateMessageReader(message_template_number_map_t& LLTemplateMessageReader::~LLTemplateMessageReader() { delete mCurrentRMessageData; - mCurrentRMessageData = NULL; + mCurrentRMessageData = nullptr; } //virtual void LLTemplateMessageReader::clearMessage() { mReceiveSize = -1; - mCurrentRMessageTemplate = NULL; + mCurrentRMessageTemplate = nullptr; delete mCurrentRMessageData; - mCurrentRMessageData = NULL; + mCurrentRMessageData = nullptr; } void LLTemplateMessageReader::getData(const char *blockname, const char *varname, void *datap, S32 size, S32 blocknum, S32 max_size) @@ -598,7 +598,7 @@ bool LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender return false; } - LLMsgBlkData* cur_data_block = NULL; + LLMsgBlkData* cur_data_block = nullptr; // now loop through the block for (i = 0; i < repeat_number; i++) @@ -825,7 +825,7 @@ bool LLTemplateMessageReader::isUdpBanned() const //virtual void LLTemplateMessageReader::copyToBuilder(LLMessageBuilder& builder) const { - if(NULL == mCurrentRMessageTemplate) + if(nullptr == mCurrentRMessageTemplate) { return; } diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 72d623ea42e..079f732a472 100644 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -81,10 +81,10 @@ void LLTransferManager::init() mValid = true; // Register message system handlers - gMessageSystem->setHandlerFunc("TransferRequest", processTransferRequest, NULL); - gMessageSystem->setHandlerFunc("TransferInfo", processTransferInfo, NULL); - gMessageSystem->setHandlerFunc("TransferPacket", processTransferPacket, NULL); - gMessageSystem->setHandlerFunc("TransferAbort", processTransferAbort, NULL); + gMessageSystem->setHandlerFunc("TransferRequest", processTransferRequest, nullptr); + gMessageSystem->setHandlerFunc("TransferInfo", processTransferInfo, nullptr); + gMessageSystem->setHandlerFunc("TransferPacket", processTransferPacket, nullptr); + gMessageSystem->setHandlerFunc("TransferAbort", processTransferAbort, nullptr); } @@ -152,7 +152,7 @@ LLTransferSourceChannel *LLTransferManager::getSourceChannel(const LLHost &host, LLTransferConnection *tcp = getTransferConnection(host); if (!tcp) { - return NULL; + return nullptr; } return tcp->getSourceChannel(type); } @@ -164,7 +164,7 @@ LLTransferTargetChannel *LLTransferManager::getTargetChannel(const LLHost &host, LLTransferConnection *tcp = getTransferConnection(host); if (!tcp) { - return NULL; + return nullptr; } return tcp->getTargetChannel(type); } @@ -195,7 +195,7 @@ LLTransferSource *LLTransferManager::findTransferSource(const LLUUID &transfer_i } } - return NULL; + return nullptr; } // @@ -369,7 +369,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) size = packetp->mSize; if (size) { - if ((packetp->mDatap != NULL) && (size<(S32)sizeof(tmp_data))) + if ((packetp->mDatap != nullptr) && (size<(S32)sizeof(tmp_data))) { memcpy(tmp_data, packetp->mDatap, size); /*Flawfinder: ignore*/ } @@ -545,7 +545,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) size = packetp->mSize; if (size) { - if ((packetp->mDatap != NULL) && (size<(S32)sizeof(tmp_data))) + if ((packetp->mDatap != nullptr) && (size<(S32)sizeof(tmp_data))) { memcpy(tmp_data, packetp->mDatap, size); /*Flawfinder: ignore*/ } @@ -609,7 +609,7 @@ void LLTransferManager::reliablePacketCallback(void **user_data, S32 result) { LLUUID *transfer_idp = (LLUUID *)user_data; if (result && - transfer_idp != NULL) + transfer_idp != nullptr) { LLTransferSource *tsp = gTransferManager.findTransferSource(*transfer_idp); if (tsp) @@ -789,7 +789,7 @@ void LLTransferSourceChannel::updateTransfers() next++; LLTransferSource *tsp = iter->second; - U8 *datap = NULL; + U8 *datap = nullptr; S32 data_size = 0; bool delete_data = false; S32 packet_id = 0; @@ -833,10 +833,10 @@ void LLTransferSourceChannel::updateTransfers() if (delete_data) { delete[] datap; - datap = NULL; + datap = nullptr; } - if (findTransferSource(transaction_id) == NULL) + if (findTransferSource(transaction_id) == nullptr) { //Warning! In the case of an aborted transfer, the sendReliable call above calls //AbortTransfer which in turn calls deleteTransfer which means that somewhere way @@ -895,7 +895,7 @@ LLTransferSource *LLTransferSourceChannel::findTransferSource(const LLUUID &tran return tsp; } } - return NULL; + return nullptr; } @@ -1015,7 +1015,7 @@ LLTransferTarget *LLTransferTargetChannel::findTransferTarget(const LLUUID &tran return ttp; } } - return NULL; + return nullptr; } @@ -1051,7 +1051,7 @@ LLTransferSource::LLTransferSource(const LLTransferSourceType type, const F32 priority) : mType(type), mID(transfer_id), - mChannelp(NULL), + mChannelp(nullptr), mPriority(priority), mSize(0), mLastPacketID(-1) @@ -1146,7 +1146,7 @@ LLTransferSource *LLTransferSource::createSource(const LLTransferSourceType styp { // Use the callback to create the source type if it's not there. LL_WARNS() << "Unknown transfer source type: " << stype << LL_ENDL; - return NULL; + return nullptr; } return (sSourceCreateMap[stype])(id, priority); } @@ -1175,7 +1175,7 @@ F32 LLTransferSource::sGetPriority(LLTransferSource *&tsp) LLTransferPacket::LLTransferPacket(const S32 packet_id, const LLTSCode status, const U8 *datap, const S32 size) : mPacketID(packet_id), mStatus(status), - mDatap(NULL), + mDatap(nullptr), mSize(size) { if (size == 0) @@ -1184,7 +1184,7 @@ LLTransferPacket::LLTransferPacket(const S32 packet_id, const LLTSCode status, c } mDatap = new U8[size]; - if (mDatap != NULL) + if (mDatap != nullptr) { memcpy(mDatap, datap, size); /*Flawfinder: ignore*/ } @@ -1206,7 +1206,7 @@ LLTransferTarget::LLTransferTarget( mType(type), mSourceType(source_type), mID(transfer_id), - mChannelp(NULL), + mChannelp(nullptr), mGotInfo(false), mSize(0), mLastPacketID(-1) @@ -1290,7 +1290,7 @@ LLTransferTarget* LLTransferTarget::createTarget( return new LLTransferTargetVFile(id, source_type); default: LL_WARNS() << "Unknown transfer target type: " << type << LL_ENDL; - return NULL; + return nullptr; } } diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 082f12b8bf2..026cda19ce3 100644 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -127,7 +127,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, { // Read failure, need to deal with it. delete[] tmpp; - *data_handle = NULL; + *data_handle = nullptr; returned_bytes = 0; delete_returned = false; return LLTS_ERROR; @@ -142,7 +142,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, if (!returned_bytes) { delete[] tmpp; - *data_handle = NULL; + *data_handle = nullptr; returned_bytes = 0; delete_returned = false; } @@ -177,7 +177,7 @@ void LLTransferSourceAsset::responderCallback(const LLUUID& uuid, LLAssetType::E LLUUID *tidp = ((LLUUID*) user_data); LLUUID transfer_id = *(tidp); delete tidp; - tidp = NULL; + tidp = nullptr; LLTransferSourceAsset *tsap = (LLTransferSourceAsset *) gTransferManager.findTransferSource(transfer_id); diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index 77a6c466c7b..007b1670726 100644 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -35,7 +35,7 @@ LLTransferSourceFile::LLTransferSourceFile(const LLUUID &request_id, const F32 priority) : LLTransferSource(LLTST_FILE, request_id, priority), - mFP(NULL) + mFP(nullptr) { } @@ -109,7 +109,7 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, if (!returned_bytes) { delete[] tmpp; - *data_handle = NULL; + *data_handle = nullptr; returned_bytes = 0; delete_returned = false; return LLTS_DONE; @@ -125,7 +125,7 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status) if (mFP) { fclose(mFP); - mFP = NULL; + mFP = nullptr; } // Delete the file iff the filename begins with "TEMP" diff --git a/indra/llmessage/lltransfertargetfile.cpp b/indra/llmessage/lltransfertargetfile.cpp index 6d8b69fa6f6..06bb2a259e2 100644 --- a/indra/llmessage/lltransfertargetfile.cpp +++ b/indra/llmessage/lltransfertargetfile.cpp @@ -36,7 +36,7 @@ LLTransferTargetFile::LLTransferTargetFile( const LLUUID& uuid, LLTransferSourceType src_type) : LLTransferTarget(LLTTT_FILE, uuid, src_type), - mFP(NULL) + mFP(nullptr) { } @@ -46,7 +46,7 @@ LLTransferTargetFile::~LLTransferTargetFile() { LL_ERRS() << "LLTransferTargetFile::~LLTransferTargetFile - Should have been cleaned up in completion callback" << LL_ENDL; fclose(mFP); - mFP = NULL; + mFP = nullptr; } } @@ -123,7 +123,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status) break; } - mFP = NULL; + mFP = nullptr; if (mParams.mCompleteCallback) { mParams.mCompleteCallback(status, mParams.mUserData); diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index bbc2ddf4cc9..55f8660bb21 100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -106,7 +106,7 @@ LLTransferTargetVFile::~LLTransferTargetVFile() { // TODO: Consider doing it in LLTransferTargetParamsVFile's destructor delete mParams.mRequestDatap; - mParams.mRequestDatap = NULL; + mParams.mRequestDatap = nullptr; } } @@ -229,6 +229,6 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status) LLExtStat::NONE); } delete mParams.mRequestDatap; - mParams.mRequestDatap = NULL; + mParams.mRequestDatap = nullptr; } } diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index 36ab87086dd..65d67882853 100644 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -32,7 +32,7 @@ /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -LLUserOperationMgr* gUserOperationMgr = NULL; +LLUserOperationMgr* gUserOperationMgr = nullptr; ///---------------------------------------------------------------------------- /// Class LLUserOperation @@ -124,7 +124,7 @@ LLUserOperation* LLUserOperationMgr::findOperation(const LLUUID& tid) if (iter != mUserOperationList.end()) return iter->second; else - return NULL; + return nullptr; } @@ -136,7 +136,7 @@ bool LLUserOperationMgr::deleteOperation(LLUserOperation* op) LLUUID id = op->getTransactionID(); rv = mUserOperationList.erase(id); delete op; - op = NULL; + op = nullptr; } return rv != 0; } @@ -145,7 +145,7 @@ void LLUserOperationMgr::deleteExpiredOperations() { const S32 MAX_OPS_CONSIDERED = 2000; S32 ops_left = MAX_OPS_CONSIDERED; - LLUserOperation* op = NULL; + LLUserOperation* op = nullptr; user_operation_list_t::iterator it; if(mLastOperationConsidered.isNull()) { diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index 358c8be671a..f9b055f1141 100644 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -65,12 +65,12 @@ void LLXfer::init (S32 chunk_size) mStatus = e_LL_XFER_UNINITIALIZED; mWaitingForACK = false; - mCallback = NULL; - mCallbackDataHandle = NULL; + mCallback = nullptr; + mCallbackDataHandle = nullptr; mCallbackResult = 0; mBufferContainsEOF = false; - mBuffer = NULL; + mBuffer = nullptr; mBufferLength = 0; mBufferStartOffset = 0; @@ -90,7 +90,7 @@ void LLXfer::cleanup () if (mBuffer) { delete[] mBuffer; - mBuffer = NULL; + mBuffer = nullptr; } } @@ -147,7 +147,7 @@ S32 LLXfer::receiveData (char *datap, S32 data_size) if (!retval) { - if (datap != NULL) + if (datap != nullptr) { // Append new data to mBuffer memcpy(&mBuffer[mBufferLength],datap,data_size); /*Flawfinder: ignore*/ mBufferLength += data_size; diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 71b910297be..7d97281c043 100644 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -70,7 +70,7 @@ LLXfer_File::~LLXfer_File () void LLXfer_File::init (const std::string& local_filename, bool delete_local_on_completion, S32 chunk_size) { - mFp = NULL; + mFp = nullptr; mLocalFilename.clear(); mRemoteFilename.clear(); mRemotePath = LL_PATH_NONE; @@ -95,7 +95,7 @@ void LLXfer_File::cleanup () if (mFp) { fclose(mFp); - mFp = NULL; + mFp = nullptr; } LLFile::remove(mTempFilename, ENOENT); @@ -144,7 +144,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, if (mBuffer) { delete(mBuffer); - mBuffer = NULL; + mBuffer = nullptr; } mBuffer = new char[LL_MAX_XFER_FILE_BUFFER]; @@ -165,7 +165,7 @@ S32 LLXfer_File::startDownload() if (mFp) { fclose(mFp); - mFp = NULL; + mFp = nullptr; // tbd - is it premature to send this message if the queue is backed up? gMessageSystem->newMessageFast(_PREHASH_RequestXfer); @@ -240,7 +240,7 @@ void LLXfer_File::closeFileHandle() if (mFp) { fclose(mFp); - mFp = NULL; + mFp = nullptr; } } @@ -250,10 +250,10 @@ S32 LLXfer_File::reopenFileHandle() { S32 retval = LL_ERR_NOERR; // presume success - if (mFp == NULL) + if (mFp == nullptr) { mFp = LLFile::fopen(mLocalFilename,"rb"); /* Flawfinder : ignore */ - if (mFp == NULL) + if (mFp == nullptr) { LL_INFOS("Xfer") << "Warning: " << mLocalFilename << " not found when re-opening file" << LL_ENDL; retval = LL_ERR_FILE_NOT_FOUND; @@ -327,7 +327,7 @@ S32 LLXfer_File::flush() // LL_INFOS("Xfer") << "******* wrote " << mBufferLength << " bytes of file xfer" << LL_ENDL; fclose(mFp); - mFp = NULL; + mFp = nullptr; mBufferLength = 0; } @@ -402,7 +402,7 @@ S32 LLXfer_File::processEOF() if (mFp) { fclose(mFp); - mFp = NULL; + mFp = nullptr; } retval = LLXfer::processEOF(); diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index b619974270d..2440b503035 100644 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -145,7 +145,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, LL_INFOS() << "Requesting file: " << remote_filename << LL_ENDL; delete [] mBuffer; - mBuffer = NULL; + mBuffer = nullptr; mBufferLength = 0; mPacketNum = 0; diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index 4f31973f3d5..97f4df6a731 100644 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -64,7 +64,7 @@ void LLXfer_VFile::init (const LLUUID &local_id, LLAssetType::EType type) mLocalID = local_id; mType = type; - mVFile = NULL; + mVFile = nullptr; std::string id_string; mLocalID.toString(id_string); @@ -92,7 +92,7 @@ void LLXfer_VFile::cleanup () } delete mVFile; - mVFile = NULL; + mVFile = nullptr; LLXfer::cleanup(); } @@ -130,7 +130,7 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, if (mBuffer) { delete[] mBuffer; - mBuffer = NULL; + mBuffer = nullptr; } mBuffer = new char[LL_MAX_XFER_FILE_BUFFER]; @@ -186,7 +186,7 @@ S32 LLXfer_VFile::startSend (U64 xfer_id, const LLHost &remote_host) mBufferStartOffset = 0; delete mVFile; - mVFile = NULL; + mVFile = nullptr; if(LLFileSystem::getExists(mLocalID, mType)) { mVFile = new LLFileSystem(mLocalID, mType, LLFileSystem::READ); @@ -196,7 +196,7 @@ S32 LLXfer_VFile::startSend (U64 xfer_id, const LLHost &remote_host) LL_WARNS("Xfer") << "LLXfer_VFile::startSend() cache file " << mLocalID << "." << LLAssetType::lookup(mType) << " has unexpected file size of " << mVFile->getSize() << LL_ENDL; delete mVFile; - mVFile = NULL; + mVFile = nullptr; return LL_ERR_FILE_EMPTY; } @@ -223,7 +223,7 @@ void LLXfer_VFile::closeFileHandle() if (mVFile) { delete mVFile; - mVFile = NULL; + mVFile = nullptr; } } @@ -233,7 +233,7 @@ S32 LLXfer_VFile::reopenFileHandle() { S32 retval = LL_ERR_NOERR; // presume success - if (mVFile == NULL) + if (mVFile == nullptr) { if (LLFileSystem::getExists(mLocalID, mType)) { @@ -357,7 +357,7 @@ S32 LLXfer_VFile::processEOF() if (mVFile) { delete mVFile; - mVFile = NULL; + mVFile = nullptr; } retval = LLXfer::processEOF(); diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index a2d09f4f365..f08072e5284 100644 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -155,7 +155,7 @@ void LLXferManager::updateHostStatus() for (xfer_list_t::iterator send_iter = mSendList.begin(); send_iter != mSendList.end(); ++send_iter) { - LLHostStatus *host_statusp = NULL; + LLHostStatus *host_statusp = nullptr; for (status_list_t::iterator iter = mOutgoingHosts.begin(); iter != mOutgoingHosts.end(); ++iter) { @@ -218,7 +218,7 @@ void LLXferManager::updateHostStatus() void LLXferManager::printHostStatus() { - LLHostStatus *host_statusp = NULL; + LLHostStatus *host_statusp = nullptr; if (!mOutgoingHosts.empty()) { LL_INFOS("Xfer") << "Outgoing Xfers:" << LL_ENDL; @@ -245,7 +245,7 @@ LLXfer * LLXferManager::findXferByID(U64 id, xfer_list_t & xfer_list) return(*iter); } } - return(NULL); + return(nullptr); } @@ -288,7 +288,7 @@ void LLXferManager::removeXfer(LLXfer *delp, xfer_list_t & xfer_list) LLHostStatus * LLXferManager::findHostStatus(const LLHost &host) { - LLHostStatus *host_statusp = NULL; + LLHostStatus *host_statusp = nullptr; for (status_list_t::iterator iter = mOutgoingHosts.begin(); iter != mOutgoingHosts.end(); ++iter) @@ -330,7 +330,7 @@ S32 LLXferManager::numActiveXfers(const LLHost &host) void LLXferManager::changeNumActiveXfers(const LLHost &host, S32 delta) { - LLHostStatus *host_statusp = NULL; + LLHostStatus *host_statusp = nullptr; for (status_list_t::iterator iter = mOutgoingHosts.begin(); iter != mOutgoingHosts.end(); ++iter) @@ -347,10 +347,10 @@ void LLXferManager::changeNumActiveXfers(const LLHost &host, S32 delta) void LLXferManager::registerCallbacks(LLMessageSystem *msgsystem) { - msgsystem->setHandlerFuncFast(_PREHASH_ConfirmXferPacket, process_confirm_packet, NULL); - msgsystem->setHandlerFuncFast(_PREHASH_RequestXfer, process_request_xfer, NULL); - msgsystem->setHandlerFuncFast(_PREHASH_SendXferPacket, continue_file_receive, NULL); - msgsystem->setHandlerFuncFast(_PREHASH_AbortXfer, process_abort_xfer, NULL); + msgsystem->setHandlerFuncFast(_PREHASH_ConfirmXferPacket, process_confirm_packet, nullptr); + msgsystem->setHandlerFuncFast(_PREHASH_RequestXfer, process_request_xfer, nullptr); + msgsystem->setHandlerFuncFast(_PREHASH_SendXferPacket, continue_file_receive, nullptr); + msgsystem->setHandlerFuncFast(_PREHASH_AbortXfer, process_abort_xfer, nullptr); } /////////////////////////////////////////////////////////// @@ -402,7 +402,7 @@ U64 LLXferManager::requestFile(const std::string& local_filename, bool is_priority, bool use_big_packets) { - LLXfer_File* file_xfer_p = NULL; + LLXfer_File* file_xfer_p = nullptr; // First check to see if it's already requested for (xfer_list_t::iterator iter = mReceiveList.begin(); @@ -466,7 +466,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, void** user_data, bool is_priority) { - LLXfer_VFile * xfer_p = NULL; + LLXfer_VFile * xfer_p = nullptr; for (xfer_list_t::iterator iter = mReceiveList.begin(); iter != mReceiveList.end(); ++iter) @@ -782,7 +782,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user if (uuid != LLUUID::null) { // Request for an asset - use a cache file - if(NULL == LLAssetType::lookup(type)) + if(nullptr == LLAssetType::lookup(type)) { LL_WARNS("Xfer") << "Invalid type for xfer request: " << uuid << ":" << type_s16 << " to " << mesgsys->getSender() << LL_ENDL; @@ -1251,7 +1251,7 @@ void LLXferManager::addToList(LLXfer* xferp, xfer_list_t & xfer_list, bool is_pr // Globals and C routines /////////////////////////////////////////////////////////// -LLXferManager *gXferManager = NULL; +LLXferManager *gXferManager = nullptr; void start_xfer_manager() @@ -1264,7 +1264,7 @@ void cleanup_xfer_manager() if (gXferManager) { delete(gXferManager); - gXferManager = NULL; + gXferManager = nullptr; } } diff --git a/indra/llmessage/llxorcipher.cpp b/indra/llmessage/llxorcipher.cpp index 8db4fca629f..a5169803660 100644 --- a/indra/llmessage/llxorcipher.cpp +++ b/indra/llmessage/llxorcipher.cpp @@ -35,8 +35,8 @@ ///---------------------------------------------------------------------------- LLXORCipher::LLXORCipher(const U8* pad, U32 pad_len) : - mPad(NULL), - mHead(NULL), + mPad(nullptr), + mHead(nullptr), mPadLen(0) { init(pad, pad_len); @@ -45,12 +45,12 @@ LLXORCipher::LLXORCipher(const U8* pad, U32 pad_len) : // Destroys the object LLXORCipher::~LLXORCipher() { - init(NULL, 0); + init(nullptr, 0); } LLXORCipher::LLXORCipher(const LLXORCipher& cipher) : - mPad(NULL), - mHead(NULL), + mPad(nullptr), + mHead(nullptr), mPadLen(0) { init(cipher.mPad, cipher.mPadLen); @@ -92,14 +92,14 @@ void LLXORCipher::init(const U8* pad, U32 pad_len) if(mPad) { delete [] mPad; - mPad = NULL; + mPad = nullptr; mPadLen = 0; } if(pad && pad_len) { mPadLen = pad_len; mPad = new U8[mPadLen]; - if (mPad != NULL) + if (mPad != nullptr) { memcpy(mPad, pad, mPadLen); /* Flawfinder : ignore */ } diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index e2937490bab..ec7f92b038c 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -186,11 +186,11 @@ void LLMessageSystem::init() mMessageFileVersionNumber = 0.f; - mTimingCallback = NULL; - mTimingCallbackData = NULL; + mTimingCallback = nullptr; + mTimingCallbackData = nullptr; - mMessageBuilder = NULL; - LockMessageReader(mMessageReader, NULL); + mMessageBuilder = nullptr; + LockMessageReader(mMessageReader, nullptr); } // Read file and build message templates @@ -227,7 +227,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mTemplateMessageBuilder = new LLTemplateMessageBuilder(mMessageTemplates); mLLSDMessageBuilder = new LLSDMessageBuilder(); - mMessageBuilder = NULL; + mMessageBuilder = nullptr; mTemplateMessageReader = new LLTemplateMessageReader(mMessageNumbers); mLLSDMessageReader = new LLSDMessageReader(); @@ -252,7 +252,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, LL_ERRS("Messaging") << "No APR pool before message system initialization!" << LL_ENDL; ll_init_apr(); } - apr_socket_t *aprSocketp = NULL; + apr_socket_t *aprSocketp = nullptr; apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, gAPRPoolp); mPollInfop = new LLMessagePollInfo; @@ -262,7 +262,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mPollInfop->mPollFD.reqevents = APR_POLLIN; mPollInfop->mPollFD.rtnevents = 0; mPollInfop->mPollFD.desc.s = aprSocketp; - mPollInfop->mPollFD.client_data = NULL; + mPollInfop->mPollFD.client_data = nullptr; F64Seconds mt_sec = getMessageTimeSeconds(); mResendDumpTime = mt_sec; @@ -332,20 +332,20 @@ LLMessageSystem::~LLMessageSystem() mSocket = 0; delete mTemplateMessageReader; - mTemplateMessageReader = NULL; + mTemplateMessageReader = nullptr; delete mTemplateMessageBuilder; - mTemplateMessageBuilder = NULL; - mMessageBuilder = NULL; + mTemplateMessageBuilder = nullptr; + mMessageBuilder = nullptr; delete mLLSDMessageReader; - mLLSDMessageReader = NULL; + mLLSDMessageReader = nullptr; delete mLLSDMessageBuilder; - mLLSDMessageBuilder = NULL; + mLLSDMessageBuilder = nullptr; delete mPollInfop; - mPollInfop = NULL; + mPollInfop = nullptr; mIncomingCompressedSize = 0; mCurrentRecvPacketID = 0; @@ -384,7 +384,7 @@ bool LLMessageSystem::poll(F32 seconds) bool LLMessageSystem::isTrustedSender(const LLHost& host) const { LLCircuitData* cdp = mCircuitInfo.findCircuit(host); - if(NULL == cdp) + if(nullptr == cdp) { return false; } @@ -407,7 +407,7 @@ findTemplate(const LLMessageSystem::message_template_name_map_t& templates, std::string name) { const char* namePrehash = LLMessageStringTable::getInstance()->getString(name.c_str()); - if(NULL == namePrehash) {return templates.end();} + if(nullptr == namePrehash) {return templates.end();} return templates.find(namePrehash); } @@ -438,7 +438,7 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, // Are we rejecting off-circuit packets? if (mbProtected) { - // cdp is already NULL, so we don't need to unset it. + // cdp is already nullptr, so we don't need to unset it. } else { @@ -463,7 +463,7 @@ LLCircuitData* LLMessageSystem::findCircuit(const LLHost& host, if (mbProtected) { // don't accept packets from unexpected sources - cdp = NULL; + cdp = nullptr; } else { @@ -949,8 +949,8 @@ void LLMessageSystem::nextBlock(const char *blockname) bool LLMessageSystem::isSendFull(const char* blockname) { - char* stringTableName = NULL; - if(NULL != blockname) + char* stringTableName = nullptr; + if(nullptr != blockname) { stringTableName = LLMessageStringTable::getInstance()->getString(blockname); } @@ -972,7 +972,7 @@ bool LLMessageSystem::removeLastBlock() S32 LLMessageSystem::sendReliable(const LLHost &host) { - return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, true, LL_PING_BASED_TIMEOUT_DUMMY, NULL, NULL); + return sendReliable(host, LL_DEFAULT_RELIABLE_RETRIES, true, LL_PING_BASED_TIMEOUT_DUMMY, nullptr, nullptr); } @@ -2190,7 +2190,7 @@ S32 LLMessageSystem::sendError( { LL_WARNS("Messaging") << "Data and message were too large -- data removed." << LL_ENDL; - addBinaryData("Data", NULL, 0); + addBinaryData("Data", nullptr, 0); } return sendReliable(host); } @@ -2491,23 +2491,23 @@ bool start_messaging_system( } } - gMessageSystem->setHandlerFuncFast(_PREHASH_StartPingCheck, process_start_ping_check, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_CompletePingCheck, process_complete_ping_check, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_OpenCircuit, open_circuit, NULL); - gMessageSystem->setHandlerFuncFast(_PREHASH_CloseCircuit, close_circuit, NULL); + gMessageSystem->setHandlerFuncFast(_PREHASH_StartPingCheck, process_start_ping_check, nullptr); + gMessageSystem->setHandlerFuncFast(_PREHASH_CompletePingCheck, process_complete_ping_check, nullptr); + gMessageSystem->setHandlerFuncFast(_PREHASH_OpenCircuit, open_circuit, nullptr); + gMessageSystem->setHandlerFuncFast(_PREHASH_CloseCircuit, close_circuit, nullptr); //gMessageSystem->setHandlerFuncFast(_PREHASH_AssignCircuitCode, LLMessageSystem::processAssignCircuitCode); gMessageSystem->setHandlerFuncFast(_PREHASH_AddCircuitCode, LLMessageSystem::processAddCircuitCode); - //gMessageSystem->setHandlerFuncFast(_PREHASH_AckAddCircuitCode, ack_add_circuit_code, NULL); + //gMessageSystem->setHandlerFuncFast(_PREHASH_AckAddCircuitCode, ack_add_circuit_code, nullptr); gMessageSystem->setHandlerFuncFast(_PREHASH_UseCircuitCode, LLMessageSystem::processUseCircuitCode, (void**)responder); - gMessageSystem->setHandlerFuncFast(_PREHASH_PacketAck, process_packet_ack, NULL); - //gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, NULL); + gMessageSystem->setHandlerFuncFast(_PREHASH_PacketAck, process_packet_ack, nullptr); + //gMessageSystem->setHandlerFuncFast(_PREHASH_LogMessages, process_log_messages, nullptr); gMessageSystem->setHandlerFuncFast(_PREHASH_CreateTrustedCircuit, process_create_trusted_circuit, - NULL); + nullptr); gMessageSystem->setHandlerFuncFast(_PREHASH_DenyTrustedCircuit, process_deny_trusted_circuit, - NULL); + nullptr); gMessageSystem->setHandlerFunc("Error", LLMessageSystem::processError); // We can hand this to the null_message_callback since it is a @@ -2516,7 +2516,7 @@ bool start_messaging_system( gMessageSystem->setHandlerFunc( "RequestTrustedCircuit", null_message_callback, - NULL); + nullptr); // Initialize the transfer manager gTransferManager.init(); @@ -2653,7 +2653,7 @@ void end_messaging_system(bool print_summary) } delete static_cast(gMessageSystem); - gMessageSystem = NULL; + gMessageSystem = nullptr; } } @@ -3074,7 +3074,7 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs( memset(digest, 0, MD5HEX_STR_SIZE); - if( secret != NULL) + if( secret != nullptr) { d.update(secret, (U32)strlen((char *) secret)); /* Flawfinder: ignore */ } @@ -3085,13 +3085,13 @@ bool LLMessageSystem::generateDigestForNumberAndUUIDs( d.update((unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ - if( (char*) id1str != NULL) + if( (char*) id1str != nullptr) { d.update(id1str, (U32)strlen((char *) id1str)); /* Flawfinder: ignore */ } d.update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ - if( (char*) id2str != NULL) + if( (char*) id2str != nullptr) { d.update(id2str, (U32)strlen((char *) id2str)); /* Flawfinder: ignore */ } @@ -3112,7 +3112,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << LL_ENDL; } - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); now /= window; @@ -3132,7 +3132,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); now /= window; @@ -3178,7 +3178,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << LL_ENDL; } - U32 now = (U32)time(NULL); + U32 now = (U32)time(nullptr); now /= window; @@ -3198,7 +3198,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ - U32 now = (S32)time(NULL); + U32 now = (S32)time(nullptr); now /= window; @@ -3286,9 +3286,9 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ LLTimer timeout; timeout.setTimerExpirySec(20.0); - setHandlerFuncFast(_PREHASH_StartPingCheck, null_message_callback, NULL); + setHandlerFuncFast(_PREHASH_StartPingCheck, null_message_callback, nullptr); setHandlerFuncFast(_PREHASH_CompletePingCheck, null_message_callback, - NULL); + nullptr); while (! timeout.hasExpired()) { @@ -3314,11 +3314,11 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ newMessage("RequestTrustedCircuit"); sendMessage(host); reallySendDenyTrustedCircuit(host); - setHandlerFuncFast(_PREHASH_StartPingCheck, process_start_ping_check, NULL); - setHandlerFuncFast(_PREHASH_CompletePingCheck, process_complete_ping_check, NULL); + setHandlerFuncFast(_PREHASH_StartPingCheck, process_start_ping_check, nullptr); + setHandlerFuncFast(_PREHASH_CompletePingCheck, process_complete_ping_check, nullptr); timeout.setTimerExpirySec(2.0); - LLCircuitData* cdp = NULL; + LLCircuitData* cdp = nullptr; while(!timeout.hasExpired()) { cdp = mCircuitInfo.findCircuit(host); diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 14cdc48a07d..a4927809c06 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -380,14 +380,14 @@ class LLMessageSystem : public LLMessageSenderInterface // methods for building, sending, receiving, and handling messages - void setHandlerFuncFast(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = NULL); - void setHandlerFunc(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = NULL) + void setHandlerFuncFast(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = nullptr); + void setHandlerFunc(const char *name, void (*handler_func)(LLMessageSystem *msgsystem, void **user_data), void **user_data = nullptr) { setHandlerFuncFast(LLMessageStringTable::getInstance()->getString(name), handler_func, user_data); } // Set a callback function for a message system exception. - void setExceptionFunc(EMessageException exception, msg_exception_callback func, void* data = NULL); + void setExceptionFunc(EMessageException exception, msg_exception_callback func, void* data = nullptr); // Call the specified exception func, and return true if a // function was found and called. Otherwise return false. bool callExceptionFunc(EMessageException exception); @@ -396,7 +396,7 @@ class LLMessageSystem : public LLMessageSenderInterface // hashed message name and the time spent in the processing handler function // measured in seconds. JC typedef void (*msg_timing_callback)(const char* hashed_name, F32 time, void* data); - void setTimingFunc(msg_timing_callback func, void* data = NULL); + void setTimingFunc(msg_timing_callback func, void* data = nullptr); msg_timing_callback getTimingCallback() { return mTimingCallback; @@ -531,8 +531,8 @@ class LLMessageSystem : public LLMessageSenderInterface // you need to go to the next block type or need to start a new // message. Specify the current blockname to check block counts, // otherwise the method only checks against MTU. - bool isSendFull(const char* blockname = NULL); - bool isSendFullFast(const char* blockname = NULL); + bool isSendFull(const char* blockname = nullptr); + bool isSendFullFast(const char* blockname = nullptr); bool removeLastBlock(); diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 2be5a9e5b63..713e07c0aef 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -115,8 +115,8 @@ const char* u32_to_ip_string(U32 ip) in.s_addr = ip; char* result = inet_ntoa(in); - // NULL indicates error in conversion - if (result != NULL) + // nullptr indicates error in conversion + if (result != nullptr) { strncpy( buffer, result, MAXADDRSTR ); /* Flawfinder: ignore */ buffer[MAXADDRSTR-1] = '\0'; @@ -129,7 +129,7 @@ const char* u32_to_ip_string(U32 ip) } -// Returns ip_string if successful, NULL if not. Copies into ip_string +// Returns ip_string if successful, nullptr if not. Copies into ip_string char *u32_to_ip_string(U32 ip, char *ip_string) { char *result; @@ -139,8 +139,8 @@ char *u32_to_ip_string(U32 ip, char *ip_string) in.s_addr = ip; result = inet_ntoa(in); - // NULL indicates error in conversion - if (result != NULL) + // nullptr indicates error in conversion + if (result != nullptr) { //the function signature needs to change to pass in the lengfth of first and last. strcpy(ip_string, result); /*Flawfinder: ignore*/ @@ -148,7 +148,7 @@ char *u32_to_ip_string(U32 ip, char *ip_string) } else { - return NULL; + return nullptr; } } @@ -543,7 +543,7 @@ static int recvfrom_destip( int socket, void *buf, int len, struct sockaddr *fro return -1; } - for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR( &msg, cmsgptr)) + for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != nullptr; cmsgptr = CMSG_NXTHDR( &msg, cmsgptr)) { if( cmsgptr->cmsg_level == SOL_IP && cmsgptr->cmsg_type == IP_PKTINFO ) { diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index c41f3bb89f1..b2d34656620 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -53,7 +53,7 @@ LLHost get_receiving_interface(); U32 get_receiving_interface_ip(void); const char* u32_to_ip_string(U32 ip); // Returns pointer to internal string buffer, "(bad IP addr)" on failure, cannot nest calls -char* u32_to_ip_string(U32 ip, char *ip_string); // NULL on failure, ip_string on success, you must allocate at least MAXADDRSTR chars +char* u32_to_ip_string(U32 ip, char *ip_string); // nullptr on failure, ip_string on success, you must allocate at least MAXADDRSTR chars U32 ip_string_to_u32(const char* ip_string); // Wrapper for inet_addr() extern const char* LOOPBACK_ADDRESS_STRING; diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp index 6113adbfcf8..3ab08fb9309 100644 --- a/indra/llmessage/partsyspacket.cpp +++ b/indra/llmessage/partsyspacket.cpp @@ -1264,7 +1264,7 @@ bool LLPartSysCompressedPacket::toLLPartInitData(LLPartInitData *out, U32 *bytes bool LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) { - if ((in != NULL) && (bytesUsed <= sizeof(mData))) + if ((in != nullptr) && (bytesUsed <= sizeof(mData))) { memcpy(mData, in, bytesUsed); /* Flawfinder: ignore */ mNumBytes = bytesUsed; diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 1881144d3e1..524de626eb2 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -58,7 +58,7 @@ namespace tut local_server(STRINGIZE("http://127.0.0.1:" << PORT << "/")) { ensure("Set environment variable PORT to local test server port", !PORT.empty()); - apr_pool_create(&mPool, NULL); + apr_pool_create(&mPool, nullptr); LLCurl::initClass(false); mClientPump = new LLPumpIO(mPool); diff --git a/indra/llmessage/tests/llhttpnode_stub.cpp b/indra/llmessage/tests/llhttpnode_stub.cpp index d896084021a..80f037a4428 100644 --- a/indra/llmessage/tests/llhttpnode_stub.cpp +++ b/indra/llmessage/tests/llhttpnode_stub.cpp @@ -57,14 +57,14 @@ void LLHTTPNode::put(LLHTTPNode::ResponsePtr response, const LLSD& context, cons void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const {} void LLHTTPNode::del(LLHTTPNode::ResponsePtr response, const LLSD& context) const {} void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const {} -LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const { return NULL; } +LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const { return nullptr; } bool LLHTTPNode::handles(const LLSD& remainder, LLSD& context) const { return false; } bool LLHTTPNode::validate(const std::string& name, LLSD& context) const { return false; } -const LLHTTPNode* LLHTTPNode::traverse(const std::string& path, LLSD& context) const { return NULL; } +const LLHTTPNode* LLHTTPNode::traverse(const std::string& path, LLSD& context) const { return nullptr; } void LLHTTPNode::addNode(const std::string& path, LLHTTPNode* nodeToAdd) { } LLSD LLHTTPNode::allNodePaths() const { return LLSD(); } -const LLHTTPNode* LLHTTPNode::rootNode() const { return NULL; } -const LLHTTPNode* LLHTTPNode::findNode(const std::string& name) const { return NULL; } +const LLHTTPNode* LLHTTPNode::rootNode() const { return nullptr; } +const LLHTTPNode* LLHTTPNode::findNode(const std::string& name) const { return nullptr; } LLHTTPNode::Response::~Response(){} void LLHTTPNode::Response::notFound(const std::string& message) @@ -95,7 +95,7 @@ void LLHTTPNode::Response::addHeader(const std::string& name,const std::string& void LLHTTPNode::describe(Description& desc) const { } -const LLChainIOFactory* LLHTTPNode::getProtocolHandler() const { return NULL; } +const LLChainIOFactory* LLHTTPNode::getProtocolHandler() const { return nullptr; } LLHTTPRegistrar::NodeFactory::~NodeFactory() { } diff --git a/indra/llmessage/tests/llnamevalue_test.cpp b/indra/llmessage/tests/llnamevalue_test.cpp index f77cd102f48..5051e8fd79d 100644 --- a/indra/llmessage/tests/llnamevalue_test.cpp +++ b/indra/llmessage/tests/llnamevalue_test.cpp @@ -57,7 +57,7 @@ namespace tut { // LLNameValue() LLNameValue nValue; - ensure("mName should have been NULL", nValue.mName == NULL); + ensure("mName should have been NULL", nValue.mName == nullptr); ensure("getTypeEnum failed",nValue.getTypeEnum() == NVT_NULL); ensure("getClassEnum failed",nValue.getClassEnum() == NVC_NULL); ensure("getSendtoEnum failed",nValue.getSendtoEnum() == NVS_NULL); @@ -68,7 +68,7 @@ namespace tut // LLNameValue(const char* data); // LLNameValue(const char* name, const char* data, const char* type, const char* nvclass, const char* nvsendto, - // TNameValueCallback nvcb = NULL, void** user_data = NULL); + // TNameValueCallback nvcb = nullptr, void** user_data = nullptr); template<> template<> void namevalue_object_t::test<2>() { @@ -135,7 +135,7 @@ namespace tut } // LLNameValue(const char* name, const char* data, const char* type, const char* nvclass, - // TNameValueCallback nvcb = NULL, void** user_data = NULL); + // TNameValueCallback nvcb = nullptr, void** user_data = nullptr); template<> template<> void namevalue_object_t::test<3>() { @@ -194,7 +194,7 @@ namespace tut } // LLNameValue(const char* name, const char* type, const char* nvclass, - // TNameValueCallback nvcb = NULL, void** user_data = NULL); + // TNameValueCallback nvcb = nullptr, void** user_data = nullptr); template<> template<> void namevalue_object_t::test<4>() { diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp index c5b852453fb..96830de99d9 100644 --- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp @@ -108,7 +108,7 @@ namespace tut template<> template<> void object::test<1>() { - LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageReader* pReader = nullptr; LLTemplateMessageDispatcher t(*pReader); t.dispatch(mMessageName, mMessage, mResponsePtr); ensure(! gUdpDispatchWasCalled); @@ -119,7 +119,7 @@ namespace tut template<> template<> void object::test<2>() { - LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageReader* pReader = nullptr; LLTemplateMessageDispatcher t(*pReader); gValidateMessage = true; std::vector vector_data; @@ -133,7 +133,7 @@ namespace tut template<> template<> void object::test<3>() { - LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageReader* pReader = nullptr; LLTemplateMessageDispatcher t(*pReader); std::vector vector_data; fillVector(vector_data, gBinaryTemplateData); @@ -147,7 +147,7 @@ namespace tut template<> template<> void object::test<4>() { - LLTemplateMessageReader* pReader = NULL; + LLTemplateMessageReader* pReader = nullptr; LLTemplateMessageDispatcher t(*pReader); gValidateMessage = true; std::vector vector_data; diff --git a/indra/llmessage/tests/networkio.h b/indra/llmessage/tests/networkio.h index a88c4ec596c..fbdc1c62ac1 100644 --- a/indra/llmessage/tests/networkio.h +++ b/indra/llmessage/tests/networkio.h @@ -46,7 +46,7 @@ class NetworkIO: public LLSingleton { LLSINGLETON(NetworkIO); NetworkIO(): - mServicePump(NULL), + mServicePump(nullptr), mDone(false) { ll_init_apr(); @@ -58,7 +58,7 @@ class NetworkIO: public LLSingleton // Create IO Pump to use for HTTP Requests. mServicePump = new LLPumpIO(gAPRPoolp); LLHTTPClient::setPump(*mServicePump); - if (ll_init_ares() == NULL || !gAres->isInitialized()) + if (ll_init_ares() == nullptr || !gAres->isInitialized()) { LLTHROW(LLException("Can't start DNS resolver")); } From 4833aa173f6d6095beb8fb408be1198232a642d4 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 14:01:12 -0500 Subject: [PATCH 10/11] Replace legacy NULL with nullptr in llrender llwindow llxml --- indra/llrender/llcubemap.cpp | 2 +- indra/llrender/llcubemaparray.cpp | 2 +- indra/llrender/llfontgl.cpp | 46 ++--- indra/llrender/llfontgl.h | 8 +- indra/llrender/llfontregistry.cpp | 32 ++-- indra/llrender/llfontvertexbuffer.h | 6 +- indra/llrender/llglslshader.cpp | 6 +- indra/llrender/llglslshader.h | 2 +- indra/llrender/llimagegl.cpp | 16 +- indra/llrender/llrender.cpp | 24 +-- indra/llrender/llrender2dutils.cpp | 30 +-- indra/llrender/llrender2dutils.h | 2 +- indra/llrender/llrendertarget.cpp | 10 +- indra/llrender/llshadermgr.cpp | 20 +- indra/llrender/llshadermgr.h | 2 +- indra/llrender/lltexturemanagerbridge.cpp | 2 +- indra/llrender/lluiimage.cpp | 6 +- indra/llrender/lluiimage.h | 4 +- indra/llrender/llvertexbuffer.cpp | 6 +- indra/llrender/llvertexbuffer.h | 4 +- indra/llwindow/lldragdropwin32.cpp | 14 +- indra/llwindow/lldxhardware.cpp | 52 +++--- indra/llwindow/llkeyboard.cpp | 12 +- indra/llwindow/llkeyboardwin32.cpp | 2 +- indra/llwindow/llwindow.cpp | 8 +- indra/llwindow/llwindow.h | 4 +- indra/llwindow/llwindowheadless.h | 4 +- indra/llwindow/llwindowmacosx-objc.mm | 6 +- indra/llwindow/llwindowmacosx.cpp | 88 ++++----- indra/llwindow/llwindowmacosx.h | 2 +- indra/llwindow/llwindowmesaheadless.cpp | 4 +- indra/llwindow/llwindowmesaheadless.h | 4 +- indra/llwindow/llwindowsdl.h | 2 +- indra/llwindow/llwindowwin32.cpp | 218 +++++++++++----------- indra/llwindow/llwindowwin32.h | 2 +- indra/llxml/llcontrol.cpp | 2 +- indra/llxml/llxmlnode.cpp | 148 +++++++-------- indra/llxml/llxmlnode.h | 4 +- indra/llxml/llxmlparser.cpp | 4 +- indra/llxml/llxmltree.cpp | 16 +- indra/llxml/llxmltree.h | 4 +- 41 files changed, 415 insertions(+), 415 deletions(-) diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index b15cec58045..411f4ec694b 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -338,6 +338,6 @@ void LLCubeMap::destroyGL() { for (S32 i = 0; i < 6; i++) { - mImages[i] = NULL; + mImages[i] = nullptr; } } diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index 998b57217d4..a0d01931e91 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -215,5 +215,5 @@ GLuint LLCubeMapArray::getGLName() void LLCubeMapArray::destroyGL() { - mImage = NULL; + mImage = nullptr; } diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 16eec1fdd24..e708bc58f09 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -63,7 +63,7 @@ bool LLFontGL::sDisplayFont = true ; std::string LLFontGL::sAppDir; LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f); -LLFontRegistry* LLFontGL::sFontRegistry = NULL; +LLFontRegistry* LLFontGL::sFontRegistry = nullptr; LLCoordGL LLFontGL::sCurOrigin; F32 LLFontGL::sCurDepth; @@ -92,7 +92,7 @@ void LLFontGL::destroyGL() bool LLFontGL::loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n) { - if(mFontFreetype == reinterpret_cast(NULL)) + if(mFontFreetype.isNull()) { mFontFreetype = new LLFontFreetype; } @@ -102,7 +102,7 @@ bool LLFontGL::loadFace(const std::string& filename, F32 point_size, const F32 v S32 LLFontGL::getNumFaces(const std::string& filename) { - if (mFontFreetype == reinterpret_cast(NULL)) + if (mFontFreetype.isNull()) { mFontFreetype = new LLFontFreetype; } @@ -176,7 +176,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (shadow != NO_SHADOW) { F32 luminance; - color.calcHSL(NULL, NULL, &luminance); + color.calcHSL(nullptr, nullptr, &luminance); drop_shadow_strength = clamp_rescale(luminance, 0.35f, 0.6f, 0.f, 1.f); if (luminance < 0.35f) { @@ -279,7 +279,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } } - const LLFontGlyphInfo* next_glyph = NULL; + const LLFontGlyphInfo* next_glyph = nullptr; // string can have more than one glyph per char (ex: bold or shadow), // make sure that GLYPH_BATCH_SIZE won't end up with half a symbol. @@ -303,7 +303,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons llwchar wch = wstr[i]; const LLFontGlyphInfo* fgi = next_glyph; - next_glyph = NULL; + next_glyph = nullptr; if(!fgi) { fgi = mFontFreetype->getGlyphInfo(wch, (!use_color) ? EFontGlyphType::Grayscale : EFontGlyphType::Color); @@ -528,7 +528,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars F32 cur_x = 0; const S32 max_index = begin_offset + max_chars; - const LLFontGlyphInfo* next_glyph = NULL; + const LLFontGlyphInfo* next_glyph = nullptr; F32 width_padding = 0.f; for (S32 i = begin_offset; i < max_index && wchars[i] != 0; i++) @@ -536,7 +536,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars llwchar wch = wchars[i]; const LLFontGlyphInfo* fgi = next_glyph; - next_glyph = NULL; + next_glyph = nullptr; if(!fgi) { fgi = mFontFreetype->getGlyphInfo(wch, EFontGlyphType::Unspecified); @@ -609,7 +609,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch F32 scaled_max_pixels = max_pixels * sScaleX; F32 width_padding = 0.f; - LLFontGlyphInfo* next_glyph = NULL; + LLFontGlyphInfo* next_glyph = nullptr; S32 i; for (i=0; (i < max_chars); i++) @@ -654,12 +654,12 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch } LLFontGlyphInfo* fgi = next_glyph; - next_glyph = NULL; + next_glyph = nullptr; if(!fgi) { fgi = mFontFreetype->getGlyphInfo(wch, EFontGlyphType::Unspecified); - if (NULL == fgi) + if (nullptr == fgi) { return 0; } @@ -789,7 +789,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t F32 scaled_max_pixels = max_pixels * sScaleX; - const LLFontGlyphInfo* next_glyph = NULL; + const LLFontGlyphInfo* next_glyph = nullptr; S32 pos; for (pos = begin_offset; pos < max_index; pos++) @@ -801,7 +801,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t } const LLFontGlyphInfo* glyph = next_glyph; - next_glyph = NULL; + next_glyph = nullptr; if(!glyph) { glyph = mFontFreetype->getGlyphInfo(wch, EFontGlyphType::Unspecified); @@ -903,12 +903,12 @@ bool LLFontGL::loadDefaultFonts() { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; bool succ = true; - succ &= (NULL != getFontSansSerifSmall()); - succ &= (NULL != getFontSansSerif()); - succ &= (NULL != getFontSansSerifBig()); - succ &= (NULL != getFontSansSerifHuge()); - succ &= (NULL != getFontSansSerifBold()); - succ &= (NULL != getFontMonospace()); + succ &= (nullptr != getFontSansSerifSmall()); + succ &= (nullptr != getFontSansSerif()); + succ &= (nullptr != getFontSansSerifBig()); + succ &= (nullptr != getFontSansSerifHuge()); + succ &= (nullptr != getFontSansSerifBold()); + succ &= (nullptr != getFontMonospace()); return succ; } @@ -926,7 +926,7 @@ void LLFontGL::destroyDefaultFonts() { // Remove the actual fonts. delete sFontRegistry; - sFontRegistry = NULL; + sFontRegistry = nullptr; } //static @@ -1170,7 +1170,7 @@ LLFontGL* LLFontGL::getFontByName(const std::string& name) } else { - return NULL; + return nullptr; } } @@ -1197,8 +1197,8 @@ std::string LLFontGL::getFontPathSystem() return fontpath; } - wchar_t *pwstr = NULL; - HRESULT okay = SHGetKnownFolderPath(FOLDERID_Fonts, 0, NULL, &pwstr); + wchar_t *pwstr = nullptr; + HRESULT okay = SHGetKnownFolderPath(FOLDERID_Fonts, 0, nullptr, &pwstr); if (SUCCEEDED(okay) && pwstr) { std::string fontpath(ll_convert_wide_to_string(pwstr)); diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h index 1c8e036f58d..f3624d596d1 100644 --- a/indra/llrender/llfontgl.h +++ b/indra/llrender/llfontgl.h @@ -98,7 +98,7 @@ class LLFontGL HAlign halign = LEFT, VAlign valign = BASELINE, U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, - F32* right_x=NULL, + F32* right_x=nullptr, bool use_ellipses = false, bool use_color = true) const; @@ -108,7 +108,7 @@ class LLFontGL HAlign halign = LEFT, VAlign valign = BASELINE, U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, - F32* right_x=NULL, + F32* right_x=nullptr, bool use_ellipses = false, bool use_color = true) const; @@ -118,14 +118,14 @@ class LLFontGL HAlign halign = LEFT, VAlign valign = BASELINE, U8 style = NORMAL, ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, - F32* right_x=NULL, + F32* right_x=nullptr, bool use_ellipses = false, bool use_color = true) const; S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const; // renderUTF8 does a conversion, so is slower! - S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x = NULL, bool use_ellipses = false, bool use_color = true) const; + S32 renderUTF8(const std::string &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x = nullptr, bool use_ellipses = false, bool use_color = true) const; S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color) const; S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const; diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index c48a389f6a5..a5ffa86ac3a 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -221,7 +221,7 @@ bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) ++path_it) { LLXMLNodePtr root; - bool parsed_file = LLXMLNode::parseFile(*path_it, root, NULL); + bool parsed_file = LLXMLNode::parseFile(*path_it, root, nullptr); if (!parsed_file) continue; @@ -336,10 +336,10 @@ bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node) // if this is the first time we've seen this font name, // create a new template map entry for it. const LLFontDescriptor *match_desc = registry->getMatchingFontDesc(desc); - if (match_desc == NULL) + if (match_desc == nullptr) { // Create a new entry (with no corresponding font). - registry->mFontMap[norm_desc] = NULL; + registry->mFontMap[norm_desc] = nullptr; } // otherwise, find the existing entry and combine data. else @@ -362,7 +362,7 @@ bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node) new_desc.setFontFiles(font_files); new_desc.setFontCollectionFiles(font_collection_files); registry->mFontMap.erase(*match_desc); - registry->mFontMap[new_desc] = NULL; + registry->mFontMap[new_desc] = nullptr; } } } @@ -407,7 +407,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) if (!found_size) { LL_WARNS() << "createFont unrecognized size " << norm_desc.getSize() << LL_ENDL; - return NULL; + return nullptr; } LL_INFOS() << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << LL_ENDL; F32 fallback_scale = 1.0; @@ -420,7 +420,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) { LL_WARNS() << "createFont failed, no template found for " << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << LL_ENDL; - return NULL; + return nullptr; } // See whether this best-match font has already been instantiated in the requested size. @@ -430,7 +430,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // If we fail to find a font in the fonts directory, it->second might be NULL. // We shouldn't construcnt a font with a NULL mFontFreetype. // This may not be the best solution, but it at least prevents a crash. - if (it != mFontMap.end() && it->second != NULL) + if (it != mFontMap.end() && it->second != nullptr) { LL_INFOS() << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << LL_ENDL; @@ -468,10 +468,10 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) if (font_files.empty()) { LL_WARNS() << "createFont failed, no file names specified" << LL_ENDL; - return NULL; + return nullptr; } - LLFontGL *result = NULL; + LLFontGL *result = nullptr; // The first font will get pulled will be the "head" font, set to non-fallback. // Rest will consitute the fallback list. @@ -492,7 +492,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) font_file_it != font_files.end(); ++font_file_it) { - LLFontGL *fontp = NULL; + LLFontGL *fontp = nullptr; bool is_ft_collection = (std::find_if(font_collection_files.begin(), font_collection_files.end(), [&font_file_it](const LLFontFileInfo& ffi) { return font_file_it->FileName == ffi.FileName; }) != font_collection_files.end()); @@ -513,7 +513,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) S32 num_faces = is_ft_collection ? fontp->getNumFaces(font_path) : 1; for (S32 i = 0; i < num_faces; i++) { - if (fontp == NULL) + if (fontp == nullptr) { fontp = new LLFontGL; } @@ -531,13 +531,13 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) result->mFontFreetype->addFallbackFont(fontp->mFontFreetype, font_file_it->CharFunctor); delete fontp; - fontp = NULL; + fontp = nullptr; } } else { delete fontp; - fontp = NULL; + fontp = nullptr; } } if (is_font_loaded) break; @@ -546,7 +546,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) { LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << font_file_it->FileName << LL_ENDL; delete fontp; - fontp = NULL; + fontp = nullptr; } } @@ -630,7 +630,7 @@ const LLFontDescriptor *LLFontRegistry::getMatchingFontDesc(const LLFontDescript if (it != mFontMap.end()) return &(it->first); else - return NULL; + return nullptr; } static U32 bitCount(U8 c) @@ -666,7 +666,7 @@ const LLFontDescriptor *LLFontRegistry::getClosestFontTemplate(const LLFontDescr LLFontDescriptor norm_desc = desc.normalize(); - const LLFontDescriptor *best_match_desc = NULL; + const LLFontDescriptor *best_match_desc = nullptr; for (font_reg_map_t::iterator it = mFontMap.begin(); it != mFontMap.end(); ++it) diff --git a/indra/llrender/llfontvertexbuffer.h b/indra/llrender/llfontvertexbuffer.h index a9e1e2337c2..6fcc803bd80 100644 --- a/indra/llrender/llfontvertexbuffer.h +++ b/indra/llrender/llfontvertexbuffer.h @@ -49,7 +49,7 @@ class LLFontVertexBuffer U8 style = LLFontGL::NORMAL, LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, - F32* right_x = NULL, + F32* right_x = nullptr, bool use_ellipses = false, bool use_color = true); @@ -62,7 +62,7 @@ class LLFontVertexBuffer U8 style = LLFontGL::NORMAL, LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW, S32 max_chars = S32_MAX, - F32* right_x = NULL, + F32* right_x = nullptr, bool use_ellipses = false, bool use_color = true); @@ -75,7 +75,7 @@ class LLFontVertexBuffer U8 style = LLFontGL::NORMAL, LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, - F32* right_x = NULL, + F32* right_x = nullptr, bool use_ellipses = false, bool use_color = true); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index a268ea07bb4..c8c7db45ae3 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -52,7 +52,7 @@ using std::make_pair; using std::string; GLuint LLGLSLShader::sCurBoundShader = 0; -LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; +LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = nullptr; S32 LLGLSLShader::sIndexedTextureChannels = 0; U32 LLGLSLShader::sMaxGLTFMaterials = 0; U32 LLGLSLShader::sMaxGLTFNodes = 0; @@ -668,7 +668,7 @@ bool LLGLSLShader::mapAttributes() mAttribute.clear(); #if LL_RELEASE_WITH_DEBUG_INFO - mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size(), { -1, NULL }); + mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size(), { -1, nullptr }); #else mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size(), -1); #endif @@ -1111,7 +1111,7 @@ void LLGLSLShader::unbind(void) glUseProgram(0); sCurBoundShader = 0; - sCurBoundShaderPtr = NULL; + sCurBoundShaderPtr = nullptr; } S32 LLGLSLShader::bindTexture(const std::string& uniform, LLTexture* texture, LLTexUnit::eTextureType mode) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 272a99aaa58..330331ba172 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -196,7 +196,7 @@ class LLGLSLShader bool attachFragmentObject(std::string object); bool attachVertexObject(std::string object); void attachObject(GLuint object); - void attachObjects(GLuint* objects = NULL, S32 count = 0); + void attachObjects(GLuint* objects = nullptr, S32 count = 0); bool mapAttributes(); bool mapUniforms(); void mapUniform(GLint index); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3165cb313b2..2f2ac1afc70 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -139,7 +139,7 @@ U32 LLImageGL::sBindCount = 0; S32 LLImageGL::sCount = 0; F32 LLImageGL::sLastFrameTime = 0.f; -LLImageGL* LLImageGL::sDefaultGLTexture = NULL ; +LLImageGL* LLImageGL::sDefaultGLTexture = nullptr; bool LLImageGL::sCompressTextures = false; std::unordered_set LLImageGL::sImageList; @@ -532,7 +532,7 @@ void LLImageGL::init(bool usemipmaps, bool allow_compression) mTextureMemory = S64Bytes(0); mLastBindTime = 0.f; - mPickMask = NULL; + mPickMask = nullptr; mPickMaskWidth = 0; mPickMaskHeight = 0; mUseMipMaps = usemipmaps; @@ -588,7 +588,7 @@ void LLImageGL::cleanup() } freePickMask(); - mSaveData = NULL; // deletes data + mSaveData = nullptr; // deletes data } //---------------------------------------------------------------------------- @@ -967,7 +967,7 @@ bool LLImageGL::setImage(const U8* data_in, bool data_hasmips /* = false */, S32 if (prev_mip_data && prev_mip_data != data_in) { delete[] prev_mip_data; - prev_mip_data = NULL; + prev_mip_data = nullptr; } } } @@ -1124,7 +1124,7 @@ bool LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 //LL_WARNS() << "Setting subimage on image without GL texture" << LL_ENDL; return false; } - if (datap == NULL) + if (datap == nullptr) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 //LL_WARNS() << "Setting subimage on image with NULL datap" << LL_ENDL; @@ -2305,11 +2305,11 @@ U32 LLImageGL::createPickMask(S32 pWidth, S32 pHeight) //---------------------------------------------------------------------------- void LLImageGL::freePickMask() { - if (mPickMask != NULL) + if (mPickMask != nullptr) { delete [] mPickMask; } - mPickMask = NULL; + mPickMask = nullptr; mPickMaskWidth = mPickMaskHeight = 0; } @@ -2520,7 +2520,7 @@ bool LLImageGL::scaleDown(S32 desired_discard) if (size > sScratchPBOSize) { - glBufferData(GL_PIXEL_PACK_BUFFER, size, NULL, GL_STREAM_COPY); + glBufferData(GL_PIXEL_PACK_BUFFER, size, nullptr, GL_STREAM_COPY); sScratchPBOSize = (U32)size; } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index ab88e4868ec..79b2bc510f7 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -219,9 +219,9 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) { gGL.flush(); - LLImageGL* gl_tex = NULL ; + LLImageGL* gl_tex = nullptr; - if (texture != NULL && (gl_tex = texture->getGLTexture())) + if (texture != nullptr && (gl_tex = texture->getGLTexture())) { if (gl_tex->getTexName()) //if texture exists { @@ -333,7 +333,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) gGL.flush(); - if (cubeMap == NULL) + if (cubeMap == nullptr) { LL_WARNS() << "NULL LLTexUnit::bind cubemap" << LL_ENDL; return false; @@ -770,8 +770,8 @@ bool LLRender::init(bool needs_vertex_buffer) #if GL_ARB_debug_output && !LL_DARWIN if (gGLManager.mHasDebugOutput && gDebugGL) { //setup debug output callback - //glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE); - glDebugMessageCallback((GLDEBUGPROC) gl_debug_callback, NULL); + //glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, nullptr, GL_TRUE); + glDebugMessageCallback((GLDEBUGPROC) gl_debug_callback, nullptr); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } #endif @@ -1394,7 +1394,7 @@ LLLightState* LLRender::getLight(U32 index) return &mLightState[index]; } - return NULL; + return nullptr; } void LLRender::setAmbientLightColor(const LLColor4& color) @@ -1863,7 +1863,7 @@ void LLRender::color3fv(const GLfloat* c) void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { @@ -1874,7 +1874,7 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b) void LLRender::diffuseColor3fv(const F32* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { @@ -1885,7 +1885,7 @@ void LLRender::diffuseColor3fv(const F32* c) void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { @@ -1896,7 +1896,7 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a) void LLRender::diffuseColor4fv(const F32* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { @@ -1907,7 +1907,7 @@ void LLRender::diffuseColor4fv(const F32* c) void LLRender::diffuseColor4ubv(const U8* c) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { @@ -1918,7 +1918,7 @@ void LLRender::diffuseColor4ubv(const U8* c) void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) { LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader != NULL); + llassert(shader != nullptr); if (shader) { diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index e9d2212a67c..fbd2fe16900 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -322,9 +322,9 @@ void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect ) { - if (NULL == image) + if (nullptr == image) { - LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; + LL_WARNS() << "image == nullptr; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); @@ -332,14 +332,14 @@ void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect) { - gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target); + gl_draw_scaled_rotated_image(x, y, width, height, 0.f, nullptr, color, uv_rect, target); } void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) { - if (NULL == image) + if (nullptr == image) { - LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; + LL_WARNS() << "image == nullptr; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); @@ -347,9 +347,9 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, bool solid_color, const LLRectf& uv_rect, bool scale_inner) { - if (NULL == image) + if (nullptr == image) { - LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; + LL_WARNS() << "image == nullptr; aborting function" << LL_ENDL; return; } @@ -365,9 +365,9 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex { stop_glerror(); - if (NULL == image) + if (nullptr == image) { - LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; + LL_WARNS() << "image == nullptr; aborting function" << LL_ENDL; return; } @@ -713,11 +713,11 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre { if (!image && !target) { - LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; + LL_WARNS() << "image == nullptr; aborting function" << LL_ENDL; return; } - if(image != NULL) + if(image != nullptr) { gGL.getTexUnit(0)->bind(image, true); } @@ -785,7 +785,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - if(image != NULL) + if(image != nullptr) { gGL.getTexUnit(0)->bind(image, true); } @@ -1809,7 +1809,7 @@ LLPointer LLRender2D::getUIImageByID(const LLUUID& image_id, S32 prio } else { - return NULL; + return nullptr; } } @@ -1818,7 +1818,7 @@ LLPointer LLRender2D::getUIImage(const std::string& name, S32 priorit if (!name.empty() && mImageProvider) return mImageProvider->getUIImage(name, priority); else - return NULL; + return nullptr; } // static @@ -1826,7 +1826,7 @@ void LLRender2D::resetProvider() { if (LLRender2D::instanceExists()) { - LLRender2D::getInstance()->mImageProvider = NULL; + LLRender2D::getInstance()->mImageProvider = nullptr; } } diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 096e7584f19..8e86d3e2938 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -75,7 +75,7 @@ void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VE void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = nullptr); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, bool solid_color = false, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, bool solid_color = false, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 0b0d69812f0..23c068a2f75 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -30,7 +30,7 @@ #include "llrender.h" #include "llgl.h" -LLRenderTarget* LLRenderTarget::sBoundTarget = NULL; +LLRenderTarget* LLRenderTarget::sBoundTarget = nullptr; U32 LLRenderTarget::sBytesAllocated = 0; void check_framebuffer_status() @@ -87,7 +87,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) for (U32 i = 0; i < mTex.size(); ++i) { //resize color attachments gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]); - LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, mInternalFormat[i], mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, mInternalFormat[i], mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, nullptr, false); sBytesAllocated += pix_diff*4; } @@ -95,7 +95,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy) { gGL.getTexUnit(0)->bindManual(mUsage, mDepth); U32 internal_type = LLTexUnit::getInternalType(mUsage); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr, false); sBytesAllocated += pix_diff*4; } @@ -231,7 +231,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) { clear_glerror(); - LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, nullptr, false); if (glGetError() != GL_NO_ERROR) { LL_WARNS() << "Could not allocate color buffer for render target." << LL_ENDL; @@ -300,7 +300,7 @@ bool LLRenderTarget::allocateDepth() U32 internal_type = LLTexUnit::getInternalType(mUsage); stop_glerror(); clear_glerror(); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); sBytesAllocated += mResX*mResY*4; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 1da71e6bf49..076974b4c17 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -43,7 +43,7 @@ using std::pair; using std::make_pair; using std::string; -LLShaderMgr * LLShaderMgr::sInstance = NULL; +LLShaderMgr * LLShaderMgr::sInstance = nullptr; LLShaderMgr::LLShaderMgr() { @@ -57,7 +57,7 @@ LLShaderMgr::~LLShaderMgr() // static LLShaderMgr * LLShaderMgr::instance() { - if(NULL == sInstance) + if(nullptr == sInstance) { LL_ERRS("Shaders") << "LLShaderMgr should already have been instantiated by the application!" << LL_ENDL; } @@ -67,7 +67,7 @@ LLShaderMgr * LLShaderMgr::instance() bool LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { - llassert_always(shader != NULL); + llassert_always(shader != nullptr); LLShaderFeatures *features = & shader->mFeatures; if (features->attachNothing) @@ -480,7 +480,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev //read in from file - LLFILE* file = NULL; + LLFILE* file = nullptr; S32 try_gpu_class = shader_level; S32 gpu_class; @@ -538,7 +538,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev } } - if (file == NULL) + if (file == nullptr) { if (gDirUtilp->fileExists(open_file_name)) { @@ -555,7 +555,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev //or any shaders longer than 4096 lines... deal - DaveP GLchar buff[1024]; GLchar *extra_code_text[1024]; - GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL }; + GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { nullptr }; GLuint extra_code_count = 0, shader_code_count = 0; BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text)); @@ -762,15 +762,15 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev bool touched = false; #endif - while(NULL != fgets((char *)buff, 1024, file) + while(nullptr != fgets((char *)buff, 1024, file) && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text))) { file_lines_count++; - bool extra_block_area_found = NULL != strstr((const char*)buff, "[EXTRA_CODE_HERE]"); + bool extra_block_area_found = nullptr != strstr((const char*)buff, "[EXTRA_CODE_HERE]"); #if TOUCH_SHADERS - if (NULL != strstr((const char*)buff, marker)) + if (nullptr != strstr((const char*)buff, marker)) { touched = true; } @@ -865,7 +865,7 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev if (ret) { LL_DEBUGS("ShaderLoading") << "glCreateShader done" << LL_ENDL; - glShaderSource(ret, shader_code_count, (const GLchar**)shader_code_text, NULL); + glShaderSource(ret, shader_code_count, (const GLchar**)shader_code_text, nullptr); error = glGetError(); if (error != GL_NO_ERROR) diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 1b638e6e065..83ca070cc7b 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -355,7 +355,7 @@ class LLShaderMgr void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text); bool linkProgramObject(GLuint obj, bool suppress_errors = false); bool validateProgramObject(GLuint obj); - GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map* defines = NULL, S32 texture_index_channels = -1); + GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map* defines = nullptr, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual diff --git a/indra/llrender/lltexturemanagerbridge.cpp b/indra/llrender/lltexturemanagerbridge.cpp index 67838418bfc..c1097c6b49d 100644 --- a/indra/llrender/lltexturemanagerbridge.cpp +++ b/indra/llrender/lltexturemanagerbridge.cpp @@ -29,6 +29,6 @@ #include "lltexturemanagerbridge.h" // Define a null texture manager bridge. Applications must provide their own bridge implementaton. -LLTextureManagerBridge* gTextureManagerBridgep = NULL; +LLTextureManagerBridge* gTextureManagerBridgep = nullptr; diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index dc18bf16bf1..62bf416496b 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -37,7 +37,7 @@ LLUIImage::LLUIImage(const std::string& name, LLPointer image) mImage(image), mScaleRegion(0.f, 1.f, 1.f, 0.f), mClipRegion(0.f, 1.f, 1.f, 0.f), - mImageLoaded(NULL), + mImageLoaded(nullptr), mScaleStyle(SCALE_INNER), mCachedW(-1), mCachedH(-1) @@ -134,7 +134,7 @@ namespace LLInitParam // do not default to current value. Used to overwrite template images. if (name() == "none") { - updateValue(NULL); + updateValue(nullptr); return; } @@ -147,7 +147,7 @@ namespace LLInitParam void ParamValue::updateBlockFromValue(bool make_block_authoritative) { - if (getValue() == NULL) + if (getValue() == nullptr) { name.set("none", make_block_authoritative); } diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 7dde84f295b..678a350fe54 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -125,7 +125,7 @@ namespace LLInitParam public: Optional name; - ParamValue(LLUIImage* const& image = NULL) + ParamValue(LLUIImage* const& image = nullptr) : super_t(image) { updateBlockFromValue(false); @@ -137,7 +137,7 @@ namespace LLInitParam }; // Need custom comparison function for our test app, which only loads - // LLUIImage* as NULL. + // LLUIImage* as nullptr. template<> struct ParamCompare { diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index d59ddd0fecb..74a79fdfc49 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -781,7 +781,7 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos) void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, U32 num_indices, const U16* indicesp) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; - llassert(LLGLSLShader::sCurBoundShaderPtr != NULL); + llassert(LLGLSLShader::sCurBoundShaderPtr != nullptr); STOP_GLERROR; @@ -1545,7 +1545,7 @@ template struct VertexBufferStrider { U8* ptr = vbo.mapIndexBuffer(index, count); - if (ptr == NULL) + if (ptr == nullptr) { LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL; return false; @@ -1561,7 +1561,7 @@ template struct VertexBufferStrider U8* ptr = vbo.mapVertexBuffer(type, index, count); - if (ptr == NULL) + if (ptr == nullptr) { LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL; return false; diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index f24d75e41d0..8770e811ffe 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -286,8 +286,8 @@ class LLVertexBuffer final : public LLRefCount U32 mIndicesStride = 2; // size of each index in bytes U32 mOffsets[TYPE_MAX]; // byte offsets into mMappedData of each attribute - U8* mMappedData = nullptr; // pointer to currently mapped data (NULL if unmapped) - U8* mMappedIndexData = nullptr; // pointer to currently mapped indices (NULL if unmapped) + U8* mMappedData = nullptr; // pointer to currently mapped data (nullptr if unmapped) + U8* mMappedIndexData = nullptr; // pointer to currently mapped indices (nullptr if unmapped) U32 mTypeMask = 0; // bitmask of present vertex attributes diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index 15490ef9536..d5a9903f66b 100644 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp @@ -114,7 +114,7 @@ class LLDragDropWin32Target: mDropUrl = std::string( (char*)data ); // XXX MAJOR MAJOR HACK! LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA ); - if (NULL != window_imp) + if (nullptr != window_imp) { LLCoordGL gl_coord( 0, 0 ); @@ -169,7 +169,7 @@ class LLDragDropWin32Target: { // XXX MAJOR MAJOR HACK! LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA ); - if (NULL != window_imp) + if (nullptr != window_imp) { LLCoordGL gl_coord( 0, 0 ); @@ -216,7 +216,7 @@ class LLDragDropWin32Target: { // XXX MAJOR MAJOR HACK! LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA ); - if (NULL != window_imp) + if (nullptr != window_imp) { LLCoordGL gl_coord( 0, 0 ); MASK mask = gKeyboard->currentMask(true); @@ -233,7 +233,7 @@ class LLDragDropWin32Target: { // window impl stored in Window data (neat!) LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA ); - if ( NULL != window_imp ) + if ( nullptr != window_imp ) { POINT pt_client; pt_client.x = pt.x; @@ -295,8 +295,8 @@ class LLDragDropWin32Target: //////////////////////////////////////////////////////////////////////////////// // LLDragDropWin32::LLDragDropWin32() : - mDropTarget( NULL ), - mDropWindowHandle( NULL ) + mDropTarget( nullptr), + mDropWindowHandle( nullptr) { } @@ -311,7 +311,7 @@ LLDragDropWin32::~LLDragDropWin32() // bool LLDragDropWin32::init( HWND hWnd ) { - if ( NOERROR != OleInitialize( NULL ) ) + if ( NOERROR != OleInitialize( nullptr) ) return false; mDropTarget = new LLDragDropWin32Target( hWnd ); diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index ff85b2cb148..2daa3b4c994 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -52,9 +52,9 @@ LLDXHardware gDXHardware; //----------------------------------------------------------------------------- // Defines, and constants //----------------------------------------------------------------------------- -#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } -#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } -#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } +#define SAFE_DELETE(p) { if(p) { delete (p); (p)=nullptr; } } +#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=nullptr; } } +#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } typedef BOOL ( WINAPI* PfnCoSetProxyBlanket )( IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, @@ -67,7 +67,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) std::string mDriverVersion; HRESULT hres; CoInitializeEx(0, COINIT_APARTMENTTHREADED); - IWbemLocator *pLoc = NULL; + IWbemLocator *pLoc = nullptr; hres = CoCreateInstance( CLSID_WbemLocator, @@ -81,17 +81,17 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) return std::string(); // Program has failed. } - IWbemServices *pSvc = NULL; + IWbemServices *pSvc = nullptr; // Connect to the root\cimv2 namespace with // the current user and obtain pointer pSvc // to make IWbemServices calls. hres = pLoc->ConnectServer( _bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace - NULL, // User name. NULL = current user - NULL, // User password. NULL = current + nullptr, // User name. NULL = current user + nullptr, // User password. NULL = current 0, // Locale. NULL indicates current - NULL, // Security flags. + 0, // Security flags. 0, // Authority (e.g. Kerberos) 0, // Context object &pSvc // pointer to IWbemServices proxy @@ -112,10 +112,10 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) pSvc, // Indicates the proxy to set RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx - NULL, // Server principal name + nullptr, // Server principal name RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx - NULL, // client identity + nullptr, // client identity EOAC_NONE // proxy capabilities ); @@ -127,7 +127,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) CoUninitialize(); return std::string(); // Program has failed. } - IEnumWbemClassObject* pEnumerator = NULL; + IEnumWbemClassObject* pEnumerator = nullptr; // Get the data from the query ULONG uReturn = 0; @@ -135,7 +135,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) bstr_t("WQL"), bstr_t("SELECT * FROM Win32_VideoController"), //Consider using Availability to filter out disabled controllers WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, - NULL, + nullptr, &pEnumerator); if (FAILED(hres)) @@ -149,7 +149,7 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) while (pEnumerator) { - IWbemClassObject *pclsObj = NULL; + IWbemClassObject *pclsObj = nullptr; HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); @@ -328,20 +328,20 @@ LLSD LLDXHardware::getDisplayInfo() LLTimer hw_timer; HRESULT hr; LLSD ret; - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - - IDxDiagProvider *dx_diag_providerp = NULL; - IDxDiagContainer *dx_diag_rootp = NULL; - IDxDiagContainer *devices_containerp = NULL; - IDxDiagContainer *device_containerp = NULL; - IDxDiagContainer *file_containerp = NULL; - IDxDiagContainer *driver_containerp = NULL; + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + IDxDiagProvider *dx_diag_providerp = nullptr; + IDxDiagContainer *dx_diag_rootp = nullptr; + IDxDiagContainer *devices_containerp = nullptr; + IDxDiagContainer *device_containerp = nullptr; + IDxDiagContainer *file_containerp = nullptr; + IDxDiagContainer *driver_containerp = nullptr; DWORD dw_device_count; // CoCreate a IDxDiagProvider* LL_INFOS() << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL; hr = CoCreateInstance(CLSID_DxDiagProvider, - NULL, + nullptr, CLSCTX_INPROC_SERVER, IID_IDxDiagProvider, (LPVOID*) &dx_diag_providerp); @@ -363,7 +363,7 @@ LLSD LLDXHardware::getDisplayInfo() dx_diag_init_params.dwSize = sizeof(DXDIAG_INIT_PARAMS); dx_diag_init_params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; dx_diag_init_params.bAllowWHQLChecks = TRUE; - dx_diag_init_params.pReserved = NULL; + dx_diag_init_params.pReserved = nullptr; LL_INFOS() << "dx_diag_providerp->Initialize" << LL_ENDL; hr = dx_diag_providerp->Initialize(&dx_diag_init_params); @@ -387,7 +387,7 @@ LLSD LLDXHardware::getDisplayInfo() if(FAILED(hr) || !devices_containerp) { // do not release 'dirty' devices_containerp at this stage, only dx_diag_rootp - devices_containerp = NULL; + devices_containerp = nullptr; goto LCleanup; } @@ -435,11 +435,11 @@ LLSD LLDXHardware::getDisplayInfo() DWORD dwType = REG_SZ; DWORD dwSize = sizeof(WCHAR) * RV_SIZE; if(ERROR_SUCCESS == RegQueryValueEx(hKey, TEXT("ReleaseVersion"), - NULL, &dwType, (LPBYTE)release_version, &dwSize)) + nullptr, &dwType, (LPBYTE)release_version, &dwSize)) { // print the value // windows doesn't guarantee to be null terminated - release_version[RV_SIZE - 1] = NULL; + release_version[RV_SIZE - 1] = 0; ret["DriverVersion"] = ll_convert(std::wstring(release_version)); } diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index df69b1390cf..1edf0e8c3c8 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -36,18 +36,18 @@ // Globals // -LLKeyboard *gKeyboard = NULL; +LLKeyboard *gKeyboard = nullptr; //static std::map LLKeyboard::sKeysToNames; std::map LLKeyboard::sNamesToKeys; -LLKeyStringTranslatorFunc* LLKeyboard::mStringTranslator = NULL; // Used for l10n + PC/Mac/Linux accelerator labeling +LLKeyStringTranslatorFunc* LLKeyboard::mStringTranslator = nullptr; // Used for l10n + PC/Mac/Linux accelerator labeling // // Class Implementation // -LLKeyboard::LLKeyboard() : mCallbacks(NULL) +LLKeyboard::LLKeyboard() : mCallbacks(nullptr) { S32 i; @@ -355,7 +355,7 @@ std::string LLKeyboard::stringFromKey(KEY key, bool translate) if (translate) { LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - if (trans != NULL) + if (trans != nullptr) { res = trans(res); } @@ -395,7 +395,7 @@ std::string LLKeyboard::stringFromMouse(EMouseClickType click, bool translate) if (translate && !res.empty()) { LLKeyStringTranslatorFunc* trans = gKeyboard->mStringTranslator; - if (trans != NULL) + if (trans != nullptr) { res = trans(res); } @@ -410,7 +410,7 @@ std::string LLKeyboard::stringFromAccelerator(MASK accel_mask) LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - if (trans == NULL) + if (trans == nullptr) { LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; return res; diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 4ef0b493a57..16a8a5ed161 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -247,7 +247,7 @@ void LLKeyboardWin32::scanKeyboard() { S32 key; MSG msg; - PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); + PeekMessage(&msg, nullptr, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD); for (key = 0; key < KEY_COUNT; key++) { // Generate callback if any event has occurred on this key this frame. diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 2313aeda50c..efea4cf6845 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -48,7 +48,7 @@ // // Globals // -LLSplashScreen *gSplashScreenp = NULL; +LLSplashScreen *gSplashScreenp = nullptr; bool gDebugClicks = false; bool gDebugWindowProc = false; @@ -108,7 +108,7 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags) mFullscreenWidth(0), mFullscreenHeight(0), mFullscreenRefresh(0), - mSupportedResolutions(NULL), + mSupportedResolutions(nullptr), mNumSupportedResolutions(0), mCurrentCursor(UI_CURSOR_ARROW), mNextCursor(UI_CURSOR_ARROW), @@ -393,7 +393,7 @@ void LLSplashScreen::hide() gSplashScreenp->hideImpl(); } delete gSplashScreenp; - gSplashScreenp = NULL; + gSplashScreenp = nullptr; } // @@ -452,7 +452,7 @@ LLWindow* LLWindowManager::createWindow( { delete new_window; LL_WARNS() << "LLWindowManager::create() : Error creating window." << LL_ENDL; - return NULL; + return nullptr; } sWindowList.insert(new_window); return new_window; diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 2d8fc80b9ea..f30f0fdedbe 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -77,7 +77,7 @@ class LLWindow : public LLInstanceTracker bool setSize(LLCoordScreen size); bool setSize(LLCoordWindow size); virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true); - virtual bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) = 0; + virtual bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = nullptr) = 0; //create a new GL context that shares a namespace with this Window's main GL context and make it current on the current thread // returns a pointer to be handed back to destroySharedConext/makeContextCurrent @@ -192,7 +192,7 @@ class LLWindow : public LLInstanceTracker static std::vector getDisplaysResolutionList(); // windows only DirectInput8 for joysticks - virtual void* getDirectInput8() { return NULL; }; + virtual void* getDirectInput8() { return nullptr; }; virtual bool getInputDevices(U32 device_type_filter, std::function osx_callback, void* win_callback, diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 8b7b0ef55c6..d6074717f89 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -53,7 +53,7 @@ class LLWindowHeadless : public LLWindow /*virtual*/ bool setPosition(LLCoordScreen position) override {return false;} /*virtual*/ bool setSizeImpl(LLCoordScreen size) override {return false;} /*virtual*/ bool setSizeImpl(LLCoordWindow size) override {return false;} - /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override {return false;} + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = nullptr) override {return false;} void* createSharedContext() override { return nullptr; } void makeContextCurrent(void*) override {} void destroySharedContext(void*) override {} @@ -97,7 +97,7 @@ class LLWindowHeadless : public LLWindow /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to) override { return false; } /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to) override { return false; } - /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return NULL; } + /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return nullptr; } /*virtual*/ F32 getNativeAspectRatio() override { return 1.0f; } /*virtual*/ F32 getPixelAspectRatio() override { return 1.0f; } /*virtual*/ void setNativeAspectRatio(F32 ratio) override {} diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index d902a82a3c6..0eb9f05f1d4 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -83,7 +83,7 @@ bool pasteBoardAvailable() @autoreleasepool { NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; - NSString *str = NULL; + NSString *str = nullptr; BOOL ok = [pboard canReadObjectForClasses:classArray options:[NSDictionary dictionary]]; if (ok) { @@ -185,7 +185,7 @@ void hideNSCursorTillMove(bool hide) // This is currently unused, since we want all our cursors to persist for the life of the app, but I've included it for completeness. OSErr releaseImageCursor(CursorRef ref) { - if( ref != NULL ) + if( ref != nullptr ) { @autoreleasepool { NSCursor *cursor = (NSCursor*)ref; @@ -202,7 +202,7 @@ OSErr releaseImageCursor(CursorRef ref) OSErr setImageCursor(CursorRef ref) { - if( ref != NULL ) + if( ref != nullptr ) { @autoreleasepool { NSCursor *cursor = (NSCursor*)ref; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index f8920318d31..9e706e029a9 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -60,7 +60,7 @@ const S32 DEFAULT_REFRESH_RATE = 60; namespace { - NSKeyEventRef mRawKeyEvent = NULL; + NSKeyEventRef mRawKeyEvent = nullptr; } // // LLWindowMacOSX @@ -149,7 +149,7 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key); // The proper way to do this is to bracket the dialog with calls to beforeDialog() and afterDialog(), but these // require a pointer to the LLWindowMacOSX object. Stash it here and maintain in the constructor and destructor. // This assumes that there will be only one object of this class at any time. Hopefully this is true. -static LLWindowMacOSX *gWindowImplementation = NULL; +static LLWindowMacOSX *gWindowImplementation = nullptr; LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, @@ -158,7 +158,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, bool enable_vsync, bool use_gl, bool ignore_pixel_depth, U32 fsaa_samples) - : LLWindow(NULL, fullscreen, flags) + : LLWindow(nullptr, fullscreen, flags) { // *HACK: During window construction we get lots of OS events for window // reshape, activate, etc. that the viewer isn't ready to handle. @@ -174,9 +174,9 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, gKeyboard->setCallbacks(callbacks); // Ignore use_gl for now, only used for drones on PC - mWindow = NULL; - mContext = NULL; - mPixelFormat = NULL; + mWindow = nullptr; + mContext = nullptr; + mPixelFormat = nullptr; mDisplay = CGMainDisplayID(); mSimulatedRightClick = false; mLastModifiers = 0; @@ -190,7 +190,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mMaximized = false; mMinimized = false; mLanguageTextInputAllowed = false; - mPreeditor = NULL; + mPreeditor = nullptr; mFSAASamples = fsaa_samples; mForceRebuild = false; @@ -211,7 +211,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, // Create the GL context and set it up for windowed or fullscreen, as appropriate. if(createContext(x, y, width, height, 32, fullscreen, enable_vsync)) { - if(mWindow != NULL) + if(mWindow != nullptr) { makeWindowOrderFront(mWindow); } @@ -232,7 +232,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, initCursors(); setCursor( UI_CURSOR_ARROW ); - allowLanguageTextInput(NULL, false); + allowLanguageTextInput(nullptr, false); } mCallbacks = callbacks; @@ -248,7 +248,7 @@ bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask) { mRawKeyEvent = event; bool retVal = gKeyboard->handleKeyUp(key, mask); - mRawKeyEvent = NULL; + mRawKeyEvent = nullptr; return retVal; } @@ -268,7 +268,7 @@ bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask, wch mRawKeyEvent = event; bool retVal = gKeyboard->handleKeyDown(key, mask); - mRawKeyEvent = NULL; + mRawKeyEvent = nullptr; return retVal; } @@ -298,7 +298,7 @@ bool callUnicodeCallback(wchar_t character, unsigned int mask) mRawKeyEvent = &eventData; bool result = gWindowImplementation->getCallbacks()->handleUnicodeChar(character, mask); - mRawKeyEvent = NULL; + mRawKeyEvent = nullptr; return result; } @@ -694,7 +694,7 @@ void getPreeditLocation(float *location, unsigned int length) LLCoordScreen screen; LLRect rect; - preeditor->getPreeditLocation(length, &coord, &rect, NULL); + preeditor->getPreeditLocation(length, &coord, &rect, nullptr); float c[4] = {float(coord.mX), float(coord.mY), 0, 0}; @@ -734,12 +734,12 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits { mFullscreen = fullscreen; - if (mWindow == NULL) + if (mWindow == nullptr) { mWindow = getMainAppWindow(); } - if(mContext == NULL) + if(mContext == nullptr) { // Our OpenGL view is already defined within SecondLife.xib. // Get the view instead. @@ -769,7 +769,7 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits GLint numPixelFormats; CGLChoosePixelFormat (attribs, &mPixelFormat, &numPixelFormats); - if(mPixelFormat == NULL) { + if(mPixelFormat == nullptr) { CGLChoosePixelFormat (attribs, &mPixelFormat, &numPixelFormats); } } @@ -781,7 +781,7 @@ bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits // Hook up the context to a drawable - if(mContext != NULL) + if(mContext != nullptr) { @@ -826,40 +826,40 @@ void LLWindowMacOSX::destroyContext() return; } // Unhook the GL context from any drawable it may have - if(mContext != NULL) + if(mContext != nullptr) { LL_DEBUGS("Window") << "destroyContext: unhooking drawable " << LL_ENDL; - CGLSetCurrentContext(NULL); + CGLSetCurrentContext(nullptr); } // Clean up remaining GL state before blowing away window gGLManager.shutdownGL(); // Clean up the pixel format - if(mPixelFormat != NULL) + if(mPixelFormat != nullptr) { CGLDestroyPixelFormat(mPixelFormat); - mPixelFormat = NULL; + mPixelFormat = nullptr; } // Clean up the GL context - if(mContext != NULL) + if(mContext != nullptr) { CGLDestroyContext(mContext); } // Destroy our LLOpenGLView - if(mGLView != NULL) + if(mGLView != nullptr) { removeGLView(mGLView); - mGLView = NULL; + mGLView = nullptr; } // Close the window - if(mWindow != NULL) + if(mWindow != nullptr) { NSWindowRef dead_window = mWindow; - mWindow = NULL; + mWindow = nullptr; closeWindow(dead_window); } @@ -869,12 +869,12 @@ LLWindowMacOSX::~LLWindowMacOSX() { destroyContext(); - if(mSupportedResolutions != NULL) + if(mSupportedResolutions != nullptr) { delete []mSupportedResolutions; } - gWindowImplementation = NULL; + gWindowImplementation = nullptr; } @@ -926,7 +926,7 @@ bool LLWindowMacOSX::isValid() return(true); } - return (mWindow != NULL); + return (mWindow != nullptr); } bool LLWindowMacOSX::getVisible() @@ -1273,7 +1273,7 @@ bool LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) float cursor_point[2]; LLCoordScreen screen_pos; - if(mWindow == NULL) + if(mWindow == nullptr) return false; getCursorPos(mWindow, cursor_point); @@ -1422,7 +1422,7 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r { CFArrayRef modes = CGDisplayCopyAllDisplayModes(mDisplay, nullptr); - if(modes != NULL) + if(modes != nullptr) { CFIndex index, cnt; @@ -1842,7 +1842,7 @@ void LLWindowMacOSX::hideCursorUntilMouseMove() // LLSplashScreenMacOSX::LLSplashScreenMacOSX() { - mWindow = NULL; + mWindow = nullptr; } LLSplashScreenMacOSX::~LLSplashScreenMacOSX() @@ -1856,18 +1856,18 @@ void LLSplashScreenMacOSX::showImpl() void LLSplashScreenMacOSX::updateImpl(const std::string& mesg) { - if(mWindow != NULL) + if(mWindow != nullptr) { - CFStringCreateWithCString(NULL, mesg.c_str(), kCFStringEncodingUTF8); + CFStringCreateWithCString(nullptr, mesg.c_str(), kCFStringEncodingUTF8); } } void LLSplashScreenMacOSX::hideImpl() { - if(mWindow != NULL) + if(mWindow != nullptr) { - mWindow = NULL; + mWindow = nullptr; } } @@ -1900,16 +1900,16 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) } S32 result = 0; - CFURLRef urlRef = NULL; + CFURLRef urlRef = nullptr; LL_INFOS() << "Opening URL " << escaped_url << LL_ENDL; - CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8); + CFStringRef stringRef = CFStringCreateWithCString(nullptr, escaped_url.c_str(), kCFStringEncodingUTF8); if (stringRef) { // This will succeed if the string is a full URL, including the http:// // Note that URLs specified this way need to be properly percent-escaped. - urlRef = CFURLCreateWithString(NULL, stringRef, NULL); + urlRef = CFURLCreateWithString(nullptr, stringRef, nullptr); // Don't use CRURLCreateWithFileSystemPath -- only want valid URLs @@ -1918,7 +1918,7 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) if (urlRef) { - result = LSOpenCFURLRef(urlRef, NULL); + result = LSOpenCFURLRef(urlRef, nullptr); if (result != noErr) { @@ -2267,7 +2267,7 @@ HidDevice populate_device( io_object_t io_obj ) IOReturn io_result = kIOReturnSuccess; HRESULT query_result = S_OK; SInt32 the_score = 0; - IOCFPlugInInterface **the_interface = NULL; + IOCFPlugInInterface **the_interface = nullptr; io_result = IOCreatePlugInInterfaceForService( io_obj, kIOHIDDeviceUserClientTypeID, @@ -2305,7 +2305,7 @@ HidDevice populate_device( io_object_t io_obj ) ( *( IOHIDDeviceInterface** ) interfacep )->Release( interfacep ); - interfacep = NULL; + interfacep = nullptr; } CFRelease( device_dic ); @@ -2462,7 +2462,7 @@ bool LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) void *LLWindowMacOSX::getPlatformWindow() { - // NOTE: this will be NULL in fullscreen mode. Plan accordingly. + // NOTE: this will be nullptr in fullscreen mode. Plan accordingly. return (void*)mWindow; } @@ -2514,7 +2514,7 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { interruptLanguageTextInput(); } - mPreeditor = (b ? preeditor : NULL); + mPreeditor = (b ? preeditor : nullptr); } if (b == mLanguageTextInputAllowed) diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index d703a84d027..c399cc699e8 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -60,7 +60,7 @@ class LLWindowMacOSX : public LLWindow bool setPosition(LLCoordScreen position) override; bool setSizeImpl(LLCoordScreen size) override; bool setSizeImpl(LLCoordWindow size) override; - bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override; + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = nullptr) override; bool setCursorPosition(LLCoordWindow position) override; bool getCursorPosition(LLCoordWindow *position) override; bool isWrapMouse() const override { return !mCursorDecoupled; }; diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index 6cbd737ed21..4341a18f6cd 100644 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -33,7 +33,7 @@ #define MESA_CHANNEL_TYPE GL_UNSIGNED_SHORT #define MESA_CHANNEL_SIZE 2 -U16 *gMesaBuffer = NULL; +U16 *gMesaBuffer = nullptr; // // LLWindowMesaHeadless @@ -47,7 +47,7 @@ LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks, if (use_gl) { LL_INFOS() << "MESA Init" << LL_ENDL; - mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL ); + mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, nullptr ); /* Allocate the image buffer */ mMesaBuffer = new unsigned char [width * height * 4 * MESA_CHANNEL_SIZE]; diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 47cd6320b1e..e54a085e5e5 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -50,7 +50,7 @@ class LLWindowMesaHeadless : public LLWindow bool getSize(LLCoordWindow *size) override {return false;}; bool setPosition(LLCoordScreen position) override {return false;}; bool setSizeImpl(LLCoordScreen size) override {return false;}; - bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL) override {return false;}; + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = nullptr) override {return false;}; bool setCursorPosition(LLCoordWindow position) override {return false;}; bool getCursorPosition(LLCoordWindow *position) override {return false;}; bool isWrapMouse() const override { return true; } @@ -92,7 +92,7 @@ class LLWindowMesaHeadless : public LLWindow bool convertCoords(LLCoordScreen from, LLCoordGL *to) override { return false; }; bool convertCoords(LLCoordGL from, LLCoordScreen *to) override { return false; }; - LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return NULL; }; + LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return nullptr; }; F32 getNativeAspectRatio() override { return 1.0f; }; F32 getPixelAspectRatio() override { return 1.0f; }; void setNativeAspectRatio(F32 ratio) override {} diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 4d4a7a5f657..11ae2fcf10a 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -76,7 +76,7 @@ class LLWindowSDL final : public LLWindow bool setSizeImpl(LLCoordWindow size) override; bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, - const LLCoordScreen *const posp = NULL) override; + const LLCoordScreen *const posp = nullptr) override; bool setCursorPosition(LLCoordWindow position) override; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 45326444d5d..e188148e2af 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -116,7 +116,7 @@ LPWSTR gIconResource = IDI_APPLICATION; LPWSTR gIconSmallResource = IDI_APPLICATION; LPDIRECTINPUT8 gDirectInput8; -LLW32MsgCallback gAsyncMsgCallback = NULL; +LLW32MsgCallback gAsyncMsgCallback = nullptr; #ifndef DPI_ENUMS_DECLARED @@ -175,7 +175,7 @@ HGLRC SafeCreateContext(HDC &hdc) } __except(EXCEPTION_EXECUTE_HANDLER) { - return NULL; + return nullptr; } } @@ -206,7 +206,7 @@ DWORD LLWindowWin32::sWinIMESentenceMode = IME_SMODE_AUTOMATIC; LLCoordWindow LLWindowWin32::sWinIMEWindowPosition(-1,-1); HMODULE LLWindowWin32::sGLDLLHandle = nullptr; -static HWND sWindowHandleForMessageBox = NULL; +static HWND sWindowHandleForMessageBox = nullptr; // The following class LLWinImm delegates Windows IMM APIs. // It was originally introduced to support US Windows XP, on which we needed @@ -429,7 +429,7 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool using FuncType = std::function; // call GetMessage() and pull enqueue messages for later processing - HWND mWindowHandleThrd = NULL; + HWND mWindowHandleThrd = nullptr; HDC mhDCThrd = 0; // *HACK: Attempt to prevent startup crashes by deferring memory accounting @@ -539,16 +539,16 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mOverrideAspectRatio = 0.f; mNativeAspectRatio = 0.f; mInputProcessingPaused = false; - mPreeditor = NULL; + mPreeditor = nullptr; mKeyCharCode = 0; mKeyScanCode = 0; mKeyVirtualKey = 0; - mhDC = NULL; - mhRC = NULL; + mhDC = nullptr; + mhRC = nullptr; memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp)); memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp)); mCustomGammaSet = false; - mWindowHandle = NULL; + mWindowHandle = nullptr; mRect = {0, 0, 0, 0}; mClientRect = {0, 0, 0, 0}; @@ -603,7 +603,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, SetRect( &mOldMouseClip, 0, 0, 0, 0 ); // Make an instance of our window then define the window class - mhInstance = GetModuleHandle(NULL); + mhInstance = GetModuleHandle(nullptr); // Init Direct Input - needed for joystick / Spacemouse @@ -613,7 +613,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, DIRECTINPUT_VERSION, // DWORD dwVersion, IID_IDirectInput8, // REFIID riidltf, (LPVOID*)&di8_interface, // LPVOID * ppvOut, - NULL // LPUNKNOWN punkOuter + nullptr // LPUNKNOWN punkOuter ); if (status == DI_OK) { @@ -662,7 +662,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, wc.hIcon = LoadIcon(mhInstance, mIconResource); // We will set the cursor ourselves - wc.hCursor = NULL; + wc.hCursor = nullptr; // background color is not used if (clearBg) @@ -671,11 +671,11 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, } else { - wc.hbrBackground = (HBRUSH) NULL; + wc.hbrBackground = (HBRUSH) nullptr; } // we don't use windows menus - wc.lpszMenuName = NULL; + wc.lpszMenuName = nullptr; wc.lpszClassName = mWindowClassName; @@ -696,7 +696,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, ::ZeroMemory(&dev_mode, sizeof(DEVMODE)); dev_mode.dmSize = sizeof(DEVMODE); DWORD current_refresh; - if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) + if (EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode)) { current_refresh = dev_mode.dmDisplayFrequency; mNativeAspectRatio = ((F32)dev_mode.dmPelsWidth) / ((F32)dev_mode.dmPelsHeight); @@ -718,7 +718,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, for (S32 mode_num = 0;; mode_num++) { - if (!EnumDisplaySettings(NULL, mode_num, &dev_mode)) + if (!EnumDisplaySettings(nullptr, mode_num, &dev_mode)) { break; } @@ -740,7 +740,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL; //success = false; - if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) + if (!EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode)) { success = false; } @@ -769,7 +769,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Keep a copy of the actual current device mode in case we minimize // and change the screen resolution. JC - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode); + EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode); // If it failed, we don't want to run fullscreen if (success) @@ -839,7 +839,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, display_device.cb = display_bytes; display_index++; - } while( EnumDisplayDevices(NULL, display_index, &display_device, display_flags )); + } while( EnumDisplayDevices(nullptr, display_index, &display_device, display_flags )); LL_INFOS("Window") << "Total Display Devices: " << display_index << LL_ENDL; @@ -867,7 +867,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Initialize (boot strap) the Language text input management, // based on the system's (or user's) default settings. - allowLanguageTextInput(NULL, false); + allowLanguageTextInput(nullptr, false); updateWindowTheme(); setCustomIcon(); } @@ -877,23 +877,23 @@ LLWindowWin32::~LLWindowWin32() { if (sWindowHandleForMessageBox == mWindowHandle) { - sWindowHandleForMessageBox = NULL; + sWindowHandleForMessageBox = nullptr; } delete mDragDrop; - mDragDrop = NULL; + mDragDrop = nullptr; delete [] mWindowTitle; - mWindowTitle = NULL; + mWindowTitle = nullptr; delete [] mSupportedResolutions; - mSupportedResolutions = NULL; + mSupportedResolutions = nullptr; delete [] mWindowClassName; - mWindowClassName = NULL; + mWindowClassName = nullptr; delete mWindowThread; - mWindowThread = NULL; + mWindowThread = nullptr; } void LLWindowWin32::show() @@ -986,7 +986,7 @@ void LLWindowWin32::close() LL_DEBUGS("Window") << "Releasing Context" << LL_ENDL; if (mhRC) { - if (!wglMakeCurrent(NULL, NULL)) + if (!wglMakeCurrent(nullptr, nullptr)) { LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL; } @@ -996,7 +996,7 @@ void LLWindowWin32::close() LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL; } - mhRC = NULL; + mhRC = nullptr; } // Restore gamma to the system values. @@ -1006,22 +1006,22 @@ void LLWindowWin32::close() if (sWindowHandleForMessageBox == mWindowHandle) { - sWindowHandleForMessageBox = NULL; + sWindowHandleForMessageBox = nullptr; } - mhDC = NULL; - mWindowHandle = NULL; + mhDC = nullptr; + mWindowHandle = nullptr; if (mWindowThread->wakeAndDestroy()) { // thread will delete itselfs once done - mWindowThread = NULL; + mWindowThread = nullptr; } } bool LLWindowWin32::isValid() { - return (mWindowHandle != NULL); + return (mWindowHandle != nullptr); } bool LLWindowWin32::getVisible() @@ -1157,7 +1157,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo resetDisplayResolution(); } - if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) + if (EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode)) { current_refresh = dev_mode.dmDisplayFrequency; } @@ -1171,7 +1171,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo //destroy gl context if (mhRC) { - if (!wglMakeCurrent(NULL, NULL)) + if (!wglMakeCurrent(nullptr, nullptr)) { LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL; } @@ -1181,7 +1181,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL; } - mhRC = NULL; + mhRC = nullptr; } if (fullscreen) @@ -1192,7 +1192,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo for (S32 mode_num = 0;; mode_num++) { - if (!EnumDisplaySettings(NULL, mode_num, &dev_mode)) + if (!EnumDisplaySettings(nullptr, mode_num, &dev_mode)) { break; } @@ -1224,7 +1224,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo // Keep a copy of the actual current device mode in case we minimize // and change the screen resolution. JC - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode); + EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode); if (success) { @@ -1468,7 +1468,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo U32 num_formats = 0; // First we try and get a 32 bit depth pixel format - BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); + BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, nullptr, 256, pixel_formats, &num_formats); while(!result && mFSAASamples > 0) { @@ -1490,7 +1490,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo end_attrib = 0 ; attrib_list[cur_attrib++] = 0 ; //end } - result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); + result = wglChoosePixelFormatARB(mhDC, attrib_list, nullptr, 256, pixel_formats, &num_formats); if(result) { @@ -1514,7 +1514,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo LL_INFOS("Window") << "No valid pixel format for " << mFSAASamples << "x anti-aliasing." << LL_ENDL; attrib_list[end_attrib] = 0; - BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); + BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, nullptr, 256, pixel_formats, &num_formats); if (!result) { close(); @@ -1528,7 +1528,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo LL_INFOS("Window") << "No 32 bit z-buffer, trying 24 bits instead" << LL_ENDL; // Try 24-bit format attrib_list[1] = 24; - BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); + BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, nullptr, 256, pixel_formats, &num_formats); if (!result) { close(); @@ -1540,7 +1540,7 @@ bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bo { LL_WARNS("Window") << "Couldn't get 24 bit z-buffer,trying 16 bits instead!" << LL_ENDL; attrib_list[1] = 16; - BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats); + BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, nullptr, 256, pixel_formats, &num_formats); if (!result || !num_formats) { close(); @@ -1610,7 +1610,7 @@ const S32 max_format = (S32)num_formats - 1; } else { - // Note: if value is NULL GetDC retrieves the DC for the entire screen. + // Note: if value is nullptr GetDC retrieves the DC for the entire screen. LL_WARNS("Window") << "Window recreation failed, code: " << GetLastError() << LL_ENDL; } @@ -1716,7 +1716,7 @@ const S32 max_format = (S32)num_formats - 1; mDragDrop->init( mWindowHandle ); //register joystick timer callback - SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer + SetTimer( mWindowHandle, 0, 1000 / 30, nullptr ); // 30 fps timer // ok to post quit messages now mPostQuit = true; @@ -1746,13 +1746,13 @@ void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw if (sWindowHandleForMessageBox == mWindowHandle) { - sWindowHandleForMessageBox = NULL; + sWindowHandleForMessageBox = nullptr; } // zero out mWindowHandle and mhDC before destroying window so window // thread falls back to peekmessage - mWindowHandle = NULL; - mhDC = NULL; + mWindowHandle = nullptr; + mhDC = nullptr; std::promise> promise; // What follows must be done on the window thread. @@ -1800,16 +1800,16 @@ void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw window_rect.top, // y pos window_rect.right - window_rect.left, // width window_rect.bottom - window_rect.top, // height - NULL, - NULL, + nullptr, + nullptr, hInstance, - NULL); + nullptr); if (! handle) { // Failed to create window: clear the variables. This // assignment is valid because we're running on mWindowThread. - self->mWindowHandleThrd = NULL; + self->mWindowHandleThrd = nullptr; self->mhDCThrd = 0; } else @@ -2096,20 +2096,20 @@ HCURSOR LLWindowWin32::loadColorCursor(LPCTSTR name) void LLWindowWin32::initCursors() { - mCursor[ UI_CURSOR_ARROW ] = LoadCursor(NULL, IDC_ARROW); - mCursor[ UI_CURSOR_WAIT ] = LoadCursor(NULL, IDC_WAIT); - mCursor[ UI_CURSOR_HAND ] = LoadCursor(NULL, IDC_HAND); - mCursor[ UI_CURSOR_IBEAM ] = LoadCursor(NULL, IDC_IBEAM); - mCursor[ UI_CURSOR_CROSS ] = LoadCursor(NULL, IDC_CROSS); - mCursor[ UI_CURSOR_SIZENWSE ] = LoadCursor(NULL, IDC_SIZENWSE); - mCursor[ UI_CURSOR_SIZENESW ] = LoadCursor(NULL, IDC_SIZENESW); - mCursor[ UI_CURSOR_SIZEWE ] = LoadCursor(NULL, IDC_SIZEWE); - mCursor[ UI_CURSOR_SIZENS ] = LoadCursor(NULL, IDC_SIZENS); - mCursor[ UI_CURSOR_SIZEALL ] = LoadCursor(NULL, IDC_SIZEALL); - mCursor[ UI_CURSOR_NO ] = LoadCursor(NULL, IDC_NO); - mCursor[ UI_CURSOR_WORKING ] = LoadCursor(NULL, IDC_APPSTARTING); - - HMODULE module = GetModuleHandle(NULL); + mCursor[ UI_CURSOR_ARROW ] = LoadCursor(nullptr, IDC_ARROW); + mCursor[ UI_CURSOR_WAIT ] = LoadCursor(nullptr, IDC_WAIT); + mCursor[ UI_CURSOR_HAND ] = LoadCursor(nullptr, IDC_HAND); + mCursor[ UI_CURSOR_IBEAM ] = LoadCursor(nullptr, IDC_IBEAM); + mCursor[ UI_CURSOR_CROSS ] = LoadCursor(nullptr, IDC_CROSS); + mCursor[ UI_CURSOR_SIZENWSE ] = LoadCursor(nullptr, IDC_SIZENWSE); + mCursor[ UI_CURSOR_SIZENESW ] = LoadCursor(nullptr, IDC_SIZENESW); + mCursor[ UI_CURSOR_SIZEWE ] = LoadCursor(nullptr, IDC_SIZEWE); + mCursor[ UI_CURSOR_SIZENS ] = LoadCursor(nullptr, IDC_SIZENS); + mCursor[ UI_CURSOR_SIZEALL ] = LoadCursor(nullptr, IDC_SIZEALL); + mCursor[ UI_CURSOR_NO ] = LoadCursor(nullptr, IDC_NO); + mCursor[ UI_CURSOR_WORKING ] = LoadCursor(nullptr, IDC_APPSTARTING); + + HMODULE module = GetModuleHandle(nullptr); mCursor[ UI_CURSOR_TOOLGRAB ] = LoadCursor(module, TEXT("TOOLGRAB")); mCursor[ UI_CURSOR_TOOLLAND ] = LoadCursor(module, TEXT("TOOLLAND")); mCursor[ UI_CURSOR_TOOLFOCUS ] = LoadCursor(module, TEXT("TOOLFOCUS")); @@ -2145,12 +2145,12 @@ void LLWindowWin32::initCursors() mCursor[ UI_CURSOR_TOOLPAUSE ] = loadColorCursor(TEXT("TOOLPAUSE")); mCursor[ UI_CURSOR_TOOLMEDIAOPEN ] = loadColorCursor(TEXT("TOOLMEDIAOPEN")); - // Note: custom cursors that are not found make LoadCursor() return NULL. + // Note: custom cursors that are not found make LoadCursor() return nullptr. for( S32 i = 0; i < UI_CURSOR_COUNT; i++ ) { if( !mCursor[i] ) { - mCursor[i] = LoadCursor(NULL, IDC_ARROW); + mCursor[i] = LoadCursor(nullptr, IDC_ARROW); } } } @@ -2241,7 +2241,7 @@ void LLWindowWin32::gatherInput() { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - PeekMessage"); S32 msg_count = 0; - while ((msg_count < MAX_MESSAGE_PER_UPDATE) && PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_REMOVE)) + while ((msg_count < MAX_MESSAGE_PER_UPDATE) && PeekMessage(&msg, nullptr, WM_USER, WM_USER, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -2315,7 +2315,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LLWindowWin32* window_imp = (LLWindowWin32*)GetWindowLongPtr(h_wnd, GWLP_USERDATA); - if (NULL != window_imp) + if (nullptr != window_imp) { // Juggle to make sure we can get negative positions for when // mouse is outside window. @@ -3112,7 +3112,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("MWP - WM_INPUT"); UINT dwSize = 0; - GetRawInputData((HRAWINPUT)l_param, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)); + GetRawInputData((HRAWINPUT)l_param, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER)); llassert(dwSize < 1024); U8 lpb[1024]; @@ -3198,7 +3198,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ break; } } - else // (NULL == window_imp) + else // (nullptr == window_imp) { LL_DEBUGS("Window") << "No window implementation to handle message with, message code: " << U32(u_msg) << LL_ENDL; if (u_msg == WM_DESTROY) @@ -3225,7 +3225,7 @@ bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) if (!mWindowHandle || !GetClientRect(mWindowHandle, &client_rect) || - NULL == to) + nullptr == to) { return false; } @@ -3244,7 +3244,7 @@ bool LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) if (!mWindowHandle || !GetClientRect(mWindowHandle, &client_rect) || - NULL == to) + nullptr == to) { return false; } @@ -3294,7 +3294,7 @@ bool LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; - if (!mWindowHandle || (NULL == to)) + if (!mWindowHandle || (nullptr == to)) { return false; } @@ -3308,7 +3308,7 @@ bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; - if (!mWindowHandle || (NULL == to)) + if (!mWindowHandle || (nullptr == to)) { return false; } @@ -3547,7 +3547,7 @@ LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_re mNumSupportedResolutions = 0; for (S32 mode_num = 0; mNumSupportedResolutions < MAX_NUM_RESOLUTIONS; mode_num++) { - if (!EnumDisplaySettings(NULL, mode_num, &dev_mode)) + if (!EnumDisplaySettings(nullptr, mode_num, &dev_mode)) { break; } @@ -3623,7 +3623,7 @@ bool LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 refresh) bool success = false; // Don't change anything if we don't have to - if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) + if (EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &dev_mode)) { if (dev_mode.dmPelsWidth == width && dev_mode.dmPelsHeight == height && @@ -3673,7 +3673,7 @@ bool LLWindowWin32::resetDisplayResolution() { LL_DEBUGS("Window") << "resetDisplayResolution START" << LL_ENDL; - LONG cds_result = ChangeDisplaySettings(NULL, 0); + LONG cds_result = ChangeDisplaySettings(nullptr, 0); bool success = (DISP_CHANGE_SUCCESSFUL == cds_result); @@ -3705,7 +3705,7 @@ void LLWindowWin32::swapBuffers() // LLSplashScreenImp // LLSplashScreenWin32::LLSplashScreenWin32() -: mWindow(NULL) +: mWindow(nullptr) { } @@ -3716,11 +3716,11 @@ LLSplashScreenWin32::~LLSplashScreenWin32() void LLSplashScreenWin32::showImpl() { // This appears to work. ??? - HINSTANCE hinst = GetModuleHandle(NULL); + HINSTANCE hinst = GetModuleHandle(nullptr); mWindow = CreateDialog(hinst, TEXT("SPLASHSCREEN"), - NULL, // no parent + nullptr, // no parent (DLGPROC) LLSplashScreenWin32::windowProc); ShowWindow(mWindow, SW_SHOW); @@ -3733,7 +3733,7 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg) { if (!mWindow) return; - int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), static_cast(mesg.length()), NULL, 0); + int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), static_cast(mesg.length()), nullptr, 0); if( output_str_len>1024 ) return; @@ -3760,7 +3760,7 @@ void LLSplashScreenWin32::hideImpl() { LL_WARNS("Window") << "Failed to properly close splash screen window!" << LL_ENDL; } - mWindow = NULL; + mWindow = nullptr; } } @@ -3806,7 +3806,7 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t // (C) Nat Goodspeed if (!IsWindow(sWindowHandleForMessageBox)) { - sWindowHandleForMessageBox = NULL; + sWindowHandleForMessageBox = nullptr; } int retval_win = MessageBoxW(sWindowHandleForMessageBox, // HWND ll_convert_string_to_wide(text).c_str(), @@ -3903,14 +3903,14 @@ bool LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) static COLORREF crCustColors[16]; cc.lStructSize = sizeof(CHOOSECOLOR); cc.hwndOwner = mWindowHandle; - cc.hInstance = NULL; + cc.hInstance = nullptr; cc.rgbResult = RGB ((*r * 255.f),(*g *255.f),(*b * 255.f)); //cc.rgbResult = RGB (0x80,0x80,0x80); cc.lpCustColors = crCustColors; cc.Flags = CC_RGBINIT | CC_FULLOPEN; cc.lCustData = 0; - cc.lpfnHook = NULL; - cc.lpTemplateName = NULL; + cc.lpfnHook = nullptr; + cc.lpTemplateName = nullptr; // This call is modal, so pause agent //send_agent_pause(); // this is in newview and we don't want to set up a dependency @@ -3975,7 +3975,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { interruptLanguageTextInput(); } - mPreeditor = (b ? preeditor : NULL); + mPreeditor = (b ? preeditor : nullptr); } sLanguageTextInputAllowed = b; @@ -4180,7 +4180,7 @@ void LLWindowWin32::updateLanguageTextInputArea() LLCoordGL caret_coord; LLRect preedit_bounds; - if (mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL)) + if (mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, nullptr)) { mLanguageTextInputPointGL = caret_coord; mLanguageTextInputAreaGL = preedit_bounds; @@ -4243,7 +4243,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) if (indexes & GCS_RESULTSTR) { - LONG size = LLWinImm::getCompositionString(himc, GCS_RESULTSTR, NULL, 0); + LONG size = LLWinImm::getCompositionString(himc, GCS_RESULTSTR, nullptr, 0); if (size >= 0) { const LPWSTR data = new WCHAR[size / sizeof(WCHAR) + 1]; @@ -4259,7 +4259,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) if (indexes & GCS_COMPSTR) { - LONG size = LLWinImm::getCompositionString(himc, GCS_COMPSTR, NULL, 0); + LONG size = LLWinImm::getCompositionString(himc, GCS_COMPSTR, nullptr, 0); if (size >= 0) { const LPWSTR data = new WCHAR[size / sizeof(WCHAR) + 1]; @@ -4276,7 +4276,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) if ((indexes & GCS_COMPCLAUSE) && preedit_string.length() > 0) { - LONG size = LLWinImm::getCompositionString(himc, GCS_COMPCLAUSE, NULL, 0); + LONG size = LLWinImm::getCompositionString(himc, GCS_COMPCLAUSE, nullptr, 0); if (size > 0) { const LPDWORD data = new DWORD[size / sizeof(DWORD)]; @@ -4299,7 +4299,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) if ((indexes & GCS_COMPATTR) && preedit_segment_lengths.size() > 1) { - LONG size = LLWinImm::getCompositionString(himc, GCS_COMPATTR, NULL, 0); + LONG size = LLWinImm::getCompositionString(himc, GCS_COMPATTR, nullptr, 0); if (size > 0) { const LPBYTE data = new BYTE[size / sizeof(BYTE)]; @@ -4324,7 +4324,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) S32 caret_position = static_cast(preedit_string.length()); if (indexes & GCS_CURSORPOS) { - const S32 caret_position_utf16 = LLWinImm::getCompositionString(himc, GCS_CURSORPOS, NULL, 0); + const S32 caret_position_utf16 = LLWinImm::getCompositionString(himc, GCS_CURSORPOS, nullptr, 0); if (caret_position_utf16 >= 0 && caret_position <= preedit_string_utf16_length) { caret_position = wstring_wstring_length_from_utf16_length(preedit_string, 0, caret_position_utf16); @@ -4432,7 +4432,7 @@ bool LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res { LLCoordGL caret_coord; LLRect preedit_bounds; - mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL); + mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, nullptr); CANDIDATEFORM *const form = (CANDIDATEFORM *)param; DWORD const dwIndex = form->dwIndex; @@ -4495,7 +4495,7 @@ bool LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res // adjust the reconvert_string structure accordingly. HIMC himc = LLWinImm::getContext(mWindowHandle); const bool adjusted = LLWinImm::setCompositionString(himc, - SCS_QUERYRECONVERTSTRING, reconvert_string, size, NULL, 0); + SCS_QUERYRECONVERTSTRING, reconvert_string, size, nullptr, 0); LLWinImm::releaseContext(mWindowHandle, himc); if (adjusted) { @@ -4552,7 +4552,7 @@ bool LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res void LLWindowWin32::setDPIAwareness() { HMODULE hShcore = LoadLibrary(L"shcore.dll"); - if (hShcore != NULL) + if (hShcore != nullptr) { SetProcessDpiAwarenessType pSPDA; pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness"); @@ -4583,7 +4583,7 @@ bool LLWindowWin32::getInputDevices(U32 device_type_filter, void * di8_devices_callback, void* userdata) { - if (gDirectInput8 != NULL) + if (gDirectInput8 != nullptr) { // Enumerate devices HRESULT status = gDirectInput8->EnumDevices( @@ -4609,13 +4609,13 @@ F32 LLWindowWin32::getSystemUISize() HMODULE hShcore = LoadLibrary(L"shcore.dll"); - if (hShcore != NULL) + if (hShcore != nullptr) { GetProcessDpiAwarenessType pGPDA; pGPDA = (GetProcessDpiAwarenessType)GetProcAddress(hShcore, "GetProcessDpiAwareness"); GetDpiForMonitorType pGDFM; pGDFM = (GetDpiForMonitorType)GetProcAddress(hShcore, "GetDpiForMonitor"); - if (pGPDA != NULL && pGDFM != NULL) + if (pGPDA != nullptr && pGDFM != nullptr) { pGPDA(hProcess, &dpi_awareness); if (dpi_awareness == PROCESS_PER_MONITOR_DPI_AWARE) @@ -4833,7 +4833,7 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem() if (p_dxgi_adapter) { p_dxgi_adapter->Release(); - p_dxgi_adapter = NULL; + p_dxgi_adapter = nullptr; } else { @@ -4886,7 +4886,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - GetMessage"); logger.always("GetMessage(", std::hex, mWindowHandleThrd, ")"); - status = GetMessage(&msg, NULL, 0, 0); + status = GetMessage(&msg, nullptr, 0, 0); } if (status > 0) { @@ -4925,7 +4925,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() void LLWindowWin32::LLWindowWin32Thread::destroyWindow() { - if (mWindowHandleThrd != NULL && IsWindow(mWindowHandleThrd)) + if (mWindowHandleThrd != nullptr && IsWindow(mWindowHandleThrd)) { if (mhDCThrd) { @@ -4933,7 +4933,7 @@ void LLWindowWin32::LLWindowWin32Thread::destroyWindow() { LL_WARNS("Window") << "Release of ghDC failed!" << LL_ENDL; } - mhDCThrd = NULL; + mhDCThrd = nullptr; } // This causes WM_DESTROY to be sent *immediately* @@ -4947,8 +4947,8 @@ void LLWindowWin32::LLWindowWin32Thread::destroyWindow() // Something killed the window while we were busy destroying gl or handle somehow got broken LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL; } - mWindowHandleThrd = NULL; - mhDCThrd = NULL; + mWindowHandleThrd = nullptr; + mhDCThrd = nullptr; } bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() @@ -5068,11 +5068,11 @@ bool LLWindowWin32::isSystemAppDarkMode() RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_READ, &hKey); if (ERROR_SUCCESS == ret_code) { - if (RegQueryValueExW(hKey, L"AppsUseLightTheme", NULL, NULL, (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS) + if (RegQueryValueExW(hKey, L"AppsUseLightTheme", nullptr, nullptr, (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS) { // If AppsUseLightTheme is not found, check SystemUsesLightTheme dwSize = sizeof(DWORD); - RegQueryValueExW(hKey, L"SystemUsesLightTheme", NULL, NULL, (LPBYTE)&dwValue, &dwSize); + RegQueryValueExW(hKey, L"SystemUsesLightTheme", nullptr, nullptr, (LPBYTE)&dwValue, &dwSize); } RegCloseKey(hKey); } @@ -5090,7 +5090,7 @@ void LLWindowWin32::updateWindowTheme() } mCurrentDarkMode = use_dark_mode; - HMODULE hUxTheme = LoadLibraryExW(L"uxtheme.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + HMODULE hUxTheme = LoadLibraryExW(L"uxtheme.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); if (hUxTheme) { auto SetPreferredAppMode = (fnSetPreferredAppMode)GetProcAddress(hUxTheme, "SetPreferredAppMode"); diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 77217747cc6..a805523bfa2 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -61,7 +61,7 @@ class LLWindowWin32 : public LLWindow /*virtual*/ bool setPosition(LLCoordScreen position); /*virtual*/ bool setSizeImpl(LLCoordScreen size); /*virtual*/ bool setSizeImpl(LLCoordWindow size); - /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL); + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = nullptr); /*virtual*/ void setTitle(const std::string title); void* createSharedContext() override; void makeContextCurrent(void* context) override; diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 562a30e8d17..b9e1d315273 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -378,7 +378,7 @@ LLControlGroup::LLControlGroup(const std::string& name) mSettingsProfile(false) { - if (NULL != getenv("LL_SETTINGS_PROFILE")) + if (nullptr != getenv("LL_SETTINGS_PROFILE")) { mSettingsProfile = true; } diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 6bdc886319a..2a268b6f5ca 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -51,7 +51,7 @@ bool LLXMLNode::sStripWhitespaceValues = false; LLXMLNode::LLXMLNode() : mID(""), - mParser(NULL), + mParser(nullptr), mIsAttribute(false), mVersionMajor(0), mVersionMinor(0), @@ -60,20 +60,20 @@ LLXMLNode::LLXMLNode() : mType(TYPE_CONTAINER), mEncoding(ENCODING_DEFAULT), mLineNumber(-1), - mParent(NULL), - mChildren(NULL), + mParent(nullptr), + mChildren(nullptr), mAttributes(), - mPrev(NULL), - mNext(NULL), - mName(NULL), + mPrev(nullptr), + mNext(nullptr), + mName(nullptr), mValue(""), - mDefault(NULL) + mDefault(nullptr) { } LLXMLNode::LLXMLNode(const char* name, bool is_attribute) : mID(""), - mParser(NULL), + mParser(nullptr), mIsAttribute(is_attribute), mVersionMajor(0), mVersionMinor(0), @@ -82,20 +82,20 @@ LLXMLNode::LLXMLNode(const char* name, bool is_attribute) : mType(TYPE_CONTAINER), mEncoding(ENCODING_DEFAULT), mLineNumber(-1), - mParent(NULL), - mChildren(NULL), + mParent(nullptr), + mChildren(nullptr), mAttributes(), - mPrev(NULL), - mNext(NULL), + mPrev(nullptr), + mNext(nullptr), mValue(""), - mDefault(NULL) + mDefault(nullptr) { mName = gStringTable.addStringEntry(name); } LLXMLNode::LLXMLNode(LLStringTableEntry* name, bool is_attribute) : mID(""), - mParser(NULL), + mParser(nullptr), mIsAttribute(is_attribute), mVersionMajor(0), mVersionMinor(0), @@ -104,14 +104,14 @@ LLXMLNode::LLXMLNode(LLStringTableEntry* name, bool is_attribute) : mType(TYPE_CONTAINER), mEncoding(ENCODING_DEFAULT), mLineNumber(-1), - mParent(NULL), - mChildren(NULL), + mParent(nullptr), + mChildren(nullptr), mAttributes(), - mPrev(NULL), - mNext(NULL), + mPrev(nullptr), + mNext(nullptr), mName(name), mValue(""), - mDefault(NULL) + mDefault(nullptr) { } @@ -126,12 +126,12 @@ LLXMLNode::LLXMLNode(const LLXMLNode& rhs) : mType(rhs.mType), mEncoding(rhs.mEncoding), mLineNumber(0), - mParser(NULL), - mParent(NULL), - mChildren(NULL), + mParser(nullptr), + mParent(nullptr), + mChildren(nullptr), mAttributes(), - mPrev(NULL), - mNext(NULL), + mPrev(nullptr), + mNext(nullptr), mName(rhs.mName), mValue(rhs.mValue), mDefault(rhs.mDefault) @@ -174,30 +174,30 @@ LLXMLNode::~LLXMLNode() iter != mChildren->map.end(); ++iter) { LLXMLNodePtr child = iter->second; - child->mParent = NULL; - child->mNext = NULL; - child->mPrev = NULL; + child->mParent = nullptr; + child->mNext = nullptr; + child->mPrev = nullptr; } mChildren->map.clear(); - mChildren->head = NULL; - mChildren->tail = NULL; - mChildren = NULL; + mChildren->head = nullptr; + mChildren->tail = nullptr; + mChildren = nullptr; } for (LLXMLAttribList::iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter) { LLXMLNodePtr attr = iter->second; - attr->mParent = NULL; - attr->mNext = NULL; - attr->mPrev = NULL; + attr->mParent = nullptr; + attr->mNext = nullptr; + attr->mPrev = nullptr; } - llassert(mParent == NULL); - mDefault = NULL; + llassert(mParent == nullptr); + mDefault = nullptr; } bool LLXMLNode::isNull() { - return (mName == NULL); + return (mName == nullptr); } // protected @@ -212,7 +212,7 @@ bool LLXMLNode::removeChild(LLXMLNode *target_child) LLXMLAttribList::iterator children_itr = mAttributes.find(target_child->mName); if (children_itr != mAttributes.end()) { - target_child->mParent = NULL; + target_child->mParent = nullptr; mAttributes.erase(children_itr); return true; } @@ -238,13 +238,13 @@ bool LLXMLNode::removeChild(LLXMLNode *target_child) if (prev.notNull()) prev->mNext = next; if (next.notNull()) next->mPrev = prev; - target_child->mPrev = NULL; - target_child->mNext = NULL; - target_child->mParent = NULL; + target_child->mPrev = nullptr; + target_child->mNext = nullptr; + target_child->mParent = nullptr; mChildren->map.erase(children_itr); if (mChildren->map.empty()) { - mChildren = NULL; + mChildren = nullptr; } return true; } @@ -263,7 +263,7 @@ bool LLXMLNode::removeChild(LLXMLNode *target_child) void LLXMLNode::addChild(LLXMLNodePtr& new_child) { - if (new_child->mParent != NULL) + if (new_child->mParent != nullptr) { if (new_child->mParent == this) { @@ -338,10 +338,10 @@ void LLXMLNode::setParent(LLXMLNodePtr& new_parent) } else { - if (mParent != NULL) + if (mParent != nullptr) { LLXMLNodePtr old_parent = mParent; - mParent = NULL; + mParent = nullptr; old_parent->removeChild(this); } } @@ -350,9 +350,9 @@ void LLXMLNode::setParent(LLXMLNodePtr& new_parent) void LLXMLNode::updateDefault() { - if (mParent != NULL && !mParent->mDefault.isNull()) + if (mParent != nullptr && !mParent->mDefault.isNull()) { - mDefault = NULL; + mDefault = nullptr; // Find default value in parent's default tree if (!mParent->mDefault.isNull()) @@ -387,9 +387,9 @@ void XMLCALL StartXMLNode(void *userData, // Set the parent-child relationship with the current active node LLXMLNode* parent = (LLXMLNode *)userData; - if (NULL == parent) + if (nullptr == parent) { - LL_WARNS() << "parent (userData) is NULL; aborting function" << LL_ENDL; + LL_WARNS() << "parent (userData) is nullptr; aborting function" << LL_ENDL; return; } @@ -402,7 +402,7 @@ void XMLCALL StartXMLNode(void *userData, // Parse attributes U32 pos = 0; - while (atts[pos] != NULL) + while (atts[pos] != nullptr) { std::string attr_name = atts[pos]; std::string attr_value = atts[pos+1]; @@ -678,7 +678,7 @@ bool LLXMLNode::parseBuffer( LLXMLNode* defaults) { // Init - XML_Parser my_parser = XML_ParserCreate(NULL); + XML_Parser my_parser = XML_ParserCreate(nullptr); XML_SetElementHandler(my_parser, StartXMLNode, EndXMLNode); XML_SetCharacterDataHandler(my_parser, XMLData); @@ -711,7 +711,7 @@ bool LLXMLNode::parseBuffer( { LL_WARNS() << "Parse failure - wrong number of top-level nodes xml." << LL_ENDL; - node = NULL ; + node = nullptr ; return false; } @@ -731,7 +731,7 @@ bool LLXMLNode::parseStream( LLXMLNode* defaults) { // Init - XML_Parser my_parser = XML_ParserCreate(NULL); + XML_Parser my_parser = XML_ParserCreate(nullptr); XML_SetElementHandler(my_parser, StartXMLNode, EndXMLNode); XML_SetCharacterDataHandler(my_parser, XMLData); @@ -770,7 +770,7 @@ bool LLXMLNode::parseStream( { LL_WARNS() << "Parse failure - wrong number of top-level nodes xml." << LL_ENDL; - node = NULL; + node = nullptr; return false; } @@ -835,7 +835,7 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, return false; } - if (!LLXMLNode::parseFile(filename, root, NULL)) + if (!LLXMLNode::parseFile(filename, root, nullptr)) { LL_WARNS() << "Problem reading UI description file: " << filename << " " << errno << LL_ENDL; return false; @@ -855,7 +855,7 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, continue; } - if (!LLXMLNode::parseFile(layer_filename, updateRoot, NULL)) + if (!LLXMLNode::parseFile(layer_filename, updateRoot, nullptr)) { LL_WARNS() << "Problem reading localized UI description file: " << layer_filename << LL_ENDL; return false; @@ -1121,7 +1121,7 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) while (itor != mChildren->map.end()) { LLXMLNodePtr child = itor->second; - LLXMLNodePtr child_tree = NULL; + LLXMLNodePtr child_tree = nullptr; // Look for this child in the default's children bool found = false; LLXMLChildList::iterator itor2 = tree->mChildren->map.begin(); @@ -1173,7 +1173,7 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, boo { return mDefault->getChild(name, node, false); } - node = NULL; + node = nullptr; return false; } @@ -1394,7 +1394,7 @@ bool LLXMLNode::getAttributeString(const char* name, std::string& value ) LLXMLNodePtr LLXMLNode::getRoot() { - if (mParent == NULL) + if (mParent == nullptr) { return this; } @@ -1425,7 +1425,7 @@ const char *LLXMLNode::parseInteger(const char *str, U64 *dest, bool *is_negativ str = skipWhitespace(str); - if (str[0] == 0) return NULL; + if (str[0] == 0) return nullptr; if (encoding == ENCODING_DECIMAL || encoding == ENCODING_DEFAULT) { @@ -1480,7 +1480,7 @@ const char *LLXMLNode::parseInteger(const char *str, U64 *dest, bool *is_negativ } else { - return NULL; + return nullptr; } ++str; } @@ -1488,7 +1488,7 @@ const char *LLXMLNode::parseInteger(const char *str, U64 *dest, bool *is_negativ *dest = ret; return str; } - return NULL; + return nullptr; } // 25 elements - decimal expansions of 1/(2^n), multiplied by 10 each iteration @@ -1519,7 +1519,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc { str = skipWhitespace(str); - if (str[0] == 0) return NULL; + if (str[0] == 0) return nullptr; if (encoding == ENCODING_DECIMAL || encoding == ENCODING_DEFAULT) { @@ -1638,7 +1638,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc U64 exp; bool is_negative; str = parseInteger(str, &exp, &is_negative, 64, ENCODING_DECIMAL); - if (str == NULL) + if (str == nullptr) { exp = 1; } @@ -1649,7 +1649,7 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc if (str == base_str) { // no digits parsed - return NULL; + return nullptr; } else { @@ -1676,11 +1676,11 @@ const char *LLXMLNode::parseFloat(const char *str, F64 *dest, U32 precision, Enc *dest = *(F64 *)&bytes_dest; break; default: - return NULL; + return nullptr; } return str; } - return NULL; + return nullptr; } U32 LLXMLNode::getBoolValue(U32 expected_length, bool *array) @@ -1755,7 +1755,7 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) U64 value; bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 8, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -1807,7 +1807,7 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) U64 value; bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -1861,7 +1861,7 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi U64 value; bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 32, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -1915,7 +1915,7 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) U64 value; bool is_negative; value_string = parseInteger(value_string, &value, &is_negative, 64, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -1967,7 +1967,7 @@ U32 LLXMLNode::getFloatValue(U32 expected_length, F32 *array, Encoding encoding) { F64 value; value_string = parseFloat(value_string, &value, 32, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -2012,7 +2012,7 @@ U32 LLXMLNode::getDoubleValue(U32 expected_length, F64 *array, Encoding encoding { F64 value; value_string = parseFloat(value_string, &value, 64, encoding); - if (value_string == NULL) + if (value_string == nullptr) { break; } @@ -2594,7 +2594,7 @@ void LLXMLNode::findDefault(LLXMLNode *defaults_list) } } } - mDefault = NULL; + mDefault = nullptr; } bool LLXMLNode::deleteChildren(const std::string& name) @@ -3167,7 +3167,7 @@ bool LLXMLNode::performUnitTest(std::string &error_buffer) LLXMLNodePtr LLXMLNode::getFirstChild() const { - if (mChildren.isNull()) return NULL; + if (mChildren.isNull()) return nullptr; LLXMLNodePtr ret = mChildren->head; return ret; } diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 09c7c4fdad9..6024b2dd0d6 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -57,9 +57,9 @@ struct CompareAttributes { bool operator()(const LLStringTableEntry* const lhs, const LLStringTableEntry* const rhs) const { - if (lhs == NULL) + if (lhs == nullptr) return true; - if (rhs == NULL) + if (rhs == nullptr) return true; return strcmp(lhs->mString, rhs->mString) < 0; diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index e2c7d17e2a0..d2d0a1c407e 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -37,13 +37,13 @@ LLXmlParser::LLXmlParser() : - mParser( NULL ), + mParser( nullptr ), mDepth( 0 ) { mAuxErrorString = "no error"; // Override the document's declared encoding. - mParser = XML_ParserCreate(NULL); + mParser = XML_ParserCreate(nullptr); XML_SetUserData(mParser, this); XML_SetElementHandler( mParser, startElementHandler, endElementHandler); diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index d66544d0f80..f13d77196a4 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -43,7 +43,7 @@ LLStdStringTable LLXmlTree::sAttributeKeys(1024); LLXmlTree::LLXmlTree() - : mRoot( NULL ), + : mRoot(nullptr), mNodeNames(512) { } @@ -56,7 +56,7 @@ LLXmlTree::~LLXmlTree() void LLXmlTree::cleanup() { delete mRoot; - mRoot = NULL; + mRoot = nullptr; mNodeNames.cleanup(); } @@ -64,7 +64,7 @@ void LLXmlTree::cleanup() bool LLXmlTree::parseFile(const std::string &path, bool keep_contents) { delete mRoot; - mRoot = NULL; + mRoot = nullptr; LLXmlTreeParser parser(this); bool success = parser.parseFile( path, &mRoot, keep_contents ); @@ -176,7 +176,7 @@ LLXmlTreeNode* LLXmlTreeNode::getChildByName(const std::string& name) LLXmlTreeNode* LLXmlTreeNode::getNextNamedChild() { if (mChildMapIter == mChildMapEndIter) - return NULL; + return nullptr; else return (mChildMapIter++)->second; } @@ -507,8 +507,8 @@ std::string LLXmlTreeNode::getTextContents() LLXmlTreeParser::LLXmlTreeParser(LLXmlTree* tree) : mTree(tree), - mRoot( NULL ), - mCurrent( NULL ), + mRoot( nullptr ), + mCurrent( nullptr ), mDump( false ), mKeepContents(false) { @@ -528,13 +528,13 @@ bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, b bool success = LLXmlParser::parseFile(path); *root = mRoot; - mRoot = NULL; + mRoot = nullptr; if( success ) { llassert( !mCurrent ); } - mCurrent = NULL; + mCurrent = nullptr; return success; } diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index 120d7d3e565..d8e883f5801 100644 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -152,8 +152,8 @@ class LLXmlTreeNode LLXmlTreeNode* getFirstChild(); LLXmlTreeNode* getNextChild(); S32 getChildCount() { return (S32)mChildren.size(); } - LLXmlTreeNode* getChildByName( const std::string& name ); // returns first child with name, NULL if none - LLXmlTreeNode* getNextNamedChild(); // returns next child with name, NULL if none + LLXmlTreeNode* getChildByName( const std::string& name ); // returns first child with name, nullptr if none + LLXmlTreeNode* getNextNamedChild(); // returns next child with name, nullptr if none protected: const std::string* getAttribute( LLStdStringHandle name) From d51e9bc47b973fdd0ef075cf51b69f14ea0a9a15 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 4 Dec 2025 03:19:56 -0500 Subject: [PATCH 11/11] Replace legacy NULL with nullptr in llui --- indra/llui/llaccordionctrl.cpp | 10 +- indra/llui/llaccordionctrltab.cpp | 4 +- indra/llui/llbadge.cpp | 8 +- indra/llui/llbadgeowner.cpp | 4 +- indra/llui/llbutton.cpp | 26 ++--- indra/llui/llchatentry.cpp | 2 +- indra/llui/llcombobox.cpp | 4 +- indra/llui/llcombobox.h | 2 +- indra/llui/llcommandmanager.cpp | 4 +- indra/llui/llconsole.cpp | 6 +- indra/llui/llcontainerview.cpp | 6 +- indra/llui/llctrlselectioninterface.h | 2 +- indra/llui/lldockablefloater.cpp | 20 ++-- indra/llui/lldockcontrol.cpp | 18 ++-- indra/llui/lldraghandle.cpp | 8 +- indra/llui/lleditmenuhandler.cpp | 4 +- indra/llui/llflatlistview.cpp | 22 ++-- indra/llui/llflatlistview.h | 4 +- indra/llui/llfloater.cpp | 58 +++++------ indra/llui/llfloater.h | 4 +- indra/llui/llfloaterreg.cpp | 16 +-- indra/llui/llfloaterreg.h | 2 +- indra/llui/llflyoutbutton.cpp | 2 +- indra/llui/llfocusmgr.cpp | 40 ++++---- indra/llui/llfocusmgr.h | 8 +- indra/llui/llfolderview.cpp | 81 ++++++++------- indra/llui/llfolderview.h | 2 +- indra/llui/llfolderviewitem.cpp | 54 +++++----- indra/llui/llfolderviewmodel.h | 14 +-- indra/llui/lliconctrl.cpp | 2 +- indra/llui/llkeywords.cpp | 2 +- indra/llui/lllayoutstack.cpp | 14 +-- indra/llui/lllazyvalue.h | 4 +- indra/llui/lllineeditor.cpp | 16 +-- indra/llui/lllineeditor.h | 2 +- indra/llui/llloadingindicator.cpp | 2 +- indra/llui/llmenubutton.cpp | 2 +- indra/llui/llmenugl.cpp | 138 +++++++++++++------------- indra/llui/llmenugl.h | 6 +- indra/llui/llmodaldialog.cpp | 12 +-- indra/llui/llmultifloater.cpp | 8 +- indra/llui/llmultislider.cpp | 8 +- indra/llui/llmultisliderctrl.cpp | 6 +- indra/llui/llnotifications.cpp | 10 +- indra/llui/llnotifications.h | 4 +- indra/llui/llpanel.cpp | 22 ++-- indra/llui/llpanel.h | 6 +- indra/llui/llresizebar.cpp | 12 +-- indra/llui/llresizehandle.cpp | 8 +- indra/llui/llresmgr.cpp | 4 +- indra/llui/llscrollbar.cpp | 6 +- indra/llui/llscrollcontainer.cpp | 8 +- indra/llui/llscrolllistcell.cpp | 12 +-- indra/llui/llscrolllistcolumn.cpp | 2 +- indra/llui/llscrolllistcolumn.h | 2 +- indra/llui/llscrolllistctrl.cpp | 66 ++++++------ indra/llui/llscrolllistctrl.h | 2 +- indra/llui/llscrolllistitem.cpp | 4 +- indra/llui/llsearcheditor.cpp | 4 +- indra/llui/llslider.cpp | 8 +- indra/llui/llsliderctrl.cpp | 8 +- indra/llui/llspinctrl.cpp | 2 +- indra/llui/llstatbar.cpp | 2 +- indra/llui/lltabcontainer.cpp | 46 ++++----- indra/llui/lltabcontainer.h | 2 +- indra/llui/lltextbase.cpp | 22 ++-- indra/llui/lltextbase.h | 2 +- indra/llui/lltextbox.cpp | 2 +- indra/llui/lltexteditor.cpp | 24 ++--- indra/llui/lltextvalidate.cpp | 4 +- indra/llui/lltimectrl.cpp | 2 +- indra/llui/lltoggleablemenu.cpp | 2 +- indra/llui/lltoolbar.cpp | 28 +++--- indra/llui/lltooltip.cpp | 14 +-- indra/llui/llui.cpp | 18 ++-- indra/llui/llui.h | 2 +- indra/llui/lluicolor.cpp | 12 +-- indra/llui/lluicolortable.cpp | 4 +- indra/llui/lluictrl.cpp | 60 +++++------ indra/llui/lluictrl.h | 4 +- indra/llui/lluictrlfactory.cpp | 14 +-- indra/llui/lluictrlfactory.h | 20 ++-- indra/llui/lluistring.h | 6 +- indra/llui/llurlentry.cpp | 2 +- indra/llui/llurlregistry.cpp | 4 +- indra/llui/llview.cpp | 84 ++++++++-------- indra/llui/llview.h | 10 +- indra/llui/llviewborder.cpp | 2 +- indra/llui/llviewinject.cpp | 4 +- indra/llui/llviewmodel.cpp | 4 +- indra/llui/llviewmodel.h | 2 +- indra/llui/llviewquery.h | 2 +- indra/llui/llvirtualtrackball.cpp | 2 +- indra/llui/llxuiparser.cpp | 12 +-- indra/llui/llxuiparser.h | 4 +- indra/llui/llxyvector.cpp | 2 +- indra/llui/tests/llurlentry_stub.cpp | 4 +- indra/llui/tests/llurlentry_test.cpp | 2 +- indra/llui/tests/llurlmatch_test.cpp | 4 +- 99 files changed, 640 insertions(+), 641 deletions(-) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index ac8f7c2126b..320426a104d 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -129,7 +129,7 @@ bool LLAccordionCtrl::postBuild() for(LLView* viewp : *getChildList()) { LLAccordionCtrlTab* accordion_tab = dynamic_cast(viewp); - if (accordion_tab == NULL) + if (accordion_tab == nullptr) continue; if (std::find(mAccordionTabs.begin(), mAccordionTabs.end(), accordion_tab) == mAccordionTabs.end()) { @@ -355,7 +355,7 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab) // if removed is selected - reset selection if (mSelectedTab == accordion_tab) { - mSelectedTab = NULL; + mSelectedTab = nullptr; } } @@ -566,7 +566,7 @@ bool LLAccordionCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, if (!handled) { handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, - cargo_data, accept, tooltip_msg) != NULL; + cargo_data, accept, tooltip_msg) != nullptr; } return true; } @@ -674,7 +674,7 @@ void LLAccordionCtrl::onOpen(const LLSD& key) for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs) { LLPanel* panel = dynamic_cast(accordion_tab->getAccordionView()); - if (panel != NULL) + if (panel != nullptr) { panel->onOpen(key); } @@ -772,7 +772,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info) if (mSelectedTab) { mSelectedTab->setSelected(false); - mSelectedTab = NULL; + mSelectedTab = nullptr; return 1; } return 0; diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 828bfb289b4..d01132e7d50 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -371,8 +371,8 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) ,mCanOpenClose(true) ,mFitPanel(p.fit_panel) ,mSelectionEnabled(p.selection_enabled) - ,mContainerPanel(NULL) - ,mScrollbar(NULL) + ,mContainerPanel(nullptr) + ,mScrollbar(nullptr) { mStoredOpenCloseState = false; mWasStateStored = false; diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 42b6f1f07b6..e14380f0e5d 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -103,7 +103,7 @@ LLBadge::LLBadge(const LLBadge::Params& p) , mLocationPercentVCenter(0.5f) , mPaddingHoriz(p.padding_horiz) , mPaddingVert(p.padding_vert) - , mParentScroller(NULL) + , mParentScroller(nullptr) , mDrawAtParentTop(false) { if (mImage.isNull()) @@ -169,7 +169,7 @@ bool LLBadge::addToView(LLView * view) LLView * parent = mOwner.get(); - while ((parent != NULL) && ((mParentScroller = dynamic_cast(parent)) == NULL)) + while ((parent != nullptr) && ((mParentScroller = dynamic_cast(parent)) == nullptr)) { parent = parent->getParent(); } @@ -236,7 +236,7 @@ void LLBadge::draw() S32 badge_label_begin_offset = 0; S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; - F32 *right_position_out = NULL; + F32 *right_position_out = nullptr; bool do_not_use_ellipses = false; F32 badge_width = (2.0f * mPaddingHoriz) + @@ -255,7 +255,7 @@ void LLBadge::draw() S32 location_offset_vert = mLocationOffsetVCenter; // If we're in a scroll container, do some math to keep us in the same place on screen if applicable - if (mParentScroller != NULL) + if (mParentScroller != nullptr) { LLRect visibleRect = mParentScroller->getVisibleContentRect(); diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 3194a4b56f5..56c937b19d1 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -36,7 +36,7 @@ LLBadgeOwner::LLBadgeOwner(LLHandle< LLView > viewHandle) : mHasBadgeHolderParent(false), - mBadge(NULL), + mBadge(nullptr), mBadgeOwnerView(viewHandle) { } @@ -86,7 +86,7 @@ void LLBadgeOwner::addBadgeToParentHolder() if (mBadge && owner_view) { - LLBadgeHolder * badge_holder = NULL; + LLBadgeHolder * badge_holder = nullptr; // Find the appropriate holder for the badge LLView * parent = owner_view->getParent(); diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 0048c44189a..7e2cd89c7a6 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -175,12 +175,12 @@ LLButton::LLButton(const LLButton::Params& p) mForcePressedState(false), mDisplayPressedState(p.display_pressed_state), mLastDrawCharsCount(0), - mMouseDownSignal(NULL), - mMouseUpSignal(NULL), - mHeldDownSignal(NULL), + mMouseDownSignal(nullptr), + mMouseUpSignal(nullptr), + mHeldDownSignal(nullptr), mUseDrawContextAlpha(p.use_draw_context_alpha), mHandleRightMouse(p.handle_right_mouse), - mFlashingTimer(NULL) + mFlashingTimer(nullptr) { if (p.button_flash_enable) { @@ -523,7 +523,7 @@ bool LLButton::handleMouseUp(S32 x, S32 y, MASK mask) resetMouseDownTimer(); // Always release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); /* * ATTENTION! This call fires another mouse up callback. @@ -594,7 +594,7 @@ bool LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { // Always release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); // if (pointInView(x, y)) // { @@ -702,8 +702,8 @@ void LLButton::draw() LLColor4 highlighting_color = LLColor4::white; LLColor4 glow_color = LLColor4::white; LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; - LLUIImage* imagep = NULL; - LLUIImage* image_glow = NULL; + LLUIImage* imagep = nullptr; + LLUIImage* image_glow = nullptr; // Cancel sticking of color, if the button is pressed, // or when a flashing of the previously selected button is ended @@ -859,7 +859,7 @@ void LLButton::draw() // Draw button image, if available. // Otherwise draw basic rectangular button. - if (imagep != NULL) + if (imagep != nullptr) { // apply automatic 50% alpha fade to disabled image LLColor4 disabled_color = mFadeWhenDisabled ? mDisabledImageColor.get() % 0.5f : mDisabledImageColor.get(); @@ -1005,7 +1005,7 @@ void LLButton::draw() LLFontGL::NORMAL, mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW, S32_MAX, text_width, - NULL, mUseEllipses, mUseFontColor); + nullptr, mUseEllipses, mUseFontColor); } LLUICtrl::draw(); @@ -1013,7 +1013,7 @@ void LLButton::draw() void LLButton::drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size) { - if (imagep == NULL) return; + if (imagep == nullptr) return; if (mScaleImage) { imagep->drawBorder(getLocalRect(), color, size); @@ -1243,7 +1243,7 @@ void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign a { if (image_name.empty()) { - mImageOverlay = NULL; + mImageOverlay = nullptr; } else { @@ -1257,7 +1257,7 @@ void LLButton::setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignmen { if (image_id.isNull()) { - mImageOverlay = NULL; + mImageOverlay = nullptr; } else { diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index 7506cd99c01..32cdb608615 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -39,7 +39,7 @@ LLChatEntry::Params::Params() LLChatEntry::LLChatEntry(const Params& p) : LLTextEditor(p), - mTextExpandedSignal(NULL), + mTextExpandedSignal(nullptr), mHasHistory(p.has_history), mIsExpandable(p.is_expandable), mExpandLinesCount(p.expand_lines_count), diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index ae676251ffc..9ca98d275e2 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -86,7 +86,7 @@ LLComboBox::Params::Params() LLComboBox::LLComboBox(const LLComboBox::Params& p) : LLUICtrl(p), - mTextEntry(NULL), + mTextEntry(nullptr), mTextEntryTentative(p.show_text_as_tentative), mHasAutocompletedText(false), mAllowTextEntry(p.allow_text_entry), @@ -658,7 +658,7 @@ void* LLComboBox::getCurrentUserdata() { return item->getUserdata(); } - return NULL; + return nullptr; } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index d6ea1202d39..56584ea2394 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -183,7 +183,7 @@ class LLComboBox virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM); virtual void clearColumns(); virtual void setColumnLabel(const std::string& column, const std::string& label); - virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = nullptr); virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD()); virtual void clearRows(); virtual void sortByColumn(const std::string& name, bool ascending); diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index b10ec51f184..45e00daeb33 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -117,7 +117,7 @@ LLCommand * LLCommandManager::getCommand(U32 commandIndex) LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) { - LLCommand * command_match = NULL; + LLCommand * command_match = nullptr; CommandIndexMap::const_iterator found = mCommandIndices.find(commandId.uuid()); @@ -131,7 +131,7 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) LLCommand * LLCommandManager::getCommand(const std::string& name) { - LLCommand * command_match = NULL; + LLCommand * command_match = nullptr; CommandVector::const_iterator it = mCommands.begin(); diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 91e6f281da5..47ae1e245dc 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -49,7 +49,7 @@ // Used for LCD display extern void AddNewDebugConsoleToLCD(const LLWString &newLine); -LLConsole* gConsole = NULL; // Created and destroyed in LLViewerWindow. +LLConsole* gConsole = nullptr; // Created and destroyed in LLViewerWindow. const F32 FADE_DURATION = 2.f; @@ -118,7 +118,7 @@ void LLConsole::setFontSize(S32 size_index) mFont = LLFontGL::getFontSansSerifHuge(); } // Make sure the font exists - if (mFont == NULL) + if (mFont == nullptr) { mFont = LLFontGL::getFontDefault(); } @@ -281,7 +281,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b if ( mParagraphText.empty() || mParagraphColorSegments.empty() - || font == NULL) + || font == nullptr) { return; //Not enough info to complete. } diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index b414e4354d6..f18e234ab8e 100644 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -49,7 +49,7 @@ LLContainerView::LLContainerView(const LLContainerView::Params& p) mLabel(utf8str_to_wstring(p.label)), mDisplayChildren(p.display_children) { - mScrollContainer = NULL; + mScrollContainer = nullptr; } LLContainerView::~LLContainerView() @@ -84,7 +84,7 @@ bool LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) bool handled = false; if (mDisplayChildren) { - handled = (LLView::childrenHandleMouseDown(x, y, mask) != NULL); + handled = (LLView::childrenHandleMouseDown(x, y, mask) != nullptr); } if (!handled) { @@ -103,7 +103,7 @@ bool LLContainerView::handleMouseUp(S32 x, S32 y, MASK mask) bool handled = false; if (mDisplayChildren) { - handled = (LLView::childrenHandleMouseUp(x, y, mask) != NULL); + handled = (LLView::childrenHandleMouseUp(x, y, mask) != nullptr); } return handled; } diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index c845f7027d4..69760930fc5 100644 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -81,7 +81,7 @@ class LLCtrlListInterface : public LLCtrlSelectionInterface virtual void clearColumns() = 0; virtual void setColumnLabel(const std::string& column, const std::string& label) = 0; // TomY TODO: Document this - virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0; + virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = nullptr) = 0; LLScrollListItem* addSimpleElement(const std::string& value); // defaults to bottom LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos); // defaults to no LLSD() id diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index c20e5a806cb..a37f509518f 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -35,7 +35,7 @@ LLHandle LLDockableFloater::sInstanceHandle; //static void LLDockableFloater::init(LLDockableFloater* thiz) { - thiz->setDocked(thiz->mDockControl.get() != NULL + thiz->setDocked(thiz->mDockControl.get() != nullptr && thiz->mDockControl.get()->isDockVisible()); thiz->resetInstance(); @@ -96,17 +96,17 @@ void LLDockableFloater::toggleInstance(const LLSD& sdname) LLDockableFloater* instance = dynamic_cast (LLFloaterReg::findInstance(name)); // if floater closed or docked - if (instance == NULL || (instance && instance->isDocked())) + if (instance == nullptr || (instance && instance->isDocked())) { LLFloaterReg::toggleInstance(name, key); // restore button toggle state - if (instance != NULL) + if (instance != nullptr) { instance->storeVisibilityControl(); } } // if floater undocked - else if (instance != NULL) + else if (instance != nullptr) { instance->setMinimized(false); if (instance->getVisible()) @@ -125,7 +125,7 @@ void LLDockableFloater::resetInstance() { if (mUniqueDocking && sInstanceHandle.get() != this) { - if (sInstanceHandle.get() != NULL && sInstanceHandle.get()->isDocked()) + if (sInstanceHandle.get() != nullptr && sInstanceHandle.get()->isDocked()) { sInstanceHandle.get()->setVisible(false); } @@ -148,7 +148,7 @@ void LLDockableFloater::setVisible(bool visible) resetInstance(); } - if (visible && mDockControl.get() != NULL) + if (visible && mDockControl.get() != nullptr) { mDockControl.get()->repositionDockable(); } @@ -175,8 +175,8 @@ void LLDockableFloater::setMinimized(bool minimize) LLView * LLDockableFloater::getDockWidget() { - LLView * res = NULL; - if (getDockControl() != NULL) { + LLView * res = nullptr; + if (getDockControl() != nullptr) { res = getDockControl()->getDock(); } @@ -198,7 +198,7 @@ void LLDockableFloater::onDockShown() void LLDockableFloater::setDocked(bool docked, bool pop_on_undock) { - if (mDockControl.get() != NULL && mDockControl.get()->isDockVisible()) + if (mDockControl.get() != nullptr && mDockControl.get()->isDockVisible()) { if (docked) { @@ -222,7 +222,7 @@ void LLDockableFloater::setDocked(bool docked, bool pop_on_undock) void LLDockableFloater::draw() { - if (mDockControl.get() != NULL) + if (mDockControl.get() != nullptr) { mDockControl.get()->repositionDockable(); if (isDocked()) diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 1a00c03856f..97e276ef0a4 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -38,7 +38,7 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, { mDockAt = dockAt; - if (dockWidget != NULL) + if (dockWidget != nullptr) { mDockWidgetHandle = dockWidget->getHandle(); } @@ -63,12 +63,12 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, mGetAllowedRectCallback = get_allowed_rect_callback; } - if (dockWidget != NULL) + if (dockWidget != nullptr) { repositionDockable(); } - if (getDock() != NULL) + if (getDock() != nullptr) { mDockWidgetVisible = isDockVisible(); } @@ -84,7 +84,7 @@ LLDockControl::~LLDockControl() void LLDockControl::setDock(LLView* dockWidget) { - if (dockWidget != NULL) + if (dockWidget != nullptr) { mDockWidgetHandle = dockWidget->getHandle(); repositionDockable(); @@ -129,7 +129,7 @@ void LLDockControl::repositionDockable() off(); LLDockableFloater* dockable_floater = dynamic_cast (mDockableFloater); - if(dockable_floater != NULL) + if(dockable_floater != nullptr) { dockable_floater->onDockHidden(); } @@ -142,7 +142,7 @@ void LLDockControl::repositionDockable() } LLDockableFloater* dockable_floater = dynamic_cast (mDockableFloater); - if(dockable_floater != NULL) + if(dockable_floater != nullptr) { dockable_floater->onDockShown(); } @@ -160,7 +160,7 @@ bool LLDockControl::isDockVisible() const { bool res = true; - if (getDock() != NULL) + if (getDock() != nullptr) { //we should check all hierarchy res = getDock()->isInVisibleChain(); @@ -206,7 +206,7 @@ void LLDockControl::moveDockable() bool use_tongue = false; LLDockableFloater* dockable_floater = dynamic_cast (mDockableFloater); - if (dockable_floater != NULL) + if (dockable_floater != nullptr) { use_tongue = dockable_floater->getUseTongue(); } @@ -375,7 +375,7 @@ void LLDockControl::drawToungue() bool use_tongue = false; LLDockableFloater* dockable_floater = dynamic_cast (mDockableFloater); - if (dockable_floater != NULL) + if (dockable_floater != nullptr) { use_tongue = dockable_floater->getUseTongue(); } diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 15536178ab5..83204adc140 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -55,7 +55,7 @@ LLDragHandle::LLDragHandle(const LLDragHandle::Params& p) mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), mLastMouseScreenY( 0 ), - mTitleBox( NULL ), + mTitleBox( nullptr ), mMaxTitleWidth( 0 ), mForeground( true ), mDragHighlightColor(p.drag_highlight_color()), @@ -118,7 +118,7 @@ void LLDragHandleTop::setTitle(const std::string& title) std::string LLDragHandleTop::getTitle() const { - return mTitleBox == NULL ? LLStringUtil::null : mTitleBox->getText(); + return mTitleBox == nullptr ? LLStringUtil::null : mTitleBox->getText(); } @@ -128,7 +128,7 @@ void LLDragHandleLeft::setTitle(const std::string& ) { removeChild(mTitleBox); delete mTitleBox; - mTitleBox = NULL; + mTitleBox = nullptr; } /* no title on left edge */ } @@ -291,7 +291,7 @@ bool LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { // Release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); } // Note: don't pass on to children diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp index 402628bc6ba..311abec3125 100644 --- a/indra/llui/lleditmenuhandler.cpp +++ b/indra/llui/lleditmenuhandler.cpp @@ -29,12 +29,12 @@ #include "lleditmenuhandler.h" /* static */ -LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL; +LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = nullptr; LLEditMenuHandler::~LLEditMenuHandler() { if (gEditMenuHandler == this) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } } diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 34eb1ea3fc6..6a734820abb 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -254,11 +254,11 @@ bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange) LLPanel* LLFlatListView::getItemByValue(const LLSD& value) const { - if (value.isUndefined()) return NULL; + if (value.isUndefined()) return nullptr; item_pair_t* pair = getItemPair(value); if (pair) return pair->first; - return NULL; + return nullptr; } bool LLFlatListView::selectItem(LLPanel* item, bool select /*= true*/) @@ -331,7 +331,7 @@ void LLFlatListView::getSelectedUUIDs(uuid_vec_t& selected_uuids) const LLPanel* LLFlatListView::getSelectedItem() const { - if (mSelectedItemPairs.empty()) return NULL; + if (mSelectedItemPairs.empty()) return nullptr; return mSelectedItemPairs.front()->first; } @@ -448,15 +448,15 @@ bool LLFlatListView::updateValue(const LLSD& old_value, const LLSD& new_value) LLFlatListView::LLFlatListView(const LLFlatListView::Params& p) : LLScrollContainer(p) - , mItemComparator(NULL) - , mItemsPanel(NULL) + , mItemComparator(nullptr) + , mItemsPanel(nullptr) , mItemPad(p.item_pad) , mAllowSelection(p.allow_select) , mMultipleSelection(p.multi_select) , mKeepOneItemSelected(p.keep_one_selected) , mCommitOnSelectionChange(false) , mPrevNotifyParentRect(LLRect()) - , mNoItemsCommentTextbox(NULL) + , mNoItemsCommentTextbox(nullptr) , mIsConsecutiveSelection(false) , mKeepSelectionVisibleOnReshape(p.keep_selection_visible_on_reshape) , mFocusOnItemClicked(true) @@ -799,7 +799,7 @@ LLFlatListView::item_pair_t* LLFlatListView::getItemPair(LLPanel* item) const item_pair_t* item_pair = *it; if (item_pair->first == item) return item_pair; } - return NULL; + return nullptr; } //compares two LLSD's @@ -841,7 +841,7 @@ LLFlatListView::item_pair_t* LLFlatListView::getItemPair(const LLSD& value) cons item_pair_t* item_pair = *it; if (llsds_are_equal(item_pair->second, value)) return item_pair; } - return NULL; + return nullptr; } bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select) @@ -972,8 +972,8 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti if ( mSelectedItemPairs.size() ) { - item_pair_t* to_sel_pair = NULL; - item_pair_t* cur_sel_pair = NULL; + item_pair_t* to_sel_pair = nullptr; + item_pair_t* cur_sel_pair = nullptr; // Take the last selected pair cur_sel_pair = mSelectedItemPairs.back(); @@ -1215,7 +1215,7 @@ void LLFlatListView::onFocusLost() // Route menu back to the default if (gEditMenuHandler == this) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 39afa33be82..faf675938cf 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -48,7 +48,7 @@ * manage the list of pick items. * * ASSUMPTIONS AND STUFF - * - NULL pointers and undefined LLSD's are not accepted by any method of this class unless specified otherwise + * - nullptr pointers and undefined LLSD's are not accepted by any method of this class unless specified otherwise * - Order of returned selected items are not guaranteed * - The control assumes that all items being added are unique. */ @@ -163,7 +163,7 @@ class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler /** * Get an item by value - * @return the item as LLPanel if associated with value, NULL otherwise + * @return the item as LLPanel if associated with value, nullptr otherwise */ virtual LLPanel* getItemByValue(const LLSD& value) const; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f609fe8105b..21f96475299 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -115,10 +115,10 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = LLFloater::onClickHelp //BUTTON_HELP }; -LLMultiFloater* LLFloater::sHostp = NULL; +LLMultiFloater* LLFloater::sHostp = nullptr; bool LLFloater::sQuitting = false; // Flag to prevent storing visibility controls while quitting -LLFloaterView* gFloaterView = NULL; +LLFloaterView* gFloaterView = nullptr; /*==========================================================================*| // DEV-38598: The fundamental problem with this operation is that it can only @@ -243,7 +243,7 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterFloaterParams(&typeid(LLFl LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) : LLPanel(), // intentionally do not pass params here, see initFromParams - mDragHandle(NULL), + mDragHandle(nullptr), mTitle(p.title), mShortTitle(p.short_title), mSingleInstance(p.single_instance), @@ -275,8 +275,8 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mPreviousMinimizedLeft(0), mDefaultRelativeX(p.rel_x), mDefaultRelativeY(p.rel_y), - mMinimizeSignal(NULL) -// mNotificationContext(NULL) + mMinimizeSignal(nullptr) +// mNotificationContext(nullptr) { mPosition.setFloater(*this); // mNotificationContext = new LLFloaterNotificationContext(getHandle()); @@ -613,7 +613,7 @@ void LLFloater::setVisible( bool visible ) if( gFocusMgr.childHasMouseCapture( this ) ) { - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); } } @@ -673,14 +673,14 @@ void LLFloater::openFloater(const LLSD& key) //RN: for now, we don't allow rehosting from one multifloater to another // just need to fix the bugs - if (getFloaterHost() != NULL && getHost() == NULL) + if (getFloaterHost() != nullptr && getHost() == nullptr) { // needs a host // only select tabs if window they are hosted in is visible getFloaterHost()->addFloater(this, getFloaterHost()->getVisible()); } - if (getHost() != NULL) + if (getHost() != nullptr) { getHost()->setMinimized(false); getHost()->setVisibleAndFrontmost(mAutoFocus && !getIsChrome()); @@ -857,7 +857,7 @@ void LLFloater::releaseFocus() if( gFocusMgr.childHasMouseCapture( this ) ) { - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); } } @@ -1029,7 +1029,7 @@ void LLFloater::applyPositioning(LLFloater* other, bool on_open) case LLFloaterEnums::POSITIONING_CASCADE_GROUP: if (on_open) { - if (other != NULL && other != this) + if (other != nullptr && other != this) { stackWith(*other); } @@ -1129,9 +1129,9 @@ std::string LLFloater::getShortTitle() const bool LLFloater::canSnapTo(const LLView* other_view) { - if (NULL == other_view) + if (nullptr == other_view) { - LL_WARNS() << "other_view is NULL" << LL_ENDL; + LL_WARNS() << "other_view is nullptr" << LL_ENDL; return false; } @@ -1346,11 +1346,11 @@ void LLFloater::setMinimized(bool minimize) for (S32 i = 0; i < 4; i++) { - if (mResizeBar[i] != NULL) + if (mResizeBar[i] != nullptr) { mResizeBar[i]->setEnabled(false); } - if (mResizeHandle[i] != NULL) + if (mResizeHandle[i] != nullptr) { mResizeHandle[i]->setEnabled(false); } @@ -1392,11 +1392,11 @@ void LLFloater::setMinimized(bool minimize) for (S32 i = 0; i < 4; i++) { - if (mResizeBar[i] != NULL) + if (mResizeBar[i] != nullptr) { mResizeBar[i]->setEnabled(isResizable()); } - if (mResizeHandle[i] != NULL) + if (mResizeHandle[i] != nullptr) { mResizeHandle[i]->setEnabled(isResizable()); } @@ -1950,7 +1950,7 @@ void LLFloater::closeFrontmostFloater() // if nothing took focus after closing focused floater // give it to next floater (to allow closing multiple windows via keyboard in rapid succession) - if (gFocusMgr.getKeyboardFocus() == NULL) + if (gFocusMgr.getKeyboardFocus() == nullptr) { // HACK: use gFloaterView directly in case we are using Ctrl-W to close snapshot window // which sits in gSnapshotFloaterView, and needs to pass focus on to normal floater view @@ -1999,7 +1999,7 @@ void LLFloater::draw() S32 right = getRect().getWidth() - LLPANEL_BORDER_WIDTH; S32 bottom = LLPANEL_BORDER_WIDTH; - LLUIImage* image = NULL; + LLUIImage* image = nullptr; LLColor4 color; LLColor4 overlay_color; if (isBackgroundOpaque()) @@ -2322,7 +2322,7 @@ void LLFloater::buildButtons(const Params& floater_params) { removeChild(mButtons[i]); delete mButtons[i]; - mButtons[i] = NULL; + mButtons[i] = nullptr; } LLRect btn_rect; @@ -2460,7 +2460,7 @@ void LLFloaterView::reshape(S32 width, S32 height, bool called_from_parent) if (!floaterp->isMinimized() && floaterp->getCanDrag()) { LLRect old_rect = floaterp->getRect(); - floaterp->applyPositioning(NULL, false); + floaterp->applyPositioning(nullptr, false); LLRect new_rect = floaterp->getRect(); //LLRect r = floaterp->getRect(); @@ -2688,7 +2688,7 @@ void LLFloaterView::bringToFront(LLFloater* child, bool give_focus, bool restore // floater did not take focus, so relinquish focus to world if (!child->hasFocus()) { - gFocusMgr.setKeyboardFocus(NULL); + gFocusMgr.setKeyboardFocus(nullptr); } } } @@ -2738,7 +2738,7 @@ void LLFloaterView::highlightFocusedFloater() LLFloater* LLFloaterView::getFrontmostClosableFloater() { child_list_const_iter_t child_it; - LLFloater* frontmost_floater = NULL; + LLFloater* frontmost_floater = nullptr; for ( child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { @@ -2750,7 +2750,7 @@ LLFloater* LLFloaterView::getFrontmostClosableFloater() } } - return NULL; + return nullptr; } void LLFloaterView::unhighlightFocusedFloater() @@ -3073,7 +3073,7 @@ LLFloater *LLFloaterView::getFocusedFloater() const } } } - return NULL; + return nullptr; } LLFloater *LLFloaterView::getFrontmost() const @@ -3086,12 +3086,12 @@ LLFloater *LLFloaterView::getFrontmost() const return (LLFloater *)viewp; } } - return NULL; + return nullptr; } LLFloater *LLFloaterView::getBackmost() const { - LLFloater* back_most = NULL; + LLFloater* back_most = nullptr; for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; @@ -3110,7 +3110,7 @@ void LLFloaterView::syncFloaterTabOrder() return; // look for a visible modal dialog, starting from first - LLModalDialog* modal_dialog = NULL; + LLModalDialog* modal_dialog = nullptr; for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLModalDialog* dialog = dynamic_cast(*child_it); @@ -3194,7 +3194,7 @@ LLFloater* LLFloaterView::getParentFloater(LLView* viewp) const return dynamic_cast(viewp); } - return NULL; + return nullptr; } S32 LLFloaterView::getZOrder(LLFloater* child) @@ -3584,7 +3584,7 @@ bool LLFloater::buildFromFile(const std::string& filename) getCommitCallbackRegistrar().pushScope(); getEnableCallbackRegistrar().pushScope(); - res = initFloaterXML(root, getParent(), filename, NULL); + res = initFloaterXML(root, getParent(), filename, nullptr); setXMLFilename(filename); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 9e1594bdd2d..bf25e1a3d65 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -219,7 +219,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb ); void initFromParams(const LLFloater::Params& p); - bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); + bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = nullptr); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); /*virtual*/ bool canSnapTo(const LLView* other_view); @@ -269,7 +269,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker /// isShown() differs from getVisible() in that isShown() also considers /// isMinimized(). isShown() is true only if visible and not minimized. bool isShown() const; - /// The static isShown() can accept a NULL pointer (which of course + /// The static isShown() can accept a nullptr pointer (which of course /// returns false). When non-NULL, it calls the non-static isShown(). static bool isShown(const LLFloater* floater); static bool isVisible(const LLFloater* floater); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index a818e72f59e..d8bef3e0909 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -87,14 +87,14 @@ LLFloater* LLFloaterReg::getLastFloaterInGroup(std::string_view name) } } } - return NULL; + return nullptr; } LLFloater* LLFloaterReg::getLastFloaterCascading() { LLRect candidate_rect; candidate_rect.mTop = 100000; - LLFloater* candidate_floater = NULL; + LLFloater* candidate_floater = nullptr; std::map::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end(); for( ; it != it_end; ++it) @@ -124,7 +124,7 @@ LLFloater* LLFloaterReg::getLastFloaterCascading() //static LLFloater* LLFloaterReg::findInstance(std::string_view name, const LLSD& key) { - LLFloater* res = NULL; + LLFloater* res = nullptr; auto it = sGroupMap.find(name); if (it != sGroupMap.end()) { @@ -170,13 +170,13 @@ LLFloater* LLFloaterReg::getInstance(std::string_view name, const LLSD& key) if (!res) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; - return NULL; + return nullptr; } bool success = res->buildFromFile(xui_file); if (!success) { LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; - return NULL; + return nullptr; } // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe @@ -186,7 +186,7 @@ LLFloater* LLFloaterReg::getInstance(std::string_view name, const LLSD& key) } res->setInstanceName(std::string(name)); - LLFloater* last_floater = (list.empty() ? NULL : list.back()); + LLFloater* last_floater = (list.empty() ? nullptr : list.back()); res->applyControlsAndPosition(last_floater); @@ -208,7 +208,7 @@ LLFloater* LLFloaterReg::getInstance(std::string_view name, const LLSD& key) //static LLFloater* LLFloaterReg::removeInstance(std::string_view name, const LLSD& key) { - LLFloater* res = NULL; + LLFloater* res = nullptr; auto it = sGroupMap.find(name); if (it != sGroupMap.end()) { @@ -290,7 +290,7 @@ bool LLFloaterReg::hideInstance(std::string_view name, const LLSD& key) { instance->closeHostedFloater(); } - return (instance != NULL); + return (instance != nullptr); } //static diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 24d1476dda5..8c65c7c67de 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -101,7 +101,7 @@ class LLFloaterReg static const_instance_list_t& getFloaterList(std::string_view name); // Visibility Management - // return NULL if instance not found or can't create instance (no builder) + // return nullptr if instance not found or can't create instance (no builder) static LLFloater* showInstance(std::string_view name, const LLSD& key = LLSD(), bool focus = false); // Close a floater (may destroy or set invisible) // return false if can't find instance diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 2e198e8dbcd..43743352fbe 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -36,7 +36,7 @@ const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24; LLFlyoutButton::LLFlyoutButton(const Params& p) : LLComboBox(p), mToggleState(false), - mActionButton(NULL) + mActionButton(nullptr) { // Always use text box // Text label button diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 7544a444785..5d4f1d46e07 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -154,13 +154,13 @@ struct LLFocusMgr::Impl LLFocusMgr gFocusMgr; LLFocusMgr::LLFocusMgr() -: mLockedView( NULL ), - mMouseCaptor( NULL ), - mKeyboardFocus( NULL ), - mLastKeyboardFocus( NULL ), - mDefaultKeyboardFocus( NULL ), +: mLockedView( nullptr ), + mMouseCaptor( nullptr ), + mKeyboardFocus( nullptr ), + mLastKeyboardFocus( nullptr ), + mDefaultKeyboardFocus( nullptr ), mKeystrokesOnly(false), - mTopCtrl( NULL ), + mTopCtrl( nullptr ), mAppHasFocus(true), // Macs don't seem to notify us that we've gotten focus, so default to true mImpl(new LLFocusMgr::Impl) { @@ -170,22 +170,22 @@ LLFocusMgr::~LLFocusMgr() { mImpl->mFocusHistory.clear(); delete mImpl; - mImpl = NULL; + mImpl = nullptr; } void LLFocusMgr::releaseFocusIfNeeded( LLView* view ) { if( childHasMouseCapture( view ) ) { - setMouseCapture( NULL ); + setMouseCapture( nullptr ); } if( childHasKeyboardFocus( view )) { if (view == mLockedView) { - mLockedView = NULL; - setKeyboardFocus( NULL ); + mLockedView = nullptr; + setKeyboardFocus( nullptr ); } else { @@ -205,7 +205,7 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool focus_dirty = false; if (mLockedView && - (new_focus == NULL || + (new_focus == nullptr || (new_focus != mLockedView && dynamic_cast(new_focus) && !dynamic_cast(new_focus)->hasAncestor(mLockedView)))) @@ -277,7 +277,7 @@ void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool // If we've got a default keyboard focus, and the caller is // releasing keyboard focus, move to the default. - if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL) + if (mDefaultKeyboardFocus != nullptr && mKeyboardFocus == nullptr) { mDefaultKeyboardFocus->setFocus(true); } @@ -329,7 +329,7 @@ bool LLFocusMgr::childHasKeyboardFocus(const LLView* parent ) const // Returns true is parent or any descedent of parent is the mouse captor. bool LLFocusMgr::childHasMouseCapture( const LLView* parent ) const { - if( mMouseCaptor && dynamic_cast(mMouseCaptor) != NULL ) + if( mMouseCaptor && dynamic_cast(mMouseCaptor) != nullptr ) { LLView* captor_view = (LLView*)mMouseCaptor; while( captor_view ) @@ -350,12 +350,12 @@ void LLFocusMgr::removeKeyboardFocusWithoutCallback( const LLFocusableElement* f // in order to unlock it if (focus == mLockedView) { - mLockedView = NULL; + mLockedView = nullptr; } if( mKeyboardFocus == focus ) { - mKeyboardFocus = NULL; + mKeyboardFocus = nullptr; } } @@ -405,7 +405,7 @@ void LLFocusMgr::removeMouseCaptureWithoutCallback( const LLMouseHandler* captor { if( mMouseCaptor == captor ) { - mMouseCaptor = NULL; + mMouseCaptor = nullptr; } } @@ -426,7 +426,7 @@ bool LLFocusMgr::childIsTopCtrl( const LLView* parent ) const -// set new_top = NULL to release top_view. +// set new_top = nullptr to release top_view. void LLFocusMgr::setTopCtrl( LLUICtrl* new_top ) { LLUICtrl* old_top = mTopCtrl; @@ -445,7 +445,7 @@ void LLFocusMgr::removeTopCtrlWithoutCallback( const LLUICtrl* top_view ) { if( mTopCtrl == top_view ) { - mTopCtrl = NULL; + mTopCtrl = nullptr; } } @@ -456,7 +456,7 @@ void LLFocusMgr::lockFocus() void LLFocusMgr::unlockFocus() { - mLockedView = NULL; + mLockedView = nullptr; } F32 LLFocusMgr::getFocusFlashAmt() const @@ -507,7 +507,7 @@ LLView* LLFocusMgr::getLastFocusForGroup(LLView* subtree_root) const return found_it->second.get(); } } - return NULL; + return nullptr; } void LLFocusMgr::clearLastFocusForGroup(LLView* subtree_root) diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 89fee5c9f14..947ef66ac0d 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -86,13 +86,13 @@ class LLFocusMgr ~LLFocusMgr(); // Mouse Captor - void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse. + void setMouseCapture(LLMouseHandler* new_captor); // new_captor = nullptr to release the mouse. LLMouseHandler* getMouseCapture() const { return mMouseCaptor; } void removeMouseCaptureWithoutCallback( const LLMouseHandler* captor ); bool childHasMouseCapture( const LLView* parent ) const; // Keyboard Focus - void setKeyboardFocus(LLFocusableElement* new_focus, bool lock = false, bool keystrokes_only = false); // new_focus = NULL to release the focus. + void setKeyboardFocus(LLFocusableElement* new_focus, bool lock = false, bool keystrokes_only = false); // new_focus = nullptr to release the focus. LLFocusableElement* getKeyboardFocus() const { return mKeyboardFocus; } LLFocusableElement* getLastKeyboardFocus() const { return mLastKeyboardFocus; } bool childHasKeyboardFocus( const LLView* parent ) const; @@ -109,7 +109,7 @@ class LLFocusMgr LLView* getLastFocusForGroup(LLView* subtree_root) const; void clearLastFocusForGroup(LLView* subtree_root); - // If setKeyboardFocus(NULL) is called, and there is a non-NULL default + // If setKeyboardFocus(nullptr) is called, and there is a non-NULL default // keyboard focus view, focus goes there. JC void setDefaultKeyboardFocus(LLFocusableElement* default_focus) { mDefaultKeyboardFocus = default_focus; } LLFocusableElement* getDefaultKeyboardFocus() const { return mDefaultKeyboardFocus; } @@ -125,7 +125,7 @@ class LLFocusMgr void releaseFocusIfNeeded( LLView* top_view ); void lockFocus(); void unlockFocus(); - bool focusLocked() const { return mLockedView != NULL; } + bool focusLocked() const { return mLockedView != nullptr; } bool keyboardFocusHasAccelerators() const; diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index db4ab8487e5..2e431da479f 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -78,7 +78,7 @@ F32 LLFolderView::sAutoOpenTime = 1.f; // LLFolderView* root = getRoot(); // if( root ) // { -// root->arrange( NULL, NULL ); +// root->arrange( nullptr, nullptr ); // root->scrollToShowSelection(); // } // to patch things up. @@ -162,14 +162,14 @@ LLFolderView::Params::Params() // Default constructor LLFolderView::LLFolderView(const Params& p) : LLFolderViewFolder(p), - mScrollContainer( NULL ), + mScrollContainer( nullptr ), mPopupMenuHandle(), mMenuFileName(p.options_menu), mAllowMultiSelect(p.allow_multiselect), mAllowDrag(p.allow_drag), mShowEmptyMessage(p.show_empty_message), mShowFolderHierarchy(false), - mRenameItem( NULL ), + mRenameItem( nullptr ), mNeedsScroll( false ), mUseLabelSuffix(p.use_label_suffix), mSuppressFolderMenu(p.suppress_folder_menu), @@ -183,11 +183,11 @@ LLFolderView::LLFolderView(const Params& p) mSignalSelectCallback(0), mMinWidth(0), mDragAndDropThisFrame(false), - mCallbackRegistrar(NULL), - mEnableRegistrar(NULL), + mCallbackRegistrar(nullptr), + mEnableRegistrar(nullptr), mUseEllipses(p.use_ellipses), - mDraggingOverItem(NULL), - mStatusTextBox(NULL), + mDraggingOverItem(nullptr), + mStatusTextBox(nullptr), mShowItemLinkOverlays(p.show_item_link_overlays), mViewModel(p.view_model), mGroupedItemModel(p.grouped_item_model), @@ -204,7 +204,7 @@ LLFolderView::LLFolderView(const Params& p) setRect( rect ); reshape(rect.getWidth(), rect.getHeight()); mAutoOpenItems.setDepth(AUTO_OPEN_STACK_DEPTH); - mAutoOpenCandidate = NULL; + mAutoOpenCandidate = nullptr; mAutoOpenTimer.stop(); mKeyboardSelection = false; mIndentation = getParentFolder() ? getParentFolder()->getIndentation() + mLocalIndentation : 0; @@ -270,10 +270,10 @@ LLFolderView::~LLFolderView( void ) // destroyed scollcontainer. Just null it out here, and no worries // about calling into the invalid scroll container. // Same with the renamer. - mScrollContainer = NULL; - mRenameItem = NULL; - mRenamer = NULL; - mStatusTextBox = NULL; + mScrollContainer = nullptr; + mRenameItem = nullptr; + mRenamer = nullptr; + mStatusTextBox = nullptr; if (mPopupMenuHandle.get()) { @@ -287,8 +287,8 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); - //mViewModel->setFolderView(NULL); - mViewModel = NULL; + //mViewModel->setFolderView(nullptr); + mViewModel = nullptr; } bool LLFolderView::canFocusChildren() const @@ -421,7 +421,7 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void ) llassert(itemp->getIsCurSelection()); return itemp; } - return NULL; + return nullptr; } LLFolderView::selected_items_t& LLFolderView::getSelectedItems( void ) @@ -522,7 +522,7 @@ void LLFolderView::sanitizeSelection() // ensure that each ancestor is open and potentially passes filtering bool visible = false; - if(item->getViewModelItem() != NULL) + if(item->getViewModelItem() != nullptr) { visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item } @@ -576,7 +576,7 @@ void LLFolderView::sanitizeSelection() if (mSelectedItems.empty()) { // ...select first available parent of original selection - LLFolderViewItem* new_selection = NULL; + LLFolderViewItem* new_selection = nullptr; if (original_selected_item) { for(LLFolderViewFolder* parent_folder = original_selected_item->getParentFolder(); @@ -602,7 +602,7 @@ void LLFolderView::sanitizeSelection() } else { - new_selection = NULL; + new_selection = nullptr; } if (new_selection) @@ -652,8 +652,7 @@ bool LLFolderView::startDrag() void LLFolderView::commitRename( const LLSD& data ) { finishRenamingItem(); - arrange( NULL, NULL ); - + arrange( nullptr, nullptr ); } void LLFolderView::draw() @@ -757,7 +756,7 @@ void LLFolderView::removeSelectedItems() if(getVisible() && getEnabled()) { // just in case we're removing the renaming item. - mRenameItem = NULL; + mRenameItem = nullptr; // create a temporary structure which we will use to remove // items, since the removal will futz with internal data @@ -765,7 +764,7 @@ void LLFolderView::removeSelectedItems() std::vector items; auto count = mSelectedItems.size(); if(count <= 0) return; - LLFolderViewItem* item = NULL; + LLFolderViewItem* item = nullptr; selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { @@ -870,7 +869,7 @@ void LLFolderView::closeAutoOpenedFolders() { mAutoOpenCandidate->setAutoOpenCountdown(0.f); } - mAutoOpenCandidate = NULL; + mAutoOpenCandidate = nullptr; mAutoOpenTimer.stop(); } @@ -930,7 +929,7 @@ void LLFolderView::copy() auto count = mSelectedItems.size(); if(getVisible() && getEnabled() && (count > 0)) { - LLFolderViewModelItem* listener = NULL; + LLFolderViewModelItem* listener = nullptr; selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { @@ -1036,7 +1035,7 @@ void LLFolderView::paste() { LLFolderViewItem* item = *selected_it; LLFolderViewFolder* folder = dynamic_cast(item); - if (folder == NULL) + if (folder == nullptr) { folder = item->getParentFolder(); } @@ -1065,7 +1064,7 @@ void LLFolderView::startRenamingSelectedItem( void ) scrollToShowSelection(); auto count = mSelectedItems.size(); - LLFolderViewItem* item = NULL; + LLFolderViewItem* item = nullptr; if(count > 0) { item = mSelectedItems.front(); @@ -1398,7 +1397,7 @@ bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc if (!search_item) { // start from first item - search_item = getNextFromChild(NULL); + search_item = getNextFromChild(nullptr); } // search over all open nodes for first substring match (with wrapping) @@ -1411,11 +1410,11 @@ bool LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc { if (backward) { - search_item = getPreviousFromChild(NULL); + search_item = getPreviousFromChild(nullptr); } else { - search_item = getNextFromChild(NULL); + search_item = getNextFromChild(nullptr); } if (!search_item || search_item == original_search_item) { @@ -1464,7 +1463,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) // this way, we know when to stop auto-updating a search mParentPanel.get()->setFocus(true); - bool handled = childrenHandleRightMouseDown(x, y, mask) != NULL; + bool handled = childrenHandleRightMouseDown(x, y, mask) != nullptr; auto count = mSelectedItems.size(); LLMenuGL* menu = static_cast(mPopupMenuHandle.get()); @@ -1478,7 +1477,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { mEnableRegistrar->pushScope(); } - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); menu = LLUICtrlFactory::getInstance()->createFromFile(mMenuFileName, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { @@ -1539,7 +1538,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { menu->setVisible(false); } - setSelection(NULL, false, true); + setSelection(nullptr, false, true); } return handled; } @@ -1548,7 +1547,7 @@ bool LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) bool LLFolderView::addNoOptions(LLMenuGL* menu) const { const std::string nooptions_str = "--no options--"; - LLView *nooptions_item = NULL; + LLView *nooptions_item = nullptr; const LLView::child_list_t *list = menu->getChildList(); for (LLView::child_list_t::const_iterator itor = list->begin(); @@ -1630,10 +1629,10 @@ void LLFolderView::deleteAllChildren() gIdleCallbacks.deleteFunction(onIdleUpdateMenu, this); } mPopupMenuHandle.markDead(); - mScrollContainer = NULL; - mRenameItem = NULL; - mRenamer = NULL; - mStatusTextBox = NULL; + mScrollContainer = nullptr; + mRenameItem = nullptr; + mRenamer = nullptr; + mStatusTextBox = nullptr; clearSelection(); LLView::deleteAllChildren(); @@ -1727,7 +1726,7 @@ void LLFolderView::update() LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_INVENTORY); // If there's no model, the view is in suspended state (being deleted) and shouldn't be updated - if (getFolderViewModel() == NULL) + if (getFolderViewModel() == nullptr) { return; } @@ -1754,7 +1753,7 @@ void LLFolderView::update() if (mNeedsAutoSelect) { // select new item only if a filtered item not currently selected and there was a selection - LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); + LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? nullptr : mSelectedItems.back(); if (!mAutoSelectOverride && selected_itemp && !selected_itemp->getViewModelItem()->potentiallyVisible()) { // these are named variables to get around gcc not binding non-const references to rvalues @@ -2021,7 +2020,7 @@ bool LLFolderView::isFolderSelected() for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) { LLFolderViewFolder* folder = dynamic_cast(*item_iter); - if (folder != NULL) + if (folder != nullptr) { return true; } @@ -2126,7 +2125,7 @@ void LLFolderView::onRenamerLost() if( mRenameItem ) { setSelection( mRenameItem, true ); - mRenameItem = NULL; + mRenameItem = nullptr; } } diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 368a86ea849..5377d1d2198 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -270,7 +270,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler static void onIdleUpdateMenu(void* user_data); protected: - LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. + LLScrollContainer* mScrollContainer; // nullptr if this is not a child of a scroll container. void commitRename( const LLSD& data ); void onRenamerLost(); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 878f1cb856e..6b2a5e1cd7d 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -173,7 +173,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mHasFavorites(false), mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), - mParentFolder( NULL ), + mParentFolder( nullptr ), mIsSelected( false ), mIsCurSelection( false ), mSelectPending(false), @@ -229,7 +229,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) // Destroys the object LLFolderViewItem::~LLFolderViewItem() { - mViewModelItem = NULL; + mViewModelItem = nullptr; gFocusMgr.removeKeyboardFocusWithoutCallback(this); } @@ -287,7 +287,7 @@ LLFolderViewItem* LLFolderViewItem::getNextOpenNode(bool include_children) { if (!mParentFolder) { - return NULL; + return nullptr; } LLFolderViewItem* itemp = mParentFolder->getNextFromChild( this, include_children ); @@ -309,7 +309,7 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(bool include_children) { if (!mParentFolder) { - return NULL; + return nullptr; } LLFolderViewItem* itemp = mParentFolder->getPreviousFromChild( this, include_children ); @@ -682,13 +682,13 @@ bool LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) && root->startDrag()) { // RN: when starting drag and drop, clear out last auto-open - root->autoOpenTest(NULL); + root->autoOpenTest(nullptr); root->setShowSelectionContext(true); // Release keyboard focus, so that if stuff is dropped into the // world, pressing the delete key won't blow away the inventory // item. - gFocusMgr.setKeyboardFocus(NULL); + gFocusMgr.setKeyboardFocus(nullptr); getWindow()->setCursor(UI_CURSOR_ARROW); } @@ -751,7 +751,7 @@ bool LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) { getRoot()->setShowSelectionContext(false); } - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); } return true; } @@ -791,7 +791,7 @@ bool LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, // store this item to get it in LLFolderBridge::dragItemIntoFolder on drop event. mRoot->setDraggingOverItem(this); handled = mParentFolder->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg); - mRoot->setDraggingOverItem(NULL); + mRoot->setDraggingOverItem(nullptr); } if (handled) { @@ -1521,7 +1521,7 @@ bool LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, bool selec LLFolderViewFolder* LLFolderViewFolder::getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse) { - if (!item_a->getParentFolder() || !item_b->getParentFolder()) return NULL; + if (!item_a->getParentFolder() || !item_b->getParentFolder()) return nullptr; std::deque item_a_ancestors; @@ -1606,12 +1606,12 @@ LLFolderViewFolder* LLFolderViewFolder::getCommonAncestor(LLFolderViewItem* item item_b_ancestors.pop_front(); } - return NULL; + return nullptr; } void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector& items) { - bool selecting = start == NULL; + bool selecting = start == nullptr; if (reverse) { for (items_t::reverse_iterator it = mItems.rbegin(), end_it = mItems.rend(); @@ -1701,7 +1701,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) return; LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); - if (cur_selected_item == NULL) + if (cur_selected_item == nullptr) { cur_selected_item = new_selection; } @@ -1719,7 +1719,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) while (cur_folder != common_ancestor) { - cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); + cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, nullptr, reverse, items_to_select_forward); last_selected_item_from_cur = cur_folder; cur_folder = cur_folder->getParentFolder(); @@ -1731,7 +1731,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) cur_folder = new_selection->getParentFolder(); while (cur_folder != common_ancestor) { - cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); + cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, nullptr, !reverse, items_to_select_reverse); last_selected_item_from_new = cur_folder; cur_folder = cur_folder->getParentFolder(); @@ -2185,7 +2185,7 @@ bool LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, } // drag and drop to child item, so clear pending auto-opens - getRoot()->autoOpenTest(NULL); + getRoot()->autoOpenTest(nullptr); return true; } @@ -2241,7 +2241,7 @@ bool LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, if (isOpen()) { - handled = (childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL); + handled = (childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != nullptr); } if (!handled) @@ -2295,7 +2295,7 @@ bool LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) if( isOpen() ) { - handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; + handled = childrenHandleRightMouseDown( x, y, mask ) != nullptr; } if (!handled) { @@ -2325,7 +2325,7 @@ bool LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) bool handled = false; if( isOpen() ) { - handled = childrenHandleMouseDown(x,y,mask) != NULL; + handled = childrenHandleMouseDown(x,y,mask) != nullptr; } if( !handled ) { @@ -2369,7 +2369,7 @@ bool LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) if( isOpen() ) { - handled = childrenHandleDoubleClick( x, y, mask ) != NULL; + handled = childrenHandleDoubleClick( x, y, mask ) != nullptr; } if( !handled ) { @@ -2423,9 +2423,9 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, { bool found_item = false; - LLFolderViewItem* result = NULL; + LLFolderViewItem* result = nullptr; // when not starting from a given item, start at beginning - if(item == NULL) + if(item == nullptr) { found_item = true; } @@ -2450,7 +2450,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, if (include_children && (*fit)->isOpen()) { // look for first descendant - return (*fit)->getNextFromChild(NULL, true); + return (*fit)->getNextFromChild(nullptr, true); } // otherwise advance to next folder ++fit; @@ -2480,7 +2480,7 @@ LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, // you should never call this method with an item that isn't a child // so we should always find something llassert(false); - return NULL; + return nullptr; } // at this point, either iit or fit point to a candidate "next" item @@ -2528,9 +2528,9 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it { bool found_item = false; - LLFolderViewItem* result = NULL; + LLFolderViewItem* result = nullptr; // when not starting from a given item, start at end - if(item == NULL) + if(item == nullptr) { found_item = true; } @@ -2578,7 +2578,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it // you should never call this method with an item that isn't a child // so we should always find something llassert(false); - return NULL; + return nullptr; } // at this point, either iit or fit point to a candidate "next" item @@ -2610,7 +2610,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it // try selecting child element of this folder if ((*fit)->isOpen() && include_children) { - result = (*fit)->getPreviousFromChild(NULL); + result = (*fit)->getPreviousFromChild(nullptr); } else { diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 07e8b890b83..c33011137f2 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -151,7 +151,7 @@ class LLFolderViewModelItem : public LLRefCount virtual LLPointer getIcon() const = 0; virtual LLPointer getIconOpen() const { return getIcon(); } - virtual LLPointer getIconOverlay() const { return NULL; } + virtual LLPointer getIconOverlay() const { return nullptr; } virtual LLFontGL::StyleFlags getLabelStyle() const = 0; virtual std::string getLabelSuffix() const = 0; @@ -244,12 +244,12 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem mPassedFolderFilter(true), mStringMatchOffsetFilter(std::string::npos), mStringFilterSize(0), - mFolderViewItem(NULL), + mFolderViewItem(nullptr), mLastFilterGeneration(-1), mLastFolderFilterGeneration(-1), mMarkedDirtyGeneration(-1), mMostFilteredDescendantGeneration(-1), - mParent(NULL), + mParent(nullptr), mRootViewModel(root_view_model) { mChildren.clear(); @@ -301,7 +301,7 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem virtual void removeChild(LLFolderViewModelItem* child) override final { - child->setParent(NULL); + child->setParent(nullptr); mChildren.remove(child); dirtyDescendantsFilter(); dirtyFilter(); @@ -310,7 +310,7 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem virtual void clearChildren() override { // We are working with models that belong to views as LLPointers, clean the list, let poiters handle the rest - std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(nullptr); }); mChildren.clear(); dirtyDescendantsFilter(); dirtyFilter(); @@ -365,7 +365,7 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem protected: virtual void setParent(LLFolderViewModelItem* parent) override final { mParent = parent; } virtual const LLFolderViewModelItem* getParent() override { return mParent; }; - virtual bool hasParent() override { return mParent != NULL; } + virtual bool hasParent() override { return mParent != nullptr; } S32 mSortVersion; bool mPassedFilter; @@ -393,7 +393,7 @@ class LLFolderViewModelCommon : public LLFolderViewModelInterface public: LLFolderViewModelCommon() : mTargetSortVersion(0), - mFolderView(NULL) + mFolderView(nullptr) {} virtual void requestSortAll() override diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 83379dd0a91..a5901bce33d 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -71,7 +71,7 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) LLIconCtrl::~LLIconCtrl() { - mImagep = NULL; + mImagep = nullptr; } diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 2bea8fb4ed2..f4a744cd456 100644 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -565,7 +565,7 @@ void LLKeywords::findSegments(std::vector* seg_list, const LLW // Check against delimiters { S32 seg_start = 0; - LLKeywordToken* cur_delimiter = NULL; + LLKeywordToken* cur_delimiter = nullptr; for (token_list_t::iterator iter = mDelimiterTokenList.begin(); iter != mDelimiterTokenList.end(); ++iter) { diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index fe0591ce4b3..da71c757eb5 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -64,7 +64,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mCollapsed(false), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible - mResizeBar(NULL), + mResizeBar(nullptr), mFractionalSize(0.f), mTargetDim(0), mIgnoreReshape(false), @@ -554,7 +554,7 @@ void LLLayoutStack::setPanelSpacing(S32 val) LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const { - if (!panelp) return NULL; + if (!panelp) return nullptr; for (LLLayoutPanel* p : mPanels) { @@ -563,12 +563,12 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const return p; } } - return NULL; + return nullptr; } LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(std::string_view name) const { - LLLayoutPanel* result = NULL; + LLLayoutPanel* result = nullptr; for (LLLayoutPanel* p : mPanels) { @@ -586,7 +586,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) { for (LLLayoutPanel* lp : mPanels) { - if (lp->mResizeBar == NULL) + if (lp->mResizeBar == nullptr) { LLResizeBar::Params resize_params; resize_params.name("resize"); @@ -849,8 +849,8 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& F32 delta_auto_resize_headroom = 0.f; F32 old_auto_resize_headroom = 0.f; - LLLayoutPanel* other_resize_panel = NULL; - LLLayoutPanel* following_panel = NULL; + LLLayoutPanel* other_resize_panel = nullptr; + LLLayoutPanel* following_panel = nullptr; BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available... { diff --git a/indra/llui/lllazyvalue.h b/indra/llui/lllazyvalue.h index fc15ead032a..1d6192012c8 100644 --- a/indra/llui/lllazyvalue.h +++ b/indra/llui/lllazyvalue.h @@ -58,7 +58,7 @@ class LLLazyValue void set(T_const_ref val) { mValue = val; - mValueGetter = NULL; + mValueGetter = nullptr; } T_const_ref get() const @@ -72,7 +72,7 @@ class LLLazyValue bool isUsingFunction() const { - return mValueGetter != NULL; + return mValueGetter != nullptr; } private: diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index b534c8d4e82..66fc2519f34 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -229,7 +229,7 @@ LLLineEditor::~LLLineEditor() { menu->hide(); } - setContextMenu(NULL); + setContextMenu(nullptr); // calls onCommit() while LLLineEditor still valid gFocusMgr.releaseFocusIfNeeded( this ); @@ -264,7 +264,7 @@ void LLLineEditor::onFocusLost() if( gEditMenuHandler == this ) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } getWindow()->showCursorFromMouseMove(); @@ -750,7 +750,7 @@ bool LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) bool LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) { // Check first whether the "clear search" button wants to deal with this. - if(childrenHandleMouseDown(x, y, mask) != NULL) + if(childrenHandleMouseDown(x, y, mask) != nullptr) { return true; } @@ -866,7 +866,7 @@ bool LLLineEditor::handleHover(S32 x, S32 y, MASK mask) // Check first whether the "clear search" button wants to deal with this. if(!hasMouseCapture()) { - if(childrenHandleHover(x, y, mask) != NULL) + if(childrenHandleHover(x, y, mask) != nullptr) { return true; } @@ -931,12 +931,12 @@ bool LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); handled = true; } // Check first whether the "clear search" button wants to deal with this. - if(!handled && childrenHandleMouseUp(x, y, mask) != NULL) + if(!handled && childrenHandleMouseUp(x, y, mask) != nullptr) { return true; } @@ -2282,7 +2282,7 @@ void LLLineEditor::setFocus( bool new_state ) // but limited paranoia is ok. if( gEditMenuHandler == this ) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } endSelection(); @@ -2731,7 +2731,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) LLContextMenu* menu = static_cast(mContextMenuHandle.get()); if (!menu) { - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); menu = LLUICtrlFactory::createFromFile ("menu_text_editor.xml", LLMenuGL::sMenuContainer, diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 3f762822eeb..f95a0298e94 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -286,7 +286,7 @@ class LLLineEditor void setReplaceNewlinesWithSpaces(bool replace); - void resetContextMenu() { setContextMenu(NULL); }; + void resetContextMenu() { setContextMenu(nullptr); }; void setBgImage(LLPointer image) { mBgImage = image; } void setBgImageFocused(LLPointer image) { mBgImageFocused = image; } diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index 70730705e62..a44b308925c 100644 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp @@ -75,7 +75,7 @@ void LLLoadingIndicator::draw() start(); } - LLUIImagePtr cur_image = mImages.empty() ? LLUIImagePtr(NULL) : mImages[mCurImageIdx]; + LLUIImagePtr cur_image = mImages.empty() ? LLUIImagePtr(nullptr) : mImages[mCurImageIdx]; // Draw current image. if( cur_image.notNull() ) diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 2f91dcb0464..3801f2aaedd 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -94,7 +94,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit return; } - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 2ca2454040f..3dda6932fb4 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -63,7 +63,7 @@ #include // static -LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; +LLMenuHolderGL *LLMenuGL::sMenuContainer = nullptr; view_listener_t::listener_map_t view_listener_t::sListeners; S32 MENU_BAR_HEIGHT = 18; @@ -271,7 +271,7 @@ bool LLMenuItemGL::handleRightMouseUp(S32 x, S32 y, MASK mask) // if not, it will be added to the list bool LLMenuItemGL::addToAcceleratorList(std::list *listp) { - LLMenuKeyboardBinding *accelerator = NULL; + LLMenuKeyboardBinding *accelerator = nullptr; if (mAcceleratorKey != KEY_NONE) { @@ -522,19 +522,19 @@ void LLMenuItemGL::draw( void ) if( !mDrawBoolLabel.empty() ) { mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, nullptr, false ); } mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, nullptr, false ); if( !mDrawAccelLabel.empty() ) { mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, nullptr, false ); } if( !mDrawBranchLabel.empty() ) { mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color, - LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, false ); + LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, nullptr, false ); } } @@ -710,7 +710,7 @@ LLFloater* LLMenuItemTearOffGL::getParentFloater() } } - return NULL; + return nullptr; } void LLMenuItemTearOffGL::onCommit() @@ -1085,7 +1085,7 @@ void LLMenuItemBranchGL::onCommit( void ) // to facilitate fast menu control via jump keys if (LLMenuGL::getKeyboardMode() && getBranch() && !getBranch()->getHighlightedItem()) { - getBranch()->highlightNextItem(NULL); + getBranch()->highlightNextItem(nullptr); } LLUICtrl::onCommit(); @@ -1182,7 +1182,7 @@ void LLMenuItemBranchGL::draw() void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) { - if (getBranch() && getBranch()->getParent() == NULL) + if (getBranch() && getBranch()->getParent() == nullptr) { // make the branch menu a sibling of my parent menu getBranch()->updateParent(parentp); @@ -1240,7 +1240,7 @@ bool LLMenuItemBranchGL::handleKeyHere(KEY key, MASK mask) // switch to keyboard navigation mode LLMenuGL::setKeyboardMode(true); - LLMenuItemGL* itemp = branch->highlightNextItem(NULL); + LLMenuItemGL* itemp = branch->highlightNextItem(nullptr); if (itemp) { return true; @@ -1275,7 +1275,7 @@ void LLMenuItemBranchGL::openMenu() { gFloaterView->bringToFront(branch_parent); // this might not be necessary, as torn off branches don't get focus and hence no highligth - branch->highlightNextItem(NULL); + branch->highlightNextItem(nullptr); } } else if( !branch->getVisible() ) @@ -1591,7 +1591,7 @@ bool LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) { onCommit(); } - getBranch()->highlightNextItem(NULL); + getBranch()->highlightNextItem(nullptr); return true; } else if (key == KEY_UP) @@ -1603,7 +1603,7 @@ bool LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask) { onCommit(); } - getBranch()->highlightPrevItem(NULL); + getBranch()->highlightPrevItem(nullptr); return true; } } @@ -1778,12 +1778,12 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mMouseVelX(0), mMouseVelY(0), mTornOff(false), - mTearOffItem(NULL), - mSpilloverBranch(NULL), - mFirstVisibleItem(NULL), - mArrowUpItem(NULL), - mArrowDownItem(NULL), - mSpilloverMenu(NULL), + mTearOffItem(nullptr), + mSpilloverBranch(nullptr), + mFirstVisibleItem(nullptr), + mArrowUpItem(nullptr), + mArrowDownItem(nullptr), + mSpilloverMenu(nullptr), mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), mNeedsArrange(false), @@ -1830,18 +1830,18 @@ LLMenuGL::~LLMenuGL( void ) void LLMenuGL::setCanTearOff(bool tear_off) { - if (tear_off && mTearOffItem == NULL) + if (tear_off && mTearOffItem == nullptr) { LLMenuItemTearOffGL::Params p; mTearOffItem = LLUICtrlFactory::create(p); addChild(mTearOffItem); } - else if (!tear_off && mTearOffItem != NULL) + else if (!tear_off && mTearOffItem != nullptr) { mItems.remove(mTearOffItem); removeChild(mTearOffItem); delete mTearOffItem; - mTearOffItem = NULL; + mTearOffItem = nullptr; needsArrange(); } } @@ -1987,7 +1987,7 @@ bool LLMenuGL::isOpen() bool LLMenuGL::scrollItems(EScrollingDirection direction) { // Slowing down items scrolling when arrow button is held - if (mScrollItemsTimer.hasExpired() && NULL != mFirstVisibleItem) + if (mScrollItemsTimer.hasExpired() && nullptr != mFirstVisibleItem) { mScrollItemsTimer.setTimerExpirySec(.033f); } @@ -2022,7 +2022,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) } case SD_DOWN: { - if (NULL == mFirstVisibleItem) + if (nullptr == mFirstVisibleItem) { mFirstVisibleItem = *mItems.begin(); } @@ -2219,7 +2219,7 @@ void LLMenuGL::arrange( void ) if (mScrollable) { // Determining visible items boundaries - if (NULL == mFirstVisibleItem) + if (nullptr == mFirstVisibleItem) { mFirstVisibleItem = *item_iter; } @@ -2315,7 +2315,7 @@ void LLMenuGL::arrange( void ) if (height_before_first_visible_item > MENU_ITEM_PADDING || height_before_first_visible_item + visible_items_height < (S32)height) { - if (NULL == mArrowUpItem) + if (nullptr == mArrowUpItem) { LLMenuScrollItem::Params item_params; item_params.name(ARROW_UP); @@ -2326,7 +2326,7 @@ void LLMenuGL::arrange( void ) LLUICtrl::addChild(mArrowUpItem); } - if (NULL == mArrowDownItem) + if (nullptr == mArrowDownItem) { LLMenuScrollItem::Params item_params; item_params.name(ARROW_DOWN); @@ -2353,11 +2353,11 @@ void LLMenuGL::arrange( void ) } else { - if (NULL != mArrowUpItem) + if (nullptr != mArrowUpItem) { mArrowUpItem->setVisible(false); } - if (NULL != mArrowDownItem) + if (nullptr != mArrowDownItem) { mArrowDownItem->setVisible(false); } @@ -2430,7 +2430,7 @@ void LLMenuGL::createSpilloverBranch() { if (!mSpilloverBranch) { - // should be NULL but delete anyway + // should be nullptr but delete anyway delete mSpilloverMenu; // technically, you can't tear off spillover menus, but we're passing the handle // along just to be safe @@ -2476,8 +2476,8 @@ void LLMenuGL::cleanupSpilloverBranch() // Delete the branch, and since the branch will delete the menu, // set the menu* to null. delete mSpilloverBranch; - mSpilloverBranch = NULL; - mSpilloverMenu = NULL; + mSpilloverBranch = nullptr; + mSpilloverMenu = nullptr; } } @@ -2586,9 +2586,9 @@ void LLMenuGL::empty( void ) cleanupSpilloverBranch(); mItems.clear(); - mFirstVisibleItem = NULL; - mArrowUpItem = NULL; - mArrowDownItem = NULL; + mFirstVisibleItem = nullptr; + mArrowUpItem = nullptr; + mArrowDownItem = nullptr; deleteAllChildren(); } @@ -2627,7 +2627,7 @@ void LLMenuGL::insert( S32 position, LLView * ctrl, bool arrange /*= true*/ ) { LLMenuItemGL * item = dynamic_cast(ctrl); - if (NULL == item || position < 0 || position >= mItems.size()) + if (nullptr == item || position < 0 || position >= mItems.size()) { return; } @@ -2832,7 +2832,7 @@ LLMenuItemGL* LLMenuGL::getItem(S32 number) number--; } } - return NULL; + return nullptr; } LLMenuItemGL* LLMenuGL::getItem(std::string name) @@ -2845,7 +2845,7 @@ LLMenuItemGL* LLMenuGL::getItem(std::string name) return (*item_iter); } } - return NULL; + return nullptr; } LLMenuItemGL* LLMenuGL::getHighlightedItem() @@ -2858,12 +2858,12 @@ LLMenuItemGL* LLMenuGL::getHighlightedItem() return (*item_iter); } } - return NULL; + return nullptr; } LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disabled) { - if (mItems.empty()) return NULL; + if (mItems.empty()) return nullptr; // highlighting first item on a torn off menu is the // same as giving focus to it if (!cur_item && getTornOff()) @@ -2899,7 +2899,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disa // and the first item is highlighted. if (mScrollable && !scrollItems(SD_BEGIN)) { - return NULL; + return nullptr; } } // If current item is the last visible, the menu is scrolled one item down @@ -2916,7 +2916,7 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disa } else { - return NULL; + return nullptr; } } } @@ -2963,12 +2963,12 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, bool skip_disa } } - return NULL; + return nullptr; } LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disabled) { - if (mItems.empty()) return NULL; + if (mItems.empty()) return nullptr; // highlighting first item on a torn off menu is the // same as giving focus to it @@ -3005,7 +3005,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disa // and the last item is highlighted. if (mScrollable && !scrollItems(SD_END)) { - return NULL; + return nullptr; } } // If current item is the first visible, the menu is scrolled one item up @@ -3022,7 +3022,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disa } else { - return NULL; + return nullptr; } } } @@ -3053,7 +3053,7 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, bool skip_disa } } - return NULL; + return nullptr; } void LLMenuGL::buildDrawLabels() @@ -3297,7 +3297,7 @@ LLMenuGL* LLMenuGL::findChildMenuByName(std::string_view name, bool recurse) con } } LL_WARNS() << "Child Menu " << name << " not found in menu " << getName() << LL_ENDL; - return NULL; + return nullptr; } bool LLMenuGL::clearHoverItem() @@ -3357,7 +3357,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S3 // Resetting scrolling position if (menu->isScrollable() && menu->isScrollPositionOnShowReset()) { - menu->mFirstVisibleItem = NULL; + menu->mFirstVisibleItem = nullptr; } // Fix menu rect if needed. @@ -3453,7 +3453,7 @@ bool LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) { // close menus originating from other menu bars when first opening menu via keyboard LLMenuGL::sMenuContainer->hideMenus(); - highlightNextItem(NULL); + highlightNextItem(nullptr); LLMenuGL::setKeyboardMode(true); } return true; @@ -3564,7 +3564,7 @@ void LLMenuBarGL::checkMenuTrigger() // close menus originating from other menu bars LLMenuGL::sMenuContainer->hideMenus(); - highlightNextItem(NULL); + highlightNextItem(nullptr); LLMenuGL::setKeyboardMode(true); } } @@ -3662,7 +3662,7 @@ bool LLMenuBarGL::appendMenu( LLMenuGL* menu ) bool LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) { bool handled = false; - LLView* active_menu = NULL; + LLView* active_menu = nullptr; bool no_mouse_data = mLastMouseX == 0 && mLastMouseY == 0; S32 mouse_delta_x = no_mouse_data ? 0 : x - mLastMouseX; @@ -3768,11 +3768,11 @@ void LLMenuHolderGL::draw() bool LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) { - bool handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleMouseDown(x, y, mask) != nullptr; if (!handled) { LLMenuGL* visible_menu = (LLMenuGL*)getVisibleMenu(); - LLMenuItemGL* parent_menu = visible_menu ? visible_menu->getParentMenuItem() : NULL; + LLMenuItemGL* parent_menu = visible_menu ? visible_menu->getParentMenuItem() : nullptr; if (parent_menu && parent_menu->getVisible()) { // don't hide menu if parent was hit @@ -3795,7 +3795,7 @@ bool LLMenuHolderGL::handleMouseDown( S32 x, S32 y, MASK mask ) bool LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) { - bool handled = LLView::childrenHandleRightMouseDown(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseDown(x, y, mask) != nullptr; if (!handled) { // clicked off of menu, hide them all @@ -3821,7 +3821,7 @@ bool LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) return true; } - bool handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; + bool handled = LLView::childrenHandleRightMouseUp(x, y, mask) != nullptr; if (!handled) { // clicked off of menu, hide them all @@ -3854,7 +3854,7 @@ bool LLMenuHolderGL::handleKey(KEY key, MASK mask, bool called_from_parent) else if (mask == MASK_NONE || (key >= KEY_LEFT && key <= KEY_DOWN)) { //highlight first enabled one - if(pMenu->highlightNextItem(NULL)) + if(pMenu->highlightNextItem(nullptr)) { handled = true; } @@ -3880,12 +3880,12 @@ LLView* const LLMenuHolderGL::getVisibleMenu() const for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - if (viewp->getVisible() && dynamic_cast(viewp) != NULL) + if (viewp->getVisible() && dynamic_cast(viewp) != nullptr) { return viewp; } } - return NULL; + return nullptr; } @@ -3903,7 +3903,7 @@ bool LLMenuHolderGL::hideMenus() for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { LLView* viewp = *child_it; - if (dynamic_cast(viewp) != NULL && viewp->getVisible()) + if (dynamic_cast(viewp) != nullptr && viewp->getVisible()) { viewp->setVisible(false); } @@ -3911,7 +3911,7 @@ bool LLMenuHolderGL::hideMenus() } //if (gFocusMgr.childHasKeyboardFocus(this)) //{ - // gFocusMgr.setKeyboardFocus(NULL); + // gFocusMgr.setKeyboardFocus(nullptr); //} return menu_visible; @@ -3961,7 +3961,7 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : mMenu = menup; // highlight first item (tear off item will be disabled) - mMenu->highlightNextItem(NULL); + mMenu->highlightNextItem(nullptr); // Can't do this in postBuild() because that is only called for floaters // constructed from XML. @@ -3995,7 +3995,7 @@ void LLTearOffMenu::onFocusReceived() // if nothing is highlighted, just highlight first item if (!mMenu->getHighlightedItem()) { - mMenu->highlightNextItem(NULL); + mMenu->highlightNextItem(nullptr); } // parent menu items get highlights so navigation logic keeps working @@ -4034,12 +4034,12 @@ bool LLTearOffMenu::handleKeyHere(KEY key, MASK mask) { if (key == KEY_UP) { - mMenu->highlightPrevItem(NULL); + mMenu->highlightPrevItem(nullptr); return true; } else if (key == KEY_DOWN) { - mMenu->highlightNextItem(NULL); + mMenu->highlightNextItem(nullptr); return true; } } @@ -4165,7 +4165,7 @@ void LLContextMenuBranch::showSubMenu() if(menu) { LLMenuItemGL* menu_item = menu->getParentMenuItem(); - if (menu_item != NULL && menu_item->getVisible()) + if (menu_item != nullptr && menu_item->getVisible()) { S32 center_x; S32 center_y; @@ -4212,7 +4212,7 @@ static MenuRegistry::Register context_menu_register2("context_men LLContextMenu::LLContextMenu(const Params& p) : LLMenuGL(p), mHoveredAnyItem(false), - mHoverItem(NULL) + mHoverItem(nullptr) { //setBackgroundVisible(true); } @@ -4299,7 +4299,7 @@ void LLContextMenu::hide() { mHoverItem->setHighlight( false ); } - mHoverItem = NULL; + mHoverItem = nullptr; } @@ -4333,7 +4333,7 @@ bool LLContextMenu::handleHover( S32 x, S32 y, MASK mask ) if (mHoverItem) { mHoverItem->setHighlight(false); - mHoverItem = NULL; + mHoverItem = nullptr; } } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index eacf2c59d40..65446f32405 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -537,7 +537,7 @@ class LLMenuGL void setTornOff(bool torn_off); bool getTornOff() { return mTornOff; } - bool getCanTearOff() { return mTearOffItem != NULL; } + bool getCanTearOff() { return mTearOffItem != nullptr; } KEY getJumpKey() const { return mJumpKey; } void setJumpKey(KEY key) { mJumpKey = key; } @@ -722,7 +722,7 @@ class LLContextMenu // can't set visibility directly, must call show or hide virtual void setVisible (bool visible); - virtual void show (S32 x, S32 y, LLView* spawning_view = NULL); + virtual void show (S32 x, S32 y, LLView* spawning_view = nullptr); virtual void hide (); virtual bool handleHover ( S32 x, S32 y, MASK mask ); @@ -850,7 +850,7 @@ class LLMenuHolderGL : public LLPanel virtual bool handleKey(KEY key, MASK mask, bool called_from_parent); virtual const LLRect getMenuRect() const { return getLocalRect(); } LLView*const getVisibleMenu() const; - virtual bool hasVisibleMenu() const {return getVisibleMenu() != NULL;} + virtual bool hasVisibleMenu() const {return getVisibleMenu() != nullptr;} static void setActivatedItem(LLMenuItemGL* item); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 225ff607ad5..b11784a55c0 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -84,7 +84,7 @@ void LLModalDialog::openFloater(const LLSD& key) { // SJB: Hack! Make sure we don't ever host a modal dialog LLMultiFloater* thost = LLFloater::getFloaterHost(); - LLFloater::setFloaterHost(NULL); + LLFloater::setFloaterHost(nullptr); LLFloater::openFloater(key); LLFloater::setFloaterHost(thost); } @@ -182,7 +182,7 @@ void LLModalDialog::setVisible( bool visible ) bool LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); - if (popup_menu != NULL) + if (popup_menu != nullptr) { S32 mx, my; LLUI::getInstance()->getMousePositionScreen(&mx, &my); @@ -212,14 +212,14 @@ bool LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) bool LLModalDialog::handleHover(S32 x, S32 y, MASK mask) { - if( childrenHandleHover(x, y, mask) == NULL ) + if( childrenHandleHover(x, y, mask) == nullptr ) { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL; } LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); - if (popup_menu != NULL) + if (popup_menu != nullptr) { S32 mx, my; LLUI::getInstance()->getMousePositionScreen(&mx, &my); @@ -229,7 +229,7 @@ bool LLModalDialog::handleHover(S32 x, S32 y, MASK mask) S32 local_x = mx - popup_menu->getRect().mLeft; S32 local_y = my - popup_menu->getRect().mBottom; popup_menu->handleHover(local_x, local_y, mask); - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); } } @@ -317,7 +317,7 @@ void LLModalDialog::onAppFocusLost() LLModalDialog* instance = LLModalDialog::sModalStack.front(); if( gFocusMgr.childHasMouseCapture( instance ) ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); } instance->setFocus(false); diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index f53e22c3495..06cfbd5dec3 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -38,7 +38,7 @@ LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params) : LLFloater(key), - mTabContainer(NULL), + mTabContainer(nullptr), mTabPos(LLTabContainer::TOP), mAutoResize(true), mOrigMinWidth(params.min_width), @@ -304,7 +304,7 @@ void LLMultiFloater::removeFloater(LLFloater* floaterp) mTabContainer->removeTabPanel(floaterp); floaterp->setBackgroundVisible(true); floaterp->setCanDrag(true); - floaterp->setHost(NULL); + floaterp->setHost(nullptr); floaterp->applyRectControl(); updateResizeLimits(); @@ -402,7 +402,7 @@ S32 LLMultiFloater::getFloaterCount() const is currently in a flashing state and is hosted by this. False otherwise. - Requires: floaterp != NULL + Requires: floaterp != nullptr **/ bool LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) { @@ -419,7 +419,7 @@ bool LLMultiFloater::isFloaterFlashing(LLFloater* floaterp) to by floaterp to be the bool flashing if the LLFloater pointed to by floaterp is hosted by this. - Requires: floaterp != NULL + Requires: floaterp != nullptr **/ void LLMultiFloater::setFloaterFlashing(LLFloater* floaterp, bool flashing) { diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index cfbf491610b..33c4b55a8f4 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -89,8 +89,8 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mTriangleColor(p.triangle_color()), mThumbWidth(p.thumb_width), mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL), - mMouseDownSignal(NULL), - mMouseUpSignal(NULL) + mMouseDownSignal(nullptr), + mMouseUpSignal(nullptr) { mValue = LLSD::emptyMap(); mCurSlider = LLStringUtil::null; @@ -332,7 +332,7 @@ void LLMultiSlider::setSliderThumbImage(const std::string &name) void LLMultiSlider::clearSliderThumbImage() { - mThumbImagep = NULL; + mThumbImagep = nullptr; } void LLMultiSlider::resetCurSlider() @@ -540,7 +540,7 @@ bool LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) if( gFocusMgr.getMouseCapture() == this ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); if (mMouseUpSignal) (*mMouseUpSignal)( this, LLSD() ); diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 32351106627..fa9e2d4774f 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -73,9 +73,9 @@ LLMultiSliderCtrl::Params::Params() LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) : LLF32UICtrl(p), - mLabelBox( NULL ), - mEditor( NULL ), - mTextBox( NULL ), + mLabelBox( nullptr ), + mEditor( nullptr ), + mTextBox( nullptr ), mTextEnabledColor(p.text_color()), mTextDisabledColor(p.text_disabled_color()) { diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 0ffe6cff5ec..858b8b45b93 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -496,7 +496,7 @@ LLNotification::LLNotification(const LLSDParamAdapter& p) : mPriority(p.priority), mCancelled(false), mIgnored(false), - mResponderObj(NULL), + mResponderObj(nullptr), mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()), mOfferFromAgent(p.offer_from_agent), mIsDND(p.is_dnd) @@ -1734,7 +1734,7 @@ LLNotificationPtr LLNotifications::add(const LLNotification::Params& p) void LLNotifications::add(const LLNotificationPtr pNotif) { - if (pNotif == NULL) return; + if (pNotif == nullptr) return; // first see if we already have it -- if so, that's a problem LLNotificationSet::iterator it=mItems.find(pNotif); @@ -1748,7 +1748,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif) void LLNotifications::load(const LLNotificationPtr pNotif) { - if (pNotif == NULL) return; + if (pNotif == nullptr) return; // first see if we already have it -- if so, that's a problem LLNotificationSet::iterator it=mItems.find(pNotif); @@ -1762,7 +1762,7 @@ void LLNotifications::load(const LLNotificationPtr pNotif) void LLNotifications::cancel(LLNotificationPtr pNotif) { - if (pNotif == NULL || pNotif->isCancelled()) return; + if (pNotif == nullptr || pNotif->isCancelled()) return; LLNotificationSet::iterator it=mItems.find(pNotif); if (it != mItems.end()) @@ -1839,7 +1839,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) if (it == mItems.end()) { LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << LL_ENDL; - return LLNotificationPtr((LLNotification*)NULL); + return LLNotificationPtr((LLNotification*)nullptr); } else { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index d56c459560a..3d342233e93 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -356,7 +356,7 @@ friend class LLNotifications; is_dnd("is_dnd", false) { time_stamp = LLDate::now(); - responder = NULL; + responder = nullptr; } Params(const std::string& _name) @@ -373,7 +373,7 @@ friend class LLNotifications; functor.name = _name; name = _name; time_stamp = LLDate::now(); - responder = NULL; + responder = nullptr; } }; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 2100b23783b..0e5f901d10d 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -104,14 +104,14 @@ LLPanel::LLPanel(const LLPanel::Params& p) mBgAlphaImageOverlay(p.bg_alpha_image_overlay), mBgOpaqueImage(p.bg_opaque_image()), mBgAlphaImage(p.bg_alpha_image()), - mDefaultBtn(NULL), - mBorder(NULL), + mDefaultBtn(nullptr), + mBorder(nullptr), mLabel(p.label), mHelpTopic(p.help_topic), mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), mXMLFilename(p.filename), - mVisibleSignal(NULL) + mVisibleSignal(nullptr) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -155,7 +155,7 @@ void LLPanel::removeBorder() { removeChild(mBorder); delete mBorder; - mBorder = NULL; + mBorder = nullptr; } } @@ -264,7 +264,7 @@ void LLPanel::setDefaultBtn(std::string_view id) } else { - setDefaultBtn(NULL); + setDefaultBtn(nullptr); } } @@ -372,7 +372,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ std::string class_attr; node->getAttributeString("class", class_attr); - LLPanel* panelp = NULL; + LLPanel* panelp = nullptr; { LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION); @@ -392,7 +392,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ if (!panelp) { - return NULL; // :( + return nullptr; // :( } } @@ -687,7 +687,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(std::string_view i { return child->getSelectionInterface(); } - return NULL; + return nullptr; } LLCtrlListInterface* LLPanel::childGetListInterface(std::string_view id) const @@ -697,7 +697,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(std::string_view id) const { return child->getListInterface(); } - return NULL; + return nullptr; } LLCtrlScrollInterface* LLPanel::childGetScrollInterface(std::string_view id) const @@ -707,7 +707,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(std::string_view id) con { return child->getScrollInterface(); } - return NULL; + return nullptr; } void LLPanel::childSetValue(std::string_view id, LLSD value) @@ -813,7 +813,7 @@ bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& getCommitCallbackRegistrar().pushScope(); getEnableCallbackRegistrar().pushScope(); - didPost = initPanelXML(root, NULL, NULL, default_params); + didPost = initPanelXML(root, nullptr, nullptr, default_params); getCommitCallbackRegistrar().popScope(); getEnableCallbackRegistrar().popScope(); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index fe861dc719c..e6a055e814e 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -131,7 +131,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder void addBorder( LLViewBorder::Params p); void addBorder(); void removeBorder(); - bool hasBorder() const { return mBorder != NULL; } + bool hasBorder() const { return mBorder != nullptr; } void setBorderVisible( bool b ); void setBackgroundColor( const LLUIColor& color ) { mBgOpaqueColor = color; } @@ -148,7 +148,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder bool isBackgroundVisible() const { return mBgVisible; } void setBackgroundOpaque(bool b) { mBgOpaque = b; } bool isBackgroundOpaque() const { return mBgOpaque; } - void setDefaultBtn(LLButton* btn = NULL); + void setDefaultBtn(LLButton* btn = nullptr); void setDefaultBtn(std::string_view id); void updateDefaultBtn(); void setLabel(const LLStringExplicit& label) { mLabel = label; } @@ -211,7 +211,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder void childSetAction(std::string_view id, std::function function, void* value); void childSetAction(std::string_view id, const commit_signal_t::slot_type& function); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); + static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = nullptr); //call onOpen to let panel know when it's about to be shown or activated virtual void onOpen(const LLSD& key) {} diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index a022fd2853b..19aced8730e 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -57,8 +57,8 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) mSnappingEnabled(p.snapping_enabled), mAllowDoubleClickSnapping(p.allow_double_click_snapping), mResizingView(p.resizing_view), - mResizeListener(NULL), - mImagePanel(NULL) + mResizeListener(nullptr), + mImagePanel(nullptr) { setFollowsNone(); // set up some generically good follow code. @@ -112,7 +112,7 @@ bool LLResizeBar::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { // Release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); handled = true; } else @@ -192,7 +192,7 @@ bool LLResizeBar::handleHover(S32 x, S32 y, MASK mask) scaled_rect.mRight = scaled_rect.mLeft + new_width; mResizingView->setRect(scaled_rect); - LLView* snap_view = NULL; + LLView* snap_view = nullptr; if (mSnappingEnabled) { @@ -314,7 +314,7 @@ bool LLResizeBar::handleHover(S32 x, S32 y, MASK mask) if (mResizeListener) { - mResizeListener(NULL); + mResizeListener(nullptr); } return handled; @@ -372,5 +372,5 @@ void LLResizeBar::setImagePanel(LLPanel * panelp) LLPanel * LLResizeBar::getImagePanel() const { - return getChildCount() > 0 ? (LLPanel *)getChildList()->back() : NULL; + return getChildCount() > 0 ? (LLPanel *)getChildList()->back() : nullptr; } diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 0b7bb553605..20cb3d13365 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -52,7 +52,7 @@ LLResizeHandle::LLResizeHandle(const LLResizeHandle::Params& p) mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), mLastMouseScreenY( 0 ), - mImage( NULL ), + mImage( nullptr ), mMinWidth( p.min_width ), mMinHeight( p.min_height ), mCorner( p.corner ) @@ -102,7 +102,7 @@ bool LLResizeHandle::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { // Release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); handled = true; } else if( pointInHandle(x, y) ) @@ -210,8 +210,8 @@ bool LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) scaled_rect.mTop = scaled_rect.mBottom + new_height; resizing_view->setRect(scaled_rect); - LLView* snap_view = NULL; - LLView* test_view = NULL; + LLView* snap_view = nullptr; + LLView* test_view = nullptr; static LLUICachedControl snap_margin ("SnapMargin", 0); // now do snapping diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 111c732548f..bd19b6232b7 100644 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -248,9 +248,9 @@ const std::string LLLocale::SYSTEM_LOCALE("C"); LLLocale::LLLocale(const std::string& locale_string) { - mPrevLocaleString = setlocale( LC_ALL, NULL ); + mPrevLocaleString = setlocale( LC_ALL, nullptr ); char* new_locale_string = setlocale( LC_ALL, locale_string.c_str()); - if ( new_locale_string == NULL) + if ( new_locale_string == nullptr) { LL_WARNS_ONCE("LLLocale") << "Failed to set locale " << locale_string << LL_ENDL; setlocale(LC_ALL, SYSTEM_LOCALE.c_str()); diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index d0eec387bda..e366e20a605 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -243,7 +243,7 @@ void LLScrollbar::updateThumbRect() bool LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) { // Check children first - bool handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != nullptr; if( !handled_by_child ) { if( mThumbRect.pointInRect(x,y) ) @@ -388,7 +388,7 @@ bool LLScrollbar::handleHover(S32 x, S32 y, MASK mask) } else { - handled = childrenHandleHover( x, y, mask ) != NULL; + handled = childrenHandleHover( x, y, mask ) != nullptr; } // Opaque @@ -447,7 +447,7 @@ bool LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) bool handled = false; if( hasMouseCapture() ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); handled = true; } else diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index df99c4f6362..cd3a7b5cb8d 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -92,7 +92,7 @@ LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p) mMinAutoScrollRate(p.min_auto_scroll_rate), mMaxAutoScrollRate(p.max_auto_scroll_rate), mMaxAutoScrollZone(p.max_auto_scroll_zone), - mScrolledView(NULL), + mScrolledView(nullptr), mSize(p.size) { static LLUICachedControl scrollbar_size_control ("UIScrollbarSize", 0); @@ -150,9 +150,9 @@ LLScrollContainer::~LLScrollContainer( void ) // destructor takes care of memory deallocation. for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { - mScrollbar[i] = NULL; + mScrollbar[i] = nullptr; } - mScrolledView = NULL; + mScrolledView = nullptr; } // internal scrollbar handlers @@ -327,7 +327,7 @@ bool LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, if( !handled ) { handled = childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, - cargo_data, accept, tooltip_msg) != NULL; + cargo_data, accept, tooltip_msg) != nullptr; } return true; diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index bdf88768c3c..1baba08f346 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -37,7 +37,7 @@ //static LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_p) { - LLScrollListCell* cell = NULL; + LLScrollListCell* cell = nullptr; if (cell_p.type() == "icon") { @@ -121,7 +121,7 @@ void LLScrollListIcon::setValue(const LLSD& value) { // don't use default image specified by LLUUID::null, use no image in that case LLUUID image_id = value.asUUID(); - mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(NULL); + mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(nullptr); } else { @@ -136,7 +136,7 @@ void LLScrollListIcon::setValue(const LLSD& value) } else { - mIcon = NULL; + mIcon = nullptr; } } } @@ -515,7 +515,7 @@ LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p) LLScrollListCheck::~LLScrollListCheck() { delete mCheckBox; - mCheckBox = NULL; + mCheckBox = nullptr; } void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color) @@ -607,7 +607,7 @@ void LLScrollListIconText::setValue(const LLSD& value) { // don't use default image specified by LLUUID::null, use no image in that case LLUUID image_id = value.asUUID(); - mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(NULL); + mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(nullptr); } else { @@ -622,7 +622,7 @@ void LLScrollListIconText::setValue(const LLSD& value) } else { - mIcon = NULL; + mIcon = nullptr; } } } diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index a4510d1fc24..99b3fcb20b0 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -311,7 +311,7 @@ LLScrollListColumn::LLScrollListColumn(const Params& p, LLScrollListCtrl* parent mParentCtrl(parent), mName(p.name), mLabel(p.header.label), - mHeader(NULL), + mHeader(nullptr), mMaxContentWidth(0), mDynamicWidth(p.width.dynamic_width), mRelWidth(p.width.relative_width), diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index 72dfcdafe0b..4f37de39a33 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -144,7 +144,7 @@ class LLScrollListColumn static const Params& getDefaultParams(); //NOTE: this is default constructible so we can store it in a map. - LLScrollListColumn(const Params& p = getDefaultParams(), LLScrollListCtrl* = NULL); + LLScrollListColumn(const Params& p = getDefaultParams(), LLScrollListCtrl* = nullptr); void setWidth(S32 width); S32 getWidth() const { return mWidth; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b459c67dade..5dc97126f4b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -402,7 +402,7 @@ void LLScrollListCtrl::clearRows() mScrollbar->setDocParams(0, 0); mScrollLines = 0; - mLastSelected = NULL; + mLastSelected = nullptr; updateLayout(); mDirty = false; } @@ -417,7 +417,7 @@ LLScrollListItem* LLScrollListCtrl::getFirstSelected() const return item; } } - return NULL; + return nullptr; } std::vector LLScrollListCtrl::getAllSelected() const @@ -469,12 +469,12 @@ S32 LLScrollListCtrl::getFirstSelectedIndex() const LLScrollListItem* LLScrollListCtrl::getFirstData() const { - return mItemList.empty() ? NULL : mItemList.front(); + return mItemList.empty() ? nullptr : mItemList.front(); } LLScrollListItem* LLScrollListCtrl::getLastData() const { - return mItemList.empty() ? NULL : mItemList.back(); + return mItemList.empty() ? nullptr : mItemList.back(); } std::vector LLScrollListCtrl::getAllData() const @@ -501,7 +501,7 @@ LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const } } - return NULL; + return nullptr; } void LLScrollListCtrl::reshape( S32 width, S32 height, bool called_from_parent ) @@ -731,7 +731,7 @@ void LLScrollListCtrl::updateColumns(bool force_update) // update column headers std::vector::iterator column_ordered_it; S32 left = mItemListRect.mLeft; - LLScrollColumnHeader* last_header = NULL; + LLScrollColumnHeader* last_header = nullptr; for (column_ordered_it = mColumnsIndexed.begin(); column_ordered_it != mColumnsIndexed.end(); ++column_ordered_it) { LLScrollListColumn* column = *column_ordered_it; @@ -972,7 +972,7 @@ void LLScrollListCtrl::deleteSingleItem(S32 target_index) itemp = mItemList[target_index]; if (itemp == mLastSelected) { - mLastSelected = NULL; + mLastSelected = nullptr; } delete itemp; mItemList.erase(mItemList.begin() + target_index); @@ -990,7 +990,7 @@ void LLScrollListCtrl::deleteItems(const LLSD& sd) { if (itemp == mLastSelected) { - mLastSelected = NULL; + mLastSelected = nullptr; } delete itemp; iter = mItemList.erase(iter); @@ -1020,7 +1020,7 @@ void LLScrollListCtrl::deleteSelectedItems() iter++; } } - mLastSelected = NULL; + mLastSelected = nullptr; dirtyColumns(); } @@ -1110,7 +1110,7 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const void LLScrollListCtrl::selectPrevItem( bool extend_selection) { - LLScrollListItem* prev_item = NULL; + LLScrollListItem* prev_item = nullptr; if (!getFirstSelected()) { @@ -1154,7 +1154,7 @@ void LLScrollListCtrl::selectPrevItem( bool extend_selection) void LLScrollListCtrl::selectNextItem( bool extend_selection) { - LLScrollListItem* next_item = NULL; + LLScrollListItem* next_item = nullptr; if (!getFirstSelected()) { @@ -1239,7 +1239,7 @@ bool LLScrollListCtrl::selectItemByLabel(const std::string& label, bool case_sen deselectAllItems(true); // ensure that no stale items are selected, even if we don't find a match LLScrollListItem* item = getItemByLabel(label, case_sensitive, column); - bool found = NULL != item; + bool found = nullptr != item; if (found) { selectItem(item, -1); @@ -1257,7 +1257,7 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo { if (label.empty()) //RN: assume no empty items { - return NULL; + return nullptr; } std::string target_text = label; @@ -1278,7 +1278,7 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, boo return item; } } - return NULL; + return nullptr; } LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index) @@ -1288,7 +1288,7 @@ LLScrollListItem* LLScrollListCtrl::getItemByIndex(S32 index) return mItemList[index]; } - return NULL; + return nullptr; } bool LLScrollListCtrl::selectItemByPrefix(const std::string& target, bool case_sensitive, S32 column) @@ -1481,7 +1481,7 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const std::string& item_te return addRow( item_p, pos ); } - return NULL; + return nullptr; } // Select the line or lines that match this UUID @@ -1772,7 +1772,7 @@ bool LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) S32 column_index = getColumnIndexFromOffset(x); LLScrollListColumn* columnp = getColumn(column_index); - if (columnp == NULL) return false; + if (columnp == nullptr) return false; bool handled = false; // show tooltip for full name of hovered item if it has been truncated @@ -1826,7 +1826,7 @@ bool LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) { if (mask & MASK_SHIFT) { - if (mLastSelected == NULL) + if (mLastSelected == nullptr) { selectItem(hit_item, getColumnIndexFromOffset(x)); } @@ -1910,7 +1910,7 @@ bool LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) } else { - //mLastSelected = NULL; + //mLastSelected = nullptr; //deselectAllItems(true); } @@ -1920,7 +1920,7 @@ bool LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask) bool LLScrollListCtrl::handleMouseDown(S32 x, S32 y, MASK mask) { - bool handled = childrenHandleMouseDown(x, y, mask) != NULL; + bool handled = childrenHandleMouseDown(x, y, mask) != nullptr; if( !handled ) { @@ -1942,7 +1942,7 @@ bool LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) { // release mouse capture immediately so // scroll to show selected logic will work - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); if(mask == MASK_NONE) { selectItemAt(x, y, mask); @@ -1993,7 +1993,7 @@ bool LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) menu->die(); mPopupMenuHandle.markDead(); } - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); menu = LLUICtrlFactory::getInstance()->createFromFile( menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -2101,7 +2101,7 @@ bool LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { // Offer the click to the children, even if we aren't enabled // so the scroll bars will work. - if (NULL == LLView::childrenHandleDoubleClick(x, y, mask)) + if (nullptr == LLView::childrenHandleDoubleClick(x, y, mask)) { // Run the callback only if an item is being double-clicked. if( mCanSelect && hitItem(x, y) && mOnDoubleClickCallback ) @@ -2149,7 +2149,7 @@ bool LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) LLScrollListCell* cellp = item->getColumn(column_index); cellp->setValue(item_value); cellp->onCommit(); - if (mLastSelected == NULL) + if (mLastSelected == nullptr) { break; } @@ -2175,7 +2175,7 @@ bool LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) LLScrollListItem* LLScrollListCtrl::hitItem( S32 x, S32 y ) { // Excludes disabled items. - LLScrollListItem* hit_item = NULL; + LLScrollListItem* hit_item = nullptr; updateSort(); @@ -2662,7 +2662,7 @@ void LLScrollListCtrl::deselectItem(LLScrollListItem* itemp) { if (mLastSelected == itemp) { - mLastSelected = NULL; + mLastSelected = nullptr; } itemp->setSelected(false); @@ -2880,7 +2880,7 @@ void LLScrollListCtrl::copy() // virtual bool LLScrollListCtrl::canCopy() const { - return (getFirstSelected() != NULL); + return (getFirstSelected() != nullptr); } // virtual @@ -3064,7 +3064,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata) std::string LLScrollListCtrl::getSortColumnName() { - LLScrollListColumn* column = mSortColumns.empty() ? NULL : mColumnsIndexed[mSortColumns.back().first]; + LLScrollListColumn* column = mSortColumns.empty() ? nullptr : mColumnsIndexed[mSortColumns.back().first]; return column ? column->mName : LLStringUtil::null; } @@ -3117,7 +3117,7 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(S32 index) { if (index < 0 || index >= (S32)mColumnsIndexed.size()) { - return NULL; + return nullptr; } return mColumnsIndexed[index]; } @@ -3129,7 +3129,7 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(const std::string& name) { return column_itor->second; } - return NULL; + return nullptr; } LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) @@ -3152,7 +3152,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& item_p, EAddPosition pos) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - if (!item_p.validateBlock() || !new_item) return NULL; + if (!item_p.validateBlock() || !new_item) return nullptr; new_item->setNumColumns(static_cast(mColumns.size())); // Add any columns we don't already have @@ -3243,7 +3243,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS for (column_map_t::iterator column_it = mColumns.begin(); column_it != mColumns.end(); ++column_it) { S32 column_idx = column_it->second->mIndex; - if (new_item->getColumn(column_idx) == NULL) + if (new_item->getColumn(column_idx) == nullptr) { LLScrollListColumn* column_ptr = column_it->second; LLScrollListCell::Params cell_p; @@ -3367,7 +3367,7 @@ void LLScrollListCtrl::onFocusLost() { if (hasMouseCapture()) { - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); } mSearchString.clear(); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index d3735c5052d..7e1819f85c1 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -182,7 +182,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler, // Adds a single element, from an array of: // "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid // Creates missing columns automatically. - virtual LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + virtual LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = nullptr); virtual LLScrollListItem* addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& value, EAddPosition pos = ADD_BOTTOM); virtual LLScrollListItem* addRow(const LLScrollListItem::Params& value, EAddPosition pos = ADD_BOTTOM); // Simple add element. Takes a single array of: diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index 0d79d19a371..34c581122ba 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -95,7 +95,7 @@ void LLScrollListItem::setNumColumns(S32 columns) for (auto col = prev_columns; col < columns; ++col) { - mColumns[col] = NULL; + mColumns[col] = nullptr; } } @@ -124,7 +124,7 @@ LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const { return mColumns[i]; } - return NULL; + return nullptr; } std::string LLScrollListItem::getContentsCSV() const diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 244faf8fe9d..49534b4712f 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -33,8 +33,8 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) : LLUICtrl(p), - mSearchButton(NULL), - mClearButton(NULL), + mSearchButton(nullptr), + mClearButton(nullptr), mEditorImage(p.background_image), mEditorImageFocused(p.background_image_focused), mEditorSearchImage(p.background_image_highlight), diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 0507733fd80..764279a6068 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -68,13 +68,13 @@ LLSlider::LLSlider(const LLSlider::Params& p) mTrackImageVertical(p.track_image_vertical), mTrackHighlightHorizontalImage(p.track_highlight_horizontal_image), mTrackHighlightVerticalImage(p.track_highlight_vertical_image), - mMouseDownSignal(NULL), - mMouseUpSignal(NULL) + mMouseDownSignal(nullptr), + mMouseUpSignal(nullptr) { mViewModel->setValue(p.initial_value); updateThumbRect(); mDragStartThumbRect = mThumbRect; - setControlName(p.control_name, NULL); + setControlName(p.control_name, nullptr); setValue(getValueF32()); if (p.mouse_down_callback.isProvided()) @@ -202,7 +202,7 @@ bool LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); if (mMouseUpSignal) (*mMouseUpSignal)( this, getValueF32() ); diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 66e97f093f6..c6ef1e55ac0 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -47,9 +47,9 @@ static LLDefaultChildRegistry::Register r("slider"); LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) : LLF32UICtrl(p), - mLabelBox( NULL ), - mEditor( NULL ), - mTextBox( NULL ), + mLabelBox( nullptr ), + mEditor( nullptr ), + mTextBox( nullptr ), mFont(p.font), mShowText(p.show_text), mCanEditText(p.can_edit_text), @@ -57,7 +57,7 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) mTextEnabledColor(p.text_color()), mTextDisabledColor(p.text_disabled_color()), mLabelWidth(p.label_width), - mEditorCommitSignal(NULL) + mEditorCommitSignal(nullptr) { S32 top = getRect().getHeight(); S32 bottom = 0; diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 8cd3e6419ae..ee9e15100e5 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -62,7 +62,7 @@ LLSpinCtrl::Params::Params() LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) : LLF32UICtrl(p), - mLabelBox(NULL), + mLabelBox(nullptr), mbHasBeenSet( false ), mPrecision(p.decimal_digits), mTextEnabledColor(p.text_enabled_color()), diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 62c0401869a..0ad0a37e91f 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -199,7 +199,7 @@ LLStatBar::LLStatBar(const Params& p) mFloatingTargetMinBar = mTargetMinBar; mFloatingTargetMaxBar = mTargetMaxBar; - mStat.valid = NULL; + mStat.valid = nullptr; // tick value will be automatically calculated later if (!p.tick_spacing.isProvided() && p.bar_min.isProvided() && p.bar_max.isProvided()) { diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 5e0985c79cf..02044b35051 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -70,7 +70,7 @@ void LLTabContainer::TabPositions::declareValues() class LLTabTuple { public: - LLTabTuple( LLTabContainer* c, LLPanel* p, LLButton* b, LLTextBox* placeholder = NULL) + LLTabTuple( LLTabContainer* c, LLPanel* p, LLButton* b, LLTextBox* placeholder = nullptr) : mTabContainer(c), mTabPanel(p), @@ -117,7 +117,7 @@ class LLCustomButtonIconCtrl : public LLButton LLCustomButtonIconCtrl(const Params& p) : LLButton(p), - mIcon(NULL), + mIcon(nullptr), mIconAlignment(LLFontGL::HCENTER), mIconCtrlPad(p.icon_ctrl_pad) {} @@ -237,7 +237,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mScrollPos(0), mScrollPosPixels(0), mMaxScrollPos(0), - mTitleBox(NULL), + mTitleBox(nullptr), mTopBorderHeight(LLPANEL_BORDER_WIDTH), mLockedTabCount(0), mMinTabWidth(0), @@ -245,13 +245,13 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mTabHeight(p.tab_height), mLabelPadBottom(p.label_pad_bottom), mLabelPadLeft(p.label_pad_left), - mPrevArrowBtn(NULL), - mNextArrowBtn(NULL), + mPrevArrowBtn(nullptr), + mNextArrowBtn(nullptr), mIsVertical( p.tab_position == LEFT ), mHideScrollArrows(p.hide_scroll_arrows), // Horizontal Specific - mJumpPrevArrowBtn(NULL), - mJumpNextArrowBtn(NULL), + mJumpPrevArrowBtn(nullptr), + mJumpNextArrowBtn(nullptr), mRightTabBtnOffset(p.tab_padding_right), mTotalTabWidth(0), mTabPosition(p.tab_position), @@ -376,7 +376,7 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) if (panelp) { - addTabPanel(TabPanelParams().panel(panelp).label(panelp->getLabel()).is_placeholder(dynamic_cast(view) != NULL)); + addTabPanel(TabPanelParams().panel(panelp).label(panelp->getLabel()).is_placeholder(dynamic_cast(view) != nullptr)); return true; } else @@ -719,7 +719,7 @@ bool LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) getTab(getCurrentPanelIndex())->mButton->setFocus(true); } } - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); } if (handled) { // Note: may need to capture local coords here @@ -1040,8 +1040,8 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) // Tab button LLRect btn_rect; // Note: btn_rect.mLeft is just a dummy. Will be updated in draw(). - LLUIImage* tab_img = NULL; - LLUIImage* tab_selected_img = NULL; + LLUIImage* tab_img = nullptr; + LLUIImage* tab_selected_img = nullptr; S32 tab_fudge = 1; // To make new tab art look better, nudge buttons up 1 pel if (mIsVertical) @@ -1064,8 +1064,8 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) tab_selected_img = mMiddleTabParams.tab_bottom_image_selected; } - LLTextBox* textbox = NULL; - LLButton* btn = NULL; + LLTextBox* textbox = nullptr; + LLButton* btn = nullptr; LLCustomButtonIconCtrl::Params custom_btn_params; { custom_btn_params.icon_ctrl_pad(mTabIconCtrlPad); @@ -1280,11 +1280,11 @@ void LLTabContainer::removeTabPanel(LLPanel* child) removeChild( tuple->mButton ); } delete tuple->mButton; - tuple->mButton = NULL; + tuple->mButton = nullptr; removeChild( tuple->mTabPanel ); // delete tuple->mTabPanel; - tuple->mTabPanel = NULL; + tuple->mTabPanel = nullptr; mTabList.erase( iter ); delete tuple; @@ -1346,11 +1346,11 @@ void LLTabContainer::deleteAllTabs() removeChild( tuple->mButton ); delete tuple->mButton; - tuple->mButton = NULL; + tuple->mButton = nullptr; removeChild( tuple->mTabPanel ); // delete tuple->mTabPanel; - tuple->mTabPanel = NULL; + tuple->mTabPanel = nullptr; } // Actually delete the tuples themselves @@ -1367,7 +1367,7 @@ LLPanel* LLTabContainer::getCurrentPanel() { return mTabList[mCurrentTabIdx]->mTabPanel; } - return NULL; + return nullptr; } S32 LLTabContainer::getCurrentPanelIndex() const @@ -1386,7 +1386,7 @@ LLPanel* LLTabContainer::getPanelByIndex(S32 index) const { return mTabList[index]->mTabPanel; } - return NULL; + return nullptr; } S32 LLTabContainer::getIndexForPanel(LLPanel* panel) const @@ -1423,7 +1423,7 @@ LLPanel* LLTabContainer::getPanelByName(std::string_view name) return panel; } } - return NULL; + return nullptr; } // Change the name of the button for the current tab. @@ -1706,7 +1706,7 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) } } - if (!hasButton && (icon != NULL)) + if (!hasButton && (icon != nullptr)) { // It was assumed that the tab's button would take ownership of the icon pointer. // But since the tab did not have a button, kill the icon to prevent the memory @@ -1726,7 +1726,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple) if(mCustomIconCtrlUsed) { LLCustomButtonIconCtrl* button = dynamic_cast(tuple->mButton); - LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : NULL; + LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : nullptr; image_overlay_width = icon_ctrl ? icon_ctrl->getRect().getWidth() : 0; } else @@ -2050,7 +2050,7 @@ LLTabTuple* LLTabContainer::getTabByPanel(LLPanel* child) return tuple; } } - return NULL; + return nullptr; } void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point) diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 4ac7e73d259..f535dac552c 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -167,7 +167,7 @@ class LLTabContainer : public LLPanel Optional user_data; TabPanelParams() - : panel("panel", NULL), + : panel("panel", nullptr), label("label"), select_tab("select_tab"), is_placeholder("is_placeholder"), diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 2079ff17fc2..9421464b432 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -182,10 +182,10 @@ LLTextBase::Params::Params() LLTextBase::LLTextBase(const LLTextBase::Params &p) : LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)), - mURLClickSignal(NULL), - mIsFriendSignal(NULL), - mIsObjectBlockedSignal(NULL), - mIsObjectReachableSignal(NULL), + mURLClickSignal(nullptr), + mIsFriendSignal(nullptr), + mIsObjectBlockedSignal(nullptr), + mIsObjectReachableSignal(nullptr), mMaxTextByteLength( p.max_text_length ), mFont(p.font), mFontShadow(p.font_shadow), @@ -235,7 +235,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mForceUrlsExternal(p.force_urls_external), mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), - mScroller(NULL), + mScroller(nullptr), mStyleDirty(true) { if(p.allow_scroll) @@ -1037,7 +1037,7 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s if (mUseEmoji) { LLStyleSP emoji_style; - LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : NULL; + LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists() ? LLEmojiDictionary::getInstance() : nullptr; LLTextSegment* segmentp = nullptr; segment_vec_t::iterator seg_iter; if (segments && segments->size() > 0) @@ -1548,7 +1548,7 @@ void LLTextBase::draw() gl_rect_2d( text_rect, bg_color, true ); } - bool should_clip = mClip || mScroller != NULL; + bool should_clip = mClip || mScroller != nullptr; { LLLocalClipRect clip(text_rect, should_clip); // draw document view @@ -2282,7 +2282,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) menu->die(); mPopupMenuHandle.markDead(); } - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); menu = LLUICtrlFactory::getInstance()->createFromFile(xui_file, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -3484,7 +3484,7 @@ const LLUIColor& LLTextSegment::getColor() const { static const LLUIColor white LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; } void LLTextSegment::setStyle(LLStyleConstSP style) {} void LLTextSegment::setToken( LLKeywordToken* token ) {} -LLKeywordToken* LLTextSegment::getToken() const { return NULL; } +LLKeywordToken* LLTextSegment::getToken() const { return nullptr; } void LLTextSegment::setToolTip( const std::string &msg ) {} void LLTextSegment::dump() const {} bool LLTextSegment::handleMouseDown(S32 x, S32 y, MASK mask) { return false; } @@ -3514,7 +3514,7 @@ bool LLTextSegment::hasMouseCapture() { return false; } LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor ) : LLTextSegment(start, end), mStyle( style ), - mToken(NULL), + mToken(nullptr), mEditor(editor), mLastGeneration(-1) { @@ -3535,7 +3535,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e LLNormalTextSegment::LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), - mToken(NULL), + mToken(nullptr), mEditor(editor), mLastGeneration(-1) { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 3ab5e905e3a..6ec3e722dfc 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -635,7 +635,7 @@ class LLTextBase void drawHighlightedBackground(); // modify contents - S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted + S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = nullptr); // returns num of chars actually inserted S32 removeStringNoUndo(S32 pos, S32 length); S32 overwriteCharNoUndo(S32 pos, llwchar wc); void appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep, e_underline underline_link = e_underline::UNDERLINE_ALWAYS); diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index d2a21998a6c..30538fc776f 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -88,7 +88,7 @@ bool LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) if (hasMouseCapture()) { // Release the mouse - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); // DO THIS AT THE VERY END to allow the button to be destroyed // as a result of being clicked. If mouseup in the widget, diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index fcdf3782ae7..7234c6f7fa4 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -258,8 +258,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : LLTextBase(p), mAutoreplaceCallback(), mBaseDocIsPristine(true), - mPristineCmd( NULL ), - mLastCmd( NULL ), + mPristineCmd( nullptr ), + mLastCmd( nullptr ), mDefaultColor( p.default_color() ), mAutoIndent(p.auto_indent), mParseOnTheFly(false), @@ -960,7 +960,7 @@ bool LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) if( hasMouseCapture() ) { - gFocusMgr.setMouseCapture( NULL ); + gFocusMgr.setMouseCapture( nullptr ); handled = true; } @@ -2128,7 +2128,7 @@ void LLTextEditor::doDelete() void LLTextEditor::blockUndo() { mBaseDocIsPristine = false; - mLastCmd = NULL; + mLastCmd = nullptr; std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); mUndoStack.clear(); } @@ -2136,7 +2136,7 @@ void LLTextEditor::blockUndo() // virtual bool LLTextEditor::canUndo() const { - return !mReadOnly && mLastCmd != NULL; + return !mReadOnly && mLastCmd != nullptr; } void LLTextEditor::undo() @@ -2156,7 +2156,7 @@ void LLTextEditor::undo() if (iter != mUndoStack.end()) mLastCmd = *iter; else - mLastCmd = NULL; + mLastCmd = nullptr; } while( mLastCmd && mLastCmd->groupWithNext() ); @@ -2190,7 +2190,7 @@ void LLTextEditor::redo() if (iter != mUndoStack.begin()) mLastCmd = *(--iter); else - mLastCmd = NULL; + mLastCmd = nullptr; } if( mLastCmd ) @@ -2220,7 +2220,7 @@ void LLTextEditor::focusLostHelper() // Route menu back to the default if( gEditMenuHandler == this ) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } if (mSelectedOnFocusReceived) @@ -2267,7 +2267,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) LLContextMenu* menu = static_cast(mContextMenuHandle.get()); if (!menu) { - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); menu = LLUICtrlFactory::createFromFile("menu_text_editor.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); @@ -2488,7 +2488,7 @@ void LLTextEditor::setFocus( bool new_state ) // Route menu back to the default if( gEditMenuHandler == this ) { - gEditMenuHandler = NULL; + gEditMenuHandler = nullptr; } endSelection(); @@ -2807,7 +2807,7 @@ bool LLTextEditor::importBuffer(const char* buffer, S32 length ) bool success = true; char* text = new char[ text_len + 1]; - if (text == NULL) + if (text == nullptr) { LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Memory allocation failure." << LL_ENDL; @@ -3136,7 +3136,7 @@ bool LLTextEditor::isDirty() const } else { - return ( NULL != mLastCmd ); + return ( nullptr != mLastCmd ); } } diff --git a/indra/llui/lltextvalidate.cpp b/indra/llui/lltextvalidate.cpp index 9a087d82307..187bb5450ac 100644 --- a/indra/llui/lltextvalidate.cpp +++ b/indra/llui/lltextvalidate.cpp @@ -38,8 +38,8 @@ namespace LLTextValidate { -static S32 strtol(const std::string& str) { return ::strtol(str.c_str(), NULL, 10); } -static S32 strtol(const LLWString& str) { return ::strtol(wstring_to_utf8str(str).c_str(), NULL, 10); } +static S32 strtol(const std::string& str) { return ::strtol(str.c_str(), nullptr, 10); } +static S32 strtol(const LLWString& str) { return ::strtol(wstring_to_utf8str(str).c_str(), nullptr, 10); } static LLSD llsd(const std::string& str) { return LLSD(str); } static LLSD llsd(const LLWString& str) { return LLSD(wstring_to_utf8str(str)); } diff --git a/indra/llui/lltimectrl.cpp b/indra/llui/lltimectrl.cpp index e2e735b1315..769a3fc035f 100644 --- a/indra/llui/lltimectrl.cpp +++ b/indra/llui/lltimectrl.cpp @@ -92,7 +92,7 @@ LLTimeCtrl::Params::Params() LLTimeCtrl::LLTimeCtrl(const LLTimeCtrl::Params& p) : LLUICtrl(p), - mLabelBox(NULL), + mLabelBox(nullptr), mTextEnabledColor(p.text_enabled_color()), mTextDisabledColor(p.text_disabled_color()), mTime(0), diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index cfa520f6936..ac574acacd5 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -35,7 +35,7 @@ static LLDefaultChildRegistry::Register r("toggleable_menu"); LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p) : LLMenuGL(p), mButtonRect(), - mVisibilityChangeSignal(NULL), + mVisibilityChangeSignal(nullptr), mClosedByButtonClick(false) { } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 785dc85448a..79660caa368 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -152,7 +152,7 @@ void LLToolBar::createContextMenu() enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); // Create the context menu - llassert(LLMenuGL::sMenuContainer != NULL); + llassert(LLMenuGL::sMenuContainer != nullptr); LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -170,7 +170,7 @@ void LLToolBar::createContextMenu() if (mRemoveButtonHandle.get()) { // Disable/Enable the "Remove button" menu item depending on whether or not a button was clicked - mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != NULL); + mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != nullptr); } } @@ -331,7 +331,7 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) { - LLButton * command_button = NULL; + LLButton * command_button = nullptr; if (commandId != LLCommandId::null) { @@ -343,7 +343,7 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) } } - return (command_button != NULL); + return (command_button != nullptr); } bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) @@ -359,7 +359,7 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) // to turn off the microphone for both behaviors without risking duplicate state. // - LLToolBarButton * command_button = NULL; + LLToolBarButton * command_button = nullptr; if (commandId != LLCommandId::null) { @@ -385,12 +385,12 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) } } - return (command_button != NULL); + return (command_button != nullptr); } bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash, bool force_flashing/* = false */) { - LLButton * command_button = NULL; + LLButton * command_button = nullptr; if (commandId != LLCommandId::null) { @@ -402,7 +402,7 @@ bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash, bool forc } } - return (command_button != NULL); + return (command_button != nullptr); } bool LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -415,7 +415,7 @@ bool LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { // Determine which button the mouse was over during the click in case the context menu action // is intended to affect the button. - mRightMouseTargetButton = NULL; + mRightMouseTargetButton = nullptr; for (LLToolBarButton* button : mButtons) { LLRect button_rect; @@ -485,7 +485,7 @@ void LLToolBar::onRemoveSelectedCommand() { removeCommand(mRightMouseTargetButton->getCommandId()); - mRightMouseTargetButton = NULL; + mRightMouseTargetButton = nullptr; } } @@ -893,7 +893,7 @@ void LLToolBar::createButtons() } mButtons.clear(); mButtonMap.clear(); - mRightMouseTargetButton = NULL; + mRightMouseTargetButton = nullptr; for (const LLCommandId& command_id : mButtonCommands) { @@ -928,7 +928,7 @@ void LLToolBarButton::callIfEnabled(LLUICtrl::commit_callback_t commit, LLUICtrl LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) { LLCommand* commandp = LLCommandManager::instance().getCommand(id); - if (!commandp) return NULL; + if (!commandp) return nullptr; LLToolBarButton::Params button_p; button_p.name = commandp->name(); @@ -951,7 +951,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) isEnabledParam.parameter = commandp->isEnabledParameters(); isEnabledCB = initEnableCallback(isEnabledParam); - if (NULL == button->mIsEnabledSignal) + if (nullptr == button->mIsEnabledSignal) { button->mIsEnabledSignal = new enable_signal_t(); } @@ -994,7 +994,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) isRunningParam.parameter = commandp->isRunningParameters(); enable_signal_t::slot_type isRunningCB = initEnableCallback(isRunningParam); - if (NULL == button->mIsRunningSignal) + if (nullptr == button->mIsRunningSignal) { button->mIsRunningSignal = new enable_signal_t(); } diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 74f03618cfe..a226201cbfa 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -45,7 +45,7 @@ // Local globals // -LLToolTipView *gToolTipView = NULL; +LLToolTipView *gToolTipView = nullptr; // // Member functions @@ -165,10 +165,10 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) mHasClickCallback(p.click_callback.isProvided()), mPadding(p.padding), mMaxWidth(p.max_width), - mTextBox(NULL), - mInfoButton(NULL), - mPlayMediaButton(NULL), - mHomePageButton(NULL), + mTextBox(nullptr), + mInfoButton(nullptr), + mPlayMediaButton(nullptr), + mHomePageButton(nullptr), mIsTooltipPastable(p.allow_paste_tooltip) { LLTextBox::Params params; @@ -421,7 +421,7 @@ void LLToolTip::getToolTipMessage(std::string& message) const LLToolTipMgr::LLToolTipMgr() : mToolTipsBlocked(false), - mToolTip(NULL), + mToolTip(nullptr), mNeedsToolTip(false) {} @@ -446,7 +446,7 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) if (tooltip_params.create_callback.isProvided()) { mToolTip = tooltip_params.create_callback()(tooltip_params); - if (mToolTip == NULL) + if (mToolTip == nullptr) { return; } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 38d57205560..baedf252eca 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -93,7 +93,7 @@ static LLDefaultChildRegistry::Register register_toolbar("toolbar"); LLUUID find_ui_sound(const char * namep) { std::string name = ll_safe_string(namep); - LLUUID uuid = LLUUID(NULL); + LLUUID uuid = LLUUID(nullptr); LLUI *ui_inst = LLUI::getInstance(); if (!ui_inst->mSettingGroups["config"]->controlExists(name)) { @@ -116,7 +116,7 @@ LLUUID find_ui_sound(const char * namep) LL_WARNS() << "UI sound named: " << name << " does not translate to a valid uuid" << LL_ENDL; } } - else if (ui_inst->mAudioCallback != NULL) + else if (ui_inst->mAudioCallback != nullptr) { if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) { @@ -153,16 +153,16 @@ LLUI::LLUI(const settings_map_t& settings, : mSettingGroups(settings), mAudioCallback(audio_callback), mDeferredAudioCallback(deferred_audio_callback), -mWindow(NULL), // set later in startup -mRootView(NULL), -mHelpImpl(NULL) +mWindow(nullptr), // set later in startup +mRootView(nullptr), +mHelpImpl(nullptr) { LLRender2D::createInstance(image_provider); LLSpellChecker::createInstance(); - if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || - (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) || - (get_ptr_in_map(mSettingGroups, std::string("ignores")) == NULL)) + if ((get_ptr_in_map(mSettingGroups, std::string("config")) == nullptr) || + (get_ptr_in_map(mSettingGroups, std::string("floater")) == nullptr) || + (get_ptr_in_map(mSettingGroups, std::string("ignores")) == nullptr)) { LL_ERRS() << "Failure to initialize configuration groups" << LL_ENDL; } @@ -376,7 +376,7 @@ LLControlGroup& LLUI::getControlControlGroup (std::string_view controlname) itor != mSettingGroups.end(); ++itor) { LLControlGroup* control_group = itor->second; - if(control_group != NULL) + if(control_group != nullptr) { if (control_group->controlExists(controlname)) return *control_group; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 2ef64baaf6f..7bee77a2519 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -265,7 +265,7 @@ class LLUI : public LLSimpleton * Adjacent "//" mean that the next level of the search is done * recursively ("descendant" rather than "child"). * - * Return values: If no match is found, NULL is returned, + * Return values: If no match is found, nullptr is returned, * otherwise the matching LLView* is returned. * * Examples: diff --git a/indra/llui/lluicolor.cpp b/indra/llui/lluicolor.cpp index 71db556fada..5bba98ce1ef 100644 --- a/indra/llui/lluicolor.cpp +++ b/indra/llui/lluicolor.cpp @@ -29,14 +29,14 @@ #include "lluicolor.h" LLUIColor::LLUIColor() - :mColorPtr(NULL) + :mColorPtr(nullptr) { } LLUIColor::LLUIColor(const LLColor4& color) : mColor(color), - mColorPtr(NULL) + mColorPtr(nullptr) { } @@ -48,7 +48,7 @@ LLUIColor::LLUIColor(const LLUIColor* color) void LLUIColor::set(const LLColor4& color) { mColor = color; - mColorPtr = NULL; + mColorPtr = nullptr; } void LLUIColor::set(const LLUIColor* color) @@ -58,7 +58,7 @@ void LLUIColor::set(const LLUIColor* color) const LLColor4& LLUIColor::get() const { - return (mColorPtr == NULL ? mColor : mColorPtr->get()); + return (mColorPtr == nullptr ? mColor : mColorPtr->get()); } LLUIColor::operator const LLColor4& () const @@ -73,7 +73,7 @@ const LLColor4& LLUIColor::operator()() const bool LLUIColor::isReference() const { - return mColorPtr != NULL; + return mColorPtr != nullptr; } namespace LLInitParam @@ -82,6 +82,6 @@ namespace LLInitParam bool ParamCompare::equals(const LLUIColor &a, const LLUIColor &b) { // do not detect value equivalence, treat pointers to colors as distinct from color values - return (a.mColorPtr == NULL && b.mColorPtr == NULL ? a.mColor == b.mColor : a.mColorPtr == b.mColorPtr); + return (a.mColorPtr == nullptr && b.mColorPtr == nullptr ? a.mColor == b.mColor : a.mColorPtr == b.mColorPtr); } } diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index a792cb8103f..b7c08cab3c8 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -300,7 +300,7 @@ void LLUIColorTable::saveUserSettings() const const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml"); LLFILE *fp = LLFile::fopen(filename, "w"); - if(fp != NULL) + if(fp != nullptr) { LLXMLNode::writeHeaderToFile(fp); output_node->writeToFile(fp); @@ -346,7 +346,7 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_ { LLXMLNodePtr root; - if(!LLXMLNode::parseFile(filename, root, NULL)) + if(!LLXMLNode::parseFile(filename, root, nullptr)) { LL_WARNS() << "Unable to parse color file " << filename << LL_ENDL; return false; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 05461edd82d..03534d4b63f 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -105,20 +105,20 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) mTabStop(false), mTentative(false), mViewModel(viewmodel), - mControlVariable(NULL), - mEnabledControlVariable(NULL), - mDisabledControlVariable(NULL), - mMakeVisibleControlVariable(NULL), - mMakeInvisibleControlVariable(NULL), - mCommitSignal(NULL), - mValidateSignal(NULL), - mMouseEnterSignal(NULL), - mMouseLeaveSignal(NULL), - mMouseDownSignal(NULL), - mMouseUpSignal(NULL), - mRightMouseDownSignal(NULL), - mRightMouseUpSignal(NULL), - mDoubleClickSignal(NULL), + mControlVariable(nullptr), + mEnabledControlVariable(nullptr), + mDisabledControlVariable(nullptr), + mMakeVisibleControlVariable(nullptr), + mMakeInvisibleControlVariable(nullptr), + mCommitSignal(nullptr), + mValidateSignal(nullptr), + mMouseEnterSignal(nullptr), + mMouseLeaveSignal(nullptr), + mMouseDownSignal(nullptr), + mMouseUpSignal(nullptr), + mRightMouseDownSignal(nullptr), + mRightMouseUpSignal(nullptr), + mDoubleClickSignal(nullptr), mTransparencyType(TT_DEFAULT) { } @@ -520,7 +520,7 @@ void LLUICtrl::setControlVariable(LLControlVariable* control) //RN: this will happen in practice, should we try to avoid it? //LL_WARNS() << "setControlName called twice on same control!" << LL_ENDL; mControlConnection.disconnect(); // disconnect current signal - mControlVariable = NULL; + mControlVariable = nullptr; } if (control) @@ -536,14 +536,14 @@ void LLUICtrl::removeControlVariable() if (mControlVariable) { mControlConnection.disconnect(); - mControlVariable = NULL; + mControlVariable = nullptr; } } //virtual void LLUICtrl::setControlName(const std::string& control_name, LLView *context) { - if (context == NULL) + if (context == nullptr) { context = this; } @@ -566,7 +566,7 @@ void LLUICtrl::setEnabledControlVariable(LLControlVariable* control) if (mEnabledControlVariable) { mEnabledControlConnection.disconnect(); // disconnect current signal - mEnabledControlVariable = NULL; + mEnabledControlVariable = nullptr; } if (control) { @@ -581,7 +581,7 @@ void LLUICtrl::setDisabledControlVariable(LLControlVariable* control) if (mDisabledControlVariable) { mDisabledControlConnection.disconnect(); // disconnect current signal - mDisabledControlVariable = NULL; + mDisabledControlVariable = nullptr; } if (control) { @@ -596,7 +596,7 @@ void LLUICtrl::setMakeVisibleControlVariable(LLControlVariable* control) if (mMakeVisibleControlVariable) { mMakeVisibleControlConnection.disconnect(); // disconnect current signal - mMakeVisibleControlVariable = NULL; + mMakeVisibleControlVariable = nullptr; } if (control) { @@ -611,7 +611,7 @@ void LLUICtrl::setMakeInvisibleControlVariable(LLControlVariable* control) if (mMakeInvisibleControlVariable) { mMakeInvisibleControlConnection.disconnect(); // disconnect current signal - mMakeInvisibleControlVariable = NULL; + mMakeInvisibleControlVariable = nullptr; } if (control) { @@ -676,19 +676,19 @@ bool LLUICtrl::setLabelArg( const std::string& key, const LLStringExplicit& text // virtual LLCtrlSelectionInterface* LLUICtrl::getSelectionInterface() { - return NULL; + return nullptr; } // virtual LLCtrlListInterface* LLUICtrl::getListInterface() { - return NULL; + return nullptr; } // virtual LLCtrlScrollInterface* LLUICtrl::getScrollInterface() { - return NULL; + return nullptr; } bool LLUICtrl::hasFocus() const @@ -714,7 +714,7 @@ void LLUICtrl::setFocus(bool b) { if( gFocusMgr.childHasKeyboardFocus(this)) { - gFocusMgr.setKeyboardFocus( NULL ); + gFocusMgr.setKeyboardFocus( nullptr ); } } } @@ -874,7 +874,7 @@ bool LLUICtrl::focusPrevItem(bool text_fields_only) LLUICtrl* LLUICtrl::findRootMostFocusRoot() { - LLUICtrl* focus_root = NULL; + LLUICtrl* focus_root = nullptr; LLUICtrl* next_view = this; while(next_view && next_view->hasTabStop()) { @@ -904,7 +904,7 @@ LLUICtrl* LLUICtrl::getParentUICtrl() const parent = parent->getParent(); } } - return NULL; + return nullptr; } bool LLUICtrl::findHelpTopic(std::string& help_topic_out) @@ -921,7 +921,7 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) { LLView *child; - LLPanel *subpanel = NULL; + LLPanel *subpanel = nullptr; // does the panel have a sub-panel with a help topic? bfs_tree_iterator_t it = beginTreeBFS(); @@ -946,7 +946,7 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) } // does the panel have an active tab with a help topic? - LLPanel *tab_panel = NULL; + LLPanel *tab_panel = nullptr; it = beginTreeBFS(); // skip ourselves @@ -954,7 +954,7 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) for (; it != endTreeBFS(); ++it) { child = *it; - LLPanel *curTabPanel = NULL; + LLPanel *curTabPanel = nullptr; // do we have a tab container? LLTabContainer *tab = dynamic_cast(child); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 749999bbfe0..ac792af6b4f 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -170,14 +170,14 @@ class LLUICtrl // New virtuals - // Return NULL by default (overrride if the class has the appropriate interface) + // Return nullptr by default (overrride if the class has the appropriate interface) virtual class LLCtrlSelectionInterface* getSelectionInterface(); virtual class LLCtrlListInterface* getListInterface(); virtual class LLCtrlScrollInterface* getScrollInterface(); bool setControlValue(const LLSD& value); void setControlVariable(LLControlVariable* control); - virtual void setControlName(const std::string& control, LLView *context = NULL); + virtual void setControlName(const std::string& control, LLView *context = nullptr); void removeControlVariable(); LLControlVariable* getControlVariable() { return mControlVariable; } diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 9abccfd9a0a..4b6d6e30aa6 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -73,7 +73,7 @@ template class LLUICtrlFactory* LLSingleton::getInstance( // LLUICtrlFactory() //----------------------------------------------------------------------------- LLUICtrlFactory::LLUICtrlFactory() - : mDummyPanel(NULL) // instantiated when first needed + : mDummyPanel(nullptr) // instantiated when first needed { } @@ -81,7 +81,7 @@ LLUICtrlFactory::~LLUICtrlFactory() { // go ahead and leak mDummyPanel since this is static destructor time //delete mDummyPanel; - //mDummyPanel = NULL; + //mDummyPanel = nullptr; } void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block) @@ -194,14 +194,14 @@ LLView *LLUICtrlFactory::createFromXML(LLXMLNodePtr node, LLView* parent, const LLStringUtil::toLower(ctrl_type); const LLWidgetCreatorFunc* funcp = registry.getValue(ctrl_type); - if (funcp == NULL) + if (funcp == nullptr) { - return NULL; + return nullptr; } - if (parent == NULL) + if (parent == nullptr) { - if (mDummyPanel == NULL) + if (mDummyPanel == nullptr) { LLPanel::Params p; mDummyPanel = create(p); @@ -257,7 +257,7 @@ void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const st { // associate parameter block type with template .xml file std::string* existing_name = LLWidgetNameRegistry::instance().getValue(param_block_type); - if (existing_name != NULL) + if (existing_name != nullptr) { if(*existing_name != name) { diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index fc069c078f9..9dc8bc63cad 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -51,7 +51,7 @@ class LLChildRegistry : public LLRegistrySingleton void popFileName(); template - static T* create(typename T::Params& params, LLView* parent = NULL) + static T* create(typename T::Params& params, LLView* parent = nullptr) { params.fillFrom(instance().mParamDefaultsMap.obtain< ParamDefaults >().get()); @@ -150,7 +150,7 @@ class LLUICtrlFactory : public LLSingleton template static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry) { - T* widget = NULL; + T* widget = nullptr; instance().pushFileName(filename); { @@ -162,7 +162,7 @@ class LLUICtrlFactory : public LLSingleton goto fail; } - LLView* view = getInstance()->createFromXML(root_node, parent, filename, registry, NULL); + LLView* view = getInstance()->createFromXML(root_node, parent, filename, registry, nullptr); if (view) { widget = dynamic_cast(view); @@ -172,7 +172,7 @@ class LLUICtrlFactory : public LLSingleton LL_WARNS() << "Widget in " << filename << " was of type " << typeid(view).name() << " instead of expected type " << typeid(T).name() << LL_ENDL; deleteView(view); - view = NULL; + view = nullptr; } } } @@ -189,7 +189,7 @@ class LLUICtrlFactory : public LLSingleton return create(widget_params); } - static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL); + static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = nullptr); static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root, LLDir::ESkinConstraint constraint=LLDir::CURRENT_SKIN); @@ -207,15 +207,15 @@ class LLUICtrlFactory : public LLSingleton static void loadWidgetTemplate(const std::string& widget_tag, LLInitParam::BaseBlock& block); template - static T* createWidgetImpl(const typename T::Params& params, LLView* parent = NULL) + static T* createWidgetImpl(const typename T::Params& params, LLView* parent = nullptr) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; - T* widget = NULL; + T* widget = nullptr; if (!params.validateBlock()) { LL_WARNS() << getInstance()->getCurFileName() << ": Invalid parameter block for " << typeid(T).name() << LL_ENDL; - //return NULL; + //return nullptr; } widget = new T(params); @@ -261,7 +261,7 @@ class LLUICtrlFactory : public LLSingleton if (widget && !widget->postBuild()) { delete widget; - widget = NULL; + widget = nullptr; } return widget; diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index 950d4e72c67..311e9f868fa 100644 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -58,10 +58,10 @@ class LLUIString public: // These methods all perform appropriate argument substitution // and modify mOrig where appropriate - LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {} + LLUIString() : mArgs(nullptr), mNeedsResult(false), mNeedsWResult(false) {} LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args); - LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); } - LLUIString(const LLWString& instring) : mArgs(NULL) { assign(instring); } + LLUIString(const std::string& instring) : mArgs(nullptr) { assign(instring); } + LLUIString(const LLWString& instring) : mArgs(nullptr) { assign(instring); } ~LLUIString() { delete mArgs; } void assign(const std::string& instring); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index bba80dd20eb..045a4d8e4c3 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -1672,7 +1672,7 @@ std::string LLUrlEntryIPv6::getUrl(const std::string &string) const // LLUrlEntryKeybinding::LLUrlEntryKeybinding() : LLUrlEntryBase() - , pHandler(NULL) + , pHandler(nullptr) { mPattern = boost::regex(APP_HEADER_REGEX "/keybinding/\\w+(\\?mode=\\w+)?$", boost::regex::perl | boost::regex::icase); diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index cb101d325d0..f7a5e134cf2 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -167,7 +167,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL // find the first matching regex from all url entries in the registry U32 match_start = 0, match_end = 0; - LLUrlEntryBase *match_entry = NULL; + LLUrlEntryBase *match_entry = nullptr; std::vector::iterator it; for (it = mUrlEntry.begin(); it != mUrlEntry.end(); ++it) @@ -189,7 +189,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL if (matchRegex(text.c_str(), url_entry->getPattern(), start, end)) { // does this match occur in the string before any other match - if (start < match_start || match_entry == NULL) + if (start < match_start || match_entry == nullptr) { if (mLLUrlEntryInvalidSLURL == *it) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 7d6c937b857..685226e69a6 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -70,7 +70,7 @@ std::string LLView::sMouseHandlerMessage; bool LLView::sForceReshape = false; std::set LLView::sPreviewHighlightedElements; bool LLView::sHighlightingDiffs = false; -LLView* LLView::sPreviewClickedElement = NULL; +LLView* LLView::sPreviewClickedElement = nullptr; bool LLView::sDrawPreviewHighlights = false; S32 LLView::sLastLeftXML = S32_MIN; S32 LLView::sLastBottomXML = S32_MIN; @@ -144,7 +144,7 @@ LLView::LLView(const LLView::Params& p) : mVisible(p.visible), mInDraw(false), mName(p.name), - mParentView(NULL), + mParentView(nullptr), mReshapeFlags(FOLLOWS_NONE), mFromXUI(p.from_xui), mIsFocusRoot(p.focus_root), @@ -157,7 +157,7 @@ LLView::LLView(const LLView::Params& p) mDefaultTabGroup(p.default_tab_group), mLastTabGroup(0), mToolTipMsg((LLStringExplicit)p.tool_tip()), - mDefaultWidgets(NULL) + mDefaultWidgets(nullptr) { // create rect first, as this will supply initial follows flags setShape(p.rect); @@ -184,7 +184,7 @@ LLView::~LLView() deleteAllChildren(); - if (mParentView != NULL) + if (mParentView != nullptr) { mParentView->removeChild(this); } @@ -192,7 +192,7 @@ LLView::~LLView() if (mDefaultWidgets) { delete mDefaultWidgets; - mDefaultWidgets = NULL; + mDefaultWidgets = nullptr; } } @@ -344,7 +344,7 @@ void LLView::removeChild(LLView* child) // if we are removing an item we are currently iterating over, that would be bad llassert(!child->mInDraw); mChildList.remove( child ); - child->mParentView = NULL; + child->mParentView = nullptr; child_tab_order_t::iterator found = mTabOrder.find(child); if (found != mTabOrder.end()) { @@ -584,7 +584,7 @@ void LLView::deleteAllChildren() while (!mChildList.empty()) { LLView* viewp = mChildList.front(); - viewp->mParentView = NULL; + viewp->mParentView = nullptr; delete viewp; mChildList.pop_front(); } @@ -694,7 +694,7 @@ void LLView::setSnappedTo(const LLView* snap_view) bool LLView::handleHover(S32 x, S32 y, MASK mask) { - return childrenHandleHover( x, y, mask ) != NULL; + return childrenHandleHover( x, y, mask ) != nullptr; } void LLView::onMouseEnter(S32 x, S32 y, MASK mask) @@ -746,7 +746,7 @@ LLView* LLView::childrenHandleCharEvent(std::string_view desc, const METHOD& met } } } - return NULL; + return nullptr; } // XDATA might be MASK, or S32 clicks @@ -777,7 +777,7 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA return viewp; } } - return NULL; + return nullptr; } LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) @@ -801,7 +801,7 @@ LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) return viewp; } } - return NULL; + return nullptr; } LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, @@ -835,7 +835,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, return viewp; } } - return NULL; + return nullptr; } LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) @@ -860,13 +860,13 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) return viewp; } } - return NULL; + return nullptr; } LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) { if (!getVisible()) - return NULL; + return nullptr; for (LLView* viewp : mChildList) { @@ -975,7 +975,7 @@ bool LLView::handleKey(KEY key, MASK mask, bool called_from_parent) if( called_from_parent ) { // Downward traversal - handled = childrenHandleKey( key, mask ) != NULL; + handled = childrenHandleKey( key, mask ) != nullptr; } if (!handled) @@ -1007,7 +1007,7 @@ bool LLView::handleKeyUp(KEY key, MASK mask, bool called_from_parent) if (called_from_parent) { // Downward traversal - handled = childrenHandleKeyUp(key, mask) != NULL; + handled = childrenHandleKeyUp(key, mask) != nullptr; } if (!handled) @@ -1053,7 +1053,7 @@ bool LLView::handleUnicodeChar(llwchar uni_char, bool called_from_parent) if( called_from_parent ) { // Downward traversal - handled = childrenHandleUnicodeChar( uni_char ) != NULL; + handled = childrenHandleUnicodeChar( uni_char ) != nullptr; } if (!handled) @@ -1092,7 +1092,7 @@ bool LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EAcceptance* accept, std::string& tooltip_msg) { - return childrenHandleDragAndDrop( x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; + return childrenHandleDragAndDrop( x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != nullptr; } void LLView::onMouseCaptureLost() @@ -1108,49 +1108,49 @@ bool LLView::handleMouseUp(S32 x, S32 y, MASK mask) { LLView* r = childrenHandleMouseUp( x, y, mask ); - return (r!=NULL); + return (r != nullptr); } bool LLView::handleMouseDown(S32 x, S32 y, MASK mask) { LLView* r= childrenHandleMouseDown(x, y, mask ); - return (r!=NULL); + return (r != nullptr); } bool LLView::handleDoubleClick(S32 x, S32 y, MASK mask) { - return childrenHandleDoubleClick( x, y, mask ) != NULL; + return childrenHandleDoubleClick( x, y, mask ) != nullptr; } bool LLView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - return childrenHandleScrollWheel( x, y, clicks ) != NULL; + return childrenHandleScrollWheel( x, y, clicks ) != nullptr; } bool LLView::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - return childrenHandleScrollHWheel( x, y, clicks ) != NULL; + return childrenHandleScrollHWheel( x, y, clicks ) != nullptr; } bool LLView::handleRightMouseDown(S32 x, S32 y, MASK mask) { - return childrenHandleRightMouseDown( x, y, mask ) != NULL; + return childrenHandleRightMouseDown( x, y, mask ) != nullptr; } bool LLView::handleRightMouseUp(S32 x, S32 y, MASK mask) { - return childrenHandleRightMouseUp( x, y, mask ) != NULL; + return childrenHandleRightMouseUp( x, y, mask ) != nullptr; } bool LLView::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { - return childrenHandleMiddleMouseDown( x, y, mask ) != NULL; + return childrenHandleMiddleMouseDown( x, y, mask ) != nullptr; } bool LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { - return childrenHandleMiddleMouseUp( x, y, mask ) != NULL; + return childrenHandleMiddleMouseUp( x, y, mask ) != nullptr; } LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) @@ -1234,7 +1234,7 @@ void LLView::drawChildren() child_list_reverse_iter_t child = child_iter++; LLView *viewp = *child; - if (viewp == NULL) + if (viewp == nullptr) { continue; } @@ -1275,7 +1275,7 @@ void LLView::drawChildren() void LLView::dirtyRect() { LLView* child = getParent(); - LLView* parent = child ? child->getParent() : NULL; + LLView* parent = child ? child->getParent() : nullptr; LLView* cur = this; while (child && parent && parent->getParent()) { //find third to top-most view @@ -1362,7 +1362,7 @@ void LLView::drawDebugRect() S32 depth = 0; LLView * viewp = this; - while (NULL != viewp) + while (nullptr != viewp) { viewp = viewp->getParent(); depth++; @@ -1417,7 +1417,7 @@ void LLView::reshape(S32 width, S32 height, bool called_from_parent) // move child views according to reshape flags for (LLView* viewp : mChildList) { - if (viewp != NULL) + if (viewp != nullptr) { LLRect child_rect( viewp->mRect ); @@ -1617,7 +1617,7 @@ bool LLView::childHasKeyboardFocus(std::string_view childname) const { LLView *focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); - while (focus != NULL) + while (focus != nullptr) { if (focus->getName() == childname) { @@ -1634,7 +1634,7 @@ bool LLView::childHasKeyboardFocus(std::string_view childname) const bool LLView::hasChild(std::string_view childname, bool recurse) const { - return findChildView(childname, recurse) != NULL; + return findChildView(childname, recurse) != nullptr; } //----------------------------------------------------------------------------- @@ -1671,7 +1671,7 @@ LLView* LLView::findChildView(std::string_view name, bool recurse) const } } } - return NULL; + return nullptr; } bool LLView::parentPointInView(S32 x, S32 y, EHitTestType type) const @@ -1767,7 +1767,7 @@ LLView* LLView::findPrevSibling(LLView* child) { return *(--prev_it); } - return NULL; + return nullptr; } LLView* LLView::findNextSibling(LLView* child) @@ -1778,7 +1778,7 @@ LLView* LLView::findNextSibling(LLView* child) next_it++; } - return (next_it != mChildList.end()) ? *next_it : NULL; + return (next_it != mChildList.end()) ? *next_it : nullptr; } @@ -1890,7 +1890,7 @@ void LLView::centerWithin(const LLRect& bounds) bool LLView::localPointToOtherView( S32 x, S32 y, S32 *other_x, S32 *other_y, const LLView* other_view) const { const LLView* cur_view = this; - const LLView* root_view = NULL; + const LLView* root_view = nullptr; while (cur_view) { @@ -1934,7 +1934,7 @@ bool LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV { LLRect cur_rect = local; const LLView* cur_view = this; - const LLView* root_view = NULL; + const LLView* root_view = nullptr; while (cur_view) { @@ -2073,11 +2073,11 @@ LLView* LLView::findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding) { new_rect = mRect; - LLView* snap_view = NULL; + LLView* snap_view = nullptr; if (!mParentView) { - return NULL; + return nullptr; } S32 delta_x = 0; @@ -2141,10 +2141,10 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna if (!mParentView) { new_edge_val = snap_pos; - return NULL; + return nullptr; } - LLView* snap_view = NULL; + LLView* snap_view = nullptr; // If the view is near the edge of its parent, snap it to // the edge. diff --git a/indra/llui/llview.h b/indra/llui/llview.h index d747ef95551..6d015555451 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -255,7 +255,7 @@ class LLView // implemented in terms of addChild() bool addChildInBack(LLView* view, S32 tab_group = 0); - // remove the specified child from the view, and set it's parent to NULL. + // remove the specified child from the view, and set it's parent to nullptr. virtual void removeChild(LLView* view); virtual bool postBuild() { return true; } @@ -296,7 +296,7 @@ class LLView /// 'available' in this context means 'visible and enabled': in other /// words, can a user actually interact with this? virtual bool isAvailable() const; - /// The static isAvailable() tests an LLView* that could be NULL. + /// The static isAvailable() tests an LLView* that could be nullptr. static bool isAvailable(const LLView* view); U8 getSoundFlags() const { return mSoundFlags; } @@ -334,7 +334,7 @@ class LLView LLView* getRootView(); LLView* getParent() const { return mParentView; } - LLView* getFirstChild() const { return (mChildList.empty()) ? NULL : *(mChildList.begin()); } + LLView* getFirstChild() const { return (mChildList.empty()) ? nullptr : *(mChildList.begin()); } LLView* findPrevSibling(LLView* child); LLView* findNextSibling(LLView* child); S32 getChildCount() const { return (S32)mChildList.size(); } @@ -448,7 +448,7 @@ class LLView virtual void onMouseLeave(S32 x, S32 y, MASK mask); std::string getPathname() const; - // static method handles NULL pointer too + // static method handles nullptr pointer too static std::string getPathname(const LLView*); template T* findChild(std::string_view name, bool recurse = true) const @@ -485,7 +485,7 @@ class LLView } parent = parent->getParent(); } - return NULL; + return nullptr; } ////////////////////////////////////////////// diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index d53fd6eb91f..c30108cf4af 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -62,7 +62,7 @@ LLViewBorder::Params::Params() LLViewBorder::LLViewBorder(const LLViewBorder::Params& p) : LLView(p), - mTexture( NULL ), + mTexture( nullptr ), mHasKeyboardFocus( false ), mBorderWidth(p.border_thickness), mHighlightLight(p.highlight_light_color()), diff --git a/indra/llui/llviewinject.cpp b/indra/llui/llviewinject.cpp index 6da00de5d41..d55aeb81bc7 100644 --- a/indra/llui/llviewinject.cpp +++ b/indra/llui/llviewinject.cpp @@ -20,8 +20,8 @@ llview::TargetEvent::TargetEvent(LLView* view) { - // Walk up the view tree from target LLView to the root (NULL). If - // passed NULL, iterate 0 times. + // Walk up the view tree from target LLView to the root (nullptr). If + // passed nullptr, iterate 0 times. for (; view; view = view->getParent()) { // At each level, operator() is going to ask: for a particular parent diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 35963c2b994..6fcd5e97a68 100644 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -162,13 +162,13 @@ void LLListViewModel::setColumnLabel(const std::string& column, const std::strin LLScrollListItem* LLListViewModel::addElement(const LLSD& value, EAddPosition pos, void* userdata) { - return NULL; + return nullptr; } LLScrollListItem* LLListViewModel::addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) { - return NULL; + return nullptr; } void LLListViewModel::clearRows() diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index 16b0800ce2a..4541eb20ed2 100644 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -144,7 +144,7 @@ class LLListViewModel: public LLViewModel virtual void clearColumns(); virtual void setColumnLabel(const std::string& column, const std::string& label); virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, - void* userdata = NULL); + void* userdata = nullptr); virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id); virtual void clearRows(); diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index c03a15e8f99..6ab050c663b 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -93,7 +93,7 @@ class LLWidgetTypeFilter : public LLQueryFilter { /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(dynamic_cast(view) != NULL, true); + return filterResult_t(dynamic_cast(view) != nullptr, true); } }; diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index 273a1d7bde6..63721728485 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -462,7 +462,7 @@ bool LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) { mPrevX = 0; mPrevY = 0; - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); make_ui_sound("UISndClickRelease"); } return LLView::handleMouseUp(x, y, mask); diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 8fd85a89a18..b337d921491 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -485,7 +485,7 @@ void LLXSDWriter::addAttributeToSchema(LLXMLNodePtr type_declaration_node, const if (!attribute_name.empty()) { LLXMLNodePtr new_enum_type_node; - if (possible_values != NULL) + if (possible_values != nullptr) { // custom attribute type, for example // @@ -911,7 +911,7 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) } } - return (out_node == mWriteRootNode ? LLXMLNodePtr(NULL) : out_node); + return (out_node == mWriteRootNode ? LLXMLNodePtr(nullptr) : out_node); } bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) @@ -1334,7 +1334,7 @@ struct ScopedFile ~ScopedFile() { fclose(mFile); - mFile = NULL; + mFile = nullptr; } S32 getRemainingBytes() @@ -1348,7 +1348,7 @@ struct ScopedFile return file_size - cur_pos; } - bool isOpen() { return mFile != NULL; } + bool isOpen() { return mFile != nullptr; } LLFILE* mFile; }; @@ -1386,7 +1386,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl { LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI); - mParser = XML_ParserCreate(NULL); + mParser = XML_ParserCreate(nullptr); XML_SetUserData(mParser, this); XML_SetElementHandler( mParser, startElementHandler, endElementHandler); XML_SetCharacterDataHandler( mParser, characterDataHandler); @@ -1527,7 +1527,7 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) // parent node is not empty mEmptyLeafNode.back() = false; // we are empty if we have no attributes - mEmptyLeafNode.push_back(atts[0] == NULL); + mEmptyLeafNode.push_back(atts[0] == nullptr); mTokenSizeStack.push_back(num_tokens_pushed); readAttributes(atts); diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index 2179ae54d3c..90bef3e6138 100644 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -111,7 +111,7 @@ LOG_CLASS(LLXUIParser); void writeXUI(LLXMLNodePtr node, const BLOCK& block, const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), - const LLInitParam::BaseBlock* diff_block = NULL) + const LLInitParam::BaseBlock* diff_block = nullptr) { if (!diff_block && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) @@ -201,7 +201,7 @@ LOG_CLASS(LLSimpleXUIParser); typedef LLInitParam::Parser::name_stack_t name_stack_t; typedef LLInitParam::BaseBlock* (*element_start_callback_t)(LLSimpleXUIParser&, const char* block_name); - LLSimpleXUIParser(element_start_callback_t element_cb = NULL); + LLSimpleXUIParser(element_start_callback_t element_cb = nullptr); virtual ~LLSimpleXUIParser(); /*virtual*/ std::string getCurrentElementName(); diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 1521823ce2c..ccfd18ff0b4 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -305,7 +305,7 @@ bool LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { - gFocusMgr.setMouseCapture(NULL); + gFocusMgr.setMouseCapture(nullptr); make_ui_sound("UISndClickRelease"); } diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 95d1586495b..626da2e9e37 100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -72,7 +72,7 @@ boost::signals2::connection LLCacheName::getGroup(const LLUUID& id, const LLCach return boost::signals2::connection(); } -LLCacheName* gCacheName = NULL; +LLCacheName* gCacheName = nullptr; // // Stub implementation for LLTrans @@ -160,7 +160,7 @@ namespace LLInitParam //static LLFontGL* LLFontGL::getFontDefault() { - return NULL; + return nullptr; } char const* const _PREHASH_AgentData = (char *)"AgentData"; diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 088cdd675bc..ad4e42ac09f 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -68,7 +68,7 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa return LLUIColor(); } -LLUIColor::LLUIColor() : mColorPtr(NULL) {} +LLUIColor::LLUIColor() : mColorPtr(nullptr) {} LLUIImage::LLUIImage(const std::string& name, LLPointer image) { diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index d03efbc1c90..3b40b0cdaba 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -34,7 +34,7 @@ // link seams LLUIColor::LLUIColor() - : mColorPtr(NULL) + : mColorPtr(nullptr) {} LLStyle::Params::Params() @@ -121,7 +121,7 @@ namespace LLInitParam //static LLFontGL* LLFontGL::getFontDefault() { - return NULL; + return nullptr; }