From 740193601685c80a2e6b73b59b8591fcfed3c6dc Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 18 May 2021 02:45:00 +0200 Subject: [PATCH] Initialize raw pointers as nullptr --- inferno/src/inferno/component/luascriptcomponent.h | 2 +- .../src/inferno/component/nativescriptcomponent.h | 2 +- inferno/src/inferno/io/log.h | 2 +- inferno/src/inferno/render/context.h | 2 +- inferno/src/inferno/render/renderer.h | 12 ++++++------ inferno/src/inferno/script/cameracontroller.h | 2 +- inferno/src/inferno/script/luascript.h | 6 +++--- inferno/src/inferno/script/nativescript.h | 6 +++--- inferno/src/inferno/system/scriptsystem.h | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/inferno/src/inferno/component/luascriptcomponent.h b/inferno/src/inferno/component/luascriptcomponent.h index d6fe1b9..46bf7e2 100644 --- a/inferno/src/inferno/component/luascriptcomponent.h +++ b/inferno/src/inferno/component/luascriptcomponent.h @@ -9,7 +9,7 @@ namespace Inferno { class LuaScript; struct LuaScriptComponent { - LuaScript* instance = nullptr; + LuaScript* instance { nullptr }; std::string path; // Dont allow manually setting instance during construction diff --git a/inferno/src/inferno/component/nativescriptcomponent.h b/inferno/src/inferno/component/nativescriptcomponent.h index ec8cd7d..5764af5 100644 --- a/inferno/src/inferno/component/nativescriptcomponent.h +++ b/inferno/src/inferno/component/nativescriptcomponent.h @@ -7,7 +7,7 @@ namespace Inferno { struct NativeScriptComponent { - NativeScript* instance = nullptr; + NativeScript* instance { nullptr }; NativeScript* (*initialize)(); diff --git a/inferno/src/inferno/io/log.h b/inferno/src/inferno/io/log.h index 2cfd978..afaa36c 100644 --- a/inferno/src/inferno/io/log.h +++ b/inferno/src/inferno/io/log.h @@ -111,7 +111,7 @@ namespace Inferno { virtual ~StringLogStream() override; private: - std::string* m_fill; + std::string* m_fill { nullptr }; }; // ----------------------------------------- diff --git a/inferno/src/inferno/render/context.h b/inferno/src/inferno/render/context.h index b3f12f7..41a8a3e 100644 --- a/inferno/src/inferno/render/context.h +++ b/inferno/src/inferno/render/context.h @@ -16,7 +16,7 @@ namespace Inferno { void setCurrent(); private: - GLFWwindow* m_window; + GLFWwindow* m_window { nullptr }; }; } diff --git a/inferno/src/inferno/render/renderer.h b/inferno/src/inferno/render/renderer.h index 43e18dd..69d1b12 100644 --- a/inferno/src/inferno/render/renderer.h +++ b/inferno/src/inferno/render/renderer.h @@ -88,8 +88,8 @@ namespace Inferno { std::array, textureUnitPerBatch> m_textureUnits; // GPU objects - std::shared_ptr m_shader = nullptr; - std::shared_ptr m_vertexArray = nullptr; + std::shared_ptr m_shader; + std::shared_ptr m_vertexArray; }; // ----------------------------------------- @@ -122,8 +122,8 @@ namespace Inferno { void nextBatch() override; // CPU quad vertices - std::unique_ptr m_vertexBufferBase = nullptr; - QuadVertex* m_vertexBufferPtr = nullptr; + std::unique_ptr m_vertexBufferBase; + QuadVertex* m_vertexBufferPtr { nullptr }; // Default quad vertex positions glm::vec4 m_vertexPositions[vertexPerQuad]; @@ -156,8 +156,8 @@ namespace Inferno { void nextBatch() override; // CPU quad vertices - std::unique_ptr m_vertexBufferBase = nullptr; - CharacterVertex* m_vertexBufferPtr = nullptr; + std::unique_ptr m_vertexBufferBase; + CharacterVertex* m_vertexBufferPtr { nullptr }; }; } diff --git a/inferno/src/inferno/script/cameracontroller.h b/inferno/src/inferno/script/cameracontroller.h index a6a5fa1..fec8806 100644 --- a/inferno/src/inferno/script/cameracontroller.h +++ b/inferno/src/inferno/script/cameracontroller.h @@ -31,7 +31,7 @@ namespace Inferno { void updatePerspective(float deltaTime); private: - CameraComponent* m_camera; + CameraComponent* m_camera { nullptr }; }; } diff --git a/inferno/src/inferno/script/luascript.h b/inferno/src/inferno/script/luascript.h index f3dd531..9e52281 100644 --- a/inferno/src/inferno/script/luascript.h +++ b/inferno/src/inferno/script/luascript.h @@ -45,9 +45,9 @@ namespace Inferno { sol::state m_state; std::string m_path = ""; - Scene* m_scene = nullptr; - uint32_t m_entity = 0; - TransformComponent* transform = nullptr; + Scene* m_scene { nullptr }; + uint32_t m_entity { 0 }; + TransformComponent* transform { nullptr }; friend class ScriptSystem; }; diff --git a/inferno/src/inferno/script/nativescript.h b/inferno/src/inferno/script/nativescript.h index df08742..c655f2c 100644 --- a/inferno/src/inferno/script/nativescript.h +++ b/inferno/src/inferno/script/nativescript.h @@ -22,11 +22,11 @@ namespace Inferno { return m_scene->getComponent(m_entity); } - TransformComponent* transform = nullptr; + TransformComponent* transform { nullptr }; private: - Scene* m_scene = nullptr; - uint32_t m_entity = 0; + Scene* m_scene { nullptr }; + uint32_t m_entity { 0 }; friend class ScriptSystem; }; diff --git a/inferno/src/inferno/system/scriptsystem.h b/inferno/src/inferno/system/scriptsystem.h index 3e0e0b4..f62ff7b 100644 --- a/inferno/src/inferno/system/scriptsystem.h +++ b/inferno/src/inferno/system/scriptsystem.h @@ -26,7 +26,7 @@ namespace Inferno { void setScene(Scene* scene) { m_scene = scene; } private: - Scene* m_scene; + Scene* m_scene { nullptr }; }; }