Modernization + AZStd::function compare fix. (#3680)
* Modernization + small fix. Modernize ( `bool`/`override`/other) code in AzCore, AzFramework, AzQtComponents, AzToolsFramework, etc. Replaced a `bind` or two, use `using` in a few places as well. Fix nullptr comparison of AZStd::function. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Apply review-based changes Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
@@ -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<uint64_t>(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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace AzFramework
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice)
|
||||
void OnInputDeviceDisconnectedEvent(const InputDevice& inputDevice) override
|
||||
{
|
||||
Call(FN_OnInputDeviceDisconnectedEvent, &inputDevice);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace AzFramework
|
||||
if (m_logFile)
|
||||
{
|
||||
delete m_logFile;
|
||||
m_logFile = NULL;
|
||||
m_logFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<MaterialLibraryAsset*>(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<MaterialSelection*>(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 "<error>";
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
+4
-4
@@ -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)
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ namespace AzFramework
|
||||
LinuxXcbConnectionManagerBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
~LinuxXcbConnectionManagerImpl()
|
||||
~LinuxXcbConnectionManagerImpl() override
|
||||
{
|
||||
LinuxXcbConnectionManagerBus::Handler::BusDisconnect();
|
||||
xcb_disconnect(m_xcbConnection);
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<const HatConfig*>(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<HatConfig*>(outBaseConfig))
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace UnitTest
|
||||
AllocatorsFixture::TearDown();
|
||||
}
|
||||
|
||||
virtual ~Base64Test()
|
||||
~Base64Test() override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace UnitTest
|
||||
Data::AssetManager::Create(desc);
|
||||
}
|
||||
|
||||
virtual ~EntityContextBasicTest()
|
||||
~EntityContextBasicTest() override
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user