From 4efa574eec9c9228036c44aa553c116bfe4388bc Mon Sep 17 00:00:00 2001 From: Vyacheslav Ivanov Date: Sat, 3 Aug 2024 21:05:19 +0300 Subject: [PATCH] fix: PVS-Studio V508 mark false Signed-off-by: Vyacheslav Ivanov --- src/data/setting.hpp | 2 +- src/graphics/core/Shader.cpp | 2 +- src/logic/scripting/scripting.cpp | 6 +++--- src/util/RunnablesList.hpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/setting.hpp b/src/data/setting.hpp index b4e74a2d..4191ec6c 100644 --- a/src/data/setting.hpp +++ b/src/data/setting.hpp @@ -48,7 +48,7 @@ public: if (callOnStart) { callback(value); } - return std::shared_ptr(new int(id), [this](int* id) { + return std::shared_ptr(new int(id), [this](int* id) { //-V508 observers.erase(*id); delete id; }); diff --git a/src/graphics/core/Shader.cpp b/src/graphics/core/Shader.cpp index 7f551fb5..a758e647 100644 --- a/src/graphics/core/Shader.cpp +++ b/src/graphics/core/Shader.cpp @@ -95,7 +95,7 @@ glshader compile_shader(GLenum type, const GLchar* source, const std::string& fi "vertex shader compilation failed ("+file+"):\n"+std::string(infoLog) ); } - return glshader(new GLuint(shader), shader_deleter); + return glshader(new GLuint(shader), shader_deleter); //-V508 } std::unique_ptr Shader::create( diff --git a/src/logic/scripting/scripting.cpp b/src/logic/scripting/scripting.cpp index a34594cb..04f3bb75 100644 --- a/src/logic/scripting/scripting.cpp +++ b/src/logic/scripting/scripting.cpp @@ -74,7 +74,7 @@ void scripting::initialize(Engine* engine) { lua::pushstring(L, pack.id); lua::setfield(L, "PACK_ID"); lua::pop(L); - return std::shared_ptr(new int(id), [=](int* id) { + return std::shared_ptr(new int(id), [=](int* id) { //-V508 lua::removeEnvironment(L, *id); delete id; }); @@ -101,7 +101,7 @@ void scripting::initialize(Engine* engine) { lua::pop(L); } lua::pop(L); - return std::shared_ptr(new int(id), [=](int* id) { + return std::shared_ptr(new int(id), [=](int* id) { //-V508 lua::removeEnvironment(L, *id); delete id; }); @@ -131,7 +131,7 @@ void scripting::initialize(Engine* engine) { } lua::pop(L); - return std::shared_ptr(new int(id), [=](int* id) { + return std::shared_ptr(new int(id), [=](int* id) { //-V508 lua::removeEnvironment(L, *id); delete id; }); diff --git a/src/util/RunnablesList.hpp b/src/util/RunnablesList.hpp index f8130ff1..8955c9a4 100644 --- a/src/util/RunnablesList.hpp +++ b/src/util/RunnablesList.hpp @@ -16,7 +16,7 @@ namespace util { observer_handler add(runnable callback) { int id = nextid++; runnables[id] = std::move(callback); - return observer_handler(new int(id), [this](int* id) { + return observer_handler(new int(id), [this](int* id) { //-V508 runnables.erase(*id); delete id; });