From d360f2ae59000fef1b151f625d3bb42c367e5427 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 12 Apr 2022 00:58:11 +0200 Subject: [PATCH] Address Visual Studio analyzer warnings --- .editorconfig | 4 ---- apps/OpenSpace/ext/sgct | 2 +- ext/ghoul | 2 +- include/openspace/engine/downloadmanager.h | 6 +++--- include/openspace/interaction/mouseinputstate.h | 2 +- include/openspace/network/parallelpeer.h | 2 +- include/openspace/rendering/framebufferrenderer.h | 12 ++++++------ include/openspace/rendering/helper.h | 12 ++++++------ include/openspace/scene/profile.h | 10 +++++----- include/openspace/scripting/lualibrary.h | 2 +- include/openspace/util/spicemanager.h | 2 +- include/openspace/util/timeconversion.h | 3 ++- include/openspace/util/timemanager.h | 2 +- modules/base/rendering/screenspaceframebuffer.cpp | 8 ++++---- src/engine/openspaceengine.cpp | 2 +- src/util/transformationmanager.cpp | 6 +++--- support/coding/codegen | 2 +- 17 files changed, 38 insertions(+), 41 deletions(-) diff --git a/.editorconfig b/.editorconfig index c1bf4823be..ea67455ec4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,3 @@ charset = utf-8 indent_style = space indent_size = 4 insert_final_newline = true - -# overwrite default settings here, for instance like this: -# [*.cpp] -# indent_style = tabs diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 0dec32d871..7ced19201b 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 0dec32d871d2528559a1de2204b0bfc029312757 +Subproject commit 7ced19201b8b2fe4ceba94f178464d4fac3867a1 diff --git a/ext/ghoul b/ext/ghoul index fd128fba7d..dd8a42a1b3 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit fd128fba7de9450d27b34b41bdb85105fed3c51f +Subproject commit dd8a42a1b3c0498297d38154a9749bc57e37c7e6 diff --git a/include/openspace/engine/downloadmanager.h b/include/openspace/engine/downloadmanager.h index bcc652168f..a0e44887b1 100644 --- a/include/openspace/engine/downloadmanager.h +++ b/include/openspace/engine/downloadmanager.h @@ -61,10 +61,10 @@ public: }; struct MemoryFile { - char* buffer; - size_t size; + char* buffer = nullptr; + size_t size = 0; std::string format; - bool corrupted; + bool corrupted = false; }; BooleanType(UseMultipleThreads); diff --git a/include/openspace/interaction/mouseinputstate.h b/include/openspace/interaction/mouseinputstate.h index 31aebfacf2..32eea582b5 100644 --- a/include/openspace/interaction/mouseinputstate.h +++ b/include/openspace/interaction/mouseinputstate.h @@ -49,7 +49,7 @@ private: // Input from mouse std::vector _mouseButtonsDown; glm::dvec2 _mousePosition = glm::dvec2(0.0); - double _mouseScrollDelta; + double _mouseScrollDelta = 0.0; }; } // namespace openspace::interaction diff --git a/include/openspace/network/parallelpeer.h b/include/openspace/network/parallelpeer.h index f9878473b4..fd73c87a6c 100644 --- a/include/openspace/network/parallelpeer.h +++ b/include/openspace/network/parallelpeer.h @@ -125,7 +125,7 @@ private: std::atomic _timeTimelineChanged; std::mutex _latencyMutex; std::deque _latencyDiffs; - double _initialTimeDiff; + double _initialTimeDiff = 0.0; std::unique_ptr _receiveThread = nullptr; std::shared_ptr> _connectionEvent; diff --git a/include/openspace/rendering/framebufferrenderer.h b/include/openspace/rendering/framebufferrenderer.h index 10d325e71f..970691a0d2 100644 --- a/include/openspace/rendering/framebufferrenderer.h +++ b/include/openspace/rendering/framebufferrenderer.h @@ -135,12 +135,12 @@ private: UniformCache(downscaledRenderedVolume, downscaledRenderedVolumeDepth, viewport, resolution) _writeDownscaledVolumeUniformCache; - GLint _defaultFBO; - GLuint _screenQuad; - GLuint _vertexPositionBuffer; - GLuint _exitColorTexture; - GLuint _exitDepthTexture; - GLuint _exitFramebuffer; + GLint _defaultFBO = 0; + GLuint _screenQuad = 0; + GLuint _vertexPositionBuffer = 0; + GLuint _exitColorTexture = 0; + GLuint _exitDepthTexture = 0; + GLuint _exitFramebuffer = 0; struct { GLuint colorTexture; diff --git a/include/openspace/rendering/helper.h b/include/openspace/rendering/helper.h index 28605720ba..4b700e326b 100644 --- a/include/openspace/rendering/helper.h +++ b/include/openspace/rendering/helper.h @@ -72,20 +72,20 @@ struct Shaders { struct VertexObjects { struct { - GLuint vao; - GLuint vbo; + GLuint vao = 0; + GLuint vbo = 0; } square; struct { - GLuint vao; - GLuint vbo; - GLuint ibo; + GLuint vao = 0; + GLuint vbo = 0; + GLuint ibo = 0; int nElements = 64; } sphere; struct { - GLuint vao; + GLuint vao = 0; } empty; }; diff --git a/include/openspace/scene/profile.h b/include/openspace/scene/profile.h index f8722b0219..ed17b6c9a7 100644 --- a/include/openspace/scene/profile.h +++ b/include/openspace/scene/profile.h @@ -86,7 +86,7 @@ public: std::string documentation; std::string name; std::string guiPath; - bool isLocal; + bool isLocal = false; std::string script; }; @@ -101,7 +101,7 @@ public: Relative }; - Type type; + Type type = Type::Absolute; std::string value; }; @@ -111,7 +111,7 @@ public: std::string anchor; std::optional aim; std::string referenceFrame; - glm::dvec3 position; + glm::dvec3 position = glm::dvec3(0.0); std::optional up; std::optional yaw; std::optional pitch; @@ -121,8 +121,8 @@ public: static constexpr const char* Type = "goToGeo"; std::string anchor; - double latitude; - double longitude; + double latitude = 0.0; + double longitude = 0.0; std::optional altitude; }; diff --git a/include/openspace/scripting/lualibrary.h b/include/openspace/scripting/lualibrary.h index 8edefd9688..5e5f642d68 100644 --- a/include/openspace/scripting/lualibrary.h +++ b/include/openspace/scripting/lualibrary.h @@ -46,7 +46,7 @@ struct LuaLibrary { /// The name of the function std::string name; /// The function pointer that is executed if the function is called - lua_CFunction function; + lua_CFunction function = nullptr; struct Argument { /// The name of the arguments std::string name; diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index 85117cdf2d..6d0958243b 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -856,7 +856,7 @@ public: }; /// The shape of the returned field of view - Shape shape; + Shape shape = Shape::Rectangle; /// The name of the reference frame in which the #bounds are defined std::string frameName; diff --git a/include/openspace/util/timeconversion.h b/include/openspace/util/timeconversion.h index adf9ef7b93..305abecd68 100644 --- a/include/openspace/util/timeconversion.h +++ b/include/openspace/util/timeconversion.h @@ -198,7 +198,8 @@ constexpr double convertTime(double t, TimeUnit sourceUnit, TimeUnit destination case TimeUnit::Year: seconds = t * SecondsPerYear; break; - default: ; + default: + break; } switch (destinationUnit) { diff --git a/include/openspace/util/timemanager.h b/include/openspace/util/timemanager.h index 4e53512e1d..4bca989b82 100644 --- a/include/openspace/util/timemanager.h +++ b/include/openspace/util/timemanager.h @@ -167,7 +167,7 @@ private: bool _shouldSetTime = false; Time _timeNextFrame; - bool _timelineChanged; + bool _timelineChanged = false; double _latestConsumedTimestamp = -std::numeric_limits::max(); int _nextCallbackHandle = 0; diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 4b2f49c59f..3ff887cbca 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -97,7 +97,7 @@ bool ScreenSpaceFramebuffer::deinitializeGL() { _framebuffer->activate(); _framebuffer->detachAll(); - _framebuffer->deactivate(); + ghoul::opengl::FramebufferObject::deactivate(); removeAllRenderFunctions(); return true; @@ -122,7 +122,7 @@ void ScreenSpaceFramebuffer::render() { ); global::renderEngine->openglStateCache().setViewportState(viewport); - GLint defaultFBO = _framebuffer->getActiveObject(); + GLint defaultFBO = ghoul::opengl::FramebufferObject::getActiveObject(); _framebuffer->activate(); glClearColor(0.f, 0.f, 0.f, 0.f); @@ -130,7 +130,7 @@ void ScreenSpaceFramebuffer::render() { for (const RenderFunction& renderFunction : _renderFunctions) { renderFunction(); } - _framebuffer->deactivate(); + ghoul::opengl::FramebufferObject::deactivate(); glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); @@ -185,7 +185,7 @@ void ScreenSpaceFramebuffer::createFramebuffer() { _texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture->purgeFromRAM(); _framebuffer->attachTexture(_texture.get(), GL_COLOR_ATTACHMENT0); - _framebuffer->deactivate(); + ghoul::opengl::FramebufferObject::deactivate(); } int ScreenSpaceFramebuffer::id() { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 365e22a358..3edd3b459c 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -170,7 +170,7 @@ void OpenSpaceEngine::registerPathTokens() { using Override = ghoul::filesystem::FileSystem::Override; FileSys.registerPathToken( std::move(fullKey), - std::move(path.second), + path.second, Override(overrideBase || overrideTemporary) ); } diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index e2f9efebbf..01d66005db 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -101,9 +101,9 @@ glm::dmat3 TransformationManager::kameleonTransformationMatrix( ccmc::Position out1; ccmc::Position out2; - _kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in0, &out0); - _kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1); - _kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2); + ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in0, &out0); + ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1); + ccmc::Kameleon::_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2); return glm::dmat3( out0.c0, out0.c1, out0.c2, diff --git a/support/coding/codegen b/support/coding/codegen index b2c8623b81..8f2fa0a689 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit b2c8623b81005283666ee319b3a972dd2b03c7a0 +Subproject commit 8f2fa0a68986241d33b5616173054f453b88536f