Merge branch 'development' into cmake/warn_format_security

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	cmake/Platform/Common/Clang/Configurations_clang.cmake
This commit is contained in:
Esteban Papp
2021-09-03 11:10:40 -07:00
641 changed files with 32438 additions and 32687 deletions
@@ -90,6 +90,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_tableModel->setFilterRole(Qt::DisplayRole);
m_tableModel->setSourceModel(m_filterModel.data());
m_tableModel->setDynamicSortFilter(true);
m_ui->m_assetBrowserTableViewWidget->setModel(m_tableModel.data());
connect(
+2
View File
@@ -174,6 +174,8 @@ ly_add_target(
Legacy::EditorLib
ProjectManager
)
ly_set_gem_variant_to_load(TARGETS Editor VARIANTS Tools)
set_property(SOURCE
CryEdit.cpp
APPEND PROPERTY
+4
View File
@@ -573,6 +573,10 @@ static CVarBlock* VarBlockFromConsoleVars()
IVariable* pVariable = nullptr;
for (int i = 0; i < cmdCount; i++)
{
if (!cmds[i].data())
{
continue;
}
ICVar* pCVar = console->GetCVar(cmds[i].data());
if (!pCVar)
{
+17 -2
View File
@@ -551,7 +551,9 @@ public:
{ "NSDocumentRevisionsDebugMode", nsDocumentRevisionsDebugMode},
{ "skipWelcomeScreenDialog", m_bSkipWelcomeScreenDialog},
{ "autotest_mode", m_bAutotestMode},
{ "regdumpall", dummy }
{ "regdumpall", dummy },
{ "attach-debugger", dummy }, // Attaches a debugger for the current application
{ "wait-for-debugger", dummy }, // Waits until a debugger is attached to the current application
};
QString dummyString;
@@ -2290,7 +2292,7 @@ int CCryEditApp::IdleProcessing(bool bBackgroundUpdate)
int res = 0;
if (bIsAppWindow || m_bForceProcessIdle || m_bKeepEditorActive
// Automated tests must always keep the editor active, or they can get stuck
|| m_bAutotestMode)
|| m_bAutotestMode || m_bRunPythonTestScript)
{
res = 1;
bActive = true;
@@ -4011,6 +4013,19 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
{
CryAllocatorsRAII cryAllocatorsRAII;
// Debugging utilities
for (int i = 1; i < argc; ++i)
{
if (azstricmp(argv[i], "--attach-debugger") == 0)
{
AZ::Debug::Trace::AttachDebugger();
}
else if (azstricmp(argv[i], "--wait-for-debugger") == 0)
{
AZ::Debug::Trace::WaitForDebugger();
}
}
// ensure the EditorEventsBus context gets created inside EditorLib
[[maybe_unused]] const auto& editorEventsContext = AzToolsFramework::EditorEvents::Bus::GetOrCreateContext();
+13
View File
@@ -401,6 +401,16 @@ inline namespace Commands
{
return static_cast<int>(GetIEditor()->GetEditorConfigPlatform());
}
bool PyAttachDebugger()
{
return AZ::Debug::Trace::AttachDebugger();
}
bool PyWaitForDebugger(float timeoutSeconds = -1.f)
{
return AZ::Debug::Trace::WaitForDebugger(timeoutSeconds);
}
}
namespace AzToolsFramework
@@ -448,6 +458,9 @@ namespace AzToolsFramework
addLegacyGeneral(behaviorContext->Method("start_process_detached", PyStartProcessDetached, nullptr, "Launches a detached process with an optional space separated list of arguments."));
addLegacyGeneral(behaviorContext->Method("launch_lua_editor", PyLaunchLUAEditor, nullptr, "Launches the Lua editor, may receive a list of space separate file paths, or an empty string to only open the editor."));
addLegacyGeneral(behaviorContext->Method("attach_debugger", PyAttachDebugger, nullptr, "Prompts for attaching the debugger"));
addLegacyGeneral(behaviorContext->Method("wait_for_debugger", PyWaitForDebugger, behaviorContext->MakeDefaultValues(-1.f), "Pauses this thread execution until the debugger has been attached"));
// this will put these methods into the 'azlmbr.legacy.checkout_dialog' module
auto addCheckoutDialog = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
{
+1 -8
View File
@@ -47,7 +47,6 @@ struct ToolTip
class CEditorPanelUtils_Impl
: public IEditorPanelUtils
{
#pragma region Drag & Drop
public:
void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
{
@@ -56,8 +55,7 @@ public:
GetIEditor()->GetViewManager()->GetView(i)->SetGlobalDropCallback(dropCallback, custom);
}
}
#pragma endregion
#pragma region Preview Window
public:
int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
@@ -72,8 +70,6 @@ public:
settings->SetDebugFlags(flags);
}
#pragma endregion
#pragma region Shortcuts
protected:
QVector<HotKey> hotkeys;
bool m_hotkeysAreEnabled;
@@ -408,8 +404,6 @@ public:
return m_hotkeysAreEnabled;
}
#pragma endregion
#pragma region ToolTip
protected:
QMap<QString, ToolTip> m_tooltips;
@@ -539,7 +533,6 @@ public:
}
return GetToolTip(path).disabledContent;
}
#pragma endregion ToolTip
};
IEditorPanelUtils* CreateEditorPanelUtils()
+1 -1
View File
@@ -65,7 +65,7 @@ EditorPreferencesDialog::EditorPreferencesDialog(QWidget* pParent)
CEditorPreferencesPage_General::Reflect(*serializeContext);
CEditorPreferencesPage_Files::Reflect(*serializeContext);
CEditorPreferencesPage_ViewportGeneral::Reflect(*serializeContext);
CEditorPreferencesPage_ViewportGizmo::Reflect(*serializeContext);
CEditorPreferencesPage_ViewportManipulator::Reflect(*serializeContext);
CEditorPreferencesPage_ViewportMovement::Reflect(*serializeContext);
CEditorPreferencesPage_ViewportDebug::Reflect(*serializeContext);
CEditorPreferencesPage_ExperimentalLighting::Reflect(*serializeContext);
@@ -5,96 +5,57 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "EditorDefs.h"
#include "EditorPreferencesPageViewportGizmo.h"
// Editor
#include "EditorViewportSettings.h"
#include "Settings.h"
void CEditorPreferencesPage_ViewportGizmo::Reflect(AZ::SerializeContext& serialize)
void CEditorPreferencesPage_ViewportManipulator::Reflect(AZ::SerializeContext& serialize)
{
serialize.Class<AxisGizmo>()
->Version(1)
->Field("Size", &AxisGizmo::m_size)
->Field("Text", &AxisGizmo::m_text)
->Field("MaxCount", &AxisGizmo::m_maxCount);
serialize.Class<Manipulators>()->Version(1)->Field("LineBoundWidth", &Manipulators::m_manipulatorLineBoundWidth);
serialize.Class<Helpers>()
->Version(1)
->Field("LabelsOn", &Helpers::m_helpersGlobalScale)
->Field("LabelsOn", &Helpers::m_tagpointScaleMulti)
->Field("LabelsOn", &Helpers::m_rulerSphereScale)
->Field("LabelsDistance", &Helpers::m_rulerSphereTrans);
serialize.Class<CEditorPreferencesPage_ViewportManipulator>()->Version(2)->Field(
"Manipulators", &CEditorPreferencesPage_ViewportManipulator::m_manipulators);
serialize.Class<CEditorPreferencesPage_ViewportGizmo>()
->Version(1)
->Field("Axis Gizmo", &CEditorPreferencesPage_ViewportGizmo::m_axisGizmo)
->Field("Helpers", &CEditorPreferencesPage_ViewportGizmo::m_helpers);
AZ::EditContext* editContext = serialize.GetEditContext();
if (editContext)
if (AZ::EditContext* editContext = serialize.GetEditContext())
{
editContext->Class<AxisGizmo>("Axis Gizmo", "")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AxisGizmo::m_size, "Size", "Axis Gizmo Size")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &AxisGizmo::m_text, "Text Labels", "Text Labels on Axis Gizmo")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AxisGizmo::m_maxCount, "Max Count", "Max Count of Axis Gizmos");
editContext->Class<Manipulators>("Manipulators", "")
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &Manipulators::m_manipulatorLineBoundWidth, "Line Bound Width",
"Manipulator Line Bound Width")
->Attribute(AZ::Edit::Attributes::Min, 0.001f)
->Attribute(AZ::Edit::Attributes::Max, 2.0f);
editContext->Class<Helpers>("Helpers", "")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_helpersGlobalScale, "Helpers Scale", "Helpers Scale")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_tagpointScaleMulti, "Tagpoint Scale Multiplier", "Tagpoint Scale Multiplier")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_rulerSphereScale, "Ruler Sphere Scale", "Ruler Sphere Scale")
->Attribute(AZ::Edit::Attributes::Min, 0.1f)
->Attribute(AZ::Edit::Attributes::Max, 100.0f)
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &Helpers::m_rulerSphereTrans, "Ruler Sphere Transparency", "Ruler Sphere Transparency")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->Attribute(AZ::Edit::Attributes::Max, 100.0f);
editContext->Class<CEditorPreferencesPage_ViewportGizmo>("Gizmo Viewport Preferences", "Gizmo Viewport Preferences")
editContext
->Class<CEditorPreferencesPage_ViewportManipulator>("Manipulator Viewport Preferences", "Manipulator Viewport Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGizmo::m_axisGizmo, "Axis Gizmo", "Axis Gizmo")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportGizmo::m_helpers, "Helpers", "Helpers");
->DataElement(
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportManipulator::m_manipulators, "Manipulators", "Manipulators");
}
}
CEditorPreferencesPage_ViewportGizmo::CEditorPreferencesPage_ViewportGizmo()
CEditorPreferencesPage_ViewportManipulator::CEditorPreferencesPage_ViewportManipulator()
{
InitializeSettings();
m_icon = QIcon(":/res/Gizmos.svg");
}
QIcon& CEditorPreferencesPage_ViewportGizmo::GetIcon()
QIcon& CEditorPreferencesPage_ViewportManipulator::GetIcon()
{
return m_icon;
}
void CEditorPreferencesPage_ViewportGizmo::OnApply()
void CEditorPreferencesPage_ViewportManipulator::OnApply()
{
gSettings.gizmo.axisGizmoSize = m_axisGizmo.m_size;
gSettings.gizmo.axisGizmoText = m_axisGizmo.m_text;
gSettings.gizmo.axisGizmoMaxCount = m_axisGizmo.m_maxCount;
gSettings.gizmo.helpersScale = m_helpers.m_helpersGlobalScale;
gSettings.gizmo.tagpointScaleMulti = m_helpers.m_tagpointScaleMulti;
gSettings.gizmo.rulerSphereScale = m_helpers.m_rulerSphereScale;
gSettings.gizmo.rulerSphereTrans = m_helpers.m_rulerSphereTrans;
SandboxEditor::SetManipulatorLineBoundWidth(m_manipulators.m_manipulatorLineBoundWidth);
}
void CEditorPreferencesPage_ViewportGizmo::InitializeSettings()
void CEditorPreferencesPage_ViewportManipulator::InitializeSettings()
{
m_axisGizmo.m_size = gSettings.gizmo.axisGizmoSize;
m_axisGizmo.m_text = gSettings.gizmo.axisGizmoText;
m_axisGizmo.m_maxCount = gSettings.gizmo.axisGizmoMaxCount;
m_helpers.m_helpersGlobalScale = gSettings.gizmo.helpersScale;
m_helpers.m_tagpointScaleMulti = gSettings.gizmo.tagpointScaleMulti;
m_helpers.m_rulerSphereScale = gSettings.gizmo.rulerSphereScale;
m_helpers.m_rulerSphereTrans = gSettings.gizmo.rulerSphereTrans;
m_manipulators.m_manipulatorLineBoundWidth = SandboxEditor::ManipulatorLineBoundWidth();
}
@@ -5,59 +5,57 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include "Include/IPreferencesPage.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <QIcon>
class CEditorPreferencesPage_ViewportGizmo
: public IPreferencesPage
class CEditorPreferencesPage_ViewportManipulator : public IPreferencesPage
{
public:
AZ_RTTI(CEditorPreferencesPage_ViewportGizmo, "{14433511-8175-4348-954E-82D903475B06}", IPreferencesPage)
AZ_RTTI(CEditorPreferencesPage_ViewportManipulator, "{14433511-8175-4348-954E-82D903475B06}", IPreferencesPage)
static void Reflect(AZ::SerializeContext& serialize);
CEditorPreferencesPage_ViewportGizmo();
virtual ~CEditorPreferencesPage_ViewportGizmo() = default;
CEditorPreferencesPage_ViewportManipulator();
virtual ~CEditorPreferencesPage_ViewportManipulator() = default;
virtual const char* GetCategory() override
{
return "Viewports";
}
virtual const char* GetTitle() override
{
return "Manipulators";
}
virtual const char* GetCategory() override { return "Viewports"; }
virtual const char* GetTitle() override { return "Gizmos"; }
virtual QIcon& GetIcon() override;
virtual void OnApply() override;
virtual void OnCancel() override {}
virtual bool OnQueryCancel() override { return true; }
virtual void OnCancel() override
{
}
virtual bool OnQueryCancel() override
{
return true;
}
private:
void InitializeSettings();
struct AxisGizmo
struct Manipulators
{
AZ_TYPE_INFO(AxisGizmo, "{7D90D60E-996B-4F54-8748-B26EFA781EE2}")
AZ_TYPE_INFO(Manipulators, "{2974439C-4839-41F6-B526-F317999B9DB9}")
float m_size;
bool m_text;
int m_maxCount;
float m_manipulatorLineBoundWidth;
};
struct Helpers
{
AZ_TYPE_INFO(Helpers, "{EC99922E-F61C-4AA0-9A51-630E09AB55AA}")
float m_helpersGlobalScale;
float m_tagpointScaleMulti;
float m_rulerSphereScale;
float m_rulerSphereTrans;
};
AxisGizmo m_axisGizmo;
Helpers m_helpers;
Manipulators m_manipulators;
QIcon m_icon;
};
+11
View File
@@ -20,6 +20,7 @@ namespace SandboxEditor
constexpr AZStd::string_view AngleSnappingSetting = "/Amazon/Preferences/Editor/AngleSnapping";
constexpr AZStd::string_view AngleSizeSetting = "/Amazon/Preferences/Editor/AngleSize";
constexpr AZStd::string_view ShowGridSetting = "/Amazon/Preferences/Editor/ShowGrid";
constexpr AZStd::string_view ManipulatorLineBoundWidthSetting = "/Amazon/Preferences/Editor/Manipulator/LineBoundWidth";
constexpr AZStd::string_view CameraTranslateSpeedSetting = "/Amazon/Preferences/Editor/Camera/TranslateSpeed";
constexpr AZStd::string_view CameraBoostMultiplierSetting = "/Amazon/Preferences/Editor/Camera/BoostMultiplier";
constexpr AZStd::string_view CameraRotateSpeedSetting = "/Amazon/Preferences/Editor/Camera/RotateSpeed";
@@ -156,6 +157,16 @@ namespace SandboxEditor
SetRegistry(ShowGridSetting, showing);
}
float ManipulatorLineBoundWidth()
{
return aznumeric_cast<float>(GetRegistry(ManipulatorLineBoundWidthSetting, 0.1));
}
void SetManipulatorLineBoundWidth(const float lineBoundWidth)
{
SetRegistry(ManipulatorLineBoundWidthSetting, lineBoundWidth);
}
float CameraTranslateSpeed()
{
return aznumeric_cast<float>(GetRegistry(CameraTranslateSpeedSetting, 10.0));
+3
View File
@@ -47,6 +47,9 @@ namespace SandboxEditor
SANDBOX_API bool ShowingGrid();
SANDBOX_API void SetShowingGrid(bool showing);
SANDBOX_API float ManipulatorLineBoundWidth();
SANDBOX_API void SetManipulatorLineBoundWidth(float lineBoundWidth);
SANDBOX_API float CameraTranslateSpeed();
SANDBOX_API void SetCameraTranslateSpeed(float speed);
+6
View File
@@ -121,6 +121,7 @@ struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::Vi
bool ShowGrid() const override;
bool AngleSnappingEnabled() const override;
float AngleStep() const override;
float ManipulatorLineBoundWidth() const override;
};
static const EditorViewportSettings g_EditorViewportSettings;
@@ -2559,6 +2560,11 @@ float EditorViewportSettings::AngleStep() const
return SandboxEditor::AngleSnappingSize();
}
float EditorViewportSettings::ManipulatorLineBoundWidth() const
{
return SandboxEditor::ManipulatorLineBoundWidth();
}
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
bool EditorViewportWidget::ShouldPreviewFullscreen() const
+2 -10
View File
@@ -84,12 +84,6 @@ AZ_POP_DISABLE_WARNING
#include "IEditorPanelUtils.h"
#include "EditorPanelUtils.h"
// even in Release mode, the editor will return its heap, because there's no Profile build configuration for the editor
#ifdef _RELEASE
#undef _RELEASE
#endif
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
static CCryEditDoc * theDocument;
@@ -104,8 +98,6 @@ static CCryEditDoc * theDocument;
#define VERIFY(EXPRESSION) { auto e = EXPRESSION; assert(e); }
#endif
#undef GetCommandLine
const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json";
CEditorImpl::CEditorImpl()
@@ -688,8 +680,8 @@ const SGizmoParameters& CEditorImpl::GetGlobalGizmoParameters()
m_pGizmoParameters->axisConstraint = m_selectedAxis;
m_pGizmoParameters->referenceCoordSys = m_refCoordsSys;
m_pGizmoParameters->axisGizmoScale = gSettings.gizmo.axisGizmoSize;
m_pGizmoParameters->axisGizmoText = gSettings.gizmo.axisGizmoText;
m_pGizmoParameters->axisGizmoScale = 1.0f;
m_pGizmoParameters->axisGizmoText = false;
return *m_pGizmoParameters;
}
+2
View File
@@ -76,6 +76,7 @@
</qresource>
<qresource prefix="/Application">
<file>res/o3de_editor.ico</file>
<file alias="o3de_application_reverse.svg">res/o3de_application_reverse.svg</file>
</qresource>
<qresource prefix="/Icons">
<file alias="Eye.svg">res/Eye.svg</file>
@@ -152,6 +153,7 @@
<file alias="error_report_error.svg">res/error_report_error.svg</file>
<file alias="error_report_warning.svg">res/error_report_warning.svg</file>
<file alias="error_report_comment.svg">res/error_report_comment.svg</file>
<file alias="error_report_helper.svg">res/error_report_helper.svg</file>
<file>particles_tree_00.png</file>
<file>particles_tree_01.png</file>
<file>particles_tree_02.png</file>
+1 -1
View File
@@ -2378,7 +2378,7 @@ void CObjectManager::SetObjectSelected(CBaseObject* pObject, bool bSelect)
if (bSelect && !GetIEditor()->GetTransformManipulator())
{
if (CAxisGizmo::GetGlobalAxisGizmoCount() < gSettings.gizmo.axisGizmoMaxCount)
if (CAxisGizmo::GetGlobalAxisGizmoCount() < 1 /*legacy axisGizmoMaxCount*/)
{
// Create axis gizmo for this object.
m_gizmoManager->AddGizmo(new CAxisGizmo(pObject));
@@ -33,7 +33,7 @@
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128 _2x.png",
"filename" : "icon_128_2x.png",
"scale" : "2x"
},
{
@@ -45,7 +45,7 @@
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256 _2x.png",
"filename" : "icon_256_2x.png",
"scale" : "2x"
},
{
@@ -65,4 +65,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc
size 27833
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1
size 20779
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2
size 48899
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666
size 24003
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf
size 48899
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f
size 114706
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -33,7 +33,7 @@
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128 _2x.png",
"filename" : "icon_128_2x.png",
"scale" : "2x"
},
{
@@ -45,7 +45,7 @@
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256 _2x.png",
"filename" : "icon_256_2x.png",
"scale" : "2x"
},
{
@@ -65,4 +65,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc
size 27833
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1
size 20779
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2
size 48899
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666
size 24003
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf
size 48899
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f
size 114706
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
+1 -1
View File
@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
processLaunchInfo.m_environmentVariables = &envVars;
processLaunchInfo.m_showWindow = true;
AZStd::unique_ptr<AzFramework::ProcessWatcher> processWatcher(AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE));
AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
application.Destroy();
@@ -48,7 +48,6 @@ OutlinerCheckBox
spacing: 0px;
padding: 0px;
line-height: 0px;
font-size: 0px;
margin: 0px;
background-color: none;
max-height: 20px;
@@ -66,7 +65,6 @@ OutlinerCheckBox::indicator
spacing: 0px;
padding: 0px;
line-height: 0px;
font-size: 0px;
margin: 0;
}
+1 -1
View File
@@ -36,7 +36,7 @@ CStdPreferencesClassDesc::CStdPreferencesClassDesc()
[](){ return new CEditorPreferencesPage_Files(); },
[](){ return new CEditorPreferencesPage_ViewportGeneral(); },
[](){ return new CEditorPreferencesPage_ViewportMovement(); },
[](){ return new CEditorPreferencesPage_ViewportGizmo(); },
[](){ return new CEditorPreferencesPage_ViewportManipulator(); },
[](){ return new CEditorPreferencesPage_ViewportDebug(); }
};
-38
View File
@@ -35,7 +35,6 @@
#include "CryEdit.h"
#include "MainWindow.h"
#pragma comment(lib, "Gdi32.lib")
//////////////////////////////////////////////////////////////////////////
// Global Instance of Editor settings.
@@ -83,7 +82,6 @@ private:
namespace
{
class QtApplicationListener
: public AzToolsFramework::EditorEvents::Bus::Handler
{
@@ -100,20 +98,8 @@ namespace
delete this;
}
};
}
//////////////////////////////////////////////////////////////////////////
SGizmoSettings::SGizmoSettings()
{
axisGizmoSize = 0.2f;
axisGizmoText = true;
axisGizmoMaxCount = 50;
helpersScale = 1.f;
tagpointScaleMulti = 0.5f;
rulerSphereScale = 0.5f;
rulerSphereTrans = 0.5f;
}
//////////////////////////////////////////////////////////////////////////
SEditorSettings::SEditorSettings()
{
@@ -565,18 +551,6 @@ void SEditorSettings::Save()
SaveValue("Settings", "ShowScaleWarnings", viewports.bShowScaleWarnings);
SaveValue("Settings", "ShowRotationWarnings", viewports.bShowRotationWarnings);
//////////////////////////////////////////////////////////////////////////
// Gizmos.
//////////////////////////////////////////////////////////////////////////
SaveValue("Settings", "AxisGizmoSize", gizmo.axisGizmoSize);
SaveValue("Settings", "AxisGizmoText", gizmo.axisGizmoText);
SaveValue("Settings", "AxisGizmoMaxCount", gizmo.axisGizmoMaxCount);
SaveValue("Settings", "HelpersScale", gizmo.helpersScale);
SaveValue("Settings", "TagPointScaleMulti", gizmo.tagpointScaleMulti);
SaveValue("Settings", "RulerSphereScale", gizmo.rulerSphereScale);
SaveValue("Settings", "RulerSphereTrans", gizmo.rulerSphereTrans);
//////////////////////////////////////////////////////////////////////////
SaveValue("Settings", "TextEditorScript", textEditorForScript);
SaveValue("Settings", "TextEditorShaders", textEditorForShaders);
SaveValue("Settings", "TextEditorBSpaces", textEditorForBspaces);
@@ -770,18 +744,6 @@ void SEditorSettings::Load()
LoadValue("Settings", "ShowScaleWarnings", viewports.bShowScaleWarnings);
LoadValue("Settings", "ShowRotationWarnings", viewports.bShowRotationWarnings);
//////////////////////////////////////////////////////////////////////////
// Gizmos.
//////////////////////////////////////////////////////////////////////////
LoadValue("Settings", "AxisGizmoSize", gizmo.axisGizmoSize);
LoadValue("Settings", "AxisGizmoText", gizmo.axisGizmoText);
LoadValue("Settings", "AxisGizmoMaxCount", gizmo.axisGizmoMaxCount);
LoadValue("Settings", "HelpersScale", gizmo.helpersScale);
LoadValue("Settings", "TagPointScaleMulti", gizmo.tagpointScaleMulti);
LoadValue("Settings", "RulerSphereScale", gizmo.rulerSphereScale);
LoadValue("Settings", "RulerSphereTrans", gizmo.rulerSphereTrans);
//////////////////////////////////////////////////////////////////////////
LoadValue("Settings", "TextEditorScript", textEditorForScript);
LoadValue("Settings", "TextEditorShaders", textEditorForShaders);
LoadValue("Settings", "TextEditorBSpaces", textEditorForBspaces);
-18
View File
@@ -22,22 +22,6 @@
#include <AzQtComponents/Components/Widgets/ToolBar.h>
struct SGizmoSettings
{
float axisGizmoSize;
bool axisGizmoText;
int axisGizmoMaxCount;
float helpersScale;
float tagpointScaleMulti;
// Scale size and transparency for debug spheres when using Ruler tool
float rulerSphereScale;
float rulerSphereTrans;
SGizmoSettings();
};
//////////////////////////////////////////////////////////////////////////
// Settings for snapping in the viewports.
//////////////////////////////////////////////////////////////////////////
@@ -381,8 +365,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
//! Keeps the editor active even if no focus is set
int keepEditorActive;
SGizmoSettings gizmo;
// Settings of the snapping.
SSnapSettings snap;
@@ -2505,7 +2505,6 @@ OutlinerCheckBox
spacing: 0px;
padding: 0px;
line-height: 0px;
font-size: 0px;
margin: 2px 2px 0 2px;
background-color: none;
max-height: 20px;
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="21px" height="21px" viewBox="0 0 21 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Icons / Notification / Helpers</title>
<g id="primary-use-cases" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Screen-1-Copy-61" transform="translate(-620.000000, -295.000000)">
<g id="Modals-/-Scrollable-Modal" transform="translate(594.114148, 244.000000)">
<g id="Group" transform="translate(24.000000, 49.500000)">
<rect id="Icon-Background" x="0" y="0" width="24" height="24"></rect>
<path d="M12,2 C17.5228475,2 22,6.4771525 22,12 C22,17.5228475 17.5228475,22 12,22 C6.4771525,22 2,17.5228475 2,12 C2,6.4771525 6.4771525,2 12,2 Z M12.4748737,17 L10.4748737,17 L10.4748737,20 L12.4748737,20 L12.4748737,17 Z M8.47487373,5 L5.5,8.06066017 L6.91421356,9.47487373 L9.324,7 L14.9,7 L16,7.888 L16,11.306 L15.501,12 L10.4748737,12 L10.4748737,15 L12.4748737,15 L12.474,14 L16.4748737,14 L17.998,12 L18,12 L18,7 L15.4748737,5 L8.47487373,5 Z" id="Combined-Shape" fill="#FFFFFF"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="21px" viewBox="0 0 24 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>o3de icon</title>
<g id="o3de-icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Mono-Reversed" transform="translate(0.000000, 0.000000)" fill="#000000" fill-rule="nonzero">
<path d="M21.1541405,17.6979529 C19.3400003,19.4999226 16.9380429,20.4923077 14.3913014,20.4923077 L14.390648,20.4923077 L14.3450938,20.4923077 C11.7797759,20.4803636 9.3640962,19.4651168 7.54323489,17.6334736 C5.11112576,15.1866169 4.27677437,11.7429896 5.03495316,8.61000159 L8.51135509,8.61000159 C8.23037526,9.33504454 8.08409772,10.1140225 8.08885851,10.9163286 C8.09866013,12.5958715 8.76171652,14.1683842 9.95574077,15.3439429 C11.1512586,16.5210879 12.7239055,17.1693342 14.3843003,17.1693342 L14.4020365,17.1692408 C16.0735398,17.163922 17.6458133,16.505038 18.8316229,15.3138961 C20.0308746,14.109317 20.6859031,12.5198213 20.6761947,10.8382256 C20.6663931,9.15513684 19.9919482,7.57151988 18.7770139,6.37907152 C17.5971786,5.2210557 16.046842,4.58577998 14.4049303,4.58577998 C14.3803796,4.58577998 14.3559222,4.5859666 14.3311848,4.58624655 C13.4169268,4.59604442 12.5319804,4.80254636 11.7229265,5.18298395 L11.7229265,1.63624556 C12.5795883,1.3889658 13.4737762,1.25879399 14.3867273,1.25879399 L14.4338684,1.25879399 C17.005814,1.27120464 19.4248544,2.29568939 21.2452489,4.14366241 C23.038479,5.96410807 24.0166808,8.37475921 23.9997847,10.9315387 C23.9828886,13.4891581 22.9722947,15.8920641 21.1541405,17.6979529 L21.1541405,17.6979529 Z M1.11066379,1.9110527 L3.02244681,1.9110527 L3.02244681,0 L1.11066379,0 L1.11066379,1.9110527 Z M0,7.6534488 L2.99948301,7.6534488 L2.99948301,4.65511162 L0,4.65511162 L0,7.6534488 Z M4.90426487,6.43272657 L9.52867009,6.43272657 L9.52867009,1.8100879 L4.90426487,1.8100879 L4.90426487,6.43272657 Z" id="Fill-2"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -456,7 +456,7 @@ namespace AZ
{
if (loadBehavior & (1 << thisFlag))
{
returnFlags[thisFlag] = 1;
returnFlags[thisFlag] = true;
}
}
return returnFlags;
@@ -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 <class Bus>
struct AssetJobConnectionPolicy
@@ -107,7 +107,7 @@ namespace AZ
virtual void OnLoadCanceled(AssetId assetId) = 0;
};
typedef EBus<BlockingAssetLoadEvents> BlockingAssetLoadBus;
using BlockingAssetLoadBus = EBus<BlockingAssetLoadEvents>;
/*
* This class processes async AssetDatabase load jobs
@@ -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);
});
}
}
@@ -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<unsigned int>(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;
@@ -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;
}
+39 -1
View File
@@ -25,6 +25,7 @@
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/Module/Environment.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/std/chrono/chrono.h>
namespace AZ
{
@@ -33,6 +34,7 @@ namespace AZ
namespace Platform
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
bool AttachDebugger();
bool IsDebuggerPresent();
void HandleExceptions(bool isEnabled);
void DebugBreak();
@@ -141,6 +143,42 @@ namespace AZ
#endif
}
bool
Trace::AttachDebugger()
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
return Platform::AttachDebugger();
#else
return false;
#endif
}
bool
Trace::WaitForDebugger([[maybe_unused]] float timeoutSeconds/*=-1.f*/)
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
using AZStd::chrono::system_clock;
using AZStd::chrono::time_point;
using AZStd::chrono::milliseconds;
milliseconds timeoutMs = milliseconds(aznumeric_cast<long long>(timeoutSeconds * 1000));
system_clock clock;
time_point start = clock.now();
auto hasTimedOut = [&clock, start, timeoutMs]()
{
return timeoutMs.count() >= 0 && (clock.now() - start) >= timeoutMs;
};
while (!AZ::Debug::Trace::IsDebuggerPresent() && !hasTimedOut())
{
AZStd::this_thread::sleep_for(milliseconds(1));
}
return AZ::Debug::Trace::IsDebuggerPresent();
#else
return false;
#endif
}
//=========================================================================
// HandleExceptions
// [8/3/2009]
@@ -180,7 +218,7 @@ namespace AZ
void Debug::Trace::Crash()
{
int* p = 0;
int* p = nullptr;
*p = 1;
}
+7 -5
View File
@@ -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,
@@ -49,6 +49,8 @@ namespace AZ
*/
static const char* GetDefaultSystemWindow();
static bool IsDebuggerPresent();
static bool AttachDebugger();
static bool WaitForDebugger(float timeoutSeconds = -1.f);
/// True or false if we want to handle system exceptions.
static void HandleExceptions(bool isEnabled);
@@ -107,7 +109,7 @@ namespace AZ
* Correct usage:
* AZ_Assert(false, "Fail always");
*/
namespace AZ
{
namespace TraceInternal
@@ -119,7 +121,7 @@ namespace AZ
static constexpr ExpressionValidResult value = ExpressionValidResult::Valid;
};
template<>
struct ExpressionIsValid<const char*&>
struct ExpressionIsValid<const char*&>
{
static constexpr ExpressionValidResult value = ExpressionValidResult::Valid;
};
@@ -226,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
@@ -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<DrillerEBusMutex::MutexType> 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<unsigned int>(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));
@@ -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<unsigned int>(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);
}
@@ -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<CompressorZLibData*>(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<CompressorZLibData*>(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<unsigned char*>(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
+25 -6
View File
@@ -11,6 +11,7 @@
#include <AzCore/std/containers/array.h>
#include <AzCore/std/string/wildcard.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/AzCore_Traits_Platform.h>
// extern instantiations of Path templates to prevent implicit instantiations
namespace AZ::IO
@@ -92,11 +93,23 @@ namespace AZ::IO::Internal
constexpr auto ConsumeRootName(InputIt entryBeginIter, InputIt entryEndIter, const char preferredSeparator)
-> AZStd::enable_if_t<AZStd::Internal::is_forward_iterator_v<InputIt>, InputIt>
{
if (preferredSeparator == '/')
if (preferredSeparator == PosixPathSeparator)
{
// If the preferred separator is forward slash the parser is in posix path
// parsing mode, which doesn't have a root name
// parsing mode, which doesn't have a root name,
// unless we're on a posix platform that uses a custom path root separator
#if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR)
const AZStd::string_view path{ entryBeginIter, entryEndIter };
const auto positionOfPathSeparator = path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR);
if (positionOfPathSeparator == AZStd::string_view::npos)
{
return entryBeginIter;
}
const AZStd::string_view rootName{ path.substr(0, positionOfPathSeparator + 1) };
return AZStd::next(entryBeginIter, rootName.size());
#else
return entryBeginIter;
#endif
}
else
{
@@ -185,13 +198,18 @@ namespace AZ::IO::Internal
template <typename InputIt, typename EndIt, typename = AZStd::enable_if_t<AZStd::Internal::is_input_iterator_v<InputIt>>>
static constexpr bool IsAbsolute(InputIt first, EndIt last, const char preferredSeparator)
{
size_t pathSize = AZStd::distance(first, last);
// If the preferred separator is a forward slash
// than an absolute path is simply one that starts with a forward slash
if (preferredSeparator == '/')
// than an absolute path is simply one that starts with a forward slash,
// unless we're on a posix platform that uses a custom path root separator
if (preferredSeparator == PosixPathSeparator)
{
#if defined(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR)
const AZStd::string_view path{ first, last };
return path.find(AZ_TRAIT_CUSTOM_PATH_ROOT_SEPARATOR) != AZStd::string_view::npos;
#else
const size_t pathSize = AZStd::distance(first, last);
return pathSize > 0 && IsSeparator(*first);
#endif
}
else
{
@@ -199,6 +217,7 @@ namespace AZ::IO::Internal
{
// If a windows path ends starts with C:foo it is a root relative path
// A path is absolute root absolute on windows if it starts with <drive_letter><colon><path_separator>
const size_t pathSize = AZStd::distance(first, last);
return pathSize > 2 && Internal::IsSeparator(*AZStd::next(first, 2));
}
@@ -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()
@@ -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)
{
@@ -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, &notifyFlag);
ProcessJobsAssist(info, nullptr, &notifyFlag);
}
else
{
ProcessJobsSynchronous(info, NULL, &notifyFlag);
ProcessJobsSynchronous(info, nullptr, &notifyFlag);
}
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<bool>* 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
+2 -2
View File
@@ -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
{
+2 -2
View File
@@ -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();
}
@@ -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<AZ::Debug::StackFrame*>(m_records.get_allocator().allocate(sizeof(AZ::Debug::StackFrame)*m_numStackLevels, 1)) : nullptr;
if (ai.m_stackFrames)
@@ -39,9 +39,9 @@ namespace AZ
return AZStd::hash<AZStd::string_view>{}(key);
}
};
typedef AZStd::basic_string<char, AZStd::char_traits<char>, AZStdIAllocator> AMString;
typedef AZStd::unordered_map<AMString, IAllocator*, AMStringHasher, AZStd::equal_to<>, AZStdIAllocator> AllocatorNameMap;
typedef AZStd::unordered_map<AMString, AMString, AMStringHasher, AZStd::equal_to<>, AZStdIAllocator> AllocatorRemappings;
using AMString = AZStd::basic_string<char, AZStd::char_traits<char>, AZStdIAllocator>;
using AllocatorNameMap = AZStd::unordered_map<AMString, IAllocator*, AMStringHasher, AZStd::equal_to<>, AZStdIAllocator>;
using AllocatorRemappings = AZStd::unordered_map<AMString, AMString, AMStringHasher, AZStd::equal_to<>, 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<size_t>(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);
}
}
}
@@ -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;
}
//=========================================================================
@@ -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<SystemAllocator>::Get()))
, m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != NULL ? desc.m_mapAllocator : &AllocatorInstance<SystemAllocator>::Get()))
, m_freeChunksMap(FreeMapType::key_compare(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance<SystemAllocator>::Get()))
, m_allocChunksMap(AllocMapType::hasher(), AllocMapType::key_eq(), AZStdIAllocator(desc.m_mapAllocator != nullptr ? desc.m_mapAllocator : &AllocatorInstance<SystemAllocator>::Get()))
{
if (m_desc.m_mapAllocator == NULL)
if (m_desc.m_mapAllocator == nullptr)
{
m_desc.m_mapAllocator = &AllocatorInstance<SystemAllocator>::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<char*>(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;
}
@@ -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<SystemAllocator>::IsReady(), "You requested to allocate memory using the system allocator, but it's not created yet!");
m_subAllocator = &AllocatorInstance<SystemAllocator>::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
@@ -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<size_t>(m_desc.m_fixedMemoryBlock) & static_cast<size_t>(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;
}
@@ -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
}
@@ -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");
@@ -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<mutex_type> lock_type;
using mutex_type = AZStd::mutex;
using lock_type = AZStd::lock_guard<mutex_type>;
AZStd::unique_ptr<OverrunDetectionSchema::PlatformAllocator> m_platformAllocator;
mutex_type m_mutex;
@@ -278,7 +278,7 @@ namespace AZ
Page* page = reinterpret_cast<Page*>(memBlock);
if (!page->m_magic.Validate())
{
return NULL;
return nullptr;
}
return page;
}
@@ -403,7 +403,7 @@ PoolAllocation<Allocator>::Allocate(size_t byteSize, size_t alignment)
u32 bucketIndex = static_cast<u32>((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<Allocator>::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<Allocator>::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<Allocator>::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<Allocator>::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<SystemAllocator>::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<SystemAllocator>::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<AZStd::recursive_mutex> 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);
}
@@ -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));
@@ -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<EnvironmentVariableHolderBase*>(variableIt.second);
if (holder)
@@ -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;
}
@@ -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<BehaviorMethod*> BehaviorClass::GetOverloads(const AZStd::string& name) const
{
AZStd::vector<BehaviorMethod*> overloads;
auto methodIter = m_methods.find(name);
if (methodIter != m_methods.end())
{
overloads = GetOverloadsIncludeMethod(methodIter->second);
}
}
return overloads;
}
AZStd::vector<BehaviorMethod*> BehaviorClass::GetOverloadsIncludeMethod(BehaviorMethod* method) const
{
AZStd::vector<BehaviorMethod*> overloads;
auto iter = method;
while (iter)
{
@@ -546,7 +546,7 @@ namespace AZ
AZStd::vector<BehaviorMethod*> BehaviorClass::GetOverloadsExcludeMethod(BehaviorMethod* method) const
{
AZStd::vector<BehaviorMethod*> overloads;
auto iter = method->m_overload;
while (iter)
{
@@ -972,5 +972,5 @@ namespace AZ
return enumRttiHelper.GetTypeId();
}
}
} // namespace AZ
@@ -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<T> 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<class T>
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<BehaviorParameterMetadata, sizeof...(Args)+s_startNamedArgumentIndex> 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<bool IsBusId>
inline AZStd::enable_if_t<IsBusId> SetBusIdType();
@@ -813,7 +813,7 @@ namespace AZ
: SetFunctionParameters<R(C::*)(Args...)>
{};
#endif
template<class FunctionType>
struct BehaviorOnDemandReflectHelper;
template<class R, class... Args>
@@ -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<AZ::Uuid> m_baseClasses;
AZStd::vector<AZ::Uuid> m_baseClasses;
AZStd::unordered_map<AZStd::string, BehaviorMethod*> m_methods;
AZStd::unordered_map<AZStd::string, BehaviorProperty*> 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<decltype(valueAddress)>::Get<valueAddress>
@@ -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<BehaviorContextEvents>;
/**
* 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<class Bus>
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<class T>
static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator<T>*/)
{
static void SetClassDefaultAllocator(BehaviorClass* behaviorClass, const AZStd::false_type& /*HasAZClassAllocator<T>*/)
{
behaviorClass->m_allocate = &DefaultSystemAllocator<T>::Allocate;
behaviorClass->m_deallocate = &DefaultSystemAllocator<T>::DeAllocate;
}
@@ -1522,20 +1522,20 @@ namespace AZ
}
template<class T>
static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible<T>*/)
static void SetClassDefaultConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_constructible<T>*/)
{
behaviorClass->m_defaultConstructor = &DefaultConstruct<T>;
}
template<class T>
static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible<T>*/)
static void SetClassDefaultDestructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_destructible<T>*/)
{
behaviorClass->m_destructor = &DefaultDestruct<T>;
}
template<class T>
static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible<T>*/)
{
static void SetClassDefaultCopyConstructor(BehaviorClass* behaviorClass, const AZStd::true_type& /*AZStd::is_copy_constructible<T>*/)
{
behaviorClass->m_cloner = &DefaultCopyConstruct<T>;
}
@@ -1585,7 +1585,7 @@ namespace AZ
const char* m_name;
BehaviorMethod* m_method;
};
struct GlobalPropertyBuilder : public AZ::Internal::GenericAttributes<GlobalPropertyBuilder>
{
typedef AZ::Internal::GenericAttributes<GlobalPropertyBuilder> 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<ParameterOverrides, AZStd::function_traits<Function>::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<class Function>
@@ -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<class Function>
GlobalMethodBuilder Method(const char* name, Function f, const char* deprecatedName, BehaviorValues* defaultValues = nullptr, const char* dbgDesc = nullptr);
template<class Function>
GlobalMethodBuilder Method(const char* name, Function f, const AZStd::array<BehaviorParameterOverrides, AZStd::function_traits<Function>::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<class R, class... Args>
void BehaviorEBusHandler::CallResult(R& result, int index, Args&&... args) const
{
@@ -2904,7 +2904,7 @@ namespace AZ
{
return ClassBuilder<T>(this, static_cast<BehaviorClass*>(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<T>(this, static_cast<BehaviorClass*>(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<class T>
BehaviorContext::EBusBuilder<T> 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<R>(m_parameters, this);
SetParameters<Args...>(&m_parameters[s_startNamedArgumentIndex], this);
}
//////////////////////////////////////////////////////////////////////////
template<class R, class... Args>
bool BehaviorMethodImpl<R(Args...)>::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<BehaviorValueParameter*>(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<class R, class C, class... Args>
bool BehaviorMethodImpl<R(C::*)(Args...)>::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<BehaviorValueParameter*>(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<class EBus, BehaviorEventType EventType, class R, class C, class... Args>
template<bool IsBusId>
@@ -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<BehaviorValueParameter*>(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<class R, class... Args>
void SetFunctionParameters<R(Args...)>::Set(AZStd::vector<BehaviorParameter>& params)
{
// result, userdata, arguments
// result, userdata, arguments
params.resize(sizeof...(Args) + eBehaviorBusForwarderEventIndices::ParameterFirst);
SetParameters<R>(&params[eBehaviorBusForwarderEventIndices::Result], nullptr);
SetParameters<void*>(&params[eBehaviorBusForwarderEventIndices::UserData], nullptr);
@@ -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)
{
@@ -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<int>(strtol(valueName + 1, NULL, 10));
valueTableIndex = static_cast<int>(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<lua_Number>(strtod(value.m_value.c_str(), NULL)));
lua_pushnumber(l, static_cast<lua_Number>(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<lua_Number>(strtod(subElement.m_value.c_str(), NULL)));
lua_pushnumber(l, static_cast<lua_Number>(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)
@@ -42,7 +42,7 @@ namespace AZ
AZ_Assert(targetPointer, "You must provide a target pointer");
bool foundSuccess = false;
typedef AZStd::function<void(void**, const SerializeContext::ClassData**, const Uuid&, SerializeContext*)> CreationCallback;
using CreationCallback = AZStd::function<void (void **, const SerializeContext::ClassData **, const Uuid &, SerializeContext *)>;
auto handler = [&targetPointer, objectClassData, &foundSuccess](void** instance, const SerializeContext::ClassData** classData, const Uuid& classId, SerializeContext* context)
{
void* convertibleInstance{};
@@ -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<size_t>(stream.Write(sizeof(T), reinterpret_cast<void*>(&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<size_t>(stream.Write(sizeof(T), reinterpret_cast<void*>(&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<size_t>(stream.Write(sizeof(T), reinterpret_cast<void*>(&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<size_t>(stream.Write(sizeof(T), reinterpret_cast<void*>(&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<size_t>(stream.Write(sizeof(AZ::s64), reinterpret_cast<void*>(&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<size_t>(stream.Write(sizeof(AZ::u64), reinterpret_cast<void*>(&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<T>(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<IDataContainer> 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<void* const*>(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;
@@ -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<AZ::Uuid> 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<class ValueType>
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<ClassType>::Name());
// SerializeGenericTypeInfo<ValueType>::GetClassTypeId() is needed solely because
// SerializeGenericTypeInfo<ValueType>::GetClassTypeId() is needed solely because
// the SerializeGenericTypeInfo specialization for AZ::Data::Asset<T> returns the GetAssetClassId() value
// and not the AzTypeInfo<AZ::Data::Asset<T>>::Uuid()
// Therefore in order to remain backwards compatible the SerializeGenericTypeInfo<ValueType>::GetClassTypeId specialization
@@ -550,7 +550,7 @@ namespace AZ::SettingsRegistryMergeUtils
}
registry.Set(FilePathKey_ProjectUserPath, projectUserPath.Native());
// Set the user directory with the provided path or using project/user as default
// Set the log directory with the provided path or using project/user/log as default
auto projectLogPathKey = FixedValueString::format("%s/project_log_path", BootstrapSettingsRootKey);
AZ::IO::FixedMaxPath projectLogPath;
if (!registry.Get(projectLogPath.Native(), projectLogPathKey))
@@ -640,7 +640,7 @@ namespace AZ::SettingsRegistryMergeUtils
}
#if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
// Setup the cache and user paths when to platform specific locations when running on non-host platforms
// Setup the cache, user, and log paths to platform specific locations when running on non-host platforms
path = engineRoot;
if (AZStd::optional<AZ::IO::FixedMaxPathString> nonHostCacheRoot = Utils::GetDefaultAppRootPath();
nonHostCacheRoot)
@@ -656,13 +656,16 @@ namespace AZ::SettingsRegistryMergeUtils
if (AZStd::optional<AZ::IO::FixedMaxPathString> devWriteStorage = Utils::GetDevWriteStoragePath();
devWriteStorage)
{
registry.Set(FilePathKey_DevWriteStorage, *devWriteStorage);
registry.Set(FilePathKey_ProjectUserPath, *devWriteStorage);
const AZ::IO::FixedMaxPath devWriteStoragePath(*devWriteStorage);
registry.Set(FilePathKey_DevWriteStorage, devWriteStoragePath.LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectUserPath, (devWriteStoragePath / "user").LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectLogPath, (devWriteStoragePath / "user/log").LexicallyNormal().Native());
}
else
{
registry.Set(FilePathKey_DevWriteStorage, path.LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectUserPath, (path / "user").LexicallyNormal().Native());
registry.Set(FilePathKey_ProjectLogPath, (path / "user/log").LexicallyNormal().Native());
}
#endif // AZ_TRAIT_OS_IS_HOST_OS_PLATFORM
}
@@ -1001,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))
@@ -1055,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);
}
@@ -1070,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()));
}
+1 -1
View File
@@ -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;
}
+3 -6
View File
@@ -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<State, MaxNumberOfStates> m_states;
};
@@ -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<char> saveBuffer;
AZ::IO::ByteContainerStream<AZStd::vector<char>> byteStream(&saveBuffer);
ObjectStream* objStream = ObjectStream::Create(&byteStream, *sc, ObjectStream::ST_XML);
bool writtenOk = objStream->WriteClass(&m_settings);
bool streamOk = objStream->Finalize();
@@ -19,10 +19,11 @@
#include <AzCore/std/typetraits/is_member_pointer.h>
#include <AzCore/std/typetraits/is_const.h>
#include <AzCore/std/typetraits/remove_cvref.h>
#include <AzCore/std/typetraits/is_volatile.h>
#include <AzCore/std/createdestroy.h>
#define AZSTD_FUNCTION_TARGET_FIX(x)
#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t<!std::is_integral_v<Functor>, Type>
#define AZSTD_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, Type) AZStd::enable_if_t<!std::is_integral_v<Functor> && !std::is_null_pointer_v<Functor>, Type>
@@ -591,8 +592,8 @@ namespace AZStd
Internal::function_util::function_buffer type_result;
type_result.type.type = aztypeid(Functor);
type_result.type.const_qualified = is_const<Functor>::value;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
type_result.type.const_qualified = AZStd::is_const<Functor>::value;
type_result.type.volatile_qualified = AZStd::is_volatile<Functor>::value;
vtable->manager(functor, type_result, Internal::function_util::check_functor_type_tag);
return static_cast<Functor*>(type_result.obj_ptr);
}
@@ -608,7 +609,7 @@ namespace AZStd
Internal::function_util::function_buffer type_result;
type_result.type.type = aztypeid(Functor);
type_result.type.const_qualified = true;
type_result.type.volatile_qualified = is_volatile<Functor>::value;
type_result.type.volatile_qualified = AZStd::is_volatile<Functor>::value;
vtable->manager(functor, type_result, Internal::function_util::check_functor_type_tag);
// GCC 2.95.3 gets the CV qualifiers wrong here, so we
// can't do the static_cast that we should do.
@@ -359,7 +359,7 @@ namespace AZStd
{
functor.obj_ref.obj_ptr = (void*)&f.get();
functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value;
functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value;
functor.obj_ref.is_volatile_qualified = AZStd::is_volatile<FunctionObj>::value;
return true;
}
else
@@ -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<decay_t<Functor>>();
@@ -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<decay_t<Functor>>();
@@ -633,7 +633,7 @@ namespace AZStd
{}
function(nullptr_t)
: base_type() {}
: base_type(nullptr) {}
function(const self_type& f)
: base_type(static_cast<const base_type&>(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>(args)...);
}
@@ -70,11 +70,11 @@ namespace AZStd
bool try_acquire_until(const chrono::time_point<Clock, Duration>& abs_time)
{
auto timeNow = chrono::system_clock::now();
if (timeNow >= absTime)
if (timeNow >= abs_time)
{
return false; // we timed out already!
}
auto deltaTime = absTime - timeNow;
auto deltaTime = abs_time - timeNow;
auto timeToTry = chrono::duration_cast<chrono::milliseconds>(deltaTime);
return (WaitForSingleObject(m_event, aznumeric_cast<DWORD>(timeToTry.count())) == AZ_WAIT_OBJECT_0);
}
@@ -31,7 +31,7 @@ namespace AZStd
AZ_REGEX_CHAR_CLASS_NAME("upper", RegexTraits<char>::Ch_upper),
AZ_REGEX_CHAR_CLASS_NAME("w", RegexTraits<char>::Ch_invalid),
AZ_REGEX_CHAR_CLASS_NAME("xdigit", RegexTraits<char>::Ch_xdigit),
{0, 0, 0},
{nullptr, 0, 0},
};
template<>
@@ -52,7 +52,7 @@ namespace AZStd
AZ_REGEX_CHAR_CLASS_NAME(L"upper", RegexTraits<wchar_t>::Ch_upper),
AZ_REGEX_CHAR_CLASS_NAME(L"w", RegexTraits<char>::Ch_invalid),
AZ_REGEX_CHAR_CLASS_NAME(L"xdigit", RegexTraits<wchar_t>::Ch_xdigit),
{0, 0, 0},
{nullptr, 0, 0},
};
#undef AZ_REGEX_CHAR_CLASS_NAME
} // namespace AZStd
@@ -56,6 +56,13 @@ namespace AZ
return ((info.kp_proc.p_flag & P_TRACED) != 0);
}
bool AttachDebugger()
{
// Not supported yet
AZ_Assert(false, "AttachDebugger() is not supported for Mac platform yet");
return false;
}
void HandleExceptions(bool)
{}
@@ -60,6 +60,13 @@ namespace AZ
return s_debuggerDetected;
}
bool AttachDebugger()
{
// Not supported yet
AZ_Assert(false, "AttachDebugger() is not supported for Unix platform yet");
return false;
}
void HandleExceptions(bool)
{}
@@ -139,7 +139,7 @@ namespace AZ
if (m_handle)
{
result = dlclose(m_handle) == 0 ? true : false;
m_handle = 0;
m_handle = nullptr;
}
return result;
}
@@ -49,6 +49,45 @@ namespace AZ
}
}
bool AttachDebugger()
{
if (IsDebuggerPresent())
{
return true;
}
// Launch vsjitdebugger.exe, this app is always present in System32 folder
// with an installation of any version of visual studio.
// It will open a debugging dialog asking the user what debugger to use
STARTUPINFOW startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);
PROCESS_INFORMATION processInfo = {0};
wchar_t cmdline[MAX_PATH];
swprintf_s(cmdline, L"vsjitdebugger.exe -p %li", ::GetCurrentProcessId());
bool success = ::CreateProcessW(
NULL, // No module name (use command line)
cmdline, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // No handle inheritance
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&startupInfo, // Pointer to STARTUPINFO structure
&processInfo); // Pointer to PROCESS_INFORMATION structure
if (success)
{
::WaitForSingleObject(processInfo.hProcess, INFINITE);
::CloseHandle(processInfo.hProcess);
::CloseHandle(processInfo.hThread);
return true;
}
return false;
}
void DebugBreak()
{
__debugbreak();
@@ -198,7 +198,7 @@ namespace AZStd
AZ_FORCE_INLINE cv_status condition_variable_any::wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time)
{
chrono::milliseconds toWait = rel_time;
EnterCriticalSection(&m_mutex);
EnterCriticalSection(AZ_STD_MUTEX_CAST(m_mutex));
lock.unlock();
// We need to make sure we use CriticalSection based mutex.
@@ -217,7 +217,7 @@ namespace AZStd
returnCode = cv_status::timeout;
}
}
LeaveCriticalSection(&m_mutex);
LeaveCriticalSection(AZ_STD_MUTEX_CAST(m_mutex));
lock.lock();
return returnCode;
}
@@ -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<int*>(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<int*>(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<aligned_int_type*>(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);
@@ -480,7 +480,9 @@ namespace UnitTest
TEST_F(AnyTest, Any_CopyAssignSelfEmpty_IsEmpty)
{
any a;
AZ_PUSH_DISABLE_WARNING(, "-Wself-assign-overloaded")
a = a;
AZ_POP_DISABLE_WARNING
EXPECT_TRUE(a.empty());
}
@@ -491,7 +493,9 @@ namespace UnitTest
any a((TypeParam(1)));
EXPECT_EQ(TypeParam::s_count, 1);
AZ_PUSH_DISABLE_WARNING(, "-Wself-assign-overloaded")
a = a;
AZ_POP_DISABLE_WARNING
EXPECT_EQ(TypeParam::s_count, 1);
EXPECT_EQ(any_cast<const TypeParam&>(a).val(), 1);

Some files were not shown because too many files have changed in this diff Show More