From 2714503efad797cd34a9b8cb1cb5874d786f3b23 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Thu, 15 Sep 2022 12:28:53 +0800 Subject: [PATCH] Fixed warnings --- SHADE_Managed/premake5.lua | 5 +++++ SHADE_Managed/src/Engine/EngineInterface.cxx | 22 +++++++++---------- SHADE_Managed/src/Engine/EngineInterface.hxx | 12 +++++----- SHADE_Managed/src/Math/Vector2.hxx | 16 +++++++------- SHADE_Managed/src/Math/Vector3.hxx | 20 ++++++++--------- .../Utility/DisposableAssemblyLoadContext.cxx | 2 +- 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/SHADE_Managed/premake5.lua b/SHADE_Managed/premake5.lua index 42d0482f..092e92af 100644 --- a/SHADE_Managed/premake5.lua +++ b/SHADE_Managed/premake5.lua @@ -41,6 +41,11 @@ project "SHADE_Managed" "SHADE_Engine" } + disablewarnings + { + "4251" + } + defines { "NOMINMAX" diff --git a/SHADE_Managed/src/Engine/EngineInterface.cxx b/SHADE_Managed/src/Engine/EngineInterface.cxx index 27645342..2009b2e5 100644 --- a/SHADE_Managed/src/Engine/EngineInterface.cxx +++ b/SHADE_Managed/src/Engine/EngineInterface.cxx @@ -24,15 +24,6 @@ of DigiPen Institute of Technology is prohibited. namespace SHADE { - /*---------------------------------------------------------------------------------*/ - /* Constructor */ - /*---------------------------------------------------------------------------------*/ - static EngineInterface::EngineInterface() - { - exceptionHandler = gcnew System::UnhandledExceptionEventHandler(unhandledExceptionHandler); - managedLibPath = System::Reflection::Assembly::GetExecutingAssembly()->Location->Replace("SHADE_Managed.dll", ManagedLibraryName + ".dll"); - } - /*---------------------------------------------------------------------------------*/ /* Interop Static Functions */ /*---------------------------------------------------------------------------------*/ @@ -98,7 +89,16 @@ namespace SHADE System::AppDomain::CurrentDomain->UnhandledException -= exceptionHandler; SAFE_NATIVE_CALL_END_N("SHADE_Managed.EngineInterface") } - + + /*---------------------------------------------------------------------------------*/ + /* Constructor */ + /*---------------------------------------------------------------------------------*/ + static EngineInterface::EngineInterface() + { + exceptionHandler = gcnew System::UnhandledExceptionEventHandler(unhandledExceptionHandler); + managedLibPath = System::Reflection::Assembly::GetExecutingAssembly()->Location->Replace("SHADE_Managed.dll", ManagedLibraryName + ".dll"); + } + /*---------------------------------------------------------------------------------*/ /* Helper Functions */ /*---------------------------------------------------------------------------------*/ @@ -127,7 +127,7 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ /* Exception Handler Functions */ /*---------------------------------------------------------------------------------*/ - void EngineInterface::unhandledExceptionHandler(System::Object^ sender, System::UnhandledExceptionEventArgs^ e) + void EngineInterface::unhandledExceptionHandler(System::Object^, System::UnhandledExceptionEventArgs^ e) { std::ostringstream oss; oss << "[EngineInterface] Unhandled managed exception: " diff --git a/SHADE_Managed/src/Engine/EngineInterface.hxx b/SHADE_Managed/src/Engine/EngineInterface.hxx index 7bd5e010..4fd8f7b3 100644 --- a/SHADE_Managed/src/Engine/EngineInterface.hxx +++ b/SHADE_Managed/src/Engine/EngineInterface.hxx @@ -32,11 +32,6 @@ namespace SHADE /// Name of the Managed Library that contains the C# scripts written externally. /// literal System::String^ ManagedLibraryName = "SHADE_Scripting"; - - /*-----------------------------------------------------------------------------*/ - /* Constructor */ - /*-----------------------------------------------------------------------------*/ - static EngineInterface(); /*-----------------------------------------------------------------------------*/ /* Interop Static Functions */ @@ -68,7 +63,12 @@ namespace SHADE /// static void Exit(); - private: + private: + /*-----------------------------------------------------------------------------*/ + /* Constructor */ + /*-----------------------------------------------------------------------------*/ + static EngineInterface(); + /*-----------------------------------------------------------------------------*/ /* Data Members */ /*-----------------------------------------------------------------------------*/ diff --git a/SHADE_Managed/src/Math/Vector2.hxx b/SHADE_Managed/src/Math/Vector2.hxx index 26d4ae6a..69a6110f 100644 --- a/SHADE_Managed/src/Math/Vector2.hxx +++ b/SHADE_Managed/src/Math/Vector2.hxx @@ -33,37 +33,37 @@ namespace SHADE /// /// Shorthand for writing Vector2(0, -1). /// - static Vector2 Down = Vector2(0.0, -1.0); + static initonly Vector2 Down = Vector2(0.0, -1.0); /// /// Shorthand for writing Vector2(-1, 0). /// - static Vector2 Left = Vector2(-1.0, 0.0); + static initonly Vector2 Left = Vector2(-1.0, 0.0); /// /// Shorthand for writing Vector2(double.NegativeInfinity, /// double.NegativeInfinity). /// - static Vector2 NegativeInfinity = Vector2(std::numeric_limits::lowest(), std::numeric_limits::lowest()); + static initonly Vector2 NegativeInfinity = Vector2(std::numeric_limits::lowest(), std::numeric_limits::lowest()); /// /// Shorthand for writing Vector2(1, 1). /// - static Vector2 One = Vector2(1.0, 1.0); + static initonly Vector2 One = Vector2(1.0, 1.0); /// /// Shorthand for writing Vector2(double.PositiveInfinity, /// double.PositiveInfinity). /// - static Vector2 PositiveInfinity = Vector2(std::numeric_limits::max(), std::numeric_limits::max()); + static initonly Vector2 PositiveInfinity = Vector2(std::numeric_limits::max(), std::numeric_limits::max()); /// /// Shorthand for writing Vector2(1, 0). /// - static Vector2 Right = Vector2(1.0, 0.0); + static initonly Vector2 Right = Vector2(1.0, 0.0); /// /// Shorthand for writing Vector2(0, 1). /// - static Vector2 Up = Vector2(0.0, 1.0); + static initonly Vector2 Up = Vector2(0.0, 1.0); /// /// Shorthand for writing Vector2(0, 0). /// - static Vector2 Zero = Vector2(0.0, 0.0); + static initonly Vector2 Zero = Vector2(0.0, 0.0); #pragma endregion /*-----------------------------------------------------------------------------*/ diff --git a/SHADE_Managed/src/Math/Vector3.hxx b/SHADE_Managed/src/Math/Vector3.hxx index fb2fe8fc..e6cdc7d4 100644 --- a/SHADE_Managed/src/Math/Vector3.hxx +++ b/SHADE_Managed/src/Math/Vector3.hxx @@ -35,49 +35,49 @@ namespace SHADE /// /// Shorthand for writing Vector3(0, 0, -1). /// - static const Vector3 Back = Vector3(0.0, 0.0, -1.0); + static initonly Vector3 Back = Vector3(0.0, 0.0, -1.0); /// /// Shorthand for writing Vector3(0, -1, 0). /// - static const Vector3 Down = Vector3(0.0, -1.0, 0.0); + static initonly Vector3 Down = Vector3(0.0, -1.0, 0.0); /// /// Shorthand for writing Vector3(0, 0, 1). /// - static const Vector3 Forward = Vector3(0.0, 0.0, 1.0); + static initonly Vector3 Forward = Vector3(0.0, 0.0, 1.0); /// /// Shorthand for writing Vector3(-1, 0, 0). /// - static const Vector3 Left = Vector3(-1.0, 0.0, 0.0); + static initonly Vector3 Left = Vector3(-1.0, 0.0, 0.0); /// /// Shorthand for writing Vector3(double.NegativeInfinity, /// double.NegativeInfinity, double.NegativeInfinity). /// - static const Vector3 NegativeInfinity = Vector3(std::numeric_limits::lowest(), + static initonly Vector3 NegativeInfinity = Vector3(std::numeric_limits::lowest(), std::numeric_limits::lowest(), std::numeric_limits::lowest()); /// /// Shorthand for writing Vector3(1, 1, 1). /// - static const Vector3 One = Vector3(1.0, 1.0, 1.0); + static initonly Vector3 One = Vector3(1.0, 1.0, 1.0); /// /// Shorthand for writing Vector3(double.PositiveInfinity, /// double.PositiveInfinity, double.PositiveInfinity). /// - static const Vector3 PositiveInfinity = Vector3(std::numeric_limits::max(), + static initonly Vector3 PositiveInfinity = Vector3(std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max()); /// /// Shorthand for writing Vector3(1, 0, 0). /// - static const Vector3 Right = Vector3(1.0, 0.0, 0.0); + static initonly Vector3 Right = Vector3(1.0, 0.0, 0.0); /// /// Shorthand for writing Vector3(0, 1, 0). /// - static const Vector3 Up = Vector3(0.0, 1.0, 0.0); + static initonly Vector3 Up = Vector3(0.0, 1.0, 0.0); /// /// Shorthand for writing Vector3(0, 0, 0). /// - static const Vector3 Zero = Vector3(0.0, 0.0, 0.0); + static initonly Vector3 Zero = Vector3(0.0, 0.0, 0.0); #pragma endregion /*-----------------------------------------------------------------------------*/ diff --git a/SHADE_Managed/src/Utility/DisposableAssemblyLoadContext.cxx b/SHADE_Managed/src/Utility/DisposableAssemblyLoadContext.cxx index 7ee674a4..ebf2e987 100644 --- a/SHADE_Managed/src/Utility/DisposableAssemblyLoadContext.cxx +++ b/SHADE_Managed/src/Utility/DisposableAssemblyLoadContext.cxx @@ -29,7 +29,7 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ /* Helper Functions */ /*---------------------------------------------------------------------------------*/ - System::Reflection::Assembly^ DisposableAssemblyLoadContext::Load(System::Reflection::AssemblyName^ assemblyName) + System::Reflection::Assembly^ DisposableAssemblyLoadContext::Load(System::Reflection::AssemblyName^) { return nullptr; }