From 710363bade528b5015a7c472db3aa90eb08207ab Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 2 Nov 2021 10:47:31 +0200 Subject: [PATCH] Use default member initializers in async loaders --- source/backends/opengl/texture2d_backend.cpp | 12 +++++------- source/core/mesh.cpp | 5 +---- source/core/mesh.h | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/source/backends/opengl/texture2d_backend.cpp b/source/backends/opengl/texture2d_backend.cpp index 2f7e503b..9efc4351 100644 --- a/source/backends/opengl/texture2d_backend.cpp +++ b/source/backends/opengl/texture2d_backend.cpp @@ -16,11 +16,11 @@ private: Texture2D &texture; IO::Seekable &io; Buffer pixel_buffer; - char *mapped_address; + char *mapped_address = 0; Graphics::Image image; - Graphics::ImageLoader *img_loader; - unsigned n_bytes; - int phase; + Graphics::ImageLoader *img_loader = 0; + unsigned n_bytes = 0; + int phase = 0; public: AsyncLoader(Texture2D &, IO::Seekable &); @@ -106,9 +106,7 @@ void OpenGLTexture2D::unload() OpenGLTexture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i): texture(t), io(i), - mapped_address(0), - img_loader(Graphics::ImageLoader::open_io(io)), - phase(0) + img_loader(Graphics::ImageLoader::open_io(io)) { } OpenGLTexture2D::AsyncLoader::~AsyncLoader() diff --git a/source/core/mesh.cpp b/source/core/mesh.cpp index e2dd853c..07e5e27f 100644 --- a/source/core/mesh.cpp +++ b/source/core/mesh.cpp @@ -285,10 +285,7 @@ void Mesh::Loader::batch(PrimitiveType p) Mesh::AsyncLoader::AsyncLoader(Mesh &m, IO::Seekable &i): mesh(m), - io(i), - vertex_updater(0), - index_updater(0), - phase(0) + io(i) { mesh.disallow_rendering = true; mesh.check_buffers(VERTEX_BUFFER|INDEX_BUFFER); diff --git a/source/core/mesh.h b/source/core/mesh.h index 5544ed1f..98a028db 100644 --- a/source/core/mesh.h +++ b/source/core/mesh.h @@ -49,9 +49,9 @@ private: private: Mesh &mesh; IO::Seekable &io; - Bufferable::AsyncUpdater *vertex_updater; - Bufferable::AsyncUpdater *index_updater; - unsigned phase; + Bufferable::AsyncUpdater *vertex_updater = 0; + Bufferable::AsyncUpdater *index_updater = 0; + unsigned phase = 0; public: AsyncLoader(Mesh &, IO::Seekable &); -- 2.43.0