diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp index 0c197e5354..af3aba49a3 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetCommon.cpp @@ -456,7 +456,7 @@ namespace AZ { if (loadBehavior & (1 << thisFlag)) { - returnFlags[thisFlag] = 1; + returnFlags[thisFlag] = true; } } return returnFlags; diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp index 3df751fb02..6ba69cffd5 100644 --- a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp +++ b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp @@ -71,8 +71,8 @@ namespace AZ ////////////////////////////////////////////////////////////////////////// // EBusTraits overrides static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; - typedef AssetId BusIdType; - typedef AZStd::recursive_mutex MutexType; + using BusIdType = AssetId; + using MutexType = AZStd::recursive_mutex; template struct AssetJobConnectionPolicy @@ -107,7 +107,7 @@ namespace AZ virtual void OnLoadCanceled(AssetId assetId) = 0; }; - typedef EBus BlockingAssetLoadBus; + using BlockingAssetLoadBus = EBus; /* * This class processes async AssetDatabase load jobs diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index eda08401a2..c76156c006 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -644,7 +644,7 @@ namespace AZ NameDictionary::Create(); // Call this and child class's reflects - ReflectionEnvironment::GetReflectionManager()->Reflect(azrtti_typeid(this), AZStd::bind(&ComponentApplication::Reflect, this, AZStd::placeholders::_1)); + ReflectionEnvironment::GetReflectionManager()->Reflect(azrtti_typeid(this), [this](ReflectContext* context) {Reflect(context); }); RegisterCoreComponents(); TickBus::AllowFunctionQueuing(true); @@ -970,7 +970,12 @@ namespace AZ { if (ReflectionEnvironment::GetReflectionManager()) { - ReflectionEnvironment::GetReflectionManager()->Reflect(descriptor->GetUuid(), AZStd::bind(&ComponentDescriptor::Reflect, descriptor, AZStd::placeholders::_1)); + ReflectionEnvironment::GetReflectionManager()->Reflect( + descriptor->GetUuid(), + [descriptor](ReflectContext* context) + { + descriptor->Reflect(context); + }); } } diff --git a/Code/Framework/AzCore/AzCore/Compression/compression.cpp b/Code/Framework/AzCore/AzCore/Compression/compression.cpp index 60351b0f7c..8b6f270b00 100644 --- a/Code/Framework/AzCore/AzCore/Compression/compression.cpp +++ b/Code/Framework/AzCore/AzCore/Compression/compression.cpp @@ -23,8 +23,8 @@ using namespace AZ; // [3/21/2011] //========================================================================= ZLib::ZLib(IAllocator* workMemAllocator) - : m_strDeflate(NULL) - , m_strInflate(NULL) + : m_strDeflate(nullptr) + , m_strInflate(nullptr) { m_workMemoryAllocator = workMemAllocator ? workMemAllocator->GetAllocationSource() : nullptr; if (!m_workMemoryAllocator) @@ -75,7 +75,7 @@ void ZLib::FreeMem(void* userData, void* address) //========================================================================= void ZLib::StartCompressor(unsigned int compressionLevel) { - AZ_Assert(m_strDeflate == NULL, "Compressor already started!"); + AZ_Assert(m_strDeflate == nullptr, "Compressor already started!"); m_strDeflate = reinterpret_cast< z_stream* >(AllocateMem(m_workMemoryAllocator, 1, sizeof(z_stream))); m_strDeflate->zalloc = &ZLib::AllocateMem; m_strDeflate->zfree = &ZLib::FreeMem; @@ -91,10 +91,10 @@ void ZLib::StartCompressor(unsigned int compressionLevel) //========================================================================= void ZLib::StopCompressor() { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); deflateEnd(m_strDeflate); FreeMem(m_workMemoryAllocator, m_strDeflate); - m_strDeflate = NULL; + m_strDeflate = nullptr; } //========================================================================= @@ -103,7 +103,7 @@ void ZLib::StopCompressor() //========================================================================= void ZLib::ResetCompressor() { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); int r = deflateReset(m_strDeflate); (void)r; AZ_Assert(r == Z_OK, "ZLib inconsistent state - deflateReset() failed !!!\n"); @@ -115,7 +115,7 @@ void ZLib::ResetCompressor() //========================================================================= unsigned int ZLib::Compress(const void* data, unsigned int& dataSize, void* compressedData, unsigned int compressedDataSize, FlushType flushType) { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); m_strDeflate->avail_in = dataSize; m_strDeflate->next_in = (unsigned char*)data; m_strDeflate->avail_out = compressedDataSize; @@ -158,7 +158,7 @@ unsigned int ZLib::Compress(const void* data, unsigned int& dataSize, void* comp //========================================================================= unsigned int ZLib::GetMinCompressedBufferSize(unsigned int sourceDataSize) { - AZ_Assert(m_strDeflate != NULL, "Compressor not started!"); + AZ_Assert(m_strDeflate != nullptr, "Compressor not started!"); return static_cast(deflateBound(m_strDeflate, sourceDataSize)); } @@ -168,7 +168,7 @@ unsigned int ZLib::GetMinCompressedBufferSize(unsigned int sourceDataSize) //========================================================================= void ZLib::StartDecompressor(Header* header) { - AZ_Assert(m_strInflate == NULL, "Decompressor already started!"); + AZ_Assert(m_strInflate == nullptr, "Decompressor already started!"); m_strInflate = reinterpret_cast< z_stream* >(AllocateMem(m_workMemoryAllocator, 1, sizeof(z_stream))); m_strInflate->zalloc = &ZLib::AllocateMem; m_strInflate->zfree = &ZLib::FreeMem; @@ -188,10 +188,10 @@ void ZLib::StartDecompressor(Header* header) //========================================================================= void ZLib::StopDecompressor() { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); inflateEnd(m_strInflate); FreeMem(m_workMemoryAllocator, m_strInflate); - m_strInflate = NULL; + m_strInflate = nullptr; } //========================================================================= @@ -200,7 +200,7 @@ void ZLib::StopDecompressor() //========================================================================= void ZLib::ResetDecompressor(Header* header) { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); int r = inflateReset(m_strInflate); (void)r; AZ_Assert(r == Z_OK, "ZLib inconsistent state - inflateReset() failed !!!\n"); @@ -229,7 +229,7 @@ void ZLib::SetupDecompressHeader(Header header) //========================================================================= unsigned int ZLib::Decompress(const void* compressedData, unsigned int compressedDataSize, void* data, unsigned int& dataSize, FlushType flushType) { - AZ_Assert(m_strInflate != NULL, "Decompressor not started!"); + AZ_Assert(m_strInflate != nullptr, "Decompressor not started!"); m_strInflate->avail_in = compressedDataSize; m_strInflate->next_in = (unsigned char*)compressedData; m_strInflate->avail_out = dataSize; diff --git a/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp b/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp index 049ac2e8a1..0009ec83b3 100644 --- a/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/LocalFileEventLogger.cpp @@ -242,7 +242,9 @@ namespace AZ::Debug ThreadData* threadData = threadStorage.m_data; // Set to nullptr so other threads doing a flush can't pick this up. - while (!threadStorage.m_data.compare_exchange_strong(threadData, nullptr)); + while (!threadStorage.m_data.compare_exchange_strong(threadData, nullptr)) + { + } uint32_t writeSize = AZ_SIZE_ALIGN_UP(sizeof(EventHeader) + size, EventBoundary); if (threadData->m_usedBytes + writeSize >= ThreadData::BufferSize) @@ -270,7 +272,9 @@ namespace AZ::Debug // swap the pending data to commit the event ThreadStorage& threadStorage = GetThreadStorage(); ThreadData* expectedData = nullptr; - while (!threadStorage.m_data.compare_exchange_strong(expectedData, threadStorage.m_pendingData)); + while (!threadStorage.m_data.compare_exchange_strong(expectedData, threadStorage.m_pendingData)) + { + } threadStorage.m_pendingData = nullptr; } diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp index 429986b724..14504cc282 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp @@ -218,7 +218,7 @@ namespace AZ void Debug::Trace::Crash() { - int* p = 0; + int* p = nullptr; *p = 1; } diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.h b/Code/Framework/AzCore/AzCore/Debug/Trace.h index b00a1cd921..26c331e1e4 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.h +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.h @@ -19,7 +19,7 @@ namespace AZ { void OutputToDebugger(const char* window, const char* message); } - + /// Global instance to the tracer. extern class Trace g_tracer; @@ -41,7 +41,7 @@ namespace AZ static void Destroy(); static int GetAssertVerbosityLevel(); static void SetAssertVerbosityLevel(int level); - + /** * Returns the default string used for a system window. * It can be useful for Trace message handlers to easily validate if the window they received is the fallback window used by this class, @@ -109,7 +109,7 @@ namespace AZ * Correct usage: * AZ_Assert(false, "Fail always"); */ - + namespace AZ { namespace TraceInternal @@ -121,7 +121,7 @@ namespace AZ static constexpr ExpressionValidResult value = ExpressionValidResult::Valid; }; template<> - struct ExpressionIsValid + struct ExpressionIsValid { static constexpr ExpressionValidResult value = ExpressionValidResult::Valid; }; @@ -228,7 +228,7 @@ namespace AZ { \ AZ::Debug::Trace::Instance().Printf(window, __VA_ARGS__); \ } - + //! The AZ_TrancePrintfOnce macro output the result of the format string only once for each use of the macro //! It does not take into account the result of the format string to determine whether to output the string or not diff --git a/Code/Framework/AzCore/AzCore/Driller/Driller.cpp b/Code/Framework/AzCore/AzCore/Driller/Driller.cpp index 84f0fe3158..41abd7793e 100644 --- a/Code/Framework/AzCore/AzCore/Driller/Driller.cpp +++ b/Code/Framework/AzCore/AzCore/Driller/Driller.cpp @@ -208,7 +208,7 @@ namespace AZ { if (drillerList.empty()) { - return NULL; + return nullptr; } m_sessions.push_back(); @@ -246,21 +246,21 @@ namespace AZ AZStd::lock_guard lock(DrillerEBusMutex::GetMutex()); ///< Make sure no driller is writing to the stream for (DrillerListType::const_iterator iDriller = drillerList.begin(); iDriller != drillerList.end(); ++iDriller) { - Driller* driller = NULL; + Driller* driller = nullptr; const DrillerInfo& di = *iDriller; for (size_t iDesc = 0; iDesc < m_drillers.size(); ++iDesc) { if (m_drillers[iDesc]->GetId() == di.id) { driller = m_drillers[iDesc]; - AZ_Assert(driller->m_output == NULL, "Driller with id %08x is already have an output stream %p (currently we support only 1 at a time)", di.id, driller->m_output); + AZ_Assert(driller->m_output == nullptr, "Driller with id %08x is already have an output stream %p (currently we support only 1 at a time)", di.id, driller->m_output); driller->m_output = &output; driller->Start(di.params.data(), static_cast(di.params.size())); s.drillers.push_back(driller); break; } } - AZ_Warning("Driller", driller != NULL, "We can't start a driller with id %d!", di.id); + AZ_Warning("Driller", driller != nullptr, "We can't start a driller with id %d!", di.id); } } return &s; @@ -293,7 +293,7 @@ namespace AZ for (size_t i = 0; i < s.drillers.size(); ++i) { s.drillers[i]->Stop(); - s.drillers[i]->m_output = NULL; + s.drillers[i]->m_output = nullptr; } } s.output->EndTag(AZ_CRC("Frame", 0xb5f83ccd)); diff --git a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp index f43e337bb8..761f964561 100644 --- a/Code/Framework/AzCore/AzCore/Driller/Stream.cpp +++ b/Code/Framework/AzCore/AzCore/Driller/Stream.cpp @@ -677,7 +677,7 @@ namespace AZ AZStd::endian_swap(crc32); } stringPtr = m_stringPool->Find(crc32); - AZ_Assert(stringPtr != NULL, "Failed to find string with id 0x%08x in the string pool, proper stream read is impossible!", crc32); + AZ_Assert(stringPtr != nullptr, "Failed to find string with id 0x%08x in the string pool, proper stream read is impossible!", crc32); stringLength = static_cast(strlen(stringPtr)); } else if (m_isPooledString) @@ -710,7 +710,7 @@ namespace AZ //========================================================================= const DrillerDOMParser::Node* DrillerDOMParser::Node::GetTag(u32 tagName) const { - const Node* tagNode = NULL; + const Node* tagNode = nullptr; for (Node::NodeListType::const_iterator i = m_tags.begin(); i != m_tags.end(); ++i) { if ((*i).m_name == tagName) @@ -728,7 +728,7 @@ namespace AZ //========================================================================= const DrillerDOMParser::Data* DrillerDOMParser::Node::GetData(u32 dataName) const { - const Data* dataNode = NULL; + const Data* dataNode = nullptr; for (Node::DataListType::const_iterator i = m_data.begin(); i != m_data.end(); ++i) { if (i->m_name == dataName) @@ -749,7 +749,7 @@ namespace AZ , m_isPersistentInputData(isPersistentInputData) { m_root.m_name = 0; - m_root.m_parent = NULL; + m_root.m_parent = nullptr; m_topNode = &m_root; } static int g_numFree = 0; @@ -850,14 +850,14 @@ namespace AZ return; } - DrillerHandlerParser* childHandler = NULL; + DrillerHandlerParser* childHandler = nullptr; DrillerHandlerParser* currentHandler = m_stack.back(); if (isOpen) { - if (currentHandler != NULL) + if (currentHandler != nullptr) { childHandler = currentHandler->OnEnterTag(name); - AZ_Warning("Driller", !currentHandler->IsWarnOnUnsupportedTags() || childHandler != NULL, "Could not find handler for tag 0x%08x", name); + AZ_Warning("Driller", !currentHandler->IsWarnOnUnsupportedTags() || childHandler != nullptr, "Could not find handler for tag 0x%08x", name); } m_stack.push_back(childHandler); } diff --git a/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp b/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp index a61cdb1133..f973c0e95a 100644 --- a/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp +++ b/Code/Framework/AzCore/AzCore/IO/CompressorZLib.cpp @@ -22,10 +22,10 @@ namespace AZ // [12/13/2012] //========================================================================= CompressorZLib::CompressorZLib(unsigned int decompressionCachePerStream, unsigned int dataBufferSize) - : m_lastReadStream(NULL) + : m_lastReadStream(nullptr) , m_lastReadStreamOffset(0) , m_lastReadStreamSize(0) - , m_compressedDataBuffer(NULL) + , m_compressedDataBuffer(nullptr) , m_compressedDataBufferSize(dataBufferSize) , m_compressedDataBufferUseCount(0) , m_decompressionCachePerStream(decompressionCachePerStream) @@ -63,7 +63,7 @@ namespace AZ //========================================================================= bool CompressorZLib::ReadHeaderAndData(CompressorStream* stream, AZ::u8* data, unsigned int dataSize) { - if (stream->GetCompressorData() != NULL) // we already have compressor data + if (stream->GetCompressorData() != nullptr) // we already have compressor data { return false; } @@ -347,7 +347,7 @@ namespace AZ AZ_Assert(stream && stream->GetCompressorData(), "This stream doesn't have compression enabled! Call Stream::WriteCompressed after you create the file!"); AZ_Assert(offset == SizeType(-1) || offset == stream->GetCurPos(), "We can write compressed data only at the end of the stream!"); - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). CompressorZLibData* zlibData = static_cast(stream->GetCompressorData()); AZ_Assert(!zlibData->m_zlib.IsDecompressorStarted(), "You can't write while reading/decompressing a compressed stream!"); @@ -398,13 +398,13 @@ namespace AZ AZ_Assert(stream && stream->GetCompressorData(), "This stream doesn't have compression enabled! Call Stream::WriteCompressed after you create the file!"); CompressorZLibData* zlibData = static_cast(stream->GetCompressorData()); - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). unsigned int compressedSize; unsigned int dataToCompress = 0; do { - compressedSize = zlibData->m_zlib.Compress(NULL, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FULL_FLUSH); + compressedSize = zlibData->m_zlib.Compress(nullptr, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FULL_FLUSH); if (compressedSize) { GenericStream* baseStream = stream->GetWrappedStream(); @@ -429,7 +429,7 @@ namespace AZ //========================================================================= bool CompressorZLib::StartCompressor(CompressorStream* stream, int compressionLevel, SizeType autoSeekDataSize) { - AZ_Assert(stream && stream->GetCompressorData() == NULL, "Stream has compressor already enabled!"); + AZ_Assert(stream && stream->GetCompressorData() == nullptr, "Stream has compressor already enabled!"); AcquireDataBuffer(); @@ -470,14 +470,14 @@ namespace AZ bool result = true; if (zlibData->m_zlib.IsCompressorStarted()) { - m_lastReadStream = NULL; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). + m_lastReadStream = nullptr; // invalidate last read position, otherwise m_dataBuffer will be corrupted (as we are about to write in it). // flush all compressed data unsigned int compressedSize; unsigned int dataToCompress = 0; do { - compressedSize = zlibData->m_zlib.Compress(NULL, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FINISH); + compressedSize = zlibData->m_zlib.Compress(nullptr, dataToCompress, m_compressedDataBuffer, m_compressedDataBufferSize, ZLib::FT_FINISH); if (compressedSize) { baseStream->Write(compressedSize, m_compressedDataBuffer); @@ -502,7 +502,7 @@ namespace AZ { if (m_lastReadStream == stream) { - m_lastReadStream = NULL; // invalidate the data in m_dataBuffer if it was from the current stream. + m_lastReadStream = nullptr; // invalidate the data in m_dataBuffer if it was from the current stream. } } @@ -525,11 +525,11 @@ namespace AZ //========================================================================= void CompressorZLib::AcquireDataBuffer() { - if (m_compressedDataBuffer == NULL) + if (m_compressedDataBuffer == nullptr) { AZ_Assert(m_compressedDataBufferUseCount == 0, "Buffer usecount should be 0 if the buffer is NULL"); m_compressedDataBuffer = reinterpret_cast(azmalloc(m_compressedDataBufferSize, m_CompressedDataBufferAlignment, AZ::SystemAllocator, "CompressorZLib")); - m_lastReadStream = NULL; // reset the cache info in the m_dataBuffer + m_lastReadStream = nullptr; // reset the cache info in the m_dataBuffer } ++m_compressedDataBufferUseCount; } @@ -543,10 +543,10 @@ namespace AZ --m_compressedDataBufferUseCount; if (m_compressedDataBufferUseCount == 0) { - AZ_Assert(m_compressedDataBuffer != NULL, "Invalid data buffer! We should have a non null pointer!"); + AZ_Assert(m_compressedDataBuffer != nullptr, "Invalid data buffer! We should have a non null pointer!"); azfree(m_compressedDataBuffer, AZ::SystemAllocator, m_compressedDataBufferSize, m_CompressedDataBufferAlignment); - m_compressedDataBuffer = NULL; - m_lastReadStream = NULL; // reset the cache info in the m_dataBuffer + m_compressedDataBuffer = nullptr; + m_lastReadStream = nullptr; // reset the cache info in the m_dataBuffer } } } // namespace IO diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp index 8de8b6b70f..5bff79b422 100644 --- a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp +++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp @@ -127,7 +127,7 @@ bool SystemFile::Open(const char* fileName, int mode, int platformFlags) bool SystemFile::ReOpen(int mode, int platformFlags) { AZ_Assert(!m_fileName.empty(), "Missing filename. You must call open first!"); - return Open(0, mode, platformFlags); + return Open(nullptr, mode, platformFlags); } void SystemFile::Close() diff --git a/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp b/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp index 37c88e34fc..af73ab4936 100644 --- a/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp +++ b/Code/Framework/AzCore/AzCore/IPC/SharedMemory.cpp @@ -125,7 +125,7 @@ SharedMemory::Close() bool SharedMemory::Map(AccessMode mode, unsigned int size) { - AZ_Assert(m_mappedBase == NULL, "We already have data mapped"); + AZ_Assert(m_mappedBase == nullptr, "We already have data mapped"); AZ_Assert(Platform::IsMapHandleValid(), "You must call Map() first!"); bool result = Platform::Map(mode, size); @@ -232,7 +232,7 @@ bool SharedMemory::CheckMappedBaseValid() // [4/29/2011] //========================================================================= SharedMemoryRingBuffer::SharedMemoryRingBuffer() - : m_info(NULL) + : m_info(nullptr) {} //========================================================================= @@ -279,7 +279,7 @@ SharedMemoryRingBuffer::Map(AccessMode mode, unsigned int size) bool SharedMemoryRingBuffer::UnMap() { - m_info = NULL; + m_info = nullptr; return SharedMemory::UnMap(); } @@ -291,7 +291,7 @@ bool SharedMemoryRingBuffer::Write(const void* data, unsigned int dataSize) { AZ_Warning("AZSystem", !Platform::IsWaitFailed(), "You are writing the ring buffer %s while the Global lock is NOT locked! This can lead to data corruption!", m_name); - AZ_Assert(m_info != NULL, "You need to Create and Map the buffer first!"); + AZ_Assert(m_info != nullptr, "You need to Create and Map the buffer first!"); if (m_info->m_writeOffset >= m_info->m_readOffset) { unsigned int freeSpace = m_dataSize - (m_info->m_writeOffset - m_info->m_readOffset); @@ -346,7 +346,7 @@ SharedMemoryRingBuffer::Read(void* data, unsigned int maxDataSize) return 0; } - AZ_Assert(m_info != NULL, "You need to Create and Map the buffer first!"); + AZ_Assert(m_info != nullptr, "You need to Create and Map the buffer first!"); unsigned int dataRead; if (m_info->m_writeOffset > m_info->m_readOffset) { diff --git a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp index 73fb4ecfe8..f76946a667 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Internal/JobManagerWorkStealing.cpp @@ -192,15 +192,15 @@ void JobManagerWorkStealing::SuspendJobUntilReady(Job* job) ThreadInfo* info = GetCurrentOrCreateThreadInfo(); AZ_Assert(info->m_currentJob == job, ("Can't suspend a job which isn't currently running")); - info->m_currentJob = NULL; //clear current job + info->m_currentJob = nullptr; //clear current job if (IsAsynchronous()) { - ProcessJobsAssist(info, job, NULL); + ProcessJobsAssist(info, job, nullptr); } else { - ProcessJobsSynchronous(info, job, NULL); + ProcessJobsSynchronous(info, job, nullptr); } info->m_currentJob = job; //restore current job @@ -223,11 +223,11 @@ void JobManagerWorkStealing::StartJobAndAssistUntilComplete(Job* job) //the processing functions will return when the empty job dependent count has reached 1 if (IsAsynchronous()) { - ProcessJobsAssist(info, NULL, ¬ifyFlag); + ProcessJobsAssist(info, nullptr, ¬ifyFlag); } else { - ProcessJobsSynchronous(info, NULL, ¬ifyFlag); + ProcessJobsSynchronous(info, nullptr, ¬ifyFlag); } AZ_Assert(!m_currentThreadInfo, ""); @@ -306,9 +306,9 @@ void JobManagerWorkStealing::ProcessJobsWorker(ThreadInfo* info) //setup thread-local storage m_currentThreadInfo = info; - ProcessJobsInternal(info, NULL, NULL); + ProcessJobsInternal(info, nullptr, nullptr); - m_currentThreadInfo = NULL; + m_currentThreadInfo = nullptr; } void JobManagerWorkStealing::ProcessJobsAssist(ThreadInfo* info, Job* suspendedJob, AZStd::atomic* notifyFlag) @@ -529,7 +529,7 @@ void JobManagerWorkStealing::ProcessJobsSynchronous(ThreadInfo* info, Job* suspe info->m_currentJob = job; Process(job); - info->m_currentJob = NULL; + info->m_currentJob = nullptr; //...after calling Process we cannot use the job pointer again, the job has completed and may not exist anymore #ifdef JOBMANAGER_ENABLE_STATS diff --git a/Code/Framework/AzCore/AzCore/Jobs/Job.cpp b/Code/Framework/AzCore/AzCore/Jobs/Job.cpp index d3a2a77d92..8462cf47e8 100644 --- a/Code/Framework/AzCore/AzCore/Jobs/Job.cpp +++ b/Code/Framework/AzCore/AzCore/Jobs/Job.cpp @@ -36,7 +36,7 @@ namespace AZ } countAndFlags |= (unsigned int)((priority << FLAG_PRIORITY_START_BIT) & FLAG_PRIORITY_MASK); SetDependentCountAndFlags(countAndFlags); - StoreDependent(NULL); + StoreDependent(nullptr); #ifdef AZ_DEBUG_JOB_STATE SetState(STATE_SETUP); @@ -66,7 +66,7 @@ namespace AZ SetDependentCountAndFlags(countAndFlags); if (isClearDependent) { - StoreDependent(NULL); + StoreDependent(nullptr); } else { diff --git a/Code/Framework/AzCore/AzCore/Math/Uuid.cpp b/Code/Framework/AzCore/AzCore/Math/Uuid.cpp index 6e71ffc3bd..d875e28a1e 100644 --- a/Code/Framework/AzCore/AzCore/Math/Uuid.cpp +++ b/Code/Framework/AzCore/AzCore/Math/Uuid.cpp @@ -56,7 +56,7 @@ namespace AZ Uuid Uuid::CreateStringSkipWarnings(const char* string, size_t stringLength, [[maybe_unused]] bool skipWarnings) { - if (string == NULL) + if (string == nullptr) { return Uuid::CreateNull(); } @@ -71,7 +71,7 @@ namespace AZ if (len < 32 || len > 38) { - AZ_Warning("Math", skipWarnings, "Invalid UUID format %s (must be) {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (or without dashes and braces)", string != NULL ? string : "null"); + AZ_Warning("Math", skipWarnings, "Invalid UUID format %s (must be) {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (or without dashes and braces)", string != nullptr ? string : "null"); return Uuid::CreateNull(); } diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp index 7d644c6917..b55b2db768 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/AllocationRecords.cpp @@ -169,7 +169,7 @@ AllocationRecords::RegisterAllocation(void* address, size_t byteSize, size_t ali ai.m_timeStamp = AZStd::GetTimeNowMicroSecond(); // if we don't have a fileName,lineNum record the stack or if the user requested it. - if ((fileName == 0 && m_mode == RECORD_STACK_IF_NO_FILE_LINE) || m_mode == RECORD_FULL) + if ((fileName == nullptr && m_mode == RECORD_STACK_IF_NO_FILE_LINE) || m_mode == RECORD_FULL) { ai.m_stackFrames = m_numStackLevels ? reinterpret_cast(m_records.get_allocator().allocate(sizeof(AZ::Debug::StackFrame)*m_numStackLevels, 1)) : nullptr; if (ai.m_stackFrames) diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp b/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp index b34a88669c..3c09b4cae6 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/AllocatorManager.cpp @@ -39,9 +39,9 @@ namespace AZ return AZStd::hash{}(key); } }; - typedef AZStd::basic_string, AZStdIAllocator> AMString; - typedef AZStd::unordered_map, AZStdIAllocator> AllocatorNameMap; - typedef AZStd::unordered_map, AZStdIAllocator> AllocatorRemappings; + using AMString = AZStd::basic_string, AZStdIAllocator>; + using AllocatorNameMap = AZStd::unordered_map, AZStdIAllocator>; + using AllocatorRemappings = AZStd::unordered_map, AZStdIAllocator>; // For allocators that are created before we have an environment, we keep some module-local data for them so that we can register them // properly once the environment is attached. @@ -403,7 +403,7 @@ AllocatorManager::AddOutOfMemoryListener(const OutOfMemoryCBType& cb) void AllocatorManager::RemoveOutOfMemoryListener() { - m_outOfMemoryListener = 0; + m_outOfMemoryListener = nullptr; } //========================================================================= @@ -660,13 +660,13 @@ void AllocatorManager::GetAllocatorStats(size_t& allocatedBytes, size_t& capacit //========================================================================= AllocatorManager::MemoryBreak::MemoryBreak() { - addressStart = NULL; - addressEnd = NULL; + addressStart = nullptr; + addressEnd = nullptr; byteSize = 0; alignment = static_cast(0xffffffff); - name = NULL; + name = nullptr; - fileName = NULL; + fileName = nullptr; lineNum = -1; } @@ -729,14 +729,14 @@ AllocatorManager::DebugBreak(void* address, const Debug::AllocationInfo& info) AZ_Assert(!(m_memoryBreak[i].alignment == info.m_alignment), "User triggered breakpoint - alignment (%d)", info.m_alignment); AZ_Assert(!(m_memoryBreak[i].byteSize == info.m_byteSize), "User triggered breakpoint - allocation size (%d)", info.m_byteSize); - AZ_Assert(!(info.m_name != NULL && m_memoryBreak[i].name != NULL && strcmp(m_memoryBreak[i].name, info.m_name) == 0), "User triggered breakpoint - name \"%s\"", info.m_name); + AZ_Assert(!(info.m_name != nullptr && m_memoryBreak[i].name != nullptr && strcmp(m_memoryBreak[i].name, info.m_name) == 0), "User triggered breakpoint - name \"%s\"", info.m_name); if (m_memoryBreak[i].lineNum != 0) { - AZ_Assert(!(info.m_fileName != NULL && m_memoryBreak[i].fileName != NULL && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0 && m_memoryBreak[i].lineNum == info.m_lineNum), "User triggered breakpoint - file/line number : %s(%d)", info.m_fileName, info.m_lineNum); + AZ_Assert(!(info.m_fileName != nullptr && m_memoryBreak[i].fileName != nullptr && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0 && m_memoryBreak[i].lineNum == info.m_lineNum), "User triggered breakpoint - file/line number : %s(%d)", info.m_fileName, info.m_lineNum); } else { - AZ_Assert(!(info.m_fileName != NULL && m_memoryBreak[i].fileName != NULL && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0), "User triggered breakpoint - file name \"%s\"", info.m_fileName); + AZ_Assert(!(info.m_fileName != nullptr && m_memoryBreak[i].fileName != nullptr && strcmp(m_memoryBreak[i].fileName, info.m_fileName) == 0), "User triggered breakpoint - file name \"%s\"", info.m_fileName); } } } diff --git a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp index a9b0ec92c3..cf26c8f723 100644 --- a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp @@ -22,7 +22,7 @@ using namespace AZ; //========================================================================= BestFitExternalMapAllocator::BestFitExternalMapAllocator() : AllocatorBase(this, "BestFitExternalMapAllocator", "Best fit allocator with external tracking storage!") - , m_schema(NULL) + , m_schema(nullptr) {} //========================================================================= @@ -47,7 +47,7 @@ BestFitExternalMapAllocator::Create(const Descriptor& desc) schemaDesc.m_memoryBlockByteSize = desc.m_memoryBlockByteSize; m_schema = azcreate(BestFitExternalMapSchema, (schemaDesc), SystemAllocator); - if (m_schema == NULL) + if (m_schema == nullptr) { isReady = false; } @@ -63,7 +63,7 @@ void BestFitExternalMapAllocator::Destroy() { azdestroy(m_schema, SystemAllocator); - m_schema = NULL; + m_schema = nullptr; } AllocatorDebugConfig BestFitExternalMapAllocator::GetDebugConfig() @@ -89,7 +89,7 @@ BestFitExternalMapAllocator::Allocate(size_type byteSize, size_type alignment, i byteSize = MemorySizeAdjustedUp(byteSize); BestFitExternalMapAllocator::pointer_type address = m_schema->Allocate(byteSize, alignment, flags); - if (address == 0) + if (address == nullptr) { if (!OnOutOfMemory(byteSize, alignment, flags, name, fileName, lineNum)) { @@ -100,7 +100,7 @@ BestFitExternalMapAllocator::Allocate(size_type byteSize, size_type alignment, i } } - AZ_Assert(address != 0, "BestFitExternalMapAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); + AZ_Assert(address != nullptr, "BestFitExternalMapAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); return address; @@ -145,7 +145,7 @@ BestFitExternalMapAllocator::ReAllocate(pointer_type ptr, size_type newSize, siz (void)newSize; (void)newAlignment; AZ_Assert(false, "Not supported!"); - return NULL; + return nullptr; } //========================================================================= diff --git a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp index 1cd7f156d1..d94d1dfe35 100644 --- a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapSchema.cpp @@ -18,15 +18,15 @@ using namespace AZ; BestFitExternalMapSchema::BestFitExternalMapSchema(const Descriptor& desc) : m_desc(desc) , m_used(0) - , m_freeChunksMap(FreeMapType::key_compare(), AZStdIAllocator(desc.m_mapAllocator != NULL ? desc.m_mapAllocator : &AllocatorInstance::Get())) - , m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != NULL ? desc.m_mapAllocator : &AllocatorInstance::Get())) + , m_freeChunksMap(FreeMapType::key_compare(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance::Get())) + , m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance::Get())) { - if (m_desc.m_mapAllocator == NULL) + if (m_desc.m_mapAllocator == nullptr) { m_desc.m_mapAllocator = &AllocatorInstance::Get(); // used as our sub allocator } AZ_Assert(m_desc.m_memoryBlockByteSize > 0, "You must provide memory block size!"); - AZ_Assert(m_desc.m_memoryBlock != NULL, "You must provide memory block allocated as you with!"); + AZ_Assert(m_desc.m_memoryBlock != nullptr, "You must provide memory block allocated as you with!"); //if( m_desc.m_memoryBlock == NULL) there is no point to automate this cause we need to flag this memory special, otherwise there is no point to use this allocator at all // m_desc.m_memoryBlock = azmalloc(SystemAllocator,m_desc.m_memoryBlockByteSize,16); m_freeChunksMap.insert(AZStd::make_pair(m_desc.m_memoryBlockByteSize, reinterpret_cast(m_desc.m_memoryBlock))); @@ -40,13 +40,13 @@ BestFitExternalMapSchema::pointer_type BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int flags) { (void)flags; - char* address = NULL; + char* address = nullptr; AZ_Assert(alignment > 0 && (alignment & (alignment - 1)) == 0, "Alignment must be >0 and power of 2!"); for (int i = 0; i < 2; ++i) // max 2 attempts to allocate { FreeMapType::iterator iter = m_freeChunksMap.find(byteSize); size_t blockSize = 0; - char* blockAddress = NULL; + char* blockAddress = nullptr; size_t preAllocBlockSize = 0; while (iter != m_freeChunksMap.end()) { @@ -64,7 +64,7 @@ BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int } ++iter; } - if (address != NULL) + if (address != nullptr) { // split blocks if (preAllocBlockSize) // if we have a block before the alignment @@ -94,7 +94,7 @@ BestFitExternalMapSchema::Allocate(size_type byteSize, size_type alignment, int void BestFitExternalMapSchema::DeAllocate(pointer_type ptr) { - if (ptr == 0) + if (ptr == nullptr) { return; } diff --git a/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp index 1c67a95d51..50e6a47630 100644 --- a/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/HeapSchema.cpp @@ -107,17 +107,17 @@ namespace AZ m_used = 0; m_desc = desc; - m_subAllocator = 0; + m_subAllocator = nullptr; for (int i = 0; i < Descriptor::m_maxNumBlocks; ++i) { - m_memSpaces[i] = 0; + m_memSpaces[i] = nullptr; m_ownMemoryBlock[i] = false; } for (int i = 0; i < m_desc.m_numMemoryBlocks; ++i) { - if (m_desc.m_memoryBlocks[i] == 0) // Allocate memory block if requested! + if (m_desc.m_memoryBlocks[i] == nullptr) // Allocate memory block if requested! { AZ_Assert(AllocatorInstance::IsReady(), "You requested to allocate memory using the system allocator, but it's not created yet!"); m_subAllocator = &AllocatorInstance::Get(); @@ -152,7 +152,7 @@ namespace AZ if (m_memSpaces[i]) { AZDLMalloc::destroy_mspace(m_memSpaces[i]); - m_memSpaces[i] = 0; + m_memSpaces[i] = nullptr; if (m_ownMemoryBlock[i]) { @@ -172,7 +172,7 @@ namespace AZ AZ_UNUSED(lineNum); AZ_UNUSED(suppressStackRecord); int blockId = flags; - AZ_Assert(m_memSpaces[blockId]!=0, "Invalid block id!"); + AZ_Assert(m_memSpaces[blockId]!=nullptr, "Invalid block id!"); HeapSchema::pointer_type address = AZDLMalloc::mspace_memalign(m_memSpaces[blockId], alignment, byteSize); if (address) { @@ -186,7 +186,7 @@ namespace AZ { AZ_UNUSED(byteSize); AZ_UNUSED(alignment); - if (ptr==0) + if (ptr==nullptr) { return; } @@ -194,7 +194,7 @@ namespace AZ // if we use m_spaces just count the chunk sizes. m_used -= ChunckSize(ptr); #ifdef FOOTERS - AZDLMalloc::mspace_free(0, ptr); ///< We use footers so we know which memspace the pointer belongs to. + AZDLMalloc::mspace_free(nullptr, ptr); ///< We use footers so we know which memspace the pointer belongs to. #else int i = 0; for (; i < m_desc.m_numMemoryBlocks; ++i) @@ -248,7 +248,7 @@ namespace AZ HeapSchema::ChunckSize(pointer_type ptr) { // based on azmalloc_usable_size + the overhead - if (ptr != 0) + if (ptr != nullptr) { mchunkptr p = mem2chunk(ptr); //if (is_inuse(p)) // we can even skip this check since we track for double free and so on anyway diff --git a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp index 5b7ca194cf..f5df0dfe96 100644 --- a/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/HphaSchema.cpp @@ -784,17 +784,17 @@ namespace AZ { // size == 0 acts as free void* realloc(void* ptr, size_t size) { - if (ptr == NULL) + if (ptr == nullptr) { return alloc(size); } if (size == 0) { free(ptr); - return NULL; + return nullptr; } debug_check(ptr); - void* newPtr = NULL; + void* newPtr = nullptr; if (ptr_in_bucket(ptr)) { if (is_small_allocation(size)) // no point to check m_isPoolAllocations as if it's false pointer can't be in a bucket. @@ -853,21 +853,21 @@ namespace AZ { { return realloc(ptr, size); } - if (ptr == NULL) + if (ptr == nullptr) { return alloc(size, alignment); } if (size == 0) { free(ptr); - return NULL; + return nullptr; } if ((size_t)ptr & (alignment - 1)) { void* newPtr = alloc(size, alignment); if (!newPtr) { - return NULL; + return nullptr; } size_t count = this->size(ptr); if (count > size) @@ -879,7 +879,7 @@ namespace AZ { return newPtr; } debug_check(ptr); - void* newPtr = NULL; + void* newPtr = nullptr; if (ptr_in_bucket(ptr)) { if (is_small_allocation(size) && alignment <= MAX_SMALL_ALLOCATION) // no point to check m_isPoolAllocations as if it was false, pointer can't be in a bucket @@ -931,7 +931,7 @@ namespace AZ { // returns the size of the resulting memory block inline size_t resize(void* ptr, size_t size) { - if (ptr == NULL) + if (ptr == nullptr) { return 0; } @@ -957,7 +957,7 @@ namespace AZ { // query the size of the memory block inline size_t size(void* ptr) const { - if (ptr == NULL) + if (ptr == nullptr) { return 0; } @@ -993,7 +993,7 @@ namespace AZ { // free the memory block inline void free(void* ptr) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1009,7 +1009,7 @@ namespace AZ { // free the memory block supplying the original size with DEFAULT_ALIGNMENT inline void free(void* ptr, size_t origSize) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1027,7 +1027,7 @@ namespace AZ { // free the memory block supplying the original size and alignment inline void free(void* ptr, size_t origSize, size_t oldAlignment) { - if (ptr == NULL) + if (ptr == nullptr) { return; } @@ -1134,10 +1134,10 @@ namespace AZ { // If m_systemChunkSize is specified, use that size for allocating tree blocks from the OS // m_treePageAlignment should be OS_VIRTUAL_PAGE_SIZE in all cases with this trait as we work // with virtual memory addresses when the tree grows and we cannot specify an alignment in all cases - : m_treePageSize(desc.m_fixedMemoryBlock != NULL ? desc.m_pageSize : + : m_treePageSize(desc.m_fixedMemoryBlock != nullptr ? desc.m_pageSize : desc.m_systemChunkSize != 0 ? desc.m_systemChunkSize : OS_VIRTUAL_PAGE_SIZE) , m_treePageAlignment(desc.m_pageSize) - , m_poolPageSize(desc.m_fixedMemoryBlock != NULL ? desc.m_poolPageSize : OS_VIRTUAL_PAGE_SIZE) + , m_poolPageSize(desc.m_fixedMemoryBlock != nullptr ? desc.m_poolPageSize : OS_VIRTUAL_PAGE_SIZE) , m_subAllocator(desc.m_subAllocator) { #ifdef DEBUG_ALLOCATOR @@ -1246,7 +1246,7 @@ namespace AZ { return p; } } - return NULL; + return nullptr; } const HpAllocator::page* HpAllocator::bucket::get_free_page() const @@ -1259,7 +1259,7 @@ namespace AZ { return p; } } - return NULL; + return nullptr; } void* HpAllocator::bucket::alloc(page* p) @@ -1359,7 +1359,7 @@ namespace AZ { p = bucket_grow(bsize, mBuckets[bi].marker()); if (!p) { - return NULL; + return nullptr; } mBuckets[bi].add_free_page(p); } @@ -1385,7 +1385,7 @@ namespace AZ { p = bucket_grow(bsize, mBuckets[bi].marker()); if (!p) { - return NULL; + return nullptr; } mBuckets[bi].add_free_page(p); } @@ -1406,7 +1406,7 @@ namespace AZ { void* newPtr = bucket_alloc(size); if (!newPtr) { - return NULL; + return nullptr; } memcpy(newPtr, ptr, AZStd::GetMin(elemSize - MEMORY_GUARD_SIZE, size - MEMORY_GUARD_SIZE)); bucket_free(ptr); @@ -1426,7 +1426,7 @@ namespace AZ { void* newPtr = bucket_alloc_direct(bucket_spacing_function(AZ::SizeAlignUp(size, alignment))); if (!newPtr) { - return NULL; + return nullptr; } memcpy(newPtr, ptr, AZStd::GetMin(elemSize - MEMORY_GUARD_SIZE, size - MEMORY_GUARD_SIZE)); bucket_free(ptr); @@ -1638,7 +1638,7 @@ namespace AZ { // create a dummy block to avoid prev() NULL checks and allow easy block shifts // potentially this dummy block might grow (due to shift_block) but not more than sizeof(free_node) block_header* front = (block_header*)mem; - front->prev(0); + front->prev(nullptr); front->size(0); front->set_used(); block_header* back = (block_header*)front->mem(); @@ -1777,7 +1777,7 @@ namespace AZ { newBl = tree_grow(size); if (!newBl) { - return NULL; + return nullptr; } } HPPA_ASSERT(!newBl->used()); @@ -1956,7 +1956,7 @@ namespace AZ { tree_free(ptr); return newPtr; } - return NULL; + return nullptr; } void* HpAllocator::tree_realloc_aligned(void* ptr, size_t size, size_t alignment) @@ -2044,7 +2044,7 @@ namespace AZ { tree_free(ptr); return newPtr; } - return NULL; + return nullptr; } size_t HpAllocator::tree_resize(void* ptr, size_t size) @@ -2121,7 +2121,7 @@ namespace AZ { HPPA_ASSERT(!bl->used()); HPPA_ASSERT(bl->prev() && bl->prev()->used()); HPPA_ASSERT(bl->next() && bl->next()->used()); - if (bl->prev()->prev() == NULL && bl->next()->size() == 0) + if (bl->prev()->prev() == nullptr && bl->next()->size() == 0) { tree_detach(bl); char* memStart = (char*)bl->prev(); @@ -2539,11 +2539,11 @@ namespace AZ { if (m_desc.m_fixedMemoryBlockByteSize > 0) { AZ_Assert((m_desc.m_fixedMemoryBlockByteSize & (m_desc.m_pageSize - 1)) == 0, "Memory block size %d MUST be multiples of the of the page size %d!", m_desc.m_fixedMemoryBlockByteSize, m_desc.m_pageSize); - if (m_desc.m_fixedMemoryBlock == NULL) + if (m_desc.m_fixedMemoryBlock == nullptr) { - AZ_Assert(m_desc.m_subAllocator != NULL, "Sub allocator must point to a valid allocator if m_fixedMemoryBlock is NOT allocated (NULL)!"); + AZ_Assert(m_desc.m_subAllocator != nullptr, "Sub allocator must point to a valid allocator if m_fixedMemoryBlock is NOT allocated (NULL)!"); m_desc.m_fixedMemoryBlock = m_desc.m_subAllocator->Allocate(m_desc.m_fixedMemoryBlockByteSize, m_desc.m_fixedMemoryBlockAlignment, 0, "HphaSchema", __FILE__, __LINE__, 1); - AZ_Assert(m_desc.m_fixedMemoryBlock != NULL, "Failed to allocate %d bytes!", m_desc.m_fixedMemoryBlockByteSize); + AZ_Assert(m_desc.m_fixedMemoryBlock != nullptr, "Failed to allocate %d bytes!", m_desc.m_fixedMemoryBlockByteSize); m_ownMemoryBlock = true; } AZ_Assert((reinterpret_cast(m_desc.m_fixedMemoryBlock) & static_cast(desc.m_fixedMemoryBlockAlignment - 1)) == 0, "Memory block must be page size (%d bytes) aligned!", desc.m_fixedMemoryBlockAlignment); @@ -2570,7 +2570,7 @@ namespace AZ { if (m_ownMemoryBlock) { m_desc.m_subAllocator->DeAllocate(m_desc.m_fixedMemoryBlock, m_desc.m_fixedMemoryBlockByteSize, m_desc.m_fixedMemoryBlockAlignment); - m_desc.m_fixedMemoryBlock = NULL; + m_desc.m_fixedMemoryBlock = nullptr; } } @@ -2587,7 +2587,7 @@ namespace AZ { (void)lineNum; (void)suppressStackRecord; pointer_type address = m_allocator->alloc(byteSize, alignment); - if (address == NULL) + if (address == nullptr) { GarbageCollect(); address = m_allocator->alloc(byteSize, alignment); @@ -2603,7 +2603,7 @@ namespace AZ { HphaSchema::ReAllocate(pointer_type ptr, size_type newSize, size_type newAlignment) { pointer_type address = m_allocator->realloc(ptr, newSize, newAlignment); - if (address == NULL && newSize > 0) + if (address == nullptr && newSize > 0) { GarbageCollect(); address = m_allocator->realloc(ptr, newSize, newAlignment); @@ -2618,7 +2618,7 @@ namespace AZ { void HphaSchema::DeAllocate(pointer_type ptr, size_type size, size_type alignment) { - if (ptr == 0) + if (ptr == nullptr) { return; } diff --git a/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp b/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp index 934efeef1b..2ea25c3397 100644 --- a/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/MemoryDriller.cpp @@ -106,7 +106,7 @@ namespace AZ m_allAllocatorRecords.push_back(allocator->GetRecords()); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -154,7 +154,7 @@ namespace AZ delete allocatorRecords; allocator->SetRecords(nullptr); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -173,7 +173,7 @@ namespace AZ if (records) { const AllocationInfo* info = records->RegisterAllocation(address, byteSize, alignment, name, fileName, lineNum, stackSuppressCount + 1); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -226,7 +226,7 @@ namespace AZ { records->UnregisterAllocation(address, byteSize, alignment, info); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } @@ -261,7 +261,7 @@ namespace AZ { records->ResizeAllocation(address, newSize); - if (m_output == NULL) + if (m_output == nullptr) { return; // we have no active output } diff --git a/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp index 5637fcc646..317df214d6 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OSAllocator.cpp @@ -75,7 +75,7 @@ namespace AZ address = AZ_OS_MALLOC(byteSize, alignment); } - if (address == 0 && byteSize > 0) + if (address == nullptr && byteSize > 0) { AZ_Printf("Memory", "======================================================\n"); AZ_Printf("Memory", "OSAllocator run out of system memory!\nWe can't track the debug allocator, since it's used for tracking and pipes trought the OS... here are the other allocator status:\n"); diff --git a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp index e59e304c54..35ad19dd9e 100644 --- a/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/OverrunDetectionAllocator.cpp @@ -216,9 +216,9 @@ namespace AZ class OverrunDetectionSchemaImpl { public: - typedef void* pointer_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + using pointer_type = void *; + using size_type = size_t; + using difference_type = ptrdiff_t; OverrunDetectionSchemaImpl(const OverrunDetectionSchema::Descriptor& desc); ~OverrunDetectionSchemaImpl(); @@ -241,8 +241,8 @@ namespace AZ Internal::AllocationRecord* CreateAllocationRecord(void* p, size_t size) const; private: - typedef AZStd::mutex mutex_type; - typedef AZStd::lock_guard lock_type; + using mutex_type = AZStd::mutex; + using lock_type = AZStd::lock_guard; AZStd::unique_ptr m_platformAllocator; mutex_type m_mutex; diff --git a/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp b/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp index b251774d77..3e71f530a0 100644 --- a/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/PoolSchema.cpp @@ -278,7 +278,7 @@ namespace AZ Page* page = reinterpret_cast(memBlock); if (!page->m_magic.Validate()) { - return NULL; + return nullptr; } return page; } @@ -403,7 +403,7 @@ PoolAllocation::Allocate(size_t byteSize, size_t alignment) u32 bucketIndex = static_cast((byteSize >> m_minAllocationShift)-1); BucketType& bucket = m_buckets[bucketIndex]; - PageType* page = 0; + PageType* page = nullptr; if (!bucket.m_pages.empty()) { page = &bucket.m_pages.front(); @@ -411,7 +411,7 @@ PoolAllocation::Allocate(size_t byteSize, size_t alignment) // check if we have free slot in the page if (page->m_freeList.empty()) { - page = 0; + page = nullptr; } else if (page->m_freeList.size()==1) { @@ -464,7 +464,7 @@ AZ_INLINE void PoolAllocation::DeAllocate(void* ptr) { PageType* page = m_allocator->PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { AZ_Error("Memory", false, "Address 0x%08x is not in the ThreadPool!", ptr); return; @@ -503,7 +503,7 @@ PoolAllocation::DeAllocate(void* ptr) m_allocator->PushFreePage(page); } } - else if (frontPage->m_next != 0) + else if (frontPage->m_next != nullptr) { // if the next page has free slots free the current page if (frontPage->m_next->m_freeList.size() < maxElementsPerBucket) @@ -584,7 +584,7 @@ PoolAllocation::GarbageCollect(bool isForceFreeAllPages) // [9/15/2009] //========================================================================= PoolSchema::PoolSchema(const Descriptor& desc) - : m_impl(NULL) + : m_impl(nullptr) { (void)desc; // ignored here, applied in Create() } @@ -595,7 +595,7 @@ PoolSchema::PoolSchema(const Descriptor& desc) //========================================================================= PoolSchema::~PoolSchema() { - AZ_Assert(m_impl==NULL, "You did not destroy the pool schema!"); + AZ_Assert(m_impl==nullptr, "You did not destroy the pool schema!"); delete m_impl; } @@ -605,12 +605,12 @@ PoolSchema::~PoolSchema() //========================================================================= bool PoolSchema::Create(const Descriptor& desc) { - AZ_Assert(m_impl==NULL, "PoolSchema already created!"); - if (m_impl == NULL) + AZ_Assert(m_impl==nullptr, "PoolSchema already created!"); + if (m_impl == nullptr) { m_impl = aznew PoolSchemaImpl(desc); } - return (m_impl!=NULL); + return (m_impl!=nullptr); } //========================================================================= @@ -620,7 +620,7 @@ bool PoolSchema::Create(const Descriptor& desc) bool PoolSchema::Destroy() { delete m_impl; - m_impl = NULL; + m_impl = nullptr; return true; } @@ -751,7 +751,7 @@ PoolSchema::GetSubAllocator() PoolSchemaImpl::PoolSchemaImpl(const PoolSchema::Descriptor& desc) : m_pageAllocator(desc.m_pageAllocator ? desc.m_pageAllocator : &AllocatorInstance::Get()) , m_allocator(this, desc.m_pageSize, desc.m_minAllocationSize, desc.m_maxAllocationSize) - , m_staticDataBlock(0) + , m_staticDataBlock(nullptr) , m_numStaticPages(desc.m_numStaticPages) , m_isDynamic(desc.m_isDynamic) , m_pageSize(desc.m_pageSize) @@ -851,7 +851,7 @@ PoolSchemaImpl::AllocationSize(PoolSchema::pointer_type ptr) AZ_FORCE_INLINE PoolSchemaImpl::Page* PoolSchemaImpl::PopFreePage() { - Page* page = 0; + Page* page = nullptr; if (!m_freePages.empty()) { page = &m_freePages.front(); @@ -938,7 +938,7 @@ PoolSchemaImpl::Page::SetupFreeList(size_t elementSize, size_t pageDataBlockSize // [9/15/2009] //========================================================================= ThreadPoolSchema::ThreadPoolSchema(GetThreadPoolData getThreadPoolData, SetThreadPoolData setThreadPoolData) - : m_impl(NULL) + : m_impl(nullptr) , m_threadPoolGetter(getThreadPoolData) , m_threadPoolSetter(setThreadPoolData) { @@ -950,7 +950,7 @@ ThreadPoolSchema::ThreadPoolSchema(GetThreadPoolData getThreadPoolData, SetThrea //========================================================================= ThreadPoolSchema::~ThreadPoolSchema() { - AZ_Assert(m_impl==NULL, "You did not destroy the thread pool schema!"); + AZ_Assert(m_impl==nullptr, "You did not destroy the thread pool schema!"); delete m_impl; } @@ -960,12 +960,12 @@ ThreadPoolSchema::~ThreadPoolSchema() //========================================================================= bool ThreadPoolSchema::Create(const Descriptor& desc) { - AZ_Assert(m_impl==NULL, "PoolSchema already created!"); - if (m_impl == NULL) + AZ_Assert(m_impl==nullptr, "PoolSchema already created!"); + if (m_impl == nullptr) { m_impl = aznew ThreadPoolSchemaImpl(desc, m_threadPoolGetter, m_threadPoolSetter); } - return (m_impl!=NULL); + return (m_impl!=nullptr); } //========================================================================= @@ -975,7 +975,7 @@ bool ThreadPoolSchema::Create(const Descriptor& desc) bool ThreadPoolSchema::Destroy() { delete m_impl; - m_impl = NULL; + m_impl = nullptr; return true; } //========================================================================= @@ -1099,7 +1099,7 @@ ThreadPoolSchemaImpl::ThreadPoolSchemaImpl(const ThreadPoolSchema::Descriptor& d : m_threadPoolGetter(threadPoolGetter) , m_threadPoolSetter(threadPoolSetter) , m_pageAllocator(desc.m_pageAllocator) - , m_staticDataBlock(0) + , m_staticDataBlock(nullptr) , m_numStaticPages(desc.m_numStaticPages) , m_pageSize(desc.m_pageSize) , m_minAllocationSize(desc.m_minAllocationSize) @@ -1112,7 +1112,7 @@ ThreadPoolSchemaImpl::ThreadPoolSchemaImpl(const ThreadPoolSchema::Descriptor& d SetCriticalSectionSpinCount(m_mutex.native_handle(), 4000); # endif - if (m_pageAllocator == 0) + if (m_pageAllocator == nullptr) { m_pageAllocator = &AllocatorInstance::Get(); // use the SystemAllocator if no page allocator is provided } @@ -1211,7 +1211,7 @@ ThreadPoolSchemaImpl::Allocate(ThreadPoolSchema::size_type byteSize, ThreadPoolS { // deallocate elements if they were freed from other threads Page::FakeNodeLF* fakeLFNode; - while ((fakeLFNode = threadData->m_freedElements.pop())!=0) + while ((fakeLFNode = threadData->m_freedElements.pop())!=nullptr) { threadData->m_allocator.DeAllocate(fakeLFNode); } @@ -1228,12 +1228,12 @@ void ThreadPoolSchemaImpl::DeAllocate(ThreadPoolSchema::pointer_type ptr) { Page* page = PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { AZ_Error("Memory", false, "Address 0x%08x is not in the ThreadPool!", ptr); return; } - AZ_Assert(page->m_threadData!=0, ("We must have valid page thread data for the page!")); + AZ_Assert(page->m_threadData!=nullptr, ("We must have valid page thread data for the page!")); ThreadPoolData* threadData = m_threadPoolGetter(); if (threadData == page->m_threadData) { @@ -1262,11 +1262,11 @@ ThreadPoolSchema::size_type ThreadPoolSchemaImpl::AllocationSize(ThreadPoolSchema::pointer_type ptr) { Page* page = PageFromAddress(ptr); - if (page==NULL) + if (page==nullptr) { return 0; } - AZ_Assert(page->m_threadData!=0, ("We must have valid page thread data for the page!")); + AZ_Assert(page->m_threadData!=nullptr, ("We must have valid page thread data for the page!")); return page->m_threadData->m_allocator.AllocationSize(ptr); } @@ -1282,7 +1282,7 @@ ThreadPoolSchemaImpl::PopFreePage() AZStd::lock_guard lock(m_mutex); if (m_freePages.empty()) { - page = NULL; + page = nullptr; } else { @@ -1387,7 +1387,7 @@ ThreadPoolData::~ThreadPoolData() { // deallocate elements if they were freed from other threads ThreadPoolSchemaImpl::Page::FakeNodeLF* fakeLFNode; - while ((fakeLFNode = m_freedElements.pop())!=0) + while ((fakeLFNode = m_freedElements.pop())!=nullptr) { m_allocator.DeAllocate(fakeLFNode); } diff --git a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp index 0fb64915dc..8c84338fd0 100644 --- a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp @@ -153,7 +153,7 @@ SystemAllocator::Create(const Descriptor& desc) #elif AZCORE_SYSTEM_ALLOCATOR == AZCORE_SYSTEM_ALLOCATOR_HEAP m_allocator = azcreate(HeapSchema, (heapDesc), SystemAllocator); #endif - if (m_allocator == NULL) + if (m_allocator == nullptr) { isReady = false; } @@ -237,7 +237,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co byteSize = MemorySizeAdjustedUp(byteSize); SystemAllocator::pointer_type address = m_allocator->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord + 1); - if (address == 0) + if (address == nullptr) { // Free all memory we can and try again! AllocatorManager::Instance().GarbageCollect(); @@ -245,7 +245,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co address = m_allocator->Allocate(byteSize, alignment, flags, name, fileName, lineNum, suppressStackRecord + 1); } - if (address == 0) + if (address == nullptr) { byteSize = MemorySizeAdjustedDown(byteSize); // restore original size @@ -258,7 +258,7 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co } } - AZ_Assert(address != 0, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); + AZ_Assert(address != nullptr, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); AZ_PROFILE_MEMORY_ALLOC_EX(MemoryReserved, fileName, lineNum, address, byteSize, name); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); diff --git a/Code/Framework/AzCore/AzCore/Module/Environment.cpp b/Code/Framework/AzCore/AzCore/Module/Environment.cpp index bec530e2d1..c07b7444d4 100644 --- a/Code/Framework/AzCore/AzCore/Module/Environment.cpp +++ b/Code/Framework/AzCore/AzCore/Module/Environment.cpp @@ -148,7 +148,7 @@ namespace AZ AZ_Assert(m_numAttached == 0, "We should not delete an environment while there are %d modules attached! Unload all DLLs first!", m_numAttached); #endif - for (auto variableIt : m_variableMap) + for (const auto &variableIt : m_variableMap) { EnvironmentVariableHolderBase* holder = reinterpret_cast(variableIt.second); if (holder) diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp index 7e1adb93b9..a75e1803eb 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp @@ -41,11 +41,17 @@ namespace AZ::NativeUI AZStd::string result = DisplayBlockingDialog("Assert Failed!", message, options); if (result.compare(buttonNames[0]) == 0) + { return AssertAction::IGNORE_ASSERT; + } else if (result.compare(buttonNames[1]) == 0) + { return AssertAction::IGNORE_ALL_ASSERTS; + } else if (result.compare(buttonNames[2]) == 0) + { return AssertAction::BREAK; + } return AssertAction::NONE; } diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp index e621ab412e..a44aa61aca 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.cpp @@ -121,12 +121,12 @@ namespace AZ { delete attrIt.second; } - + if (m_overload) { delete m_overload; } - + m_attributes.clear(); } @@ -180,7 +180,7 @@ namespace AZ if (GetNumArguments() == overload->GetNumArguments()) { bool anyDifference = false; - + for (size_t i(0), sentinel(GetNumArguments()); !anyDifference && i < sentinel; ++i) { const BehaviorParameter* thisArg = GetArgument(i); @@ -273,7 +273,7 @@ namespace AZ auto attributes = AZStd::move(m_attributes); // Actually delete everything - for (auto propertyIt : events) + for (const auto &propertyIt : events) { delete propertyIt.second.m_broadcast; delete propertyIt.second.m_event; @@ -519,20 +519,20 @@ namespace AZ AZStd::vector BehaviorClass::GetOverloads(const AZStd::string& name) const { AZStd::vector overloads; - + auto methodIter = m_methods.find(name); if (methodIter != m_methods.end()) { overloads = GetOverloadsIncludeMethod(methodIter->second); - } - + } + return overloads; } AZStd::vector BehaviorClass::GetOverloadsIncludeMethod(BehaviorMethod* method) const { AZStd::vector overloads; - + auto iter = method; while (iter) { @@ -546,7 +546,7 @@ namespace AZ AZStd::vector BehaviorClass::GetOverloadsExcludeMethod(BehaviorMethod* method) const { AZStd::vector overloads; - + auto iter = method->m_overload; while (iter) { @@ -972,5 +972,5 @@ namespace AZ return enumRttiHelper.GetTypeId(); } } - + } // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index f02c37492b..ba8808d4d2 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -36,7 +36,7 @@ namespace AZ constexpr const char* k_PropertyNameGetterSuffix = "::Getter"; constexpr const char* k_PropertyNameSetterSuffix = "::Setter"; - + /// Typedef for class unwrapping callback (i.e. used for things like smart_ptr to unwrap for T) using BehaviorClassUnwrapperFunction = void(*)(void* /*classPtr*/, void*& /*unwrappedClass*/, AZ::Uuid& /*unwrappedClassTypeId*/, void* /*userData*/); @@ -53,7 +53,7 @@ namespace AZ IfPresent, }; - struct BehaviorObject // same as DynamicSerializableField, make sure we merge them... so we can store the object easily + struct BehaviorObject // same as DynamicSerializableField, make sure we merge them... so we can store the object easily { AZ_TYPE_INFO(BehaviorObject, "{2813cdfb-0a4a-411c-9216-72a7b644d1dd}"); @@ -165,7 +165,7 @@ namespace AZ /// Convert to BehaviorObject implicitly for passing generic parameters (usually not known at compile time) operator BehaviorObject() const; - /// Converts internally the value to a specific type known at compile time. \returns true if conversion was successful. + /// Converts internally the value to a specific type known at compile time. \returns true if conversion was successful. template bool ConvertTo(); @@ -452,7 +452,7 @@ namespace AZ namespace Internal { const AZ::TypeId& GetUnderlyingTypeId(const IRttiHelper& enumRttiHelper); - + // Converts sourceAddress to targetType inline bool ConvertValueTo(void* sourceAddress, const IRttiHelper* sourceRtti, const AZ::Uuid& targetType, void*& targetAddress, BehaviorParameter::TempValueParameterAllocator& tempAllocator) { @@ -520,7 +520,7 @@ namespace AZ static const int s_startNamedArgumentIndex = s_startArgumentIndex; // +1 for result type BehaviorMethodImpl(FunctionPointer functionPointer, BehaviorContext* context, const AZStd::string& name = AZStd::string()); - + bool Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const override; bool HasResult() const override; @@ -548,7 +548,7 @@ namespace AZ BehaviorParameter m_parameters[sizeof...(Args)+s_startNamedArgumentIndex]; AZStd::array m_metadataParameters; ///< Stores the per parameter metadata which is used to add names, tooltips, trait, default values, etc... to the parameters }; - + #if __cpp_noexcept_function_type // C++17 makes exception specifications as part of the type in paper P0012R1 // Therefore noexcept overloads must be distinguished from non-noexcept overloads @@ -732,7 +732,7 @@ namespace AZ BehaviorEBusEvent(FunctionPointer functionPointer, BehaviorContext* context); BehaviorEBusEvent(FunctionPointerConst functionPointer, BehaviorContext* context); - + template inline AZStd::enable_if_t SetBusIdType(); @@ -813,7 +813,7 @@ namespace AZ : SetFunctionParameters {}; #endif - + template struct BehaviorOnDemandReflectHelper; template @@ -997,14 +997,14 @@ namespace AZ } // namespace Internal /** - * Behavior representation of reflected class. + * Behavior representation of reflected class. */ class BehaviorClass { public: AZ_CLASS_ALLOCATOR(BehaviorClass, SystemAllocator, 0); - BehaviorClass(); + BehaviorClass(); ~BehaviorClass(); /// Hooks to override default memory allocation for the class (AZ_CLASS_ALLOCATOR is used by default) @@ -1065,7 +1065,7 @@ namespace AZ void* m_userData; AZStd::string m_name; - AZStd::vector m_baseClasses; + AZStd::vector m_baseClasses; AZStd::unordered_map m_methods; AZStd::unordered_map m_properties; AttributeArray m_attributes; @@ -1081,7 +1081,7 @@ namespace AZ AZ::Uuid m_wrappedTypeId; // Store all owned instances for unload verification? }; - + // Helper macros to generate getter and setter function from a pointer to value or member value // Syntax BehaviorValueGetter(&globalValue) BehaviorValueGetter(&Class::MemberValue) # define BehaviorValueGetter(valueAddress) &AZ::Internal::BehaviorValuePropertyHelper::Get @@ -1095,7 +1095,7 @@ namespace AZ * Property representation, a property has getter and setter. A read only property will have a "nullptr" for a setter. * You can use lambdas, global of member function. If you want to just expose a variable (not write the function and handle changes) * you can use \ref BehaviorValueProperty macros (or BehaviorValueGetter/Setter to control read/write functionality) - * Member constants are a property too, use \ref BehaviorConstant for it. Everything is either a property or a method, the main reason + * Member constants are a property too, use \ref BehaviorConstant for it. Everything is either a property or a method, the main reason * why we "push" people to use functions is that in most cases when we manipulate an object, you will need to do more than just set a value * to a new value. */ @@ -1163,7 +1163,7 @@ namespace AZ }; /** - * RAII class which keeps track of functions reflected to the BehaviorContext + * RAII class which keeps track of functions reflected to the BehaviorContext * when it is supplied as an OnDemandReflectionOwner */ class ScopedBehaviorOnDemandReflector @@ -1182,7 +1182,7 @@ namespace AZ AZ_CLASS_ALLOCATOR(BehaviorEBus, SystemAllocator, 0); typedef void(*QueueFunctionType)(void* /*userData1*/, void* /*userData2*/); - + struct VirtualProperty { VirtualProperty(BehaviorEBusEventSender* getter, BehaviorEBusEventSender* setter) @@ -1294,7 +1294,7 @@ namespace AZ AZStd::string m_scriptPath; #endif - AZStd::string GetScriptPath() const + AZStd::string GetScriptPath() const { #if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode return m_scriptPath; @@ -1303,8 +1303,8 @@ namespace AZ #endif } - void SetScriptPath(const char* scriptPath) - { + void SetScriptPath(const char* scriptPath) + { #if defined(PERFORMANCE_BUILD) || !defined(_RELEASE) // m_scriptPath is only available in non-Release mode m_scriptPath = scriptPath; #else @@ -1346,7 +1346,7 @@ namespace AZ virtual void OnAddGlobalProperty(const char* propertyName, BehaviorProperty* prop) { (void)propertyName; (void)prop; } virtual void OnRemoveGlobalProperty(const char* propertyName, BehaviorProperty* prop) { (void)propertyName; (void)prop; } - /// Called when a class is added or removed + /// Called when a class is added or removed virtual void OnAddClass(const char* className, BehaviorClass* behaviorClass) { (void)className; (void)behaviorClass; } virtual void OnRemoveClass(const char* className, BehaviorClass* behaviorClass) { (void)className; (void)behaviorClass; } @@ -1358,10 +1358,10 @@ namespace AZ using BehaviorContextBus = AZ::EBus; /** - * BehaviorContext is used to reflect classes, methods and EBuses for runtime interaction. A typical consumer of this context and different + * BehaviorContext is used to reflect classes, methods and EBuses for runtime interaction. A typical consumer of this context and different * scripting systems (i.e. Lua, Visual Script, etc.). Even though (as designed) there are overlaps between some context they have very different * purpose and set of rules. For example SerializeContext, doesn't reflect any methods, it just reflects data fields that will be stored for initial object - * setup, it handles version conversion and so thing, this related to storing the object to a persistent storage. Behavior context, doesn't need to deal with versions as + * setup, it handles version conversion and so thing, this related to storing the object to a persistent storage. Behavior context, doesn't need to deal with versions as * no data is stored, just methods for manipulating the object state. */ class BehaviorContext : public ReflectContext @@ -1379,7 +1379,7 @@ namespace AZ } template - static void QueueFunction(BehaviorEBus::QueueFunctionType f, void* userData1, void* userData2) + static void QueueFunction(BehaviorEBus::QueueFunctionType f, void* userData1, void* userData2) { Bus::QueueFunction(f, userData1, userData2); } @@ -1484,8 +1484,8 @@ namespace AZ } template - static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator*/) - { + static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator*/) + { behaviorClass->m_allocate = &DefaultSystemAllocator::Allocate; behaviorClass->m_deallocate = &DefaultSystemAllocator::DeAllocate; } @@ -1522,20 +1522,20 @@ namespace AZ } template - static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible*/) + static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible*/) { behaviorClass->m_defaultConstructor = &DefaultConstruct; } template - static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible*/) + static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible*/) { behaviorClass->m_destructor = &DefaultDestruct; } template - static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible*/) - { + static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible*/) + { behaviorClass->m_cloner = &DefaultCopyConstruct; } @@ -1585,7 +1585,7 @@ namespace AZ const char* m_name; BehaviorMethod* m_method; }; - + struct GlobalPropertyBuilder : public AZ::Internal::GenericAttributes { typedef AZ::Internal::GenericAttributes Base; @@ -1608,7 +1608,7 @@ namespace AZ ClassBuilder(BehaviorContext* context, BehaviorClass* behaviorClass); ~ClassBuilder(); ClassBuilder* operator->(); - + /** * Sets custom allocator for a class, this function will error if this not inside a class. * This is only for very specific cases when you want to override AZ_CLASS_ALLOCATOR or you are dealing with 3rd party classes, otherwise @@ -1659,9 +1659,9 @@ namespace AZ ClassBuilder* Constant(const char* name, Getter getter); /** - * You can describe buses that this class uses to communicate. Those buses will be used by tools when + * You can describe buses that this class uses to communicate. Those buses will be used by tools when * you need to give developers hints as to what buses this class interacts with. - * You don't need to reflect all buses that your class uses, just the ones related to + * You don't need to reflect all buses that your class uses, just the ones related to * class behavior. Please refer to component documentation for more information on * the pattern of Request and Notification buses. * {@ @@ -1717,10 +1717,10 @@ namespace AZ /** * With request buses (please refer to component communication patterns documentation) we ofter have EBus events - * that represent a getter and a setter for a value. To allow our tools to take advantage of it, you can reflect + * that represent a getter and a setter for a value. To allow our tools to take advantage of it, you can reflect * VirtualProperty to indicate which event is the getter and which is the setter. * This function validates that getter event has no argument and a result and setter function has no results and only - * one argument which is the same type as the result of the getter. + * one argument which is the same type as the result of the getter. * \note Make sure you call this function after you have reflected the getter and setter events as it will report an error * if we can't find the function */ @@ -1731,7 +1731,7 @@ namespace AZ BehaviorContext(); ~BehaviorContext(); - + ///< \deprecated Use "Method(const char*, Function, const AZStd::array::num_args>&, const char*)" instead ///< This method does not support passing in argument names and tooltips nor does it support overriding specific parameter Behavior traits template @@ -1741,7 +1741,7 @@ namespace AZ ///< This method does not support passing in argument names and tooltips nor does it support overriding specific parameter Behavior traits template GlobalMethodBuilder Method(const char* name, Function f, const char* deprecatedName, BehaviorValues* defaultValues = nullptr, const char* dbgDesc = nullptr); - + template GlobalMethodBuilder Method(const char* name, Function f, const AZStd::array::num_args>& args, const char* dbgDesc = nullptr); @@ -1836,13 +1836,13 @@ namespace AZ /** * Helper MACRO to help you write the EBus handler that you want to reflect to behavior. This is not required, but generally we recommend reflecting all useful - * buses as this enable people to "script" complex behaviors. + * buses as this enable people to "script" complex behaviors. * You don't have to use this macro to write a Handler, but some people find it useful * Here is an example how to use it: * class MyEBusBehaviorHandler : public MyEBus::Handler, public AZ::BehaviorEBusHandler * { * public: - * AZ_EBUS_BEHAVIOR_BINDER(MyEBusBehaviorHandler, "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX}",Allocator, OnEvent1, OnEvent2 and so on); + * AZ_EBUS_BEHAVIOR_BINDER(MyEBusBehaviorHandler, "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX}",Allocator, OnEvent1, OnEvent2 and so on); * // now you need implementations for those event * * @@ -1854,7 +1854,7 @@ namespace AZ * // The AZ_EBUS_BEHAVIOR_BINDER defines FN_EventName for each index. You can also cache it yourself (but it's slower), static int cacheIndex = GetFunctionIndex("OnEvent1"); and use that . * CallResult(result, FN_OnEvent1, data); // forward to the binding (there can be none, this is why we need to always have properly set result, when there is one) * return result; // return the result like you will in any normal EBus even with result - * } * + * } * * // handle the other events here * }; * @@ -1922,7 +1922,7 @@ namespace AZ /** * Provides the same functionality of the AZ_EBUS_BEHAVIOR_BINDER macro above with the additional ability to specify the names and a tooltips of handler methods * after listing the handler method in the macro. - * An example Usage is + * An example Usage is * class MyEBusBehaviorHandler : public MyEBus::Handler, public AZ::BehaviorEBusHandler * { * public: @@ -1930,7 +1930,7 @@ namespace AZ * OnEvent2, ({#OnEvent2 first parameter name(float), #OnEvent2 first parameter tooltip(float)}, {#OnEvent2 second parameter name(bool), {#OnEvent2 second parameter tooltip(bool)}), * OnEvent3, ()); * // The reason for needing parenthesis around the parameter name and tooltip object(AZ::BehaviorParameterOverrides) is to prevent the macro from parsing the comma in the intializer as seperate parameters - * // When using this macro, the BehaviorParameterOverrides objects must be placed after every listing a function as a handler. Furthermore the number of BehaviorParameterOverrides objects for each function must match the number of parameters + * // When using this macro, the BehaviorParameterOverrides objects must be placed after every listing a function as a handler. Furthermore the number of BehaviorParameterOverrides objects for each function must match the number of parameters * // to that function * // Ex. for a function called HugeEvent with a signature of void HugeEvent(int, float, double, char, short), two arguments must be supplied to the macro. * // 1. HugeEvent @@ -2181,7 +2181,7 @@ namespace AZ // Template implementations ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - + ////////////////////////////////////////////////////////////////////////// inline BehaviorObject::BehaviorObject() : m_address(nullptr) @@ -2569,7 +2569,7 @@ namespace AZ m_getter = nullptr; return false; } - + // assure that TR_THIS_PTR is set on the first parameter m_getter->OverrideParameterTraits(0, AZ::BehaviorParameter::TR_THIS_PTR, 0); } @@ -2847,7 +2847,7 @@ namespace AZ } ////////////////////////////////////////////////////////////////////////// - + template void BehaviorEBusHandler::CallResult(R& result, int index, Args&&... args) const { @@ -2904,7 +2904,7 @@ namespace AZ { return ClassBuilder(this, static_cast(nullptr)); } - + auto classTypeIt = m_typeToClassMap.find(typeUuid); if (IsRemovingReflection()) { @@ -2933,7 +2933,7 @@ namespace AZ // class already reflected, display name and uuid char uuidName[AZ::Uuid::MaxStringBuffer]; classTypeIt->first.ToString(uuidName, AZ::Uuid::MaxStringBuffer); - + AZ_Error("Reflection", false, "Class '%s' is already registered using Uuid: %s!", name, uuidName); return ClassBuilder(this, static_cast(nullptr)); } @@ -3002,7 +3002,7 @@ namespace AZ if (m_class && (!Base::m_context->IsRemovingReflection())) { - for (auto method : m_class->m_methods) + for (const auto &method : m_class->m_methods) { m_class->PostProcessMethod(Base::m_context, *method.second); if (MethodReturnsAzEventByReferenceOrPointer(*method.second)) @@ -3485,7 +3485,7 @@ namespace AZ return this; } - + ////////////////////////////////////////////////////////////////////////// template BehaviorContext::EBusBuilder BehaviorContext::EBus(const char* name, const char* deprecatedName /*=nullptr*/, const char* toolTip /*=nullptr*/) @@ -3748,9 +3748,9 @@ namespace AZ return this; } } - + m_ebus->m_virtualProperties.insert(AZStd::make_pair(name, BehaviorEBus::VirtualProperty(getter, setter))); - } + } return this; } @@ -3868,7 +3868,7 @@ namespace AZ SetParameters(m_parameters, this); SetParameters(&m_parameters[s_startNamedArgumentIndex], this); } - + ////////////////////////////////////////////////////////////////////////// template bool BehaviorMethodImpl::Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const @@ -3876,7 +3876,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4072,7 +4072,7 @@ namespace AZ { m_isConst = true; } - + ////////////////////////////////////////////////////////////////////////// template bool BehaviorMethodImpl::Call(BehaviorValueParameter* arguments, unsigned int numArguments, BehaviorValueParameter* result) const @@ -4080,7 +4080,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4284,7 +4284,7 @@ namespace AZ { m_isConst = true; } - + ////////////////////////////////////////////////////////////////////////// template template @@ -4307,7 +4307,7 @@ namespace AZ size_t totalArguments = GetNumArguments(); if (numArguments < totalArguments) { - // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array + // We are cloning all arguments on the stack, since Call is called only from Invoke we can reserve bigger "arguments" array // that can always handle all parameters. So far the don't use default values that ofter, so we will optimize for the common case first. BehaviorValueParameter* newArguments = reinterpret_cast(alloca(sizeof(BehaviorValueParameter)* totalArguments)); // clone the input parameters (we don't need to clone temp buffers, etc. as they will be still on the stack) @@ -4497,7 +4497,7 @@ namespace AZ template void SetFunctionParameters::Set(AZStd::vector& params) { - // result, userdata, arguments + // result, userdata, arguments params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::Result], nullptr); SetParameters(¶ms[eBehaviorBusForwarderEventIndices::UserData], nullptr); diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp index 531c91bcf4..fb0d12f552 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContext.cpp @@ -1463,9 +1463,9 @@ static void* LuaMemoryHook(void* userData, void* ptr, size_t osize, size_t nsize { allocator->DeAllocate(ptr); } - return NULL; + return nullptr; } - else if (ptr == NULL) + else if (ptr == nullptr) { return allocator->Allocate(nsize, LUA_DEFAULT_ALIGNMENT, 0, "Script", __FILE__, __LINE__, 1); } @@ -1708,7 +1708,7 @@ LUA_API const Node* lua_getDummyNode() "Invalid stack!"); lua_pop(m_nativeContext, (currentTop - m_startVariableIndex) + 1); - m_nativeContext = NULL; + m_nativeContext = nullptr; m_startVariableIndex = 0; m_numArguments = 0; m_numResults = 0; @@ -2038,7 +2038,7 @@ LUA_API const Node* lua_getDummyNode() LSV_BEGIN_VARIABLE(m_nativeContext); valueIndex = 0; - name = NULL; + name = nullptr; index = -1; if (m_mode == MD_INSPECT) { diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp index 63f44a2469..e28a289c9e 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp @@ -43,7 +43,7 @@ public: , m_numErrors(0) { using namespace AZStd::placeholders; - m_context->SetErrorHook(AZStd::bind(&ScriptErrorCatcher::ErrorCB, this, _1, _2, _3)); + m_context->SetErrorHook([this](ScriptContext* a, ScriptContext::ErrorType b, const char* c) { ErrorCB(a,b,c); }); } ~ScriptErrorCatcher() { @@ -66,7 +66,7 @@ public: // [6/29/2012] //========================================================================= ScriptContextDebug::ScriptContextDebug(ScriptContext& scriptContext, bool isEnableStackRecord) - : m_luaDebug(NULL) + : m_luaDebug(nullptr) , m_currentStackLevel(-1) , m_stepStackLevel(-1) , m_isRecordCallstack(isEnableStackRecord) @@ -104,7 +104,7 @@ void ScriptContextDebug::ConnectHook() //========================================================================= void ScriptContextDebug::DisconnectHook() { - lua_sethook(m_context.NativeContext(), 0, 0, 0); + lua_sethook(m_context.NativeContext(), nullptr, 0, 0); } //========================================================================= @@ -149,7 +149,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe lua_rawgeti(l, -2, AZ_LUA_CLASS_METATABLE_NAME_INDEX); // load class name AZ_Assert(lua_isstring(l, -1), "Internal scipt error: class without a classname at index %d", AZ_LUA_CLASS_METATABLE_NAME_INDEX); - + if (!enumClass(lua_tostring(l, -1), behaviorClass->m_typeId, userData)) { lua_pop(l, 5); @@ -199,7 +199,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe // for any non-built in methods if (strncmp(name, "__", 2) != 0) { - const char* dbgParamInfo = NULL; + const char* dbgParamInfo = nullptr; // attempt to get the name bool popDebugName = lua_getupvalue(l, -1, 2) != nullptr; @@ -278,7 +278,7 @@ ScriptContextDebug::EnumRegisteredGlobals(EnumMethod enumMethod, EnumProperty en { if (strncmp(name, "__", 2) != 0) { - const char* dbgParamInfo = NULL; + const char* dbgParamInfo = nullptr; lua_getupvalue(l, -1, 2); if (lua_isstring(l, -1)) { @@ -606,7 +606,7 @@ void AZ::LuaHook(lua_State* l, lua_Debug* ar) lua_pop(l, 1); // bool doBreak = false; - ScriptContextDebug::Breakpoint* bp = NULL; + ScriptContextDebug::Breakpoint* bp = nullptr; ScriptContextDebug::Breakpoint localBreakPoint; lua_getinfo(l, "Sunl", ar); @@ -735,7 +735,7 @@ void AZ::LuaHook(lua_State* l, lua_Debug* ar) { context->m_luaDebug = ar; context->m_breakCallback(context, bp); - context->m_luaDebug = NULL; + context->m_luaDebug = nullptr; } } @@ -752,7 +752,7 @@ ScriptContextDebug::EnumLocals(EnumLocalCallback& cb) int local = 1; const char* name; ScriptDataContext dc; - while ((name = lua_getlocal(l, m_luaDebug, local)) != NULL) + while ((name = lua_getlocal(l, m_luaDebug, local)) != nullptr) { if (name[0] != '(') // skip temporary variables { @@ -846,7 +846,7 @@ ScriptContextDebug::EnableBreakpoints(BreakpointCallback& cb) void ScriptContextDebug::DisableBreakpoints() { - m_breakCallback = NULL; + m_breakCallback = nullptr; } //========================================================================= @@ -1079,7 +1079,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i int valueTableIndex = -1; if (valueName[0] == '[') { - valueTableIndex = static_cast(strtol(valueName + 1, NULL, 10)); + valueTableIndex = static_cast(strtol(valueName + 1, nullptr, 10)); } if (strcmp(valueName, "__metatable__") == 0) // metatable are read only { @@ -1114,7 +1114,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i } break; case LUA_TNUMBER: { - lua_pushnumber(l, static_cast(strtod(value.m_value.c_str(), NULL))); + lua_pushnumber(l, static_cast(strtod(value.m_value.c_str(), nullptr))); if (localIndex != -1) { lua_setlocal(l, m_luaDebug, localIndex); @@ -1256,7 +1256,7 @@ ScriptContextDebug::WriteValue(const DebugValue& value, const char* valueName, i else { lua_pushvalue(l, -5); // copy the user data (this pointer) - lua_pushnumber(l, static_cast(strtod(subElement.m_value.c_str(), NULL))); + lua_pushnumber(l, static_cast(strtod(subElement.m_value.c_str(), nullptr))); lua_call(l, 2, 0); // call the setter } break; @@ -1375,7 +1375,7 @@ ScriptContextDebug::GetValue(DebugValue& value) { int iLocal = 1; const char* localName; - while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != NULL) + while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != nullptr) { if (localName[0] != '(' && strcmp(name, localName) == 0) { @@ -1460,7 +1460,7 @@ ScriptContextDebug::SetValue(const DebugValue& sourceValue) // create hierarchy from tokens const DebugValue* value = &sourceValue; DebugValue untokenizedValue; - + if (tokens.size() > 1) { untokenizedValue.m_name = tokens[0]; @@ -1519,7 +1519,7 @@ ScriptContextDebug::SetValue(const DebugValue& sourceValue) { int iLocal = 1; const char* localName; - while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != NULL) + while ((localName = lua_getlocal(l, m_luaDebug, iLocal)) != nullptr) { lua_pop(l, 1); if (localName[0] != '(' && strcmp(name, localName) == 0) diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp index c8e6c28679..37eacd940e 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializationUtils.cpp @@ -42,7 +42,7 @@ namespace AZ AZ_Assert(targetPointer, "You must provide a target pointer"); bool foundSuccess = false; - typedef AZStd::function CreationCallback; + using CreationCallback = AZStd::function; auto handler = [&targetPointer, objectClassData, &foundSuccess](void** instance, const SerializeContext::ClassData** classData, const Uuid& classId, SerializeContext* context) { void* convertibleInstance{}; diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp index cea4b795d7..f326b021e7 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp @@ -91,7 +91,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown char, short, int version!"); (void)textVersion; - long value = strtol(text, NULL, 10); + long value = strtol(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -124,7 +124,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long value = strtoul(text, NULL, 10); + unsigned long value = strtoul(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -158,7 +158,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - long value = strtol(text, NULL, 10); + long value = strtol(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -192,7 +192,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long value = strtoul(text, NULL, 10); + unsigned long value = strtoul(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(T), reinterpret_cast(&value))); } @@ -225,7 +225,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - AZ::s64 value = strtoll(text, NULL, 10); + AZ::s64 value = strtoll(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(AZ::s64), reinterpret_cast(&value))); } @@ -258,7 +258,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown unsigned char, short, int version!"); (void)textVersion; - unsigned long long value = strtoull(text, NULL, 10); + unsigned long long value = strtoull(text, nullptr, 10); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); return static_cast(stream.Write(sizeof(AZ::u64), reinterpret_cast(&value))); } @@ -292,7 +292,7 @@ namespace AZ { AZ_Assert(textVersion == 0, "Unknown float/double version!"); (void)textVersion; - double value = strtod(text, NULL); + double value = strtod(text, nullptr); AZ_SERIALIZE_SWAP_ENDIAN(value, isDataBigEndian); T data = static_cast(value); @@ -815,7 +815,7 @@ namespace AZ const ClassData* fromClass = FindClassData(fromClassId); if (!fromClass) { - return NULL; + return nullptr; } for (size_t i = 0; i < fromClass->m_elements.size(); ++i) @@ -831,7 +831,7 @@ namespace AZ if (!fromClass->m_azRtti) { - return NULL; // Reflection info failed to cast and we can't find rtti info + return nullptr; // Reflection info failed to cast and we can't find rtti info } fromClassHelper = fromClass->m_azRtti; } @@ -841,7 +841,7 @@ namespace AZ const ClassData* toClass = FindClassData(toClassId); if (!toClass || !toClass->m_azRtti) { - return NULL; // We can't cast without class data or rtti helper + return nullptr; // We can't cast without class data or rtti helper } toClassHelper = toClass->m_azRtti; } @@ -855,7 +855,7 @@ namespace AZ // [5/22/2012] //========================================================================= SerializeContext::DataElement::DataElement() - : m_name(0) + : m_name(nullptr) , m_nameCrc(0) , m_dataSize(0) , m_byteStream(&m_buffer) @@ -1045,7 +1045,7 @@ namespace AZ //========================================================================= bool SerializeContext::DataElementNode::Convert(SerializeContext& sc, const char* name, const Uuid& id) { - AZ_Assert(name != NULL && strlen(name) > 0, "Empty name is an INVALID element name!"); + AZ_Assert(name != nullptr && strlen(name) > 0, "Empty name is an INVALID element name!"); u32 nameCrc = Crc32(name); #if defined(AZ_ENABLE_TRACING) @@ -1165,7 +1165,7 @@ namespace AZ int SerializeContext::DataElementNode::AddElement(SerializeContext& sc, const char* name, const ClassData& classData) { (void)sc; - AZ_Assert(name != NULL && strlen(name) > 0, "Empty name is an INVALID element name!"); + AZ_Assert(name != nullptr && strlen(name) > 0, "Empty name is an INVALID element name!"); u32 nameCrc = Crc32(name); #if defined(AZ_ENABLE_TRACING) @@ -1703,7 +1703,7 @@ namespace AZ m_classData->second.m_serializer = AZStd::move(serializer); return this; - + } //========================================================================= @@ -1801,7 +1801,7 @@ namespace AZ void* objectPtr = ptr; const AZ::Uuid* classIdPtr = &classId; const SerializeContext::ClassData* dataClassInfo = classData; - + if (classElement) { // if we are a pointer, then we may be pointing to a derived type. @@ -1854,14 +1854,14 @@ namespace AZ DbgStackEntry de; de.m_dataPtr = objectPtr; de.m_uuidPtr = classIdPtr; - de.m_elementName = classElement ? classElement->m_name : NULL; + de.m_elementName = classElement ? classElement->m_name : nullptr; de.m_classData = dataClassInfo; de.m_classElement = classElement; callContext->m_errorHandler->Push(de); } #endif // AZ_ENABLE_SERIALIZER_DEBUG - if (dataClassInfo == NULL) + if (dataClassInfo == nullptr) { #if defined (AZ_ENABLE_SERIALIZER_DEBUG) AZStd::string error; @@ -2182,9 +2182,9 @@ namespace AZ AZ::SerializeContext::DataPatchUpgradeHandler::~DataPatchUpgradeHandler() { - for (auto fieldUpgrades : m_upgrades) + for (const auto& fieldUpgrades : m_upgrades) { - for (auto versionUpgrades : fieldUpgrades.second) + for (const auto& versionUpgrades : fieldUpgrades.second) { for (auto* upgrade : versionUpgrades.second) { @@ -2192,8 +2192,8 @@ namespace AZ } } } - } - + } + void AZ::SerializeContext::DataPatchUpgradeHandler::AddFieldUpgrade(DataPatchUpgrade* upgrade) { // Find the field @@ -2448,7 +2448,7 @@ namespace AZ classData->m_eventHandler->OnWriteEnd(dataPtr); classData->m_eventHandler->OnObjectCloned(dataPtr); } - + if (classData->m_serializer) { classData->m_serializer->PostClone(dataPtr); @@ -2489,7 +2489,7 @@ namespace AZ { if (cd.m_azRtti->IsTypeOf(typeId)) { - if (!callback(&cd, 0)) + if (!callback(&cd, nullptr)) { return; } @@ -2507,7 +2507,7 @@ namespace AZ // if both classes have azRtti they will be enumerated already by the code above (azrtti) if (cd.m_azRtti == nullptr || cd.m_elements[i].m_azRtti == nullptr) { - if (!callback(&cd, 0)) + if (!callback(&cd, nullptr)) { return; } @@ -2539,7 +2539,7 @@ namespace AZ if (baseClassData) { callbackData.m_reportedTypes.push_back(baseClassData->m_typeId); - if (!callback(baseClassData, 0)) + if (!callback(baseClassData, nullptr)) { return; } @@ -2586,8 +2586,8 @@ namespace AZ void SerializeContext::RegisterDataContainer(AZStd::unique_ptr dataContainer) { m_dataContainers.push_back(AZStd::move(dataContainer)); - } - + } + //========================================================================= // EnumerateBaseRTTIEnumCallback // [11/13/2012] @@ -2731,10 +2731,10 @@ namespace AZ //========================================================================= void SerializeContext::IDataContainer::DeletePointerData(SerializeContext* context, const ClassElement* classElement, const void* element) { - AZ_Assert(context != NULL && classElement != NULL && element != NULL, "Invalid input"); + AZ_Assert(context != nullptr && classElement != nullptr && element != nullptr, "Invalid input"); const AZ::Uuid* elemUuid = &classElement->m_typeId; // find the class data for the specific element - const SerializeContext::ClassData* classData = classElement->m_genericClassInfo ? classElement->m_genericClassInfo->GetClassData() : context->FindClassData(*elemUuid, NULL, 0); + const SerializeContext::ClassData* classData = classElement->m_genericClassInfo ? classElement->m_genericClassInfo->GetClassData() : context->FindClassData(*elemUuid, nullptr, 0); if (classElement->m_flags & SerializeContext::ClassElement::FLG_POINTER) { const void* dataPtr = *reinterpret_cast(element); @@ -2745,7 +2745,7 @@ namespace AZ if (*actualClassId != *elemUuid) { // we are pointing to derived type, adjust class data, uuid and pointer. - classData = context->FindClassData(*actualClassId, NULL, 0); + classData = context->FindClassData(*actualClassId, nullptr, 0); elemUuid = actualClassId; if (classData) { @@ -2754,7 +2754,7 @@ namespace AZ } } } - if (classData == NULL) + if (classData == nullptr) { if ((classElement->m_flags & ClassElement::FLG_POINTER) != 0) { @@ -3250,7 +3250,7 @@ namespace AZ return m_moduleOSAllocator; } - // Take advantage of static variables being unique per dll module to clean up module specific registered classes when the module unloads + // Take advantage of static variables being unique per dll module to clean up module specific registered classes when the module unloads SerializeContext::PerModuleGenericClassInfo& GetCurrentSerializeContextModule() { static SerializeContext::PerModuleGenericClassInfo s_ModuleCleanupInstance; diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h index d48e9df665..3d7f3c00f8 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h +++ b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.h @@ -602,7 +602,7 @@ namespace AZ ///< @param resultPtr output parameter that is populated with the memory address that can be used to store an element of the convertible type ///< @param convertibleTypeId type to check to determine if it can converted to an element of class represent by this Class Data ///< @param classPtr memory address of the class represented by the ClassData - ///< @return true if a non-null memory address has been returned that can store the convertible type + ///< @return true if a non-null memory address has been returned that can store the convertible type bool ConvertFromType(void*& convertibleTypePtr, const TypeId& convertibleTypeId, void* classPtr, AZ::SerializeContext& serializeContext) const; /// Find the persistence id (check base classes) \todo this is a TEMP fix, analyze and cache that information in the class @@ -797,8 +797,8 @@ namespace AZ virtual void* ReserveElement(void* instance, const ClassElement* classElement) = 0; /// Free an element that was reserved using ReserveElement, but was not stored by calling StoreElement. virtual void FreeReservedElement(void* instance, void* element, SerializeContext* deletePointerDataContext) - { - RemoveElement(instance, element, deletePointerDataContext); + { + RemoveElement(instance, element, deletePointerDataContext); } /// Get an element's address by its index (called before the element is loaded). virtual void* GetElementByIndex(void* instance, const ClassElement* classElement, size_t index) = 0; @@ -858,7 +858,7 @@ namespace AZ /** * Data Converter interface which can be used to provide a conversion operation from to unrelated C++ types - * derived class to base class casting is taken care of through the RTTI system so those relations should not be + * derived class to base class casting is taken care of through the RTTI system so those relations should not be * check within this class */ class IDataConverter @@ -879,7 +879,7 @@ namespace AZ ///< @param convertibleTypeId type to check to determine if it can converted to an element of class represent by this Class Data ///< @param classPtr memory address of the class represented by the @classData type ///< @param classData reference to the metadata representing the type stored in classPtr - ///< @return true if a non-null memory address has been returned that can store the convertible type + ///< @return true if a non-null memory address has been returned that can store the convertible type virtual bool ConvertFromType(void*& convertibleTypePtr, const TypeId& convertibleTypeId, void* classPtr, const SerializeContext::ClassData& classData, SerializeContext& /*serializeContext*/) { if (classData.m_typeId == convertibleTypeId) @@ -1054,7 +1054,7 @@ namespace AZ AZStd::vector FindClassId(const AZ::Crc32& classNameCrc) const; /// Find GenericClassData data based on the supplied class ID - GenericClassInfo* FindGenericClassInfo(const Uuid& classId) const; + GenericClassInfo* FindGenericClassInfo(const Uuid& classId) const; /// Creates an AZStd::any based on the provided class Uuid, or returns an empty AZStd::any if no class data is found or the class is virtual AZStd::any CreateAny(const Uuid& classId); @@ -1161,7 +1161,7 @@ namespace AZ /* Declare a name change of a serialized field * These are used by the serializer to repair old data patches - * + * */ ClassBuilder* NameChange(unsigned int fromVersion, unsigned int toVersion, AZStd::string_view oldFieldName, AZStd::string_view newFieldName); @@ -1403,7 +1403,7 @@ namespace AZ template struct SerializeGenericTypeInfo { - // Provides a specific type alias that can be used to create GenericClassInfo of the + // Provides a specific type alias that can be used to create GenericClassInfo of the // specified type. By default this is GenericClassInfo class which is abstract using ClassInfoType = GenericClassInfo; @@ -1938,7 +1938,7 @@ namespace AZ if (m_context->IsRemovingReflection()) { // Delete any attributes allocated for this call. - for (auto attributePair : attributes) + for (auto& attributePair : attributes) { delete attributePair.second; } @@ -1955,7 +1955,7 @@ namespace AZ m_classData->second.m_name, AzTypeInfo::Name()); - // SerializeGenericTypeInfo::GetClassTypeId() is needed solely because + // SerializeGenericTypeInfo::GetClassTypeId() is needed solely because // the SerializeGenericTypeInfo specialization for AZ::Data::Asset returns the GetAssetClassId() value // and not the AzTypeInfo>::Uuid() // Therefore in order to remain backwards compatible the SerializeGenericTypeInfo::GetClassTypeId specialization diff --git a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp index 0ca354ac95..cb666a7c02 100644 --- a/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Settings/SettingsRegistryMergeUtils.cpp @@ -1004,7 +1004,7 @@ namespace AZ::SettingsRegistryMergeUtils } AZ::SettingsRegistryInterface::VisitResponse Traverse( AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::VisitAction action, - AZ::SettingsRegistryInterface::Type type) + AZ::SettingsRegistryInterface::Type type) override { // Pass the pointer path to the inclusion filter if available if (m_dumperSettings.m_includeFilter && !m_dumperSettings.m_includeFilter(path)) @@ -1058,7 +1058,7 @@ namespace AZ::SettingsRegistryMergeUtils AZ::SettingsRegistryInterface::VisitResponse::Done; } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, bool value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, bool value) override { m_result = m_result && WriteName(valueName) && m_writer.Bool(value); } @@ -1073,12 +1073,12 @@ namespace AZ::SettingsRegistryMergeUtils m_result = m_result && WriteName(valueName) && m_writer.Uint64(value); } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, double value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, double value) override { m_result = m_result && WriteName(valueName) && m_writer.Double(value); } - void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) + void Visit(AZStd::string_view, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override { m_result = m_result && WriteName(valueName) && m_writer.String(value.data(), aznumeric_caster(value.size())); } diff --git a/Code/Framework/AzCore/AzCore/State/HSM.cpp b/Code/Framework/AzCore/AzCore/State/HSM.cpp index e9e069cf9a..56a7e9a27a 100644 --- a/Code/Framework/AzCore/AzCore/State/HSM.cpp +++ b/Code/Framework/AzCore/AzCore/State/HSM.cpp @@ -187,7 +187,7 @@ void HSM::ClearStateHandler(StateId id) { m_states[id].handler.clear(); - m_states[id].name = NULL; + m_states[id].name = nullptr; m_states[id].superId = InvalidStateId; } diff --git a/Code/Framework/AzCore/AzCore/State/HSM.h b/Code/Framework/AzCore/AzCore/State/HSM.h index 042843cb7d..4004ca4341 100644 --- a/Code/Framework/AzCore/AzCore/State/HSM.h +++ b/Code/Framework/AzCore/AzCore/State/HSM.h @@ -103,13 +103,10 @@ namespace AZ struct State { - State() - : superId(InvalidStateId) - , name(NULL) {} StateHandler handler; - StateId superId; ///< State id of the super state, InvalidStateId if this is a top state InvalidStateId. - StateId subId; ///< If != InvalidStateId it will enter the sub ID after the state Enter event is called. - const char* name; + StateId superId = InvalidStateId; ///< State id of the super state, InvalidStateId if this is a top state InvalidStateId. + StateId subId = InvalidStateId; ///< If != InvalidStateId it will enter the sub ID after the state Enter event is called. + const char* name = nullptr; }; AZStd::array m_states; }; diff --git a/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp b/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp index 6c92803ac4..d56fc9a5d6 100644 --- a/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp +++ b/Code/Framework/AzCore/AzCore/UserSettings/UserSettingsProvider.cpp @@ -81,8 +81,12 @@ namespace AZ if (settingsFile.IsOpen()) { IO::SystemFileStream settingsFileStream(&settingsFile, false); - ObjectStream::ClassReadyCB readyCB(AZStd::bind(&UserSettingsProvider::OnSettingLoaded, this, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3)); - + ObjectStream::ClassReadyCB readyCB( + [this](void* classPtr, const Uuid& classId, const SerializeContext* sc) + { + OnSettingLoaded(classPtr, classId, sc); + }); + // do not try to load assets during User Settings Provider bootup - we are still initializing the application! // in addition, the file may contain settings we don't understand, from other applications - don't error on those. settingsLoaded = ObjectStream::LoadBlocking(&settingsFileStream, *sc, readyCB, ObjectStream::FilterDescriptor(&AZ::Data::AssetFilterNoAssetLoading, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); @@ -104,7 +108,7 @@ namespace AZ { AZStd::vector saveBuffer; AZ::IO::ByteContainerStream> byteStream(&saveBuffer); - + ObjectStream* objStream = ObjectStream::Create(&byteStream, *sc, ObjectStream::ST_XML); bool writtenOk = objStream->WriteClass(&m_settings); bool streamOk = objStream->Finalize(); diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index 8ceba11239..6aa8a8ebc5 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -23,7 +23,7 @@ #include #define AZSTD_FUNCTION_TARGET_FIX(x) -#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t, Type> +#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t && !std::is_null_pointer_v, Type> diff --git a/Code/Framework/AzCore/AzCore/std/function/function_template.h b/Code/Framework/AzCore/AzCore/std/function/function_template.h index 8e389cb53d..a9c24ca75f 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_template.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_template.h @@ -531,7 +531,7 @@ namespace AZStd //! A static vtable is used to avoid the need to dynamically allocate a vtable //! whose purpose is to contain a function ptr that can the manage the function buffer //! i.e performs the copy, move and destruction operations for the function buffer - //! as well as to validate if a the stored function can be type_cast to the type supplied in + //! as well as to validate if a the stored function can be type_cast to the type supplied in //! std::function::target //! The vtable other purpose is to store a function ptr that is used to wrap the invocation of the underlying function static vtable_type stored_vtable = get_invoker::template create_vtable>(); @@ -556,7 +556,7 @@ namespace AZStd //! A static vtable is used to avoid the need to dynamically allocate a vtable //! whose purpose is to contain a function ptr that can the manage the function buffer //! i.e performs the copy, move and destruction operations for the function buffer - //! as well as to validate if a the stored function can be type_cast to the type supplied in + //! as well as to validate if a the stored function can be type_cast to the type supplied in //! std::function::target //! The vtable other purpose is to store a function ptr that is used to wrap the invocation of the underlying function static vtable_type stored_vtable = get_invoker::template create_vtable>(); @@ -633,7 +633,7 @@ namespace AZStd {} function(nullptr_t) - : base_type() {} + : base_type(nullptr) {} function(const self_type& f) : base_type(static_cast(f)){} function(const base_type& f) @@ -678,7 +678,7 @@ namespace AZStd return *this; } - R operator()(Args... args) const + R operator()(Args... args) const { return base_type::operator()(AZStd::forward(args)...); } diff --git a/Code/Framework/AzCore/AzCore/std/string/regex.cpp b/Code/Framework/AzCore/AzCore/std/string/regex.cpp index 65f6bc732e..a8604130fe 100644 --- a/Code/Framework/AzCore/AzCore/std/string/regex.cpp +++ b/Code/Framework/AzCore/AzCore/std/string/regex.cpp @@ -31,7 +31,7 @@ namespace AZStd AZ_REGEX_CHAR_CLASS_NAME("upper", RegexTraits::Ch_upper), AZ_REGEX_CHAR_CLASS_NAME("w", RegexTraits::Ch_invalid), AZ_REGEX_CHAR_CLASS_NAME("xdigit", RegexTraits::Ch_xdigit), - {0, 0, 0}, + {nullptr, 0, 0}, }; template<> @@ -52,7 +52,7 @@ namespace AZStd AZ_REGEX_CHAR_CLASS_NAME(L"upper", RegexTraits::Ch_upper), AZ_REGEX_CHAR_CLASS_NAME(L"w", RegexTraits::Ch_invalid), AZ_REGEX_CHAR_CLASS_NAME(L"xdigit", RegexTraits::Ch_xdigit), - {0, 0, 0}, + {nullptr, 0, 0}, }; #undef AZ_REGEX_CHAR_CLASS_NAME } // namespace AZStd diff --git a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp index bfc69a05a3..5cf854d49f 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Module/DynamicModuleHandle_UnixLike.cpp @@ -139,7 +139,7 @@ namespace AZ if (m_handle) { result = dlclose(m_handle) == 0 ? true : false; - m_handle = 0; + m_handle = nullptr; } return result; } diff --git a/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp b/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp index 8f34c7f31f..6b82c642d5 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Allocators.cpp @@ -41,12 +41,12 @@ namespace UnitTest AZ_TEST_ASSERT(strcmp(myalloc.get_name(), newName) == 0); AZStd::allocator::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); myalloc.deallocate(data, 100, 1); data = myalloc.allocate(50, 128); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); myalloc.deallocate(data, 50, 128); @@ -153,7 +153,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); buffer_alloc_type::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100); AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100); @@ -172,7 +172,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); data = myalloc.allocate(50, 64); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0); AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50); AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50); @@ -198,7 +198,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); int* data = reinterpret_cast(myalloc.allocate(sizeof(int), 1)); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - 1) * sizeof(int)); AZ_TEST_ASSERT(myalloc.get_allocated_size() == sizeof(int)); @@ -209,7 +209,7 @@ namespace UnitTest for (int i = 0; i < numNodes; ++i) { data = reinterpret_cast(myalloc.allocate(sizeof(int), 1)); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == (numNodes - (i + 1)) * sizeof(int)); AZ_TEST_ASSERT(myalloc.get_allocated_size() == (i + 1) * sizeof(int)); } @@ -231,7 +231,7 @@ namespace UnitTest aligned_int_node_pool_type myaligned_pool; aligned_int_type* aligned_data = reinterpret_cast(myaligned_pool.allocate(sizeof(aligned_int_type), dataAlignment)); - AZ_TEST_ASSERT(aligned_data != 0); + AZ_TEST_ASSERT(aligned_data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)aligned_data & (dataAlignment - 1)) == 0); AZ_TEST_ASSERT(myaligned_pool.get_max_size() == (numNodes - 1) * sizeof(aligned_int_type)); AZ_TEST_ASSERT(myaligned_pool.get_allocated_size() == sizeof(aligned_int_type)); @@ -267,14 +267,14 @@ namespace UnitTest AZ_TEST_ASSERT(ref_allocator2.get_allocator() == ref_allocator1.get_allocator()); ref_allocator_type::pointer_type data1 = ref_allocator1.allocate(10, 1); - AZ_TEST_ASSERT(data1 != 0); + AZ_TEST_ASSERT(data1 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() == bufferSize - 10); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() == 10); AZ_TEST_ASSERT(shared_allocator.get_max_size() == bufferSize - 10); AZ_TEST_ASSERT(shared_allocator.get_allocated_size() == 10); ref_allocator_type::pointer_type data2 = ref_allocator2.allocate(10, 1); - AZ_TEST_ASSERT(data2 != 0); + AZ_TEST_ASSERT(data2 != nullptr); AZ_TEST_ASSERT(ref_allocator2.get_max_size() <= bufferSize - 20); AZ_TEST_ASSERT(ref_allocator2.get_allocated_size() >= 20); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20); @@ -283,14 +283,14 @@ namespace UnitTest shared_allocator.reset(); data1 = ref_allocator1.allocate(10, 32); - AZ_TEST_ASSERT(data1 != 0); + AZ_TEST_ASSERT(data1 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 10); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 10); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 10); AZ_TEST_ASSERT(shared_allocator.get_allocated_size() >= 10); data2 = ref_allocator2.allocate(10, 32); - AZ_TEST_ASSERT(data2 != 0); + AZ_TEST_ASSERT(data2 != nullptr); AZ_TEST_ASSERT(ref_allocator1.get_max_size() <= bufferSize - 20); AZ_TEST_ASSERT(ref_allocator1.get_allocated_size() >= 20); AZ_TEST_ASSERT(shared_allocator.get_max_size() <= bufferSize - 20); @@ -316,7 +316,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); stack_allocator::pointer_type data = myalloc.allocate(100, 1); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(myalloc.get_max_size() == bufferSize - 100); AZ_TEST_ASSERT(myalloc.get_allocated_size() == 100); @@ -329,7 +329,7 @@ namespace UnitTest AZ_TEST_ASSERT(myalloc.get_allocated_size() == 0); data = myalloc.allocate(50, 64); - AZ_TEST_ASSERT(data != 0); + AZ_TEST_ASSERT(data != nullptr); AZ_TEST_ASSERT(((AZStd::size_t)data & 63) == 0); AZ_TEST_ASSERT(myalloc.get_max_size() <= bufferSize - 50); AZ_TEST_ASSERT(myalloc.get_allocated_size() >= 50); diff --git a/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp b/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp index 57975ad09b..a5da293057 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Atomics.cpp @@ -975,13 +975,13 @@ namespace UnitTest A obj(T(0)); bool b0 = obj.is_lock_free(); ((void)b0); // mark as unused - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE(obj == T(nullptr)); AZStd::atomic_init(&obj, T(1)); EXPECT_TRUE(obj == T(1)); AZStd::atomic_init(&obj, T(2)); EXPECT_TRUE(obj == T(2)); obj.store(T(0)); - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE(obj == T(nullptr)); obj.store(T(1), AZStd::memory_order_release); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(obj.load() == T(1)); @@ -1001,11 +1001,11 @@ namespace UnitTest EXPECT_TRUE(obj.compare_exchange_strong(x, T(1)) == true); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(x == T(2)); - EXPECT_TRUE(obj.compare_exchange_strong(x, T(0)) == false); + EXPECT_TRUE(obj.compare_exchange_strong(x, T(nullptr)) == false); EXPECT_TRUE(obj == T(1)); EXPECT_TRUE(x == T(1)); - EXPECT_TRUE((obj = T(0)) == T(0)); - EXPECT_TRUE(obj == T(0)); + EXPECT_TRUE((obj = T(nullptr)) == T(nullptr)); + EXPECT_TRUE(obj == T(nullptr)); obj = T(2 * sizeof(X)); EXPECT_TRUE((obj += AZStd::ptrdiff_t(3)) == T(5 * sizeof(X))); EXPECT_TRUE(obj == T(5 * sizeof(X))); @@ -1015,7 +1015,7 @@ namespace UnitTest { alignas(A) char storage[sizeof(A)] = { 23 }; A& zero = *new (storage) A(); - EXPECT_TRUE(zero == T(0)); + EXPECT_TRUE(zero == T(nullptr)); zero.~A(); } } diff --git a/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp b/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp index ed1d59906b..7279e4015a 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Bitset.cpp @@ -127,7 +127,7 @@ namespace UnitTest AZStd::bitset<32> m_bitset1; AZStd::bitset<32> m_bitset2; }; - + TEST_P(BitsetUnsignedLongPairTests, BitwiseANDOperator_MatchesUnsignedLongAND) { EXPECT_EQ((m_bitset1 & m_bitset2).to_ulong(), m_unsignedLong1 & m_unsignedLong2); @@ -316,7 +316,7 @@ namespace UnitTest { for (unsigned long value2 : testCases) { - testCasePairs.push_back(AZStd::pair(value1, value2)); + testCasePairs.emplace_back(value1, value2); } } return testCasePairs; diff --git a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp index 6bfda10ddc..2a4c598218 100644 --- a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp @@ -219,7 +219,7 @@ class OtherClass double rubbish; // to ensure this class has non-zero size. public: virtual ~OtherClass() {} - virtual void UnusedVirtualFunction(void) { (void)rubbish; } + virtual void UnusedVirtualFunction() { (void)rubbish; } virtual void TrickyVirtualFunction(int num, char* str) = 0; }; @@ -268,7 +268,7 @@ namespace UnitTest // Assignment to an empty function v1 = five; - AZ_TEST_ASSERT(v1 != 0); + AZ_TEST_ASSERT(v1 != nullptr); // Invocation of a function global_int = 0; @@ -277,7 +277,7 @@ namespace UnitTest // clear() method v1.clear(); - AZ_TEST_ASSERT(v1 == 0); + AZ_TEST_ASSERT(v1 == nullptr); // Assignment to an empty function v1 = three; @@ -303,12 +303,12 @@ namespace UnitTest AZ_TEST_ASSERT(global_int == 5); // clear - v1 = 0; - AZ_TEST_ASSERT(0 == v1); + v1 = nullptr; + AZ_TEST_ASSERT(nullptr == v1); // Assignment to an empty function from a free function v1 = AZSTD_FUNCTION_TARGET_FIX(&) write_five; - AZ_TEST_ASSERT(0 != v1); + AZ_TEST_ASSERT(nullptr != v1); // Invocation global_int = 0; @@ -697,9 +697,9 @@ namespace UnitTest AZ_TEST_ASSERT(global_int == 2); // Test construction from 0 and comparison to 0 - func_void_type v9(0); - AZ_TEST_ASSERT(v9 == 0); - AZ_TEST_ASSERT(0 == v9); + func_void_type v9(nullptr); + AZ_TEST_ASSERT(v9 == nullptr); + AZ_TEST_ASSERT(nullptr == v9); // Test return values typedef function func_int_type; @@ -941,7 +941,7 @@ namespace UnitTest TEST_F(Function, FunctionWithNonAZStdAllocatorDestructsSuccessfully) { - // 64 Byte buffer is used to prevent AZStd::function for storing the + // 64 Byte buffer is used to prevent AZStd::function for storing the // lambda internal storage using the small buffer optimization // Therefore causing the supplied allocator to be used [[maybe_unused]] AZStd::aligned_storage_t<64, 1> bufferToAvoidSmallBufferOptimization; @@ -994,7 +994,7 @@ namespace UnitTest return static_cast(lhs) + rhs; } - // Make sure the functor have a specific size so + // Make sure the functor have a specific size so // that it can be used to test both the AZStd::function small_object_optimization path // and the heap allocated function object path AZStd::aligned_storage_t m_functorPadding; @@ -1044,7 +1044,7 @@ namespace UnitTest TestFunctor testFunctor; AZStd::function testFunction2(AZStd::move(testFunctor)); EXPECT_GT(s_functorMoveConstructorCount, 0); - + double testFunc2Result = testFunction2(16, 4.0); EXPECT_DOUBLE_EQ(20, testFunc2Result); @@ -1068,7 +1068,7 @@ namespace UnitTest AZStd::function testFunction2; testFunction2 = AZStd::move(testFunctor); EXPECT_GT(s_functorMoveConstructorCount + s_functorMoveAssignmentCount, 0); - + double testFunc2Result = testFunction2(16, 4.0); EXPECT_DOUBLE_EQ(20, testFunc2Result); @@ -1643,7 +1643,7 @@ namespace UnitTest AZStd::reference_wrapper refTimeStamp(timeStamp); double result = nestedFunc(32, refTimeStamp, 64.0); EXPECT_EQ(512, timeStamp); - + constexpr double expectedResult = static_cast(32 + 16 + 128.0 + 512); EXPECT_DOUBLE_EQ(expectedResult, result); } diff --git a/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp b/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp index 2743d5e323..f3d4f58250 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Parallel.cpp @@ -195,7 +195,7 @@ namespace UnitTest void test_thread_id_for_running_thread_is_not_default_constructed_id() { - const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc); AZ_TEST_ASSERT(t.get_id() != AZStd::thread::id()); t.join(); @@ -203,8 +203,8 @@ namespace UnitTest void test_different_threads_have_different_ids() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2); AZ_TEST_ASSERT(t.get_id() != t2.get_id()); @@ -214,9 +214,9 @@ namespace UnitTest void test_thread_ids_have_a_total_order() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; - const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; + const thread_desc* desc3 = m_numThreadDesc ? &m_desc[2] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::do_nothing, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::do_nothing, this), desc2); @@ -313,7 +313,7 @@ namespace UnitTest void test_thread_id_of_running_thread_returned_by_this_thread_get_id() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id id; AZStd::thread t(AZStd::bind(&Parallel_Thread::get_thread_id, this, &id), desc1); @@ -366,7 +366,7 @@ namespace UnitTest void test_move_on_construction() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id the_id; AZStd::thread x; x = AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, &the_id), desc1); @@ -377,7 +377,7 @@ namespace UnitTest AZStd::thread make_thread(AZStd::thread::id* the_id) { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; return AZStd::thread(AZStd::bind(&Parallel_Thread::do_nothing_id, this, the_id), desc1); } @@ -430,7 +430,7 @@ namespace UnitTest void do_test_creation() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; m_data = 0; AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1); t.join(); @@ -445,7 +445,7 @@ namespace UnitTest void do_test_id_comparison() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; AZStd::thread::id self = this_thread::get_id(); AZStd::thread thrd(AZStd::bind(&Parallel_Thread::comparison_thread, this, self), desc1); thrd.join(); @@ -476,7 +476,7 @@ namespace UnitTest void do_test_creation_through_reference_wrapper() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; non_copyable_functor f; AZStd::thread thrd(AZStd::ref(f), desc1); @@ -491,8 +491,8 @@ namespace UnitTest void test_swap() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; - const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; + const thread_desc* desc2 = m_numThreadDesc ? &m_desc[1] : nullptr; AZStd::thread t(AZStd::bind(&Parallel_Thread::simple_thread, this), desc1); AZStd::thread t2(AZStd::bind(&Parallel_Thread::simple_thread, this), desc2); AZStd::thread::id id1 = t.get_id(); @@ -512,7 +512,7 @@ namespace UnitTest void run() { - const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : 0; + const thread_desc* desc1 = m_numThreadDesc ? &m_desc[0] : nullptr; // We need to have at least one processor AZ_TEST_ASSERT(AZStd::thread::hardware_concurrency() >= 1); diff --git a/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp b/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp index f50da28b1f..b6a5a62c05 100644 --- a/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/SmartPtr.cpp @@ -137,7 +137,7 @@ namespace UnitTest static void deleter(int* p) { - EXPECT_TRUE(p == 0); + EXPECT_TRUE(p == nullptr); } struct deleter2 @@ -158,7 +158,7 @@ namespace UnitTest { void operator()(incomplete* p) { - EXPECT_TRUE(p == 0); + EXPECT_TRUE(p == nullptr); } }; @@ -331,7 +331,7 @@ namespace UnitTest AZStd::shared_ptr pv; EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_EQ(0, pv.get()); + EXPECT_EQ(nullptr, pv.get()); EXPECT_EQ(0, pv.use_count()); } @@ -355,35 +355,35 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCtorIntPtr) { - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorConstIntPtr) { - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorX) { - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); - m_sharedPtr->TestType(static_cast(0)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); + m_sharedPtr->TestType(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorXConvert) { - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); - m_sharedPtr->TestNull(static_cast(0)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); + m_sharedPtr->TestNull(static_cast(nullptr)); } TEST_F(SmartPtr, SharedPtrCtorIntValue) @@ -518,15 +518,15 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCtorNullDeleter) { { - AZStd::shared_ptr pi(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pi(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pi, nullptr); } { - AZStd::shared_ptr pv(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pv(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pv, nullptr); } { - AZStd::shared_ptr pv(static_cast(0), &SharedPtr::test::deleter); + AZStd::shared_ptr pv(static_cast(nullptr), &SharedPtr::test::deleter); m_sharedPtr->TestPtr(pv, nullptr); } } @@ -589,21 +589,21 @@ namespace UnitTest EXPECT_EQ(pi2, pi); EXPECT_FALSE(pi2); EXPECT_TRUE(!pi2); - EXPECT_EQ(0, pi2.get()); + EXPECT_EQ(nullptr, pi2.get()); EXPECT_EQ(pi2.use_count(), pi.use_count()); AZStd::shared_ptr pi3(pi); EXPECT_EQ(pi3, pi); EXPECT_FALSE(pi3); EXPECT_TRUE(!pi3); - EXPECT_EQ(0, pi3.get()); + EXPECT_EQ(nullptr, pi3.get()); EXPECT_EQ(pi3.use_count(), pi.use_count()); AZStd::shared_ptr pi4(pi3); EXPECT_EQ(pi4, pi3); EXPECT_FALSE(pi4); EXPECT_TRUE(!pi4); - EXPECT_EQ(0, pi4.get()); + EXPECT_EQ(nullptr, pi4.get()); EXPECT_EQ(pi4.use_count(), pi3.use_count()); } @@ -615,7 +615,7 @@ namespace UnitTest EXPECT_EQ(pv2, pv); EXPECT_FALSE(pv2); EXPECT_TRUE(!pv2); - EXPECT_EQ(0, pv2.get()); + EXPECT_EQ(nullptr, pv2.get()); EXPECT_EQ(pv2.use_count(), pv.use_count()); } @@ -628,26 +628,26 @@ namespace UnitTest EXPECT_EQ(px, px2); EXPECT_FALSE(px2); EXPECT_TRUE(!px2); - EXPECT_EQ(0, px2.get()); + EXPECT_EQ(nullptr, px2.get()); EXPECT_EQ(px.use_count(), px2.use_count()); AZStd::shared_ptr px3(px); EXPECT_EQ(px, px3); EXPECT_FALSE(px3); EXPECT_TRUE(!px3); - EXPECT_EQ(0, px3.get()); + EXPECT_EQ(nullptr, px3.get()); EXPECT_EQ(px.use_count(), px3.use_count()); } TEST_F(SmartPtr, SharedPtrCopyCtorIntVoidSharedOwnershipTest) { - AZStd::shared_ptr pi(static_cast(0)); + AZStd::shared_ptr pi(static_cast(nullptr)); AZStd::shared_ptr pi2(pi); EXPECT_EQ(pi, pi2); EXPECT_FALSE(pi2); EXPECT_TRUE(!pi2); - EXPECT_EQ(0, pi2.get()); + EXPECT_EQ(nullptr, pi2.get()); EXPECT_EQ(2, pi2.use_count()); EXPECT_FALSE(pi2.unique()); EXPECT_EQ(pi.use_count(), pi2.use_count()); @@ -657,7 +657,7 @@ namespace UnitTest EXPECT_EQ(pi, pi3); EXPECT_FALSE(pi3); EXPECT_TRUE(!pi3); - EXPECT_EQ(0, pi3.get()); + EXPECT_EQ(nullptr, pi3.get()); EXPECT_EQ(3, pi3.use_count()); EXPECT_FALSE(pi3.unique()); EXPECT_EQ(pi.use_count(), pi3.use_count()); @@ -667,7 +667,7 @@ namespace UnitTest EXPECT_EQ(pi2, pi4); EXPECT_FALSE(pi4); EXPECT_TRUE(!pi4); - EXPECT_EQ(0, pi4.get()); + EXPECT_EQ(nullptr, pi4.get()); EXPECT_EQ(4, pi4.use_count()); EXPECT_FALSE(pi4.unique()); EXPECT_EQ(pi2.use_count(), pi4.use_count()); @@ -680,13 +680,13 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrCopyCtorClassSharedOwnershipTest) { using X = SharedPtr::test::X; - AZStd::shared_ptr px(static_cast(0)); + AZStd::shared_ptr px(static_cast(nullptr)); AZStd::shared_ptr px2(px); EXPECT_EQ(px, px2); EXPECT_FALSE(px2); EXPECT_TRUE(!px2); - EXPECT_EQ(0, px2.get()); + EXPECT_EQ(nullptr, px2.get()); EXPECT_EQ(2, px2.use_count()); EXPECT_FALSE(px2.unique()); EXPECT_EQ(px.use_count(), px2.use_count()); @@ -696,7 +696,7 @@ namespace UnitTest EXPECT_EQ(px, px3); EXPECT_FALSE(px3); EXPECT_TRUE(!px3); - EXPECT_EQ(0, px3.get()); + EXPECT_EQ(nullptr, px3.get()); EXPECT_EQ(3, px3.use_count()); EXPECT_FALSE(px3.unique()); EXPECT_EQ(px.use_count(), px3.use_count()); @@ -706,7 +706,7 @@ namespace UnitTest EXPECT_EQ(px2, px4); EXPECT_FALSE(px4); EXPECT_TRUE(!px4); - EXPECT_EQ(0, px4.get()); + EXPECT_EQ(nullptr, px4.get()); EXPECT_EQ(4, px4.use_count()); EXPECT_FALSE(px4.unique()); EXPECT_EQ(px2.use_count(), px4.use_count()); @@ -871,11 +871,11 @@ namespace UnitTest { AZStd::shared_ptr p2(wp); EXPECT_EQ(wp.use_count(), p2.use_count()); - EXPECT_EQ(0, p2.get()); + EXPECT_EQ(nullptr, p2.get()); AZStd::shared_ptr p3(wp); EXPECT_EQ(wp.use_count(), p3.use_count()); - EXPECT_EQ(0, p3.get()); + EXPECT_EQ(nullptr, p3.get()); } } @@ -927,7 +927,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -936,7 +936,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -945,7 +945,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); } TEST_F(SmartPtr, SharedPtrCopyAssignVoid) @@ -959,7 +959,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -968,7 +968,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -977,7 +977,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p4(new int); EXPECT_EQ(1, p4.use_count()); @@ -1007,7 +1007,7 @@ namespace UnitTest EXPECT_EQ(p1, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p2; @@ -1016,7 +1016,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p3(p1); @@ -1025,7 +1025,7 @@ namespace UnitTest EXPECT_EQ(p3, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1065,7 +1065,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); AZStd::shared_ptr p4(new int); EXPECT_EQ(1, p4.use_count()); @@ -1098,7 +1098,7 @@ namespace UnitTest EXPECT_EQ(p2, p1); EXPECT_FALSE(p1); EXPECT_TRUE(!p1); - EXPECT_EQ(0, p1.get()); + EXPECT_EQ(nullptr, p1.get()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(0, m_sharedPtr->m_test.m_yInstances); @@ -1144,17 +1144,17 @@ namespace UnitTest pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } TEST_F(SmartPtr, SharedPtrResetNullInt) { - AZStd::shared_ptr pi(static_cast(0)); + AZStd::shared_ptr pi(static_cast(nullptr)); pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } @@ -1164,7 +1164,7 @@ namespace UnitTest pi.reset(); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 0); } @@ -1175,7 +1175,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1187,7 +1187,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1198,7 +1198,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); } @@ -1211,7 +1211,7 @@ namespace UnitTest px.reset(); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 0); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); } @@ -1222,7 +1222,7 @@ namespace UnitTest pv.reset(); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 0); } @@ -1235,7 +1235,7 @@ namespace UnitTest pv.reset(); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 0); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); } @@ -1244,10 +1244,10 @@ namespace UnitTest { AZStd::shared_ptr pi; - pi.reset(static_cast(0)); + pi.reset(static_cast(nullptr)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); @@ -1259,10 +1259,10 @@ namespace UnitTest EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); - pi.reset(static_cast(0)); + pi.reset(static_cast(nullptr)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); } @@ -1273,10 +1273,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr px; - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1290,10 +1290,10 @@ namespace UnitTest EXPECT_TRUE(px.unique()); EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1309,10 +1309,10 @@ namespace UnitTest EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances); - px.reset(static_cast(0)); + px.reset(static_cast(nullptr)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1325,10 +1325,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr pv; - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1342,10 +1342,10 @@ namespace UnitTest EXPECT_TRUE(pv.unique()); EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1361,10 +1361,10 @@ namespace UnitTest EXPECT_EQ(1, m_sharedPtr->m_test.m_xInstances); EXPECT_EQ(1, m_sharedPtr->m_test.m_yInstances); - pv.reset(static_cast(0)); + pv.reset(static_cast(nullptr)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); EXPECT_EQ(0, m_sharedPtr->m_test.m_xInstances); @@ -1375,10 +1375,10 @@ namespace UnitTest { AZStd::shared_ptr pi; - pi.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pi.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); @@ -1386,23 +1386,23 @@ namespace UnitTest int m = 0; pi.reset(&m, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pi ? true : false); EXPECT_TRUE(!!pi); EXPECT_TRUE(pi.get() == &m); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); - pi.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pi.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &m); EXPECT_FALSE(pi); EXPECT_TRUE(!pi); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); EXPECT_TRUE(pi.use_count() == 1); EXPECT_TRUE(pi.unique()); pi.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetClassWithDeleter) @@ -1411,10 +1411,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr px; - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); @@ -1422,40 +1422,40 @@ namespace UnitTest X x(m_sharedPtr->m_test); px.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(px ? true : false); EXPECT_TRUE(!!px); EXPECT_TRUE(px.get() == &x); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); Y y(m_sharedPtr->m_test); px.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(px ? true : false); EXPECT_TRUE(!!px); EXPECT_TRUE(px.get() == &y); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); - px.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + px.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); px.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetVoidClassWithDeleter) @@ -1464,10 +1464,10 @@ namespace UnitTest using Y = SharedPtr::test::Y; AZStd::shared_ptr pv; - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); @@ -1475,40 +1475,40 @@ namespace UnitTest X x(m_sharedPtr->m_test); pv.reset(&x, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pv ? true : false); EXPECT_TRUE(!!pv); EXPECT_TRUE(pv.get() == &x); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &x); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); Y y(m_sharedPtr->m_test); pv.reset(&y, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); EXPECT_TRUE(pv ? true : false); EXPECT_TRUE(!!pv); EXPECT_TRUE(pv.get() == &y); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); - pv.reset(static_cast(0), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); + pv.reset(static_cast(nullptr), SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_TRUE(m_sharedPtr->m_test.deleted == &y); EXPECT_FALSE(pv); EXPECT_TRUE(!pv); - EXPECT_TRUE(pv.get() == 0); + EXPECT_TRUE(pv.get() == nullptr); EXPECT_TRUE(pv.use_count() == 1); EXPECT_TRUE(pv.unique()); pv.reset(); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrResetIncompleteNullWithDeleter) @@ -1521,20 +1521,20 @@ namespace UnitTest px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); EXPECT_FALSE(px); EXPECT_TRUE(!px); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); m_sharedPtr->m_test.deleted = &px; px.reset(p0, SharedPtr::test::deleter_void(m_sharedPtr->m_test.deleted)); - EXPECT_TRUE(m_sharedPtr->m_test.deleted == 0); + EXPECT_TRUE(m_sharedPtr->m_test.deleted == nullptr); } TEST_F(SmartPtr, SharedPtrGetPointerEmpty) { struct X {}; AZStd::shared_ptr px; - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1544,8 +1544,8 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrGetPointerNull) { struct X {}; - AZStd::shared_ptr px(static_cast(0)); - EXPECT_TRUE(px.get() == 0); + AZStd::shared_ptr px(static_cast(nullptr)); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1555,8 +1555,8 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrGetPointerCheckedDeleterNull) { struct X {}; - AZStd::shared_ptr px(static_cast(0), AZStd::checked_deleter()); - EXPECT_TRUE(px.get() == 0); + AZStd::shared_ptr px(static_cast(nullptr), AZStd::checked_deleter()); + EXPECT_TRUE(px.get() == nullptr); EXPECT_FALSE(px); EXPECT_TRUE(!px); @@ -1594,7 +1594,7 @@ namespace UnitTest TEST_F(SmartPtr, SharedPtrUseCountNullClass) { struct X {}; - AZStd::shared_ptr px(static_cast(0)); + AZStd::shared_ptr px(static_cast(nullptr)); EXPECT_TRUE(px.use_count() == 1); EXPECT_TRUE(px.unique()); @@ -1641,14 +1641,14 @@ namespace UnitTest px.swap(px2); - EXPECT_TRUE(px.get() == 0); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px.get() == nullptr); + EXPECT_TRUE(px2.get() == nullptr); using std::swap; swap(px, px2); - EXPECT_TRUE(px.get() == 0); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px.get() == nullptr); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrSwapNewClass) @@ -1663,14 +1663,14 @@ namespace UnitTest EXPECT_TRUE(px.get() == p); EXPECT_TRUE(px.use_count() == 2); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); EXPECT_TRUE(px3.get() == p); EXPECT_TRUE(px3.use_count() == 2); using std::swap; swap(px, px2); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); EXPECT_TRUE(px2.get() == p); EXPECT_TRUE(px2.use_count() == 2); EXPECT_TRUE(px3.get() == p); @@ -1876,10 +1876,10 @@ namespace UnitTest AZStd::shared_ptr pv; AZStd::shared_ptr pi = AZStd::static_pointer_cast(pv); - EXPECT_TRUE(pi.get() == 0); + EXPECT_TRUE(pi.get() == nullptr); AZStd::shared_ptr px = AZStd::static_pointer_cast(pv); - EXPECT_TRUE(px.get() == 0); + EXPECT_TRUE(px.get() == nullptr); } TEST_F(SmartPtr, SharedPtrStaticPointerCastNewIntToVoid) @@ -1946,7 +1946,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrIntConstPointerCastInt) @@ -1954,7 +1954,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrClassConstPointerCastClass) @@ -1963,7 +1963,7 @@ namespace UnitTest AZStd::shared_ptr px; AZStd::shared_ptr px2 = AZStd::const_pointer_cast(px); - EXPECT_TRUE(px2.get() == 0); + EXPECT_TRUE(px2.get() == nullptr); } TEST_F(SmartPtr, SharedPtrVoidVolatileConstPointerCastVoid) diff --git a/Code/Framework/AzCore/Tests/AZStd/String.cpp b/Code/Framework/AzCore/Tests/AZStd/String.cpp index 4c6687b00d..91d2237ca2 100644 --- a/Code/Framework/AzCore/Tests/AZStd/String.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/String.cpp @@ -444,7 +444,7 @@ namespace UnitTest str2.back() = 'p'; AZ_TEST_ASSERT(str2.back() == 'p'); - AZ_TEST_ASSERT(str2.c_str() != 0); + AZ_TEST_ASSERT(str2.c_str() != nullptr); AZ_TEST_ASSERT(::strlen(str2.c_str()) == str2.length()); str2.resize(30, 'm'); @@ -793,7 +793,7 @@ namespace UnitTest AZ_TEST_ASSERT(alphanum_comp(strdup("Alpha 2 B"), strA) > 0); // show usage of the comparison functor with a set - typedef set > StringSetType; + using StringSetType = set>; StringSetType s; s.insert("Xiph Xlater 58"); s.insert("Xiph Xlater 5000"); @@ -879,7 +879,7 @@ namespace UnitTest AZ_TEST_ASSERT(*setIt++ == "Xiph Xlater 10000"); // show usage of comparison functor with a map - typedef map > StringIntMapType; + using StringIntMapType = map>; StringIntMapType m; m["z1.doc"] = 1; m["z10.doc"] = 2; @@ -1441,7 +1441,7 @@ namespace UnitTest TEST_F(String, String_FormatOnlyAllowsValidArgs) { - constexpr bool v1 = 0; + constexpr bool v1 = false; constexpr char v2 = 0; constexpr unsigned char v3 = 0; constexpr signed char v4 = 0; diff --git a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp index 933db73c3f..47c3630091 100644 --- a/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/VectorAndArray.cpp @@ -824,7 +824,7 @@ namespace UnitTest {1, 2, 3, 4} }; AZ_TEST_ASSERT(myArr.empty() == false); - AZ_TEST_ASSERT(myArr.data() != 0); + AZ_TEST_ASSERT(myArr.data() != nullptr); AZ_TEST_ASSERT(myArr.size() == 10); AZ_TEST_ASSERT(myArr.front() == 1); AZ_TEST_ASSERT(myArr.back() == 0); diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp index e25c3dbcf7..8ce3747620 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerLoadingTests.cpp @@ -52,7 +52,7 @@ namespace UnitTest AssetLoadBus::Handler::BusConnect(m_assetId); } } - ~OnAssetReadyListener() + ~OnAssetReadyListener() override { m_assetId.SetInvalid(); m_latest = {}; @@ -109,7 +109,7 @@ namespace UnitTest { BusConnect(assetId); } - ~ContainerReadyListener() + ~ContainerReadyListener() override { BusDisconnect(); } @@ -2658,7 +2658,7 @@ namespace UnitTest m_canceled = true; } - ~CancelListener() + ~CancelListener() override { BusDisconnect(); } diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp index 46ff4ff3e7..a683f9630e 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp @@ -420,7 +420,7 @@ namespace UnitTest AZ::Data::AssetHandler::LoadResult LoadAssetData( [[maybe_unused]] const AZ::Data::Asset& asset, [[maybe_unused]] AZStd::shared_ptr stream, - [[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) + [[maybe_unused]] const AZ::Data::AssetFilterCB& assetLoadFilterCB) override { return AZ::Data::AssetHandler::LoadResult::LoadComplete; } diff --git a/Code/Framework/AzCore/Tests/EventTests.cpp b/Code/Framework/AzCore/Tests/EventTests.cpp index aaa70344e7..cb86ef0c17 100644 --- a/Code/Framework/AzCore/Tests/EventTests.cpp +++ b/Code/Framework/AzCore/Tests/EventTests.cpp @@ -398,7 +398,7 @@ namespace Benchmark { public: EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void OnSignal(int32_t) override {} }; @@ -418,7 +418,7 @@ namespace Benchmark { public: EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; } void OnSignal(int32_t) override { ++(*m_incrementCounter); } int32_t* m_incrementCounter; diff --git a/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp b/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp index 41e0ac3f09..2fca03bc59 100644 --- a/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp +++ b/Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp @@ -870,11 +870,11 @@ namespace Benchmark , public ::UnitTest::AllocatorsBase { public: - void SetUp([[maybe_unused]] const ::benchmark::State& state) + void SetUp([[maybe_unused]] const ::benchmark::State& state) override { ::UnitTest::AllocatorsBase::SetupAllocator(); } - void TearDown([[maybe_unused]] const ::benchmark::State& state) + void TearDown([[maybe_unused]] const ::benchmark::State& state) override { ::UnitTest::AllocatorsBase::TeardownAllocator(); } diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index b88e1f5b32..b63e139dd0 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -184,7 +184,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(Vector3SumJob, ThreadPoolAllocator, 0) - Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = NULL) + Vector3SumJob(const Vector3* array, unsigned int size, Vector3* result, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_size(size) @@ -284,7 +284,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJobJoin, ThreadPoolAllocator, 0) - FibonacciJobJoin(int* result, JobContext* context = NULL) + FibonacciJobJoin(int* result, JobContext* context = nullptr) : Job(true, context) , m_result(result) { @@ -304,7 +304,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJobFork, ThreadPoolAllocator, 0) - FibonacciJobFork(int n, int* result, JobContext* context = NULL) + FibonacciJobFork(int n, int* result, JobContext* context = nullptr) : Job(true, context) , m_n(n) , m_result(result) @@ -374,7 +374,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(FibonacciJob2, ThreadPoolAllocator, 0) - FibonacciJob2(int n, int* result, JobContext* context = NULL) + FibonacciJob2(int n, int* result, JobContext* context = nullptr) : Job(true, context) , m_n(n) , m_result(result) @@ -441,7 +441,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(MergeSortJobJoin, ThreadPoolAllocator, 0) - MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = NULL) + MergeSortJobJoin(int* array, int* tempArray, int size1, int size2, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_tempArray(tempArray) @@ -496,7 +496,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(MergeSortJobFork, ThreadPoolAllocator, 0) - MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = NULL) + MergeSortJobFork(int* array, int* tempArray, int size, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_tempArray(tempArray) @@ -585,7 +585,7 @@ namespace UnitTest public: AZ_CLASS_ALLOCATOR(QuickSortJob, ThreadPoolAllocator, 0) - QuickSortJob(int* array, int left, int right, JobContext* context = NULL) + QuickSortJob(int* array, int left, int right, JobContext* context = nullptr) : Job(true, context) , m_array(array) , m_left(left) diff --git a/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp b/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp index e4314f9cfb..9aed29005d 100644 --- a/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/Matrix3x4PerformanceTests.cpp @@ -22,7 +22,7 @@ namespace Benchmark : public benchmark::Fixture { public: - void SetUp([[maybe_unused]] const::benchmark::State& state) + void SetUp([[maybe_unused]] const::benchmark::State& state) override { m_testDataArray.resize(1000); diff --git a/Code/Framework/AzCore/Tests/Memory.cpp b/Code/Framework/AzCore/Tests/Memory.cpp index ea6495755e..611af827d2 100644 --- a/Code/Framework/AzCore/Tests/Memory.cpp +++ b/Code/Framework/AzCore/Tests/Memory.cpp @@ -90,7 +90,7 @@ namespace UnitTest #else static const int numAllocations = 10000; #endif - void* addresses[numAllocations] = {0}; + void* addresses[numAllocations] = {nullptr}; IAllocatorAllocate& sysAlloc = AllocatorInstance::Get(); @@ -242,7 +242,7 @@ namespace UnitTest ////////////////////////////////////////////////////////////////////////// // realloc test - address[0] = NULL; + address[0] = nullptr; static const unsigned int checkValue = 0x0badbabe; // create tree (non pool) allocation (we usually pool < 256 bytes) address[0] = sysAlloc.Allocate(2048, 16); @@ -372,7 +372,7 @@ namespace UnitTest poolAllocator.GetRecords()->unlock(); } - for (i = 0; address[i] != 0; ++i) + for (i = 0; address[i] != nullptr; ++i) { poolAlloc.DeAllocate(address[i]); } @@ -544,7 +544,7 @@ namespace UnitTest #else static const int numAllocations = 10000; #endif - void* addresses[numAllocations] = {0}; + void* addresses[numAllocations] = {nullptr}; IAllocatorAllocate& poolAlloc = AllocatorInstance::Get(); @@ -665,7 +665,7 @@ namespace UnitTest poolAllocator.GetRecords()->unlock(); } - for (int i = 0; address[i] != 0; ++i) + for (int i = 0; address[i] != nullptr; ++i) { poolAlloc.DeAllocate(address[i]); } @@ -820,7 +820,7 @@ namespace UnitTest AllocatorInstance::Create(sysDesc); BestFitExternalMapAllocator::Descriptor desc; - desc.m_mapAllocator = NULL; // use the system allocator + desc.m_mapAllocator = nullptr; // use the system allocator desc.m_memoryBlockByteSize = 4 * 1024 * 1024; desc.m_memoryBlock = azmalloc(desc.m_memoryBlockByteSize, desc.m_memoryBlockAlignment); diff --git a/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp b/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp index cb2b32e212..aaf4ce1811 100644 --- a/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp +++ b/Code/Framework/AzCore/Tests/Memory/HphaSchema.cpp @@ -121,13 +121,13 @@ namespace Benchmark : public ::benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state) + void SetUp(const ::benchmark::State& state) override { AZ_UNUSED(state); AZ::AllocatorInstance::Create(); } - void TearDown(const ::benchmark::State& state) + void TearDown(const ::benchmark::State& state) override { AZ_UNUSED(state); AZ::AllocatorInstance::Destroy(); diff --git a/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp b/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp index 2bca8b5970..7801059535 100644 --- a/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Name/NameJsonSerializerTests.cpp @@ -28,12 +28,12 @@ namespace JsonSerializationTests AZ::NameDictionary::Destroy(); } - void Reflect(AZStd::unique_ptr& context) + void Reflect(AZStd::unique_ptr& context) override { AZ::Name::Reflect(context.get()); } - void Reflect(AZStd::unique_ptr& context) + void Reflect(AZStd::unique_ptr& context) override { AZ::Name::Reflect(context.get()); } diff --git a/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp b/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp index 7cada35d19..25b2007bea 100644 --- a/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp +++ b/Code/Framework/AzCore/Tests/OrderedEventBenchmarks.cpp @@ -74,7 +74,7 @@ namespace Benchmark { public: EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplEmpty() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplEmpty() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void OnSignal(int32_t) override {} }; @@ -94,7 +94,7 @@ namespace Benchmark { public: EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusConnect(); } - ~EBusPerfBaselineImplIncrement() { EBusPerfBaselineBus::Handler::BusDisconnect(); } + ~EBusPerfBaselineImplIncrement() override { EBusPerfBaselineBus::Handler::BusDisconnect(); } void SetIncrementCounter(int32_t* incrementCounter) { m_incrementCounter = incrementCounter; } void OnSignal(int32_t) override { ++(*m_incrementCounter); } int32_t* m_incrementCounter; diff --git a/Code/Framework/AzCore/Tests/Script.cpp b/Code/Framework/AzCore/Tests/Script.cpp index e0301f8974..336e4e5dd0 100644 --- a/Code/Framework/AzCore/Tests/Script.cpp +++ b/Code/Framework/AzCore/Tests/Script.cpp @@ -1382,7 +1382,7 @@ namespace UnitTest static int s_errorCount = 0; IncompleteType* s_globalIncompletePtr = static_cast(AZ_INVALID_POINTER); - IncompleteType* s_globalIncompletePtr1 = 0; + IncompleteType* s_globalIncompletePtr1 = nullptr; void GlobalVarSet(int v) { @@ -2234,7 +2234,7 @@ namespace UnitTest // incomplete types passed by a light-user data (pointer reference) AZ_TEST_ASSERT(s_globalIncompletePtr == reinterpret_cast(AZ_INVALID_POINTER)); - AZ_TEST_ASSERT(s_globalIncompletePtr1 == 0); + AZ_TEST_ASSERT(s_globalIncompletePtr1 == nullptr); script.Execute("globalIncomplete1 = globalIncomplete"); AZ_TEST_ASSERT(s_globalIncompletePtr1 == s_globalIncompletePtr); @@ -3157,7 +3157,7 @@ namespace UnitTest char stackOutput[2048]; debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput)); AZ_Printf("Script", "%s", stackOutput); - AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != 0); + AZ_TEST_ASSERT(strstr(stackOutput, "GlobalFunction") != nullptr); AZ_TEST_ASSERT(breakpoint->m_lineNumber == 20); } else if (m_numBreakpointHits == 2) @@ -3193,7 +3193,7 @@ namespace UnitTest char stackOutput[2048]; debugContext->StackTrace(stackOutput, AZ_ARRAY_SIZE(stackOutput)); AZ_Printf("Script", "%s", stackOutput); - AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != 0); + AZ_TEST_ASSERT(strstr(stackOutput, "GlobalMult") != nullptr); AZ_TEST_ASSERT(breakpoint->m_lineNumber == 23); } diff --git a/Code/Framework/AzCore/Tests/Serialization.cpp b/Code/Framework/AzCore/Tests/Serialization.cpp index 9ff2925472..e554945b55 100644 --- a/Code/Framework/AzCore/Tests/Serialization.cpp +++ b/Code/Framework/AzCore/Tests/Serialization.cpp @@ -2231,7 +2231,7 @@ TEST_F(SerializeBasicTest, BasicTypeTest_Succeed) (void)classId; DeprecationTestClass* obj = reinterpret_cast(classPtr); EXPECT_EQ( 0, obj->m_deprecated.m_data ); - EXPECT_EQ( NULL, obj->m_deprecatedPtr ); + EXPECT_EQ( nullptr, obj->m_deprecatedPtr ); EXPECT_EQ( 0, obj->m_oldClassData ); EXPECT_EQ( 0.f, obj->m_newClassData ); EXPECT_EQ( 0, obj->m_missingMember ); @@ -4057,7 +4057,7 @@ namespace UnitTest if (strcmp(classData->m_name, "MyEditStruct") == 0) { - EXPECT_TRUE(classData->m_editData != NULL); + EXPECT_TRUE(classData->m_editData != nullptr); EXPECT_EQ( 0, strcmp(classData->m_editData->m_name, "MyEditStruct") ); EXPECT_EQ( 0, strcmp(classData->m_editData->m_description, "My edit struct class used for ...") ); EXPECT_EQ( 2, classData->m_editData->m_elements.size() ); @@ -4071,12 +4071,12 @@ namespace UnitTest // Number of options attribute EXPECT_EQ(classElement->m_editData->m_attributes[0].first, AZ_CRC("NumOptions", 0x90274abc)); Edit::AttributeData* intData = azrtti_cast*>(classElement->m_editData->m_attributes[0].second); - EXPECT_TRUE(intData != NULL); + EXPECT_TRUE(intData != nullptr); EXPECT_EQ( 3, intData->Get(instance) ); // Get options attribute EXPECT_EQ( classElement->m_editData->m_attributes[1].first, AZ_CRC("Options", 0xd035fa87)); Edit::AttributeFunction* funcData = azrtti_cast*>(classElement->m_editData->m_attributes[1].second); - EXPECT_TRUE(funcData != NULL); + EXPECT_TRUE(funcData != nullptr); EXPECT_EQ( 20, funcData->Invoke(instance, 10) ); } return true; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp index 4dc74779f2..e410ba9ca4 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/ArraySerializerTests.cpp @@ -58,7 +58,7 @@ namespace JsonSerializationTests return array; } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto array = AZStd::make_shared(); (*array)[0] = 10; @@ -128,7 +128,7 @@ namespace JsonSerializationTests return array; } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto partialInstance = aznew MultipleInheritence(); partialInstance->m_var1 = 142; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp index 41b17f9ade..4979df04be 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MapSerializerTests.cpp @@ -169,7 +169,7 @@ namespace JsonSerializationTests return AZStd::shared_ptr(new Map{}, &Delete); } - AZStd::shared_ptr CreatePartialDefaultInstance() + AZStd::shared_ptr CreatePartialDefaultInstance() override { auto instance = AZStd::shared_ptr(new Map{}, &Delete); instance->emplace(AZStd::make_pair(aznew SimpleClass(), aznew SimpleClass(188, 188.0))); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp index a2a3d42ebb..af6dedb51b 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/StringSerializerTests.cpp @@ -33,7 +33,7 @@ namespace JsonSerializationTests return AZStd::make_shared("Hello"); } - AZStd::string_view GetJsonForFullySetInstance() + AZStd::string_view GetJsonForFullySetInstance() override { return R"("Hello")"; } @@ -48,7 +48,7 @@ namespace JsonSerializationTests features.m_supportsInjection = false; } - bool AreEqual(const String& lhs, const String& rhs) + bool AreEqual(const String& lhs, const String& rhs) override { return lhs.compare(rhs) == 0; } diff --git a/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp b/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp index 5b18faa3d1..6bcd57f849 100644 --- a/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp +++ b/Code/Framework/AzCore/Tests/Settings/SettingsRegistryConsoleUtilsTests.cpp @@ -147,7 +147,7 @@ namespace SettingsRegistryConsoleUtilsTests struct SettingsRegistryDumpCommandHandler : public AZ::Debug::TraceMessageBus::Handler { - bool OnOutput(const char* window, const char* message) + bool OnOutput(const char* window, const char* message) override { if (window == AZStd::string_view("SettingsRegistry")) { @@ -218,7 +218,7 @@ namespace SettingsRegistryConsoleUtilsTests , m_expectedValue2{ expectedValue2 } { } - bool OnOutput(const char* window, const char* message) + bool OnOutput(const char* window, const char* message) override { if (window == AZStd::string_view("SettingsRegistry")) { diff --git a/Code/Framework/AzCore/Tests/Statistics.cpp b/Code/Framework/AzCore/Tests/Statistics.cpp index 941c2eff0b..4577618d5a 100644 --- a/Code/Framework/AzCore/Tests/Statistics.cpp +++ b/Code/Framework/AzCore/Tests/Statistics.cpp @@ -40,7 +40,7 @@ namespace UnitTest } } - ~StatisticsTest() + ~StatisticsTest() override { } diff --git a/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp b/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp index f770af57be..3a107da61d 100644 --- a/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp +++ b/Code/Framework/AzCore/Tests/Streamer/BlockCacheTests.cpp @@ -184,7 +184,7 @@ namespace AZ::IO size = size >> 2; for (u64 i = 0; i < size; ++i) { - // Using assert here because in case of a problem EXPECT would + // Using assert here because in case of a problem EXPECT would // cause a large amount of log noise. ASSERT_EQ(buffer[i], offset + (i << 2)); } @@ -203,7 +203,9 @@ namespace AZ::IO { do { - while (m_context->FinalizeCompletedRequests()); + while (m_context->FinalizeCompletedRequests()) + { + } } while (m_cache->ExecuteRequests()); } @@ -269,7 +271,7 @@ namespace AZ::IO RedirectReadCalls(); EXPECT_CALL(*this, ReadFile(_, _, 0, m_fakeFileLength)); - + ProcessRead(m_buffer, m_path, 0, m_fakeFileLength, IStreamerTypes::RequestStatus::Completed); VerifyReadBuffer(0, m_fakeFileLength); } @@ -519,8 +521,8 @@ namespace AZ::IO using ::testing::_; using ::testing::Return; - CreateTestEnvironment(); - + CreateTestEnvironment(); + EXPECT_CALL(*m_mock, ExecuteRequests()) .WillOnce(Return(true)) .WillRepeatedly(Return(false)); @@ -553,7 +555,7 @@ namespace AZ::IO RunProcessLoop(); EXPECT_TRUE(allRequestsCompleted); - + VerifyReadBuffer(256, m_fakeFileLength - 512); VerifyReadBuffer(buffer1, m_fakeFileLength - 768, secondReadSize); } @@ -622,7 +624,7 @@ namespace AZ::IO m_fakeFileFound = false; m_fakeFileLength = 0; - + ProcessRead(m_buffer, m_path, 0, m_blockSize, IStreamerTypes::RequestStatus::Failed); } @@ -650,18 +652,18 @@ namespace AZ::IO status.m_isIdle = false; })); EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(count); - + constexpr size_t scratchBufferSize = 128_kib; using ScratchBuffer = char[scratchBufferSize]; ScratchBuffer buffers[count]; - + bool allRequestsCompleted = true; auto completed = [&allRequestsCompleted](const FileRequest& request) { // Capture result before request is recycled. allRequestsCompleted = allRequestsCompleted && request.GetStatus() == IStreamerTypes::RequestStatus::Completed; }; - + for (size_t i = 0; i < count; ++i) { StreamStackEntry::Status status; @@ -738,7 +740,7 @@ namespace AZ::IO RedirectReadCalls(); EXPECT_CALL(*this, ReadFile(_, _, 256, m_fakeFileLength - 256)); - + ProcessRead(m_buffer, m_path, 256, m_fakeFileLength - 256, IStreamerTypes::RequestStatus::Completed); VerifyReadBuffer(256, m_fakeFileLength - 256); } @@ -1062,7 +1064,7 @@ namespace AZ::IO .WillRepeatedly(Return(false)); EXPECT_CALL(*m_mock, QueueRequest(_)) .WillRepeatedly(Invoke(this, &BlockCacheTest::QueueReadRequest)); - + size_t firstReadSize = m_fakeFileLength - (2 * m_blockSize) - 512; FileRequest* request0 = m_context->GetNewInternalRequest(); request0->CreateRead(nullptr, m_buffer, m_bufferSize, m_path, 256, firstReadSize); @@ -1097,7 +1099,7 @@ namespace AZ::IO VerifyReadBuffer(buffer1.get(), secondReadOffset, secondReadSize); } - + @@ -1146,7 +1148,7 @@ namespace AZ::IO FileRequest* request = m_context->GetNewInternalRequest(); request->CreateFlush(m_path); RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed); - + // The partial read would normally be serviced from the cache, but now triggers another read. EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1); ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed); @@ -1170,7 +1172,7 @@ namespace AZ::IO FileRequest* request = m_context->GetNewInternalRequest(); request->CreateFlushAll(); RunAndCompleteRequest(request, IStreamerTypes::RequestStatus::Completed); - + // The partial read would normally be serviced from the cache, but now triggers another read. EXPECT_CALL(*this, ReadFile(_, _, _, _)).Times(1); ProcessRead(m_buffer, m_path, 512, m_blockSize - 1024, IStreamerTypes::RequestStatus::Completed); diff --git a/Code/Framework/AzCore/Tests/StringFunc.cpp b/Code/Framework/AzCore/Tests/StringFunc.cpp index 2b6f19736a..68821ba3f9 100644 --- a/Code/Framework/AzCore/Tests/StringFunc.cpp +++ b/Code/Framework/AzCore/Tests/StringFunc.cpp @@ -966,7 +966,7 @@ namespace AZ { public: StringPathFuncTest() = default; - virtual ~StringPathFuncTest() = default; + ~StringPathFuncTest() override = default; }; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index 8688f6b878..ce0cc23a4e 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -374,8 +374,8 @@ namespace AZ::IO { public: AZ_CLASS_ALLOCATOR(CResourceList, AZ::SystemAllocator, 0); - CResourceList() { m_iter = m_set.end(); }; - ~CResourceList() {}; + CResourceList() { m_iter = m_set.end(); } + ~CResourceList() override {} void Add(AZStd::string_view sResourceFile) override { @@ -2571,7 +2571,7 @@ namespace AZ::IO return aznumeric_cast(pFileEntry->nFileDataOffset); } - EStreamSourceMediaType Archive::GetFileMediaType(AZStd::string_view szName) const + EStreamSourceMediaType Archive::GetFileMediaType(AZStd::string_view szName) const { auto szFullPath = AZ::IO::FileIOBase::GetDirectInstance()->ResolvePath(szName); if (!szFullPath) diff --git a/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp b/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp index db36a91448..9703e4a993 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/FileOperations.cpp @@ -114,7 +114,7 @@ namespace AZ AZ_Warning("AZ::IO::SmartMove", false, "Unable to move/copy the source file (%s)", sourceFilePath); if (destFileMoved) { - // if we were unable to move/copy the source file to the dest file, + // if we were unable to move/copy the source file to the dest file, // we will try to revert back the destination file from the temp file. if (!fileIO->Rename(tmpDestFile.c_str(), destinationFilePath)) { @@ -124,7 +124,7 @@ namespace AZ return ResultCode::Error; } - // removing the source file if copy succeeds + // removing the source file if copy succeeds if (!fileIO->Remove(sourceFilePath)) { AZ_Warning("AZ::IO::SmartMove", false, "Unable to delete the source file (%s)", sourceFilePath); @@ -140,7 +140,7 @@ namespace AZ return ResultCode::Error; } } - + return ResultCode::Success; } @@ -158,7 +158,7 @@ namespace AZ const int s_MaxCreateTempFileTries = 16; AZStd::string fullPath, fileName; tempFile.clear(); - + if (!AzFramework::StringFunc::Path::GetFullPath(file, fullPath)) { AZ_Warning("AZ::IO::CreateTempFileName", false, " Filepath needs to be an absolute path: '%s'", file); @@ -170,7 +170,7 @@ namespace AZ AZ_Warning("AZ::IO::CreateTempFileName", false, " Filepath needs to be an absolute path: '%s'", file); return false; } - + for (int idx = 0; idx < s_MaxCreateTempFileTries; idx++) { AzFramework::StringFunc::Path::ConstructFull(fullPath.c_str(), AZStd::string::format("$tmp%d_%s", rand(), fileName.c_str()).c_str(), tempFile, true); @@ -235,7 +235,7 @@ namespace AZ fileIO->Read(fileHandle, buffer, bufferSize - 1, false, &bytesRead); if (!bytesRead) { - return 0; + return nullptr; } char* currentPosition = buffer; diff --git a/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp b/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp index f1b4e02b2d..2f44f80eba 100644 --- a/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp +++ b/Code/Framework/AzFramework/AzFramework/Input/Devices/InputDevice.cpp @@ -39,7 +39,7 @@ namespace AzFramework } //////////////////////////////////////////////////////////////////////////////////////////// - void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice) + void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice) override { Call(FN_OnInputDeviceDisconnectedEvent, &inputDevice); } diff --git a/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp b/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp index aa1344fa4f..d5ba65425c 100644 --- a/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Logging/LoggingComponent.cpp @@ -101,7 +101,7 @@ namespace AzFramework if (m_logFile) { delete m_logFile; - m_logFile = NULL; + m_logFile = nullptr; } } diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp index 994d93d99e..4ac97cf041 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Material.cpp @@ -28,7 +28,7 @@ namespace Physics class MaterialLibraryAssetEventHandler : public AZ::SerializeContext::IEventHandler { - void OnReadBegin(void* classPtr) + void OnReadBegin(void* classPtr) override { auto matAsset = static_cast(classPtr); matAsset->GenerateMissingIds(); @@ -38,7 +38,7 @@ namespace Physics class MaterialSelectionEventHandler : public AZ::SerializeContext::IEventHandler { - void OnReadEnd(void* classPtr) + void OnReadEnd(void* classPtr) override { auto materialSelection = static_cast(classPtr); if (materialSelection->GetMaterialIdsAssignedToSlots().empty()) @@ -362,8 +362,8 @@ namespace Physics MaterialId MaterialId::Create() { - MaterialId id; - id.m_id = AZ::Uuid::Create(); + MaterialId id; + id.m_id = AZ::Uuid::Create(); return id; } @@ -425,7 +425,7 @@ namespace Physics } else { - // If there is more than one material slot + // If there is more than one material slot // the caller must use SetMaterialSlots function return ""; } diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp index 06fd8acd79..011d967631 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptRemoteDebugging.cpp @@ -174,25 +174,25 @@ namespace AzFramework ScriptDebugAgent() = default; ////////////////////////////////////////////////////////////////////////// // Component base - virtual void Init(); - virtual void Activate(); - virtual void Deactivate(); + void Init() override; + void Activate() override; + void Deactivate() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // AZ::SystemTickBus - virtual void OnSystemTick(); + void OnSystemTick() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // ScriptDebugAgentBus - virtual void RegisterContext(AZ::ScriptContext* sc, const char* name); - virtual void UnregisterContext(AZ::ScriptContext* sc); + void RegisterContext(AZ::ScriptContext* sc, const char* name) override; + void UnregisterContext(AZ::ScriptContext* sc) override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // TmMsgBus - virtual void OnReceivedMsg(TmMsgPtr msg); + void OnReceivedMsg(TmMsgPtr msg) override; ////////////////////////////////////////////////////////////////////////// protected: @@ -241,10 +241,10 @@ namespace AzFramework void ScriptDebugAgent::Activate() { m_executionState = SDA_STATE_DETACHED; - m_curContext = NULL; + m_curContext = nullptr; // register default app script context if there is one - AZ::ScriptContext* defaultScriptContext = NULL; + AZ::ScriptContext* defaultScriptContext = nullptr; EBUS_EVENT_RESULT(defaultScriptContext, AZ::ScriptSystemRequestBus, GetContext, AZ::ScriptContextIds::DefaultScriptContextId); if (defaultScriptContext) { @@ -379,7 +379,7 @@ namespace AzFramework AZ_TracePrintf("LUA", "Remote debugger %s has detached from context 0x%p.\n", m_debugger.GetDisplayName(), m_curContext); m_debugger = TargetInfo(); - m_curContext = NULL; + m_curContext = nullptr; m_executionState = SDA_STATE_DETACHED; } //------------------------------------------------------------------------- @@ -435,7 +435,7 @@ namespace AzFramework void ScriptDebugAgent::Process() { // Process messages - AZ::ScriptContextDebug* dbgContext = m_curContext ? m_curContext->GetDebugContext() : NULL; + AZ::ScriptContextDebug* dbgContext = m_curContext ? m_curContext->GetDebugContext() : nullptr; while (!m_msgQueue.empty()) { m_msgMutex.lock(); diff --git a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp index c1ce31613c..1c26cbc744 100644 --- a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementComponent.cpp @@ -562,7 +562,7 @@ namespace AzFramework void TargetManagementComponent::SetMyPersistentName(const char* name) { - AZ_Assert(m_networkImpl->m_session == NULL, "We cannot change our neighborhood while connected!"); + AZ_Assert(m_networkImpl->m_session == nullptr, "We cannot change our neighborhood while connected!"); m_settings->m_persistentName = name; } @@ -585,7 +585,7 @@ namespace AzFramework void TargetManagementComponent::SetNeighborhood(const char* name) { - AZ_Assert(m_networkImpl->m_session == NULL, "We cannot change our neighborhood while connected!"); + AZ_Assert(m_networkImpl->m_session == nullptr, "We cannot change our neighborhood while connected!"); m_settings->m_neighborhoodName = name; } @@ -714,7 +714,7 @@ namespace AzFramework { GridMate::GridMember* member = m_networkImpl->m_session->GetMemberByIndex(i); GridMate::MemberIDCompact memberId = member->GetId().Compact(); - const TargetInfo* target = NULL; + const TargetInfo* target = nullptr; AZ::u32 targetId = 0; for (TargetContainer::const_iterator targetIt = m_availableTargets.begin(); targetIt != m_availableTargets.end(); ++targetIt) { @@ -742,7 +742,7 @@ namespace AzFramework AZ::IO::MemoryStream msgBuffer(m_tmpInboundBuffer.data(), result.m_numBytes, result.m_numBytes); TmMsg* msg = nullptr; AZ::ObjectStream::ClassReadyCB readyCB(AZStd::bind(&TargetManagementComponent::OnMsgParsed, this, &msg, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3)); - AZ::ObjectStream::LoadBlocking(&msgBuffer, *m_serializeContext, readyCB, AZ::ObjectStream::FilterDescriptor(0, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); + AZ::ObjectStream::LoadBlocking(&msgBuffer, *m_serializeContext, readyCB, AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES)); if (msg) { if (msg->GetCustomBlobSize() > 0) diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp index eb4165453e..407e256052 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Application/Application_Linux.cpp @@ -24,7 +24,7 @@ namespace AzFramework LinuxXcbConnectionManagerBus::Handler::BusConnect(); } - ~LinuxXcbConnectionManagerImpl() + ~LinuxXcbConnectionManagerImpl() override { LinuxXcbConnectionManagerBus::Handler::BusDisconnect(); xcb_disconnect(m_xcbConnection); diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp index 0249a42976..f8cc26b19b 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessCommunicator_Linux.cpp @@ -78,7 +78,7 @@ namespace AzFramework FD_ZERO(&set); FD_SET(handle->GetHandle(), &set); - [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, NULL, NULL, NULL); + [[maybe_unused]] int numReady = select(handle->GetHandle() + 1, &set, nullptr, nullptr, nullptr); // if numReady == -1 and errno == EINTR then the child process died unexpectedly and // the handle was closed. Not something to assert about in regards to trying to read diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp index eb60b8e6ae..2d29fac73d 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp @@ -277,7 +277,7 @@ namespace AzFramework environmentVariables[i][0] = '\0'; azstrcat(environmentVariables[i], envVarString.size(), envVarString.c_str()); } - environmentVariables[numEnvironmentVars] = NULL; + environmentVariables[numEnvironmentVars] = nullptr; } pid_t child_pid = fork(); @@ -373,7 +373,7 @@ namespace AzFramework } bool isProcessDone = false; - time_t startTime = time(0); + time_t startTime = time(nullptr); time_t currentTime = startTime; AZ_Assert(currentTime != -1, "time(0) returned an invalid time"); while (((currentTime - startTime) < waitTimeInSeconds) && !isProcessDone) @@ -385,7 +385,7 @@ namespace AzFramework m_pWatcherData->m_childProcessIsDone = true; break; } - currentTime = time(0); + currentTime = time(nullptr); } //returns false if process is still running after time return isProcessDone; diff --git a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp index 2caaf6ee71..6a359e714c 100644 --- a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp +++ b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp @@ -570,7 +570,7 @@ namespace UnitTest EXPECT_TRUE(found_mylevel_folder); numFound = 0; - found_mylevel_folder = 0; + found_mylevel_folder = false; // now make sure no red herrings appear // for example, if a file is mounted at "@assets@\\uniquename\\mylevel2\\mylevel3\\mylevel4" diff --git a/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp b/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp index f42a0faeee..3c860a88dd 100644 --- a/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp +++ b/Code/Framework/AzFramework/Tests/BehaviorEntityTests.cpp @@ -29,7 +29,7 @@ public: void Activate() override {} void Deactivate() override {} - bool ReadInConfig(const AZ::ComponentConfig* baseConfig) + bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override { if (auto config = azrtti_cast(baseConfig)) { @@ -39,7 +39,7 @@ public: return false; } - bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const + bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override { if (auto outConfig = azrtti_cast(outBaseConfig)) { diff --git a/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp b/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp index b4d4ff63b0..a1ebdfd945 100644 --- a/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp +++ b/Code/Framework/AzFramework/Tests/BinToTextEncode.cpp @@ -46,7 +46,7 @@ namespace UnitTest AllocatorsFixture::TearDown(); } - virtual ~Base64Test() + ~Base64Test() override { } diff --git a/Code/Framework/AzFramework/Tests/EntityContext.cpp b/Code/Framework/AzFramework/Tests/EntityContext.cpp index cb957fa46c..74a4948e04 100644 --- a/Code/Framework/AzFramework/Tests/EntityContext.cpp +++ b/Code/Framework/AzFramework/Tests/EntityContext.cpp @@ -41,7 +41,7 @@ namespace UnitTest Data::AssetManager::Create(desc); } - virtual ~EntityContextBasicTest() + ~EntityContextBasicTest() override { } diff --git a/Code/Framework/AzFramework/Tests/FileIO.cpp b/Code/Framework/AzFramework/Tests/FileIO.cpp index 7a01ba991b..fb95512968 100644 --- a/Code/Framework/AzFramework/Tests/FileIO.cpp +++ b/Code/Framework/AzFramework/Tests/FileIO.cpp @@ -118,7 +118,7 @@ namespace UnitTest AZ::IO::FileIOBase::SetInstance(&m_fileIO); } - ~FileIOStreamTest() + ~FileIOStreamTest() override { } @@ -341,7 +341,7 @@ namespace UnitTest AZ_TEST_ASSERT(!local.Eof(fileHandle)); AZ_TEST_ASSERT(!local.Flush(fileHandle)); AZ_TEST_ASSERT(!local.ModificationTime(fileHandle)); - AZ_TEST_ASSERT(!local.Read(fileHandle, 0, 0, false)); + AZ_TEST_ASSERT(!local.Read(fileHandle, nullptr, 0, false)); AZ_TEST_ASSERT(!local.Tell(fileHandle, fs)); AZ_TEST_ASSERT(!local.Exists((file01Name + "notexist").c_str())); diff --git a/Code/Framework/AzFramework/Tests/NativeWindow.cpp b/Code/Framework/AzFramework/Tests/NativeWindow.cpp index 9554b6ab10..f160d88003 100644 --- a/Code/Framework/AzFramework/Tests/NativeWindow.cpp +++ b/Code/Framework/AzFramework/Tests/NativeWindow.cpp @@ -27,19 +27,19 @@ namespace UnitTest AzFramework::WindowNotificationBus::Handler::BusConnect(m_windowHandle); } - ~NativeWindowListener() + ~NativeWindowListener() override { AzFramework::WindowNotificationBus::Handler::BusDisconnect(m_windowHandle); } // WindowNotificationBus::Handler overrides... - void OnWindowResized(uint32_t width, uint32_t height) + void OnWindowResized(uint32_t width, uint32_t height) override { AZ_UNUSED(width); AZ_UNUSED(height); m_wasOnWindowResizedReceived = true; } - void OnWindowClosed() + void OnWindowClosed() override { m_wasOnWindowClosedReceived = true; } diff --git a/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp b/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp index a667af4e20..c9234fe488 100644 --- a/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp +++ b/Code/Framework/AzManipulatorTestFramework/Source/DirectManipulatorViewportInteraction.cpp @@ -34,7 +34,7 @@ namespace AzManipulatorTestFramework ViewportInteractionInterface* viewportInteraction, AZStd::shared_ptr manipulatorManager); // ManipulatorManagerInterface ... - void ConsumeMouseInteractionEvent(const MouseInteractionEvent& event); + void ConsumeMouseInteractionEvent(const MouseInteractionEvent& event) override; AzToolsFramework::ManipulatorManagerId GetId() const override; bool ManipulatorBeingInteracted() const override; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp index 57badcee4e..3fdfa042a5 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp @@ -473,7 +473,7 @@ namespace AzNetworking { const AZ::CVarFixedString contextPassword = (trustZone == TrustZone::ExternalClientToServer) ? net_SslExternalContextPassword : net_SslInternalContextPassword; - SSL_CTX_set_default_passwd_cb(context, NULL); + SSL_CTX_set_default_passwd_cb(context, nullptr); SSL_CTX_set_default_passwd_cb_userdata(context, (void*)contextPassword.c_str()); if (SSL_CTX_use_PrivateKey_file(context, privateKeyPath.c_str(), SSL_FILETYPE_PEM) != OpenSslResultSuccess) diff --git a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp index d06aac1a14..9dc7ae0ccf 100644 --- a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp @@ -23,12 +23,12 @@ namespace UnitTest : public IConnectionListener { public: - ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) override { return ConnectResult::Accepted; } - void OnConnect([[maybe_unused]] IConnection* connection) + void OnConnect([[maybe_unused]] IConnection* connection) override { ; } @@ -40,12 +40,12 @@ namespace UnitTest return PacketDispatchResult::Failure; } - void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) + void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) override { } - void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) + void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) override { } diff --git a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp index 9cc3fd4b09..02c7085023 100644 --- a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp @@ -26,12 +26,12 @@ namespace UnitTest : public IConnectionListener { public: - ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + ConnectResult ValidateConnect([[maybe_unused]] const IpAddress& remoteAddress, [[maybe_unused]] const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) override { return ConnectResult::Accepted; } - void OnConnect([[maybe_unused]] IConnection* connection) + void OnConnect([[maybe_unused]] IConnection* connection) override { ; } @@ -43,12 +43,12 @@ namespace UnitTest return PacketDispatchResult::Failure; } - void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) + void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) override { } - void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) + void OnDisconnect([[maybe_unused]] IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] TerminationEndpoint endpoint) override { } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp index 127163f056..cd6af7391c 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp @@ -147,7 +147,7 @@ namespace AzQtComponents TabBar::tabLayoutChange(); // Only the active tab's close button should be shown - const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); const int numTabs = count(); const int activeTabIndex = currentIndex(); for (int i = 0; i < numTabs; ++i) @@ -190,7 +190,7 @@ namespace AzQtComponents } }); - const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + const ButtonPosition closeSide = (ButtonPosition) style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); setTabButton(index, closeSide, closeButton); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp index c78314b8d7..0478779561 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FlowLayout.cpp @@ -112,7 +112,7 @@ QLayoutItem* FlowLayout::takeAt(int index) } else { - return 0; + return nullptr; } } @@ -207,7 +207,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const else if (parent->isWidgetType()) { QWidget* pw = static_cast(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp index 9bf77f0f9b..690d275646 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/StyledSpinBox.cpp @@ -75,11 +75,11 @@ namespace AzQtComponents connect(slider, &QSlider::sliderReleased, this, [this] { m_dragging = false; }); } } - ~ClickEventFilterPrivate() {} + ~ClickEventFilterPrivate() override {} signals: void clickOnApplication(const QPoint& pos); protected: - bool eventFilter(QObject* obj, QEvent* event) + bool eventFilter(QObject* obj, QEvent* event) override { if (event->type() == QEvent::MouseButtonRelease && !m_dragging) { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp index 2c3dacda7a..c3fb6e88cd 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/LineEdit.cpp @@ -773,7 +773,7 @@ namespace AzQtComponents if (numButtons > 0) { // and finally add the right margins QLineEdit removes to make the buttons fit (it thinks) - const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, 0, widget); + const int iconSize = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, widget); const int delta = iconSize / 4 + iconSize + 6; r.setRight(r.right() + delta * numButtons); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp index ac281a0e1c..b8cd37a6f7 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ScrollBar.cpp @@ -191,7 +191,7 @@ namespace AzQtComponents }; QMap m_widgets; - void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)(void)) + void perScrollBar(QObject* scrollArea, void (QScrollBar::*callback)()) { auto iterator = m_widgets.find(scrollArea); if (iterator != m_widgets.end()) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp index 008560b59c..d52ae3685d 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/TabWidget.cpp @@ -632,7 +632,7 @@ namespace AzQtComponents return; } - ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); + ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); for (int i = 0; i < count(); i++) { QWidget* tabBtn = tabButton(i, closeSide); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp b/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp index ffca99f1d6..27d12438eb 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/PropertyEditorStandalone/main.cpp @@ -135,7 +135,7 @@ public: if (auto editContext = serializeContext->GetEditContext()) { editContext->Class("SimpleKeyContainer", "") - ->DataElement(0, &SimpleKeyedContainer::m_map, "map", "") + ->DataElement(nullptr, &SimpleKeyedContainer::m_map, "map", "") ->ElementAttribute(AZ::Edit::Attributes::ShowAsKeyValuePairs, true); } } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp index a717ad337e..3c911c8acc 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Tests/AzQtComponentTests.cpp @@ -20,7 +20,7 @@ public: AzQtComponents::registerMetaTypes(); } - virtual ~AzQtComponentsTestEnvironment() {} + ~AzQtComponentsTestEnvironment() override {} protected: diff --git a/Code/Framework/AzTest/AzTest/Utils.cpp b/Code/Framework/AzTest/AzTest/Utils.cpp index 7c2c964504..d06024c72f 100644 --- a/Code/Framework/AzTest/AzTest/Utils.cpp +++ b/Code/Framework/AzTest/AzTest/Utils.cpp @@ -123,10 +123,10 @@ namespace AZ std::vector tokens; [[maybe_unused]] char* next_token = nullptr; char* tok = azstrtok(cmdLine, 0, " ", &next_token); - while (tok != NULL) + while (tok != nullptr) { tokens.push_back(tok); - tok = azstrtok(NULL, 0, " ", &next_token); + tok = azstrtok(nullptr, 0, " ", &next_token); } size = (int)tokens.size(); char** token_array = new char*[size]; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index a3a79402ad..6de529e456 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -139,7 +139,7 @@ namespace AzToolsFramework AZ_PROFILE_SCOPE(AzToolsFramework, "Internal::DeleteEntities:UndoCaptureAndPurgeEntities"); for (const auto& entityId : entityIds) { - AZ::Entity* entity = NULL; + AZ::Entity* entity = nullptr; EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, entityId); if (entity) @@ -1237,7 +1237,7 @@ namespace AzToolsFramework void ToolsApplication::RequestEditForFile(const char* assetPath, RequestEditResultCallback resultCallback) { - AZ_Error("RequestEdit", resultCallback != 0, "User result callback is required."); + AZ_Error("RequestEdit", resultCallback != nullptr, "User result callback is required."); AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); if (fileIO && !fileIO->IsReadOnly(assetPath)) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp index 92c8d37540..6e55d9f97c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Asset/AssetUtils.cpp @@ -97,7 +97,7 @@ namespace AzToolsFramework::AssetUtils struct EnabledPlatformsVisitor : AZ::SettingsRegistryInterface::Visitor { - void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value); + void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override; AZStd::vector m_enabledPlatforms; }; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp index e155189a99..77b9185e82 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp @@ -721,7 +721,7 @@ namespace AzToolsFramework AZ::Data::AssetInfo assetInfo; AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, assetId); if (assetInfo.m_assetType == m_inMemoryAsset.GetType() - && strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != 0) + && strstr(m_expectedAddedAssetPath.c_str(), assetInfo.m_relativePath.c_str()) != nullptr) { m_expectedAddedAssetPath.clear(); m_recentlyAddedAssetPath = assetInfo.m_relativePath; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp index d4c4fa1e65..d05a2dcc4b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/PreemptiveUndoCache.cpp @@ -103,7 +103,7 @@ namespace AzToolsFramework newData.clear(); AZ::IO::ByteContainerStream ms(&newData); - AZ::SerializeContext* sc = NULL; + AZ::SerializeContext* sc = nullptr; EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext); AZ_Assert(sc, "Serialization context not found!"); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp index 33b2a14b89..6854663db7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Commands/SelectionCommand.cpp @@ -34,7 +34,7 @@ namespace AzToolsFramework void SelectionCommand::Post() { - UndoSystem::UndoStack* undoStack = NULL; + UndoSystem::UndoStack* undoStack = nullptr; EBUS_EVENT_RESULT(undoStack, AzToolsFramework::ToolsApplicationRequests::Bus, GetUndoStack); if (undoStack) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index f3250e0bfd..2d3d1722ca 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -462,7 +462,7 @@ namespace AzToolsFramework linkId, templateId, templateToDelete.GetFilePath().c_str()); } - result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != 0; + result = m_templateToLinkIdsMap.erase(templateToLinkIterator) != nullptr; AZ_Assert(result, "Prefab - PrefabSystemComponent::RemoveTemplate - " "Failed to remove Template with Id '%llu' on file path '%s' " diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp index 4ad409507e..3bd12b1ad3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/SourceControl/PerforceComponent.cpp @@ -1315,7 +1315,7 @@ namespace AzToolsFramework void PerforceComponent::ThreadWorker() { m_ProcessThreadID = AZStd::this_thread::get_id(); - while (1) + while (true) { // block until signaled: m_WorkerSemaphore.acquire(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp index da12a4bd7a..cc350c8107 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ScriptEditorComponent.cpp @@ -38,7 +38,7 @@ namespace AZ AttributeDynamicScriptValue(const DynamicSerializableField& value) : m_value(value) {} - virtual ~AttributeDynamicScriptValue() + ~AttributeDynamicScriptValue() override { m_value.DestroyData(); } @@ -1031,15 +1031,15 @@ namespace AzToolsFramework ->Attribute("EditButton", "") ->Attribute("EditDescription", "Open in Lua Editor") ->Attribute("EditCallback", &ScriptEditorComponent::LaunchLuaEditor) - ->DataElement(0, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template") + ->DataElement(nullptr, &ScriptEditorComponent::m_scriptComponent, "Script properties", "The script template") ->SetDynamicEditDataProvider(&ScriptEditorComponent::GetScriptPropertyEditData) ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ; ec->Class("Script Component", "Adding scripting functionality to the entity!") - ->DataElement(0, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties") + ->DataElement(nullptr, &AzFramework::ScriptComponent::m_properties, "Properties", "Lua script properties") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(0, &AzFramework::ScriptComponent::m_script, "Asset", "") + ->DataElement(nullptr, &AzFramework::ScriptComponent::m_script, "Asset", "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide) ->Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushable) // Only the editor-component's script asset needs to be slice-pushable. ; @@ -1048,9 +1048,9 @@ namespace AzToolsFramework ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AzFramework::ScriptPropertyGroup::m_name)-> Attribute(AZ::Edit::Attributes::AutoExpand, true)-> - DataElement(0, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")-> + DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_properties, "m_properties", "Properties in this property group")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")-> + DataElement(nullptr, &AzFramework::ScriptPropertyGroup::m_groups, "m_groups", "Subgroups in this property group")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly); ec->Class("Script Property", "Base class for script properties")-> @@ -1060,50 +1060,50 @@ namespace AzToolsFramework ec->Class("Script Property (bool)", "A script boolean property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")-> + DataElement(nullptr, &AZ::ScriptPropertyBoolean::m_value, "m_value", "A boolean")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (number)", "A script number property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")-> + DataElement(nullptr, &AZ::ScriptPropertyNumber::m_value, "m_value", "A number")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (string)", "A script string property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyString::m_value, "m_value", "A string")-> + DataElement(nullptr, &AZ::ScriptPropertyString::m_value, "m_value", "A string")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property (object)", "A script object property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGroup's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyGenericClass::m_value, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly); ec->Class("Script Property Array(bool)", "A script bool array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyBooleanArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyBooleanArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(number)", "A script number array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyNumberArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyNumberArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(string)", "A script string array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyStringArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> - DataElement(0, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyStringArray::m_values, "m_value", "An object")-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); ec->Class("Script Property Array(object)", "A script object array property")-> ClassElement(AZ::Edit::ClassElements::EditorData, "ScriptPropertyGenericClassArray's class attributes.")-> Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> Attribute(AZ::Edit::Attributes::DynamicElementType, &AZ::ScriptPropertyGenericClassArray::GetElementTypeUuid)-> - DataElement(0, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")-> + DataElement(nullptr, &AZ::ScriptPropertyGenericClassArray::m_values, "m_value", "An object")-> ElementAttribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)-> Attribute(AZ::Edit::Attributes::NameLabelOverride, &AZ::ScriptProperty::m_name); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp index 2ed70d81b8..4dd352646c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.cpp @@ -17,21 +17,21 @@ namespace LegacyFramework { const char* appName() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationName); return result; } const char* appModule() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationModule); return result; } const char* appDir() { - const char* result = NULL; + const char* result = nullptr; EBUS_EVENT_RESULT(result, FrameworkApplicationMessages::Bus, GetApplicationDirectory); return result; } @@ -74,7 +74,7 @@ namespace LegacyFramework // helper function which retrieves the serialize context and asserts if its not found. AZ::SerializeContext* GetSerializeContext() { - AZ::SerializeContext* serializeContext = NULL; + AZ::SerializeContext* serializeContext = nullptr; EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext); AZ_Assert(serializeContext, "No serialize context"); return serializeContext; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp index 33562421e9..95ea5397e7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp @@ -237,7 +237,7 @@ namespace LegacyFramework { m_applicationEntity->Deactivate(); delete m_applicationEntity; - m_applicationEntity = NULL; + m_applicationEntity = nullptr; } AZ::SystemTickBus::ExecuteQueuedEvents(); @@ -249,7 +249,7 @@ namespace LegacyFramework #endif delete m_ptrCommandLineParser; - m_ptrCommandLineParser = NULL; + m_ptrCommandLineParser = nullptr; CoreMessageBus::Handler::BusDisconnect(); FrameworkApplicationMessages::Handler::BusDisconnect(); @@ -269,7 +269,7 @@ namespace LegacyFramework { m_applicationEntity->Deactivate(); delete m_applicationEntity; - m_applicationEntity = NULL; + m_applicationEntity = nullptr; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp index bc16b29830..98e06b77f3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFramework.cpp @@ -144,9 +144,9 @@ namespace AzToolsFramework qInstallMessageHandler(myMessageOutput); } - virtual ~AZQtApplication() + ~AZQtApplication() override { - qInstallMessageHandler(NULL); + qInstallMessageHandler(nullptr); } }; @@ -201,9 +201,9 @@ namespace AzToolsFramework // enable the built-in stylesheet by default: bool enableStyleSheet = true; - const AzFramework::CommandLine* comp = NULL; + const AzFramework::CommandLine* comp = nullptr; EBUS_EVENT_RESULT(comp, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser); - if (comp != NULL) + if (comp != nullptr) { if (comp->HasSwitch("nostyle")) { @@ -275,18 +275,18 @@ namespace AzToolsFramework // see still need to clean up: m_ptrTicker->cancel(); QApplication::processEvents(); - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { pApp->Tick(); } azdestroy(m_ptrTicker); - m_ptrTicker = NULL; + m_ptrTicker = nullptr; } } - Framework::~Framework(void) + Framework::~Framework() { AZ::SystemTickBus::Handler::BusDisconnect(); @@ -299,7 +299,7 @@ namespace AzToolsFramework delete m_ActionChangeProject; m_ActionChangeProject = nullptr; - pApplication = NULL; + pApplication = nullptr; } // once we set the project, we can then tell all our other windows to restore our state. @@ -360,7 +360,7 @@ namespace AzToolsFramework } m_bTicking = true; // Tick the component app. - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { @@ -491,7 +491,7 @@ namespace AzToolsFramework // we successfully got permission to quit! // pump the tickbus one last time! // QApplication::processEvents(); - AZ::ComponentApplication* pApp = NULL; + AZ::ComponentApplication* pApp = nullptr; EBUS_EVENT_RESULT(pApp, AZ::ComponentApplicationBus, GetApplication); if (pApp) { @@ -501,7 +501,7 @@ namespace AzToolsFramework m_ptrTicker->cancel(); azdestroy(m_ptrTicker); - m_ptrTicker = NULL; + m_ptrTicker = nullptr; QApplication::quit(); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp index 6318bc3e6e..72bef700d7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/UIFrameworkPreferences.cpp @@ -38,7 +38,7 @@ namespace AzToolsFramework else { delete m_View; - m_View = NULL; + m_View = nullptr; } } void Framework::PreferencesAccepted() @@ -59,11 +59,11 @@ namespace AzToolsFramework if (m_View) { delete m_View; - m_View = NULL; + m_View = nullptr; } if (m_Model) { - m_Model = NULL; + m_Model = nullptr; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp index 4fabdfad12..ef8bf42713 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp @@ -61,7 +61,7 @@ namespace AzToolsFramework , m_impl(new BaseLogPanel::Impl) { m_impl->storageID = 0; - this->setLayout(aznew LogPanelLayout(NULL)); + this->setLayout(aznew LogPanelLayout(nullptr)); m_impl->pTabWidget = new AzQtComponents::TabWidget(this); m_impl->pTabWidget->setObjectName(QString::fromUtf8("tabWidget")); @@ -601,7 +601,7 @@ namespace AzToolsFramework { if (index >= (int)m_children.size()) { - return NULL; + return nullptr; } return m_children[index]; @@ -609,11 +609,11 @@ namespace AzToolsFramework QLayoutItem* LogPanelLayout::takeAt(int index) { - QLayoutItem* pItem = NULL; + QLayoutItem* pItem = nullptr; if (index >= (int)m_children.size()) { - return NULL; + return nullptr; } pItem = m_children[index]; @@ -860,7 +860,7 @@ namespace AzToolsFramework return richLabel; } - return NULL; + return nullptr; } bool LogPanelItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp index 1542a5f5ab..f550dbdc87 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/StyledLogPanel.cpp @@ -322,7 +322,7 @@ namespace AzToolsFramework actionList.removeAll(m_actionSelectAll); } - QMenu::exec(actionList, QCursor::pos(), 0, this); + QMenu::exec(actionList, QCursor::pos(), nullptr, this); } void StyledLogTab::CopySelected() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp index fccabbf205..7fefb04872 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.cpp @@ -236,7 +236,7 @@ namespace AzToolsFramework AZ_Assert(container, "This node is NOT a container node!"); const AZ::SerializeContext::ClassElement* containerClassElement = container->GetElement(container->GetDefaultElementNameCrc()); - AZ_Assert(containerClassElement != NULL, "We should have a valid default element in the container, otherwise we don't know what elements to make!"); + AZ_Assert(containerClassElement != nullptr, "We should have a valid default element in the container, otherwise we don't know what elements to make!"); if (!containerClassElement) { return false; @@ -261,7 +261,7 @@ namespace AzToolsFramework AZ_Assert(newDataAddress, "Faliled to create new element for the continer!"); // cast to base type (if needed) void* basePtr = m_context->DownCast(newDataAddress, classData->m_typeId, containerClassElement->m_typeId, classData->m_azRtti, containerClassElement->m_azRtti); - AZ_Assert(basePtr != NULL, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name); + AZ_Assert(basePtr != nullptr, "Can't cast container element %s to %s, make sure classes are registered in the system and not generics!", classData->m_name, containerClassElement->m_name); *reinterpret_cast(dataAddress) = basePtr; // store the pointer in the class /// Store the element in the container container->StoreElement(GetInstance(i), dataAddress); @@ -608,7 +608,7 @@ namespace AzToolsFramework AZ_Assert(sc, "sc can't be NULL!"); AZ_Assert(m_rootInstances.size() > 0, "No root instances have been added to this hierarchy!"); - m_curParentNode = NULL; + m_curParentNode = nullptr; m_isMerging = false; m_instances.clear(); m_children.clear(); @@ -636,7 +636,7 @@ namespace AzToolsFramework for (size_t i = 1; i < m_rootInstances.size(); ++i) { - m_curParentNode = NULL; + m_curParentNode = nullptr; m_isMerging = true; m_matched = false; sc->EnumerateInstanceConst( @@ -956,7 +956,7 @@ namespace AzToolsFramework } } - InstanceDataNode* node = NULL; + InstanceDataNode* node = nullptr; // Extra steps need to be taken when we are merging if (m_isMerging) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp index ee43eb7e2c..c07191fda2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp @@ -349,7 +349,7 @@ namespace AzToolsFramework if (pAssetType) { - (*pAssetType) = 0; + (*pAssetType) = nullptr; } if (!pData) @@ -529,7 +529,7 @@ namespace AzToolsFramework if (m_errorButton) { // If the button is already active, disconnect its pressed handler so we don't get multiple popups - disconnect(m_errorButton, &QPushButton::pressed, this, 0); + disconnect(m_errorButton, &QPushButton::pressed, this, nullptr); } else { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp index 6a1f1404a1..38a7f426db 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp @@ -137,7 +137,7 @@ namespace AzToolsFramework Q_UNUSED(debugName) } - AZ::u32 U32CRCHandler::GetHandlerName(void) const + AZ::u32 U32CRCHandler::GetHandlerName() const { return AZ::Edit::UIHandlers::Crc; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp index 678693ea32..2eabe64333 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp @@ -225,7 +225,7 @@ namespace AzToolsFramework if (!pHandlerFound) { // does a base class have a handler? - AZ::SerializeContext* sc = NULL; + AZ::SerializeContext* sc = nullptr; EBUS_EVENT_RESULT(sc, AZ::ComponentApplicationBus, GetSerializeContext); AZStd::vector classes; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp index c87f0e03ba..0ad874d1f6 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp @@ -254,9 +254,9 @@ namespace AzToolsFramework void QueueInvalidationIfSharedData(InternalReflectedPropertyEditorEvents* sender, PropertyModificationRefreshLevel level, const AZStd::set& sourceInstanceSet) override; // PropertyEditorGUIMessages::Bus::Handler - virtual void RequestWrite(QWidget* editorGUI) override; - virtual void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override; - virtual void RequestRefresh(PropertyModificationRefreshLevel) override; + void RequestWrite(QWidget* editorGUI) override; + void AddElementsToParentContainer(QWidget* editorGUI, size_t numElements, const InstanceDataNode::FillDataClassCallback& fillDataCallback) override; + void RequestRefresh(PropertyModificationRefreshLevel) override; void RequestPropertyNotify(QWidget* editorGUI) override; void OnEditingFinished(QWidget* editorGUI) override; }; @@ -890,7 +890,7 @@ namespace AzToolsFramework { instance.Build(m_impl->m_context, AZ::SerializeContext::ENUM_ACCESS_FOR_READ, m_impl->m_dynamicEditDataProvider, m_impl->m_editorParent); m_impl->FilterNode(instance.GetRootNode(), filter); - m_impl->AddProperty(instance.GetRootNode(), NULL, 0); + m_impl->AddProperty(instance.GetRootNode(), nullptr, 0); } m_impl->UpdateExpansionState(); @@ -1077,7 +1077,7 @@ namespace AzToolsFramework PropertyRowWidget* ReflectedPropertyEditor::Impl::CreateOrPullFromPool() { - PropertyRowWidget* newWidget = NULL; + PropertyRowWidget* newWidget = nullptr; if (m_widgetPool.empty()) { newWidget = aznew PropertyRowWidget(m_containerWidget); @@ -1184,7 +1184,7 @@ namespace AzToolsFramework { // re-create the tab order, based on vertical position in the list. - QWidget* pLastWidget = NULL; + QWidget* pLastWidget = nullptr; for (AZStd::size_t pos = 0; pos < m_impl->m_widgetsInDisplayOrder.size(); ++pos) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp index 849b8d1705..e5fd3351ae 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.cpp @@ -195,17 +195,17 @@ namespace AzToolsFramework , m_criteriaOperator(FilterOperatorType::Or) , m_suppressCriteriaChanged(false) { - m_mainLayout = new QVBoxLayout(NULL); + m_mainLayout = new QVBoxLayout(nullptr); m_mainLayout->setSizeConstraint(QLayout::SetMinimumSize); m_mainLayout->setContentsMargins(0, 0, 0, 0); - QHBoxLayout* secondaryLayout = new QHBoxLayout(NULL); + QHBoxLayout* secondaryLayout = new QHBoxLayout(nullptr); secondaryLayout->setSizeConstraint(QLayout::SetMinimumSize); secondaryLayout->setContentsMargins(0, 0, 0, 0); - m_filterLayout = new QHBoxLayout(NULL); + m_filterLayout = new QHBoxLayout(nullptr); m_tagLayout = new FlowLayout(nullptr); m_tagLayout->setAlignment(Qt::AlignLeft); - QHBoxLayout* filterTextLayout = new QHBoxLayout(NULL); + QHBoxLayout* filterTextLayout = new QHBoxLayout(nullptr); filterTextLayout->setSizeConstraint(QLayout::SetMinimumSize); filterTextLayout->setContentsMargins(0, 0, 0, 0); filterTextLayout->setSpacing(0); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp index 75c8c607c6..e71910f4fc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.cpp @@ -41,7 +41,7 @@ namespace AzToolsFramework { } - virtual ~QTreeViewStateSaverData() + ~QTreeViewStateSaverData() override { } @@ -213,7 +213,7 @@ namespace AzToolsFramework } } - void ApplySnapshot(QTreeView* treeView) + void ApplySnapshot(QTreeView* treeView) override { Q_ASSERT(treeView && treeView->model()); diff --git a/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp b/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp index 4083608370..24488f3ed3 100644 --- a/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp +++ b/Code/Framework/AzToolsFramework/Tests/AssetSeedManager.cpp @@ -219,7 +219,7 @@ namespace UnitTest delete m_application; } - AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id) + AZ::Data::AssetInfo GetAssetInfoById(const AZ::Data::AssetId& id) override { auto foundIter = m_assetRegistry->m_assetIdToInfo.find(id); if (foundIter != m_assetRegistry->m_assetIdToInfo.end()) diff --git a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp index e15f4f3cfd..e416efc5c6 100644 --- a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp +++ b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp @@ -1202,7 +1202,7 @@ namespace UnitTest AZ_COMPONENT(HiddenComponent, "{E4D2AD8B-3930-46FC-837A-8DDFCA0FB1AF}", AzToolsFramework::Components::EditorComponentBase); static Component* s_wasDeleted; - virtual ~HiddenComponent() + ~HiddenComponent() override { s_wasDeleted = this; } diff --git a/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp b/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp index db92085e98..2c757f8e9e 100644 --- a/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Entity/EditorEntitySearchComponentTests.cpp @@ -66,7 +66,7 @@ namespace AzToolsFramework { } - virtual ~EntitySearch_TestComponent1() override + ~EntitySearch_TestComponent1() override {} private: @@ -123,7 +123,7 @@ namespace AzToolsFramework { } - virtual ~EntitySearch_TestComponent2() override + ~EntitySearch_TestComponent2() override {} private: diff --git a/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp b/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp index b6b428cc11..486224c011 100644 --- a/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EntityIdQLabelTests.cpp @@ -55,7 +55,7 @@ namespace UnitTest AzToolsFramework::EditorRequests::Bus::Handler::BusConnect(); } - ~EditorRequestHandlerTest() + ~EditorRequestHandlerTest() override { AzToolsFramework::EditorRequests::Bus::Handler::BusDisconnect(); } diff --git a/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp b/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp index 9af74c7996..0fbc7eba98 100644 --- a/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EntityInspectorTests.cpp @@ -67,7 +67,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService1")); } - virtual ~Inspector_TestComponent1() override + ~Inspector_TestComponent1() override { } @@ -136,7 +136,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService2")); } - virtual ~Inspector_TestComponent2() override + ~Inspector_TestComponent2() override { } @@ -205,7 +205,7 @@ namespace UnitTest services.push_back(AZ_CRC("InspectorTestService3")); } - virtual ~Inspector_TestComponent3() override + ~Inspector_TestComponent3() override { } diff --git a/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp b/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp index c4299a6ff9..94b32f9e41 100644 --- a/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp +++ b/Code/Framework/AzToolsFramework/Tests/FileFunc.cpp @@ -31,7 +31,7 @@ namespace UnitTest class FileFuncTest : public ScopedAllocatorSetupFixture { public: - void SetUp() + void SetUp() override { m_prevFileIO = AZ::IO::FileIOBase::GetInstance(); AZ::IO::FileIOBase::SetInstance(nullptr); diff --git a/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp b/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp index 806a3bbab2..4d144d0d1b 100644 --- a/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp +++ b/Code/Framework/AzToolsFramework/Tests/InstanceDataHierarchy.cpp @@ -104,15 +104,15 @@ namespace UnitTest if (AZ::EditContext* edit = serializeContext->GetEditContext()) { edit->Class("Test Component", "A test component") - ->DataElement(0, &TestComponent::m_float, "Float Field", "A float field") - ->DataElement(0, &TestComponent::m_string, "String Field", "A string field") - ->DataElement(0, &TestComponent::m_normalContainer, "Normal Container", "A container") - ->DataElement(0, &TestComponent::m_pointerContainer, "Pointer Container", "A container") - ->DataElement(0, &TestComponent::m_subData, "Struct Field", "A sub data type") + ->DataElement(nullptr, &TestComponent::m_float, "Float Field", "A float field") + ->DataElement(nullptr, &TestComponent::m_string, "String Field", "A string field") + ->DataElement(nullptr, &TestComponent::m_normalContainer, "Normal Container", "A container") + ->DataElement(nullptr, &TestComponent::m_pointerContainer, "Pointer Container", "A container") + ->DataElement(nullptr, &TestComponent::m_subData, "Struct Field", "A sub data type") ; edit->Class("Test Component", "A test component") - ->DataElement(0, &SubData::m_int, "Int Field", "An int") + ->DataElement(nullptr, &SubData::m_int, "Int Field", "An int") ; } } @@ -156,7 +156,7 @@ namespace UnitTest { } - ~InstanceDataHierarchyBasicTest() + ~InstanceDataHierarchyBasicTest() override { } @@ -481,7 +481,7 @@ namespace UnitTest { } - ~InstanceDataHierarchyCopyContainerChangesTest() + ~InstanceDataHierarchyCopyContainerChangesTest() override { } @@ -680,8 +680,8 @@ namespace UnitTest ; edit->Class("Enum Container", "Test container that has an external enum") - ->DataElement(0, &EnumContainer::m_enum, "Enum Field", "An enum value") - ->DataElement(0, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values") + ->DataElement(nullptr, &EnumContainer::m_enum, "Enum Field", "An enum value") + ->DataElement(nullptr, &EnumContainer::m_enumVector, "Enum Vector Field", "A vector of enum values") ; } } @@ -776,21 +776,21 @@ namespace UnitTest { edit->Class("Group Test Component", "Testing normal groups and toggle groups") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->DataElement(0, &GroupTestComponent::m_float, "Float Field", "A float field") + ->DataElement(nullptr, &GroupTestComponent::m_float, "Float Field", "A float field") ->ClassElement(AZ::Edit::ClassElements::Group, "Normal Group") - ->DataElement(0, &GroupTestComponent::m_groupFloat, "Float Field", "A float field") - ->DataElement(0, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type") + ->DataElement(nullptr, &GroupTestComponent::m_groupFloat, "Float Field", "A float field") + ->DataElement(nullptr, &GroupTestComponent::m_subGroupForNormal, "Struct Field", "A sub data type") ->GroupElementToggle("Group Toggle", &GroupTestComponent::m_groupToggle) - ->DataElement(0, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer") - ->DataElement(0, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type") + ->DataElement(nullptr, &GroupTestComponent::m_toggleGroupInt, "Normal Integer", "An Integer") + ->DataElement(nullptr, &GroupTestComponent::m_subGroupForToggle, "Struct Field", "A sub data type") ; edit->Class("SubGroup Test Component", "Testing nested normal groups and toggle groups") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->ClassElement(AZ::Edit::ClassElements::Group, "Normal SubGroup") - ->DataElement(0, &SubData::m_int, "SubGroup Int Field", "An int") + ->DataElement(nullptr, &SubData::m_int, "SubGroup Int Field", "An int") ->GroupElementToggle("SubGroup Toggle", &SubData::m_bool) - ->DataElement(0, &SubData::m_float, "SubGroup Float Field", "An int") + ->DataElement(nullptr, &SubData::m_float, "SubGroup Float Field", "An int") ; } } @@ -974,7 +974,7 @@ namespace UnitTest { } - void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const + void InsertAndVerifyKeys(AZ::SerializeContext::IDataContainer* container, void* key, void* instance, const AZ::SerializeContext::ClassElement* classElement) const override { T* keyContainer = reinterpret_cast(key); for (const T& keyToInsert : keysToInsert) @@ -1258,7 +1258,7 @@ namespace UnitTest { editContext->Class("Test", "") ->UIElement("TestHandler", "UIElement") - ->DataElement(0, &UIElementContainer::m_data) + ->DataElement(nullptr, &UIElementContainer::m_data) ->UIElement(AZ_CRC("TestHandler2"), "UIElement2") ; } @@ -1322,8 +1322,8 @@ namespace UnitTest { // By default, DataElements accept multi-edit and UIElements do not editContext->Class("Test", "") - ->DataElement(0, &AggregatedContainer::m_aggregated) - ->DataElement(0, &AggregatedContainer::m_notAggregated) + ->DataElement(nullptr, &AggregatedContainer::m_aggregated) + ->DataElement(nullptr, &AggregatedContainer::m_notAggregated) ->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, false) ->UIElement("TestHandler", "aggregatedUIElement") ->Attribute(AZ::Edit::Attributes::AcceptsMultiEdit, true) diff --git a/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp b/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp index 1c1e063592..91e53f1650 100644 --- a/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/PropertyTreeEditorTests.cpp @@ -73,7 +73,7 @@ namespace UnitTest if (AZ::EditContext* editContext = serializeContext->GetEditContext()) { editContext->Class("TestSimpleAsset", "Test data block for a simple asset mock data block") - ->DataElement(0, &TestSimpleAsset::m_data, "My Data", "A test bool value.") + ->DataElement(nullptr, &TestSimpleAsset::m_data, "My Data", "A test bool value.") ; } } @@ -171,7 +171,7 @@ namespace UnitTest ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::HideChildren) ->DataElement(AZ::Edit::UIHandlers::Default, &PropertyTreeEditorTester::m_myReadOnlyShort, "My Read Only", "A test read only node.") ->Attribute(AZ::Edit::Attributes::ReadOnly, true) - ->DataElement(0, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test") + ->DataElement(nullptr, &PropertyTreeEditorTester::m_mySubBlock, "My Sub Block", "sub block test") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->ClassElement(AZ::Edit::ClassElements::Group, "Grouped") diff --git a/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp b/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp index b2fa44c271..8e273992ac 100644 --- a/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/SQLiteConnectionTests.cpp @@ -31,7 +31,7 @@ namespace UnitTest { } - ~SQLiteTest() = default; + ~SQLiteTest() override = default; void SetUp() override { diff --git a/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp b/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp index 2aa180cfc0..cdb8fea513 100644 --- a/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Script/ScriptEntityTests.cpp @@ -28,7 +28,7 @@ namespace UnitTest ScriptContext* m_scriptContext; - ~EntityScriptTest() + ~EntityScriptTest() override { } diff --git a/Code/Framework/AzToolsFramework/Tests/Slice.cpp b/Code/Framework/AzToolsFramework/Tests/Slice.cpp index 1723fbed8b..58865df345 100644 --- a/Code/Framework/AzToolsFramework/Tests/Slice.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Slice.cpp @@ -457,7 +457,7 @@ namespace UnitTest { AZ::Debug::TraceMessageBus::Handler::BusConnect(); } - ~SliceTestWarningInterceptor() + ~SliceTestWarningInterceptor() override { AZ::Debug::TraceMessageBus::Handler::BusDisconnect(); } diff --git a/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp b/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp index f9b84c6130..ca32097341 100644 --- a/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp +++ b/Code/Framework/AzToolsFramework/Tests/UndoStack.cpp @@ -413,7 +413,7 @@ namespace UnitTest *m_completedFlag = false; } - ~UndoDestructorTest() + ~UndoDestructorTest() override { *m_completedFlag = true; } diff --git a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp index e1896af4db..ddfcde34b2 100644 --- a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiDisplayTests.cpp @@ -28,7 +28,7 @@ namespace UnitTest public: ViewportUiDisplayTestFixture() = default; - void SetUp() + void SetUp() override { m_buttonGroup = AZStd::make_shared(); m_buttonGroup->AddButton(""); @@ -36,7 +36,7 @@ namespace UnitTest m_mockRenderOverlay = new QWidget(); } - void TearDown() + void TearDown() override { m_buttonGroup.reset(); delete m_parentWidget; diff --git a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp index 91100b18c5..676b9c5e35 100644 --- a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp @@ -26,7 +26,7 @@ namespace UnitTest { public: ViewportUiManagerTestable() = default; - ~ViewportUiManagerTestable() = default; + ~ViewportUiManagerTestable() override = default; const AZStd::unordered_map>& GetClusterMap() { @@ -84,12 +84,12 @@ namespace UnitTest ViewportManagerWrapper m_viewportManagerWrapper; - void SetUp() + void SetUp() override { m_viewportManagerWrapper.Create(); } - void TearDown() + void TearDown() override { m_viewportManagerWrapper.Destroy(); } diff --git a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp index 8b484143de..095f392501 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/Carrier.cpp @@ -591,13 +591,13 @@ namespace GridMate ThreadMessage(MainThreadMsg mtm) : m_code(mtm) - , m_connection(NULL) - , m_threadConnection(NULL) + , m_connection(nullptr) + , m_threadConnection(nullptr) {} ThreadMessage(CarrierThreadMsg ctm) : m_code(ctm) - , m_connection(NULL) - , m_threadConnection(NULL) + , m_connection(nullptr) + , m_threadConnection(nullptr) {} int m_code; @@ -787,7 +787,7 @@ namespace GridMate AZ_FORCE_INLINE ThreadMessage* PopCarrierThreadMessage() { AZStd::lock_guard l(m_carrierMsgQueueLock); - ThreadMessage* res = NULL; + ThreadMessage* res = nullptr; if (!m_carrierMsgQueue.empty()) { res = m_carrierMsgQueue.front(); @@ -799,7 +799,7 @@ namespace GridMate AZ_FORCE_INLINE ThreadMessage* PopMainThreadMessage() { AZStd::lock_guard l(m_mainMsgQueueLock); - ThreadMessage* res = NULL; + ThreadMessage* res = nullptr; if (!m_mainMsgQueue.empty()) { res = m_mainMsgQueue.front(); @@ -1120,7 +1120,7 @@ using namespace GridMate; ////////////////////////////////////////////////////////////////////////// Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address) : m_threadOwner(threadOwner) - , m_threadConn(NULL) + , m_threadConn(nullptr) , m_fullAddress(address) , m_state(Carrier::CST_CONNECTING) { @@ -1139,7 +1139,7 @@ Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address) Connection::~Connection() { - AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == NULL, "We must detach the thread connection first!"); + AZ_Error("GridMate", m_threadConn.load(AZStd::memory_order_acquire) == nullptr, "We must detach the thread connection first!"); // Make sure render thread doesn't reference is at this point... it's too late for (unsigned int i = 0; i < AZ_ARRAY_SIZE(m_toSend); ++i) { @@ -1172,7 +1172,7 @@ Connection::~Connection() ThreadConnection::ThreadConnection(CarrierThread* threadOwner) : m_threadOwner(threadOwner) - , m_mainConnection(NULL) + , m_mainConnection(nullptr) , m_dataGramSeqNum(1) // IMPORTANT to start with 1 if we have not received any datagrams we will confirm a datagram with value of 0. , m_lastAckedDatagram(0) , m_lastReceivedDatagramTime(AZStd::chrono::system_clock::now()) @@ -1196,7 +1196,7 @@ ThreadConnection::ThreadConnection(CarrierThread* threadOwner) ThreadConnection::~ThreadConnection() { - AZ_Error("GridMate", m_mainConnection == NULL || m_mainConnection->m_threadConn.load() == NULL, "We should have unbound the thread connection by now!"); + AZ_Error("GridMate", m_mainConnection == nullptr || m_mainConnection->m_threadConn.load() == nullptr, "We should have unbound the thread connection by now!"); for (unsigned char iChannel = 0; iChannel < k_maxNumberOfChannels; ++iChannel) { @@ -1215,8 +1215,8 @@ ThreadConnection::~ThreadConnection() m_threadOwner->FreeDatagram(dgram); } - m_target->m_threadConnection = NULL; - m_target = NULL; + m_target->m_threadConnection = nullptr; + m_target = nullptr; m_threadOwner->RemoveConnectionToSend(this); AZ_Error("GridMate", !IsLinked(), "Connection still linked!"); @@ -1245,7 +1245,7 @@ CarrierThread::CarrierThread(const CarrierDesc& desc, AZStd::shared_ptrGetMaxSendSize(), @@ -1667,7 +1667,7 @@ CarrierThread::UpdateReceive() ReadBuffer readBuffer(kCarrierEndian, data, recvDataGramSize); ThreadConnection* conn = nullptr; - if (fromAddress->m_threadConnection != NULL) + if (fromAddress->m_threadConnection != nullptr) { conn = fromAddress->m_threadConnection; receivedConnections.insert(conn); @@ -2214,7 +2214,7 @@ CarrierThread::UpdateStats() for (ThreadConnectionList::iterator iConn = m_threadConnections.begin(); iConn != m_threadConnections.end(); ++iConn) { ThreadConnection* conn = *iConn; - if (conn->m_mainConnection == NULL) + if (conn->m_mainConnection == nullptr) { continue; } @@ -2267,40 +2267,40 @@ CarrierThread::ThreadPump() // Process messages for us { ThreadMessage* msg; - while ((msg = PopCarrierThreadMessage()) != NULL) + while ((msg = PopCarrierThreadMessage()) != nullptr) { switch (msg->m_code) { case CTM_CONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); // if this connect was initiated from a remote machine msg->threadConnection will be != NULL ThreadConnection* conn = msg->m_threadConnection; if (!conn) { // The main thread is initiating this connection AZStd::intrusive_ptr driverAddress = m_driver->CreateDriverAddress(msg->m_connection->m_fullAddress); - if (driverAddress->m_threadConnection != NULL) + if (driverAddress->m_threadConnection != nullptr) { AZ_TracePrintf("GridMate", "Thread connection to %s already exists!\n", driverAddress->ToString().c_str()); // we already have such thread connection conn = driverAddress->m_threadConnection; // make sure the existing connection is not bound - AZ_Assert(conn->m_mainConnection == NULL, "This thread connection should be unbound!"); + AZ_Assert(conn->m_mainConnection == nullptr, "This thread connection should be unbound!"); } else { conn = MakeNewConnection(driverAddress); } } - AZ_Assert(conn->m_mainConnection == NULL || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!"); + AZ_Assert(conn->m_mainConnection == nullptr || conn->m_mainConnection == msg->m_connection, "This thread connection should be unbound or bound to the imcomming main connection!"); conn->m_mainConnection = msg->m_connection; - AZ_Assert(conn->m_mainConnection->m_threadConn.load() == NULL || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!"); + AZ_Assert(conn->m_mainConnection->m_threadConn.load() == nullptr || conn->m_mainConnection->m_threadConn.load() == conn, "This main connection should be unbound or bound to us!"); conn->m_mainConnection->m_threadConn = conn; } break; case CTM_DISCONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); ThreadConnection* tc = msg->m_connection->m_threadConn; if (tc && !tc->m_isDisconnecting) { @@ -2312,7 +2312,7 @@ CarrierThread::ThreadPump() } break; case CTM_DELETE_CONNECTION: { - ThreadConnection* tc = NULL; + ThreadConnection* tc = nullptr; tc = msg->m_threadConnection; if (tc) { @@ -2339,7 +2339,7 @@ CarrierThread::ThreadPump() ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION); mtm->m_connection = msg->m_connection; RemoveConnectionToSend(mtm->m_threadConnection); - mtm->m_threadConnection = NULL; + mtm->m_threadConnection = nullptr; mtm->m_disconnectReason = msg->m_disconnectReason; PushMainThreadMessage(mtm); } @@ -2413,10 +2413,10 @@ CarrierThread::ThreadPump() if (tc->m_mainConnection) { RemoveConnectionToSend(tc); - tc->m_mainConnection->m_threadConn = NULL; + tc->m_mainConnection->m_threadConn = nullptr; ThreadMessage* mtm = aznew ThreadMessage(MTM_DELETE_CONNECTION); mtm->m_connection = tc->m_mainConnection; - mtm->m_threadConnection = NULL; + mtm->m_threadConnection = nullptr; mtm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_SHUTTING_DOWN; PushMainThreadMessage(mtm); } @@ -2582,7 +2582,7 @@ void CarrierThread::WriteAckData(ThreadConnection* connection, WriteBuffer& writ // Generate ACK bits SequenceNumber lastToAck; // last received datagram SequenceNumber firstToAck; // first received datagram (still in the list) - unsigned char* ackHistoryBits = NULL; + unsigned char* ackHistoryBits = nullptr; unsigned char ackNumHistoryBytes = 0; unsigned char ackHistoryBitsStorage[DataGramHistoryList::m_datagramHistoryMaxNumberOfBytes]; @@ -2736,7 +2736,7 @@ CarrierThread::ReadAckData(ThreadConnection* connection, ReadBuffer& readBuffer) return; } - if (connection != NULL && isAckData) + if (connection != nullptr && isAckData) { if (firstToAck != lastToAck) { @@ -3707,12 +3707,12 @@ CarrierImpl::~CarrierImpl() } delete m_thread; - m_thread = NULL; + m_thread = nullptr; if (m_ownHandshake) { delete m_handshake; - m_handshake = NULL; + m_handshake = nullptr; } } @@ -4235,13 +4235,13 @@ CarrierImpl::ProcessMainThreadMessages() // Process messages from the carrier thread { ThreadMessage* msg; - while ((msg = m_thread->PopMainThreadMessage()) != NULL) + while ((msg = m_thread->PopMainThreadMessage()) != nullptr) { switch (msg->m_code) { case MTM_NEW_CONNECTION: { - Connection* conn = NULL; + Connection* conn = nullptr; // check if we don't have it in the list. for(auto& c : m_connections) { @@ -4255,8 +4255,8 @@ CarrierImpl::ProcessMainThreadMessages() { // we already have such connection ThreadConnection* threadConn = conn->m_threadConn.load(AZStd::memory_order_acquire); - AZ_Assert(threadConn == NULL || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection); - if (threadConn == NULL) + AZ_Assert(threadConn == nullptr || threadConn == msg->m_threadConnection, "This main connection 0x%08x (%s) already have bound thread connection 0x%08x->0x%08x!", conn, conn->m_fullAddress.c_str(), threadConn, threadConn->m_mainConnection); + if (threadConn == nullptr) { // request a bind we have not already ThreadMessage* ctm = aznew ThreadMessage(CTM_CONNECT); @@ -4283,23 +4283,23 @@ CarrierImpl::ProcessMainThreadMessages() // we will not even make a connection ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_threadConnection = msg->m_threadConnection; - ctm->m_connection = NULL; + ctm->m_connection = nullptr; ctm->m_disconnectReason = CarrierDisconnectReason::DISCONNECT_HANDSHAKE_REJECTED; m_thread->PushCarrierThreadMessage(ctm); } } break; case MTM_DISCONNECT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); DisconnectRequest(msg->m_connection, msg->m_disconnectReason); } break; case MTM_DISCONNECT_TIMEOUT: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); if (msg->m_connection->m_state == Carrier::CST_DISCONNECTING) { // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = msg->m_connection->m_threadConn.exchange(nullptr); msg->m_connection->m_state = Carrier::CST_DISCONNECTED; ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = msg->m_connection; @@ -4311,7 +4311,7 @@ CarrierImpl::ProcessMainThreadMessages() } break; case MTM_DELETE_CONNECTION: { - AZ_Assert(msg->m_connection != NULL, "You must provide a valid connection pointer!"); + AZ_Assert(msg->m_connection != nullptr, "You must provide a valid connection pointer!"); DeleteConnection(msg->m_connection, msg->m_disconnectReason); } break; case MTM_ON_ERROR: @@ -4534,7 +4534,7 @@ CarrierImpl::ProcessSystemMessages() // Delete connection conn->m_state = Carrier::CST_DISCONNECTED; // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr); ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = conn; ctm->m_threadConnection = threadConn; @@ -4829,7 +4829,7 @@ CarrierImpl::GetTime() void CarrierImpl::DebugDeleteConnection(ConnectionID id) { - if (id == InvalidConnectionID && m_thread != NULL) + if (id == InvalidConnectionID && m_thread != nullptr) { return; } @@ -4844,7 +4844,7 @@ CarrierImpl::DebugDeleteConnection(ConnectionID id) // Delete connection conn->m_state = Carrier::CST_DISCONNECTED; // unbind from the thread connection and inform carrier thread to delete it. - ThreadConnection* threadConn = conn->m_threadConn.exchange(NULL); + ThreadConnection* threadConn = conn->m_threadConn.exchange(nullptr); ThreadMessage* ctm = aznew ThreadMessage(CTM_DELETE_CONNECTION); ctm->m_connection = conn; ctm->m_threadConnection = threadConn; @@ -4914,7 +4914,7 @@ DefaultCarrier::Create(const CarrierDesc& desc, IGridMate* gridMate) AZStd::string CarrierEventsBase::ReasonToString(CarrierDisconnectReason reason) { - const char* reasonStr = 0; + const char* reasonStr = nullptr; switch (reason) { case CarrierDisconnectReason::DISCONNECT_USER_REQUESTED: diff --git a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp index f9280d9918..8743e50e83 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/DefaultTrafficControl.cpp @@ -58,8 +58,8 @@ DefaultTrafficControl::~DefaultTrafficControl() void DefaultTrafficControl::OnConnect(TrafficControlConnectionId id, const AZStd::intrusive_ptr& address) { - AZ_Assert(id->m_trafficData == NULL, "We have already assigned traffic data to this connection!"); - if (id->m_trafficData != NULL) + AZ_Assert(id->m_trafficData == nullptr, "We have already assigned traffic data to this connection!"); + if (id->m_trafficData != nullptr) { return; } @@ -100,7 +100,7 @@ void DefaultTrafficControl::OnDisconnect(TrafficControlConnectionId id) { ConnectionData* cd = reinterpret_cast(id->m_trafficData); - id->m_trafficData = NULL; + id->m_trafficData = nullptr; bool isFound = false; for (ConnectionListType::iterator i = m_connections.begin(); i != m_connections.end(); ++i) { diff --git a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp index 08c5408848..91fc1ca69b 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/SocketDriver.cpp @@ -1081,7 +1081,7 @@ namespace GridMate }; sockaddr* sockAddr = reinterpret_cast(&sockAddrIn6); socklen_t sockAddrLen = sizeof(sockAddrIn6); - from = NULL; + from = nullptr; unsigned int recvd = m_platformDriver->Receive(data, maxDataSize, sockAddr, sockAddrLen, resultCode); @@ -1207,7 +1207,7 @@ namespace GridMate unsigned int port; if (!AddressToIPPort(address, ip, port)) { - return NULL; + return nullptr; } SocketDriverAddress drvAddr(this, ip, port); @@ -1313,7 +1313,7 @@ namespace GridMate fd_set fdwrite; FD_ZERO(&fdwrite); FD_SET(m_socket, &fdwrite); - select(FD_SETSIZE, 0, &fdwrite, 0, 0); + select(FD_SETSIZE, nullptr, &fdwrite, nullptr, nullptr); continue; } @@ -1376,7 +1376,7 @@ namespace GridMate FD_SET(m_socket, &fdread); timeval t = Platform::GetTimeValue(timeOut); - int result = select(FD_SETSIZE, &fdread, 0, 0, &t); + int result = select(FD_SETSIZE, &fdread, nullptr, nullptr, &t); if (result > 0) { m_parent.m_isStoppedWaitForData = true; diff --git a/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp index 759a2b5e47..647b34e1b9 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/StreamSecureSocketDriver.cpp @@ -343,7 +343,7 @@ namespace GridMate break; } } - while (0); + while (false); // did everything successfully create and/or allocate? if (m_ssl && m_bioIn && m_bioOut && m_scratch) diff --git a/Code/Framework/GridMate/GridMate/GridMate.cpp b/Code/Framework/GridMate/GridMate/GridMate.cpp index 356f7ad16b..22b4fd7af6 100644 --- a/Code/Framework/GridMate/GridMate/GridMate.cpp +++ b/Code/Framework/GridMate/GridMate/GridMate.cpp @@ -36,7 +36,7 @@ namespace GridMate AZ_CLASS_ALLOCATOR(GridMateImpl, GridMateAllocator, 0); GridMateImpl(const GridMateDesc& desc); - virtual ~GridMateImpl(); + ~GridMateImpl() override; void Update() override; diff --git a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp index c1de3b71f2..a05b92a7a0 100644 --- a/Code/Framework/GridMate/GridMate/Replica/Replica.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/Replica.cpp @@ -777,7 +777,7 @@ namespace GridMate CtorContextBase::s_pCur->m_members.push_back(this); } //----------------------------------------------------------------------------- - CtorContextBase* CtorContextBase::s_pCur = NULL; + CtorContextBase* CtorContextBase::s_pCur = nullptr; //----------------------------------------------------------------------------- CtorContextBase::CtorContextBase() { diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp index 2582710aa7..7a56393bd5 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaMgr.cpp @@ -460,7 +460,7 @@ namespace GridMate { return iter->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------- RepIdSeed ReplicaManager::ReserveIdBlock(PeerId requestor) @@ -995,7 +995,7 @@ namespace GridMate AZ_Assert(iObj->second, "Detected NULL replica pointer in replica map! (id=0x%x)", replicaId); return iObj->second; } - return ReplicaPtr(NULL); + return ReplicaPtr(nullptr); } //----------------------------------------------------------------------------- void ReplicaManager::_Unmarshal(ReadBuffer& rb, ReplicaPeer* pFrom) diff --git a/Code/Framework/GridMate/GridMate/Session/LANSession.cpp b/Code/Framework/GridMate/GridMate/Session/LANSession.cpp index e4e1c9e9b6..223085cf13 100644 --- a/Code/Framework/GridMate/GridMate/Session/LANSession.cpp +++ b/Code/Framework/GridMate/GridMate/Session/LANSession.cpp @@ -52,13 +52,13 @@ namespace GridMate MemberIDCompact GetID() const { return m_id; } - virtual AZStd::string ToString() const + AZStd::string ToString() const override { return AZStd::string::format("%x", m_id); } - virtual AZStd::string ToAddress() const { return m_address; } - virtual MemberIDCompact Compact() const { return m_id; } - virtual bool IsValid() const { return m_id != 0; } + AZStd::string ToAddress() const override { return m_address; } + MemberIDCompact Compact() const override { return m_id; } + bool IsValid() const override { return m_id != 0; } private: MemberIDCompact m_id; @@ -285,9 +285,9 @@ namespace GridMate static const char* GetChunkName() { return "GridMateLANMember"; } /// return an abstracted member id. (member ID is world unique but unrelated to player ID it's related to the session). - virtual const MemberID& GetId() const { return m_memberId; } + const MemberID& GetId() const override { return m_memberId; } /// returns a base player id, it's implementation is platform dependent. (NOT supported) - virtual const PlayerId* GetPlayerId() const { return nullptr; } + const PlayerId* GetPlayerId() const override { return nullptr; } /// Remote member ctor. LANMember(ConnectionID connId, const LANMemberID& id, LANSession* session); @@ -321,16 +321,16 @@ namespace GridMate friend class LANSessionService; public: GM_CLASS_ALLOCATOR(LANSearch); - virtual ~LANSearch(); + ~LANSearch() override; /// Return true if the search has finished, otherwise false. - virtual unsigned int GetNumResults() const { return static_cast(m_results.size()); } - virtual const SearchInfo* GetResult(unsigned int index) const { return &m_results[index]; } - virtual void AbortSearch(); + unsigned int GetNumResults() const override { return static_cast(m_results.size()); } + const SearchInfo* GetResult(unsigned int index) const override { return &m_results[index]; } + void AbortSearch() override; private: LANSearch(const LANSearchParams& searchParams, SessionService* service); - virtual void Update(); + void Update() override; void SearchDone(); Driver* m_driver; diff --git a/Code/Framework/GridMate/GridMate/Session/Session.cpp b/Code/Framework/GridMate/GridMate/Session/Session.cpp index 471e21127c..b731d82b71 100644 --- a/Code/Framework/GridMate/GridMate/Session/Session.cpp +++ b/Code/Framework/GridMate/GridMate/Session/Session.cpp @@ -63,40 +63,40 @@ namespace GridMate typedef unordered_set AddressSetType; GridSessionHandshake(unsigned int handshakeTimeoutMS, const VersionType& version); - virtual ~GridSessionHandshake() {} + ~GridSessionHandshake() override {} ////////////////////////////////////////////////////////////////////////// // Handshake /// Called from the system to write initial handshake data. - virtual void OnInitiate(ConnectionID id, WriteBuffer& wb); + void OnInitiate(ConnectionID id, WriteBuffer& wb) override; /** * Called when a system receives a handshake initiation from another system. * You can write a reply in the WriteBuffer. * return true if you accept this connection and false if you reject it. */ - virtual HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb); + HandshakeErrorCode OnReceiveRequest(ConnectionID id, ReadBuffer& rb, WriteBuffer& wb) override; /** * If we already have a valid connection and we receive another connection request, the system will * call this function to verify the state of the connection. */ - virtual bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb); + bool OnConfirmRequest(ConnectionID id, ReadBuffer& rb) override; /** * Called when we receive Ack from the other system on our initial data \ref OnInitiate. * return true to accept the ack or false to reject the handshake. */ - virtual bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering + bool OnReceiveAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering /** * Called when we receive Ack from the other system while we were connected. This callback is called * so we can just confirm that our connection is valid! */ - virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering + bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) override { (void)id; (void)rb; return true; } // we don't do any further filtering /// Return true if you want to reject early reject a connection. - virtual bool OnNewConnection(const AZStd::string& address); + bool OnNewConnection(const AZStd::string& address) override; /// Called when we close a connection. - virtual void OnDisconnect(ConnectionID id); + void OnDisconnect(ConnectionID id) override; /// Return timeout in milliseconds of the handshake procedure. - virtual unsigned int GetHandshakeTimeOutMS() const { return m_handshakeTimeOutMS; } + unsigned int GetHandshakeTimeOutMS() const override { return m_handshakeTimeOutMS; } ////////////////////////////////////////////////////////////////////////// void BanAddress(AZStd::string address); diff --git a/Code/Framework/GridMate/Tests/Carrier.cpp b/Code/Framework/GridMate/Tests/Carrier.cpp index 9a18eb9a2c..5b18a80221 100644 --- a/Code/Framework/GridMate/Tests/Carrier.cpp +++ b/Code/Framework/GridMate/Tests/Carrier.cpp @@ -90,7 +90,7 @@ public: { } - ~CarrierCallbacksHandler() + ~CarrierCallbacksHandler() override { CarrierEventBus::Handler::BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp b/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp index 6af6a6ab87..8ec3ad540f 100644 --- a/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp +++ b/Code/Framework/GridMate/Tests/CarrierStreamSocketDriverTests.cpp @@ -65,7 +65,7 @@ public: { } - ~CarrierStreamCallbacksHandler() + ~CarrierStreamCallbacksHandler() override { if (m_active) { diff --git a/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp b/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp index 22771cc035..f6f88d2dff 100644 --- a/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaBehavior.cpp @@ -282,7 +282,7 @@ namespace ReplicaBehavior { GM_CLASS_ALLOCATOR(EntityLikeScriptReplicaChunk); EntityLikeScriptReplicaChunk(); - ~EntityLikeScriptReplicaChunk() = default; + ~EntityLikeScriptReplicaChunk() override = default; ////////////////////////////////////////////////////////////////////// //! GridMate::ReplicaChunk overrides. @@ -296,7 +296,7 @@ namespace ReplicaBehavior { int GetMaxServerProperties() const { return k_maxScriptableDataSets; } - AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext); + AZ::u32 CalculateDirtyDataSetMask(MarshalContext& marshalContext) override; EntityLikeScriptDataSet m_scriptDataSets[k_maxScriptableDataSets]; AZ::u32 m_enabledDataSetMask; @@ -815,7 +815,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_ReplicaDefaultDataSetDriller() + ~Integ_ReplicaDefaultDataSetDriller() override { m_driller.BusDisconnect(); } @@ -928,7 +928,7 @@ namespace ReplicaBehavior { m_replicaU8Id = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica2); } - ~Integ_Replica_ComparePackingBoolsVsU8() + ~Integ_Replica_ComparePackingBoolsVsU8() override { m_driller.BusDisconnect(); } @@ -1057,7 +1057,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary() + ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary() override { m_driller.BusDisconnect(); } @@ -1154,7 +1154,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty() + ~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty() override { m_driller.BusDisconnect(); } @@ -1248,7 +1248,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckReplicaIsntSentWithNoChanges() + ~Integ_CheckReplicaIsntSentWithNoChanges() override { m_driller.BusDisconnect(); } @@ -1359,7 +1359,7 @@ namespace ReplicaBehavior { m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges() + ~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges() override { m_driller.BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/ReplicaMedium.cpp b/Code/Framework/GridMate/Tests/ReplicaMedium.cpp index c1148c4fdb..61fe9d65b2 100644 --- a/Code/Framework/GridMate/Tests/ReplicaMedium.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaMedium.cpp @@ -601,7 +601,7 @@ class MPSession { public: - ~MPSession() + ~MPSession() override { CarrierEventBus::Handler::BusDisconnect(); } @@ -2007,7 +2007,7 @@ public: m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~Integ_ReplicaDriller() + ~Integ_ReplicaDriller() override { m_driller.BusDisconnect(); } @@ -2893,7 +2893,7 @@ public: m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica); } - ~ReplicaACKfeedbackTestFixture() + ~ReplicaACKfeedbackTestFixture() override { m_driller.BusDisconnect(); } diff --git a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp index 3b3942e8f3..d71789ae90 100644 --- a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp @@ -254,7 +254,7 @@ public: s_nInstances++; } - ~OfflineChunk() + ~OfflineChunk() override { s_nInstances--; } @@ -273,7 +273,7 @@ public: return true; } - bool IsReplicaMigratable() { return true; } + bool IsReplicaMigratable() override { return true; } DataSet m_data1; DataSet::BindInterface m_data2; diff --git a/Code/Framework/GridMate/Tests/Session.cpp b/Code/Framework/GridMate/Tests/Session.cpp index 0c5baef483..d4f56871c5 100644 --- a/Code/Framework/GridMate/Tests/Session.cpp +++ b/Code/Framework/GridMate/Tests/Session.cpp @@ -71,7 +71,7 @@ namespace UnitTest AZ_TEST_ASSERT(GridMate::LANSessionServiceBus::FindFirstHandler(m_clientGridMate) != nullptr); ////////////////////////////////////////////////////////////////////////// } - virtual ~Integ_LANSessionMatchmakingParamsTest() + ~Integ_LANSessionMatchmakingParamsTest() override { SessionEventBus::MultiHandler::BusDisconnect(m_gridMate); SessionEventBus::MultiHandler::BusDisconnect(m_clientGridMate); @@ -290,7 +290,7 @@ namespace UnitTest AZ_TEST_ASSERT(LANSessionServiceBus::FindFirstHandler(m_peers[i].m_gridMate) != nullptr); } } - virtual ~Integ_LANSessionTest() + ~Integ_LANSessionTest() override { StopGridMateService(m_peers[0].m_gridMate); @@ -645,7 +645,7 @@ namespace UnitTest } } - virtual ~Integ_LANMultipleSessionTest() + ~Integ_LANMultipleSessionTest() override { GridMate::StopGridMateService(m_gridMates[0]); @@ -884,7 +884,7 @@ namespace UnitTest } } - virtual ~Integ_LANLatencySessionTest() + ~Integ_LANLatencySessionTest() override { StopGridMateService(m_gridMates[0]); @@ -1283,7 +1283,7 @@ namespace UnitTest //StartDrilling("lanmigration"); } - virtual ~Integ_LANSessionMigarationTestTest() + ~Integ_LANSessionMigarationTestTest() override { StopGridMateService(m_gridMates[0]); @@ -1597,7 +1597,7 @@ namespace UnitTest //StartDrilling("lanmigration2"); } - virtual ~Integ_LANSessionMigarationTestTest2() + ~Integ_LANSessionMigarationTestTest2() override { StopGridMateService(m_gridMates[0]); diff --git a/Code/Framework/GridMate/Tests/test_Main.cpp b/Code/Framework/GridMate/Tests/test_Main.cpp index 7fc71ef125..cbe4a09ef4 100644 --- a/Code/Framework/GridMate/Tests/test_Main.cpp +++ b/Code/Framework/GridMate/Tests/test_Main.cpp @@ -14,12 +14,12 @@ struct GridMateTestEnvironment : public AZ::Test::ITestEnvironment , public AZ::Debug::TraceMessageBus::Handler { - void SetupEnvironment() override final + void SetupEnvironment() final { AZ::AllocatorInstance::Create(); BusConnect(); } - void TeardownEnvironment() override final + void TeardownEnvironment() final { BusDisconnect(); AZ::AllocatorInstance::Destroy();