From 24ad0788cfe20dc619669429615220061b4865ea Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 11 Nov 2021 13:37:09 +0200 Subject: [PATCH] Some more default member initializers --- source/backends/opengl/framebuffer_backend.cpp | 1 - source/backends/opengl/framebuffer_backend.h | 2 +- source/backends/opengl/uniformblock_backend.h | 2 +- source/core/framebuffer.cpp | 8 ++------ source/core/framebuffer.h | 6 +++--- source/glsl/finalize.h | 8 +++----- source/glsl/syntax.cpp | 3 +-- source/render/view.cpp | 6 ------ source/render/view.h | 8 ++++---- 9 files changed, 15 insertions(+), 29 deletions(-) diff --git a/source/backends/opengl/framebuffer_backend.cpp b/source/backends/opengl/framebuffer_backend.cpp index b56499d1..db1905d2 100644 --- a/source/backends/opengl/framebuffer_backend.cpp +++ b/source/backends/opengl/framebuffer_backend.cpp @@ -19,7 +19,6 @@ namespace Msp { namespace GL { OpenGLFramebuffer::OpenGLFramebuffer(bool is_system): - id(0), status(is_system ? GL_FRAMEBUFFER_COMPLETE : GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) { if(!is_system) diff --git a/source/backends/opengl/framebuffer_backend.h b/source/backends/opengl/framebuffer_backend.h index 090071f7..7a7ebfbe 100644 --- a/source/backends/opengl/framebuffer_backend.h +++ b/source/backends/opengl/framebuffer_backend.h @@ -13,7 +13,7 @@ class OpenGLFramebuffer friend class OpenGLPipelineState; protected: - unsigned id; + unsigned id = 0; mutable unsigned status; OpenGLFramebuffer(bool); diff --git a/source/backends/opengl/uniformblock_backend.h b/source/backends/opengl/uniformblock_backend.h index c95a3481..9607ea69 100644 --- a/source/backends/opengl/uniformblock_backend.h +++ b/source/backends/opengl/uniformblock_backend.h @@ -8,7 +8,7 @@ class OpenGLUniformBlock { protected: OpenGLUniformBlock(bool); - ~OpenGLUniformBlock() { } + ~OpenGLUniformBlock() = default; }; using UniformBlockBackend = OpenGLUniformBlock; diff --git a/source/core/framebuffer.cpp b/source/core/framebuffer.cpp index 70c19859..b0777171 100644 --- a/source/core/framebuffer.cpp +++ b/source/core/framebuffer.cpp @@ -16,15 +16,11 @@ framebuffer_incomplete::framebuffer_incomplete(const std::string &reason): Framebuffer::Framebuffer(bool s): - FramebufferBackend(s), - dirty(0) + FramebufferBackend(s) { } Framebuffer::Framebuffer(): - FramebufferBackend(false), - width(0), - height(0), - dirty(0) + FramebufferBackend(false) { } Framebuffer::Framebuffer(FrameAttachment fa): diff --git a/source/core/framebuffer.h b/source/core/framebuffer.h index fd7b8eb4..920d9422 100644 --- a/source/core/framebuffer.h +++ b/source/core/framebuffer.h @@ -47,9 +47,9 @@ protected: FrameFormat format; std::vector attachments; - unsigned width; - unsigned height; - mutable unsigned dirty; + unsigned width = 0; + unsigned height = 0; + mutable unsigned dirty = 0; Framebuffer(bool); public: diff --git a/source/glsl/finalize.h b/source/glsl/finalize.h index 19ad5947..f9502954 100644 --- a/source/glsl/finalize.h +++ b/source/glsl/finalize.h @@ -29,11 +29,9 @@ class LocationAllocator: private TraversingVisitor private: struct Uniform { - int location; - int desc_set; - int bind_point; - - Uniform(): location(-1), desc_set(0), bind_point(-1) { } + int location = -1; + int desc_set = 0; + int bind_point = -1; }; Features features; diff --git a/source/glsl/syntax.cpp b/source/glsl/syntax.cpp index 2ab4d1b6..45765f27 100644 --- a/source/glsl/syntax.cpp +++ b/source/glsl/syntax.cpp @@ -78,8 +78,7 @@ NodeContainer::NodeContainer(const NodeContainer &c): Block::Block(const Block &other): Node(other), body(other.body), - use_braces(other.use_braces), - parent(0) + use_braces(other.use_braces) { } void Block::visit(NodeVisitor &visitor) diff --git a/source/render/view.cpp b/source/render/view.cpp index 54828c7b..d57c8530 100644 --- a/source/render/view.cpp +++ b/source/render/view.cpp @@ -6,12 +6,6 @@ namespace Msp { namespace GL { -View::View(): - camera(0), - content(0), - internal_renderer(0) -{ } - View::~View() { delete internal_renderer; diff --git a/source/render/view.h b/source/render/view.h index b7cb2256..bdddb65d 100644 --- a/source/render/view.h +++ b/source/render/view.h @@ -20,11 +20,11 @@ Sequence can be used to specify other tags and add post-processing. class View { protected: - Camera *camera; - Renderable *content; - Renderer *internal_renderer; + Camera *camera = 0; + Renderable *content = 0; + Renderer *internal_renderer = 0; - View(); + View() = default; public: virtual ~View(); -- 2.43.0