diff --git a/src/app/controller.h b/src/app/controller.h index 985bae3c..dc3592e0 100644 --- a/src/app/controller.h +++ b/src/app/controller.h @@ -55,6 +55,5 @@ public: void StartGame(LevelCategory cat, int chap, int lvl); private: - CApplication* m_app; std::unique_ptr m_main; }; diff --git a/src/common/language.cpp b/src/common/language.cpp index 94a8e484..3e004961 100644 --- a/src/common/language.cpp +++ b/src/common/language.cpp @@ -51,4 +51,4 @@ bool LanguageToString(const Language& language, std::string& str) return true; } return false; -} \ No newline at end of file +} diff --git a/src/common/language.h b/src/common/language.h index b0988c54..6d6fb080 100644 --- a/src/common/language.h +++ b/src/common/language.h @@ -36,4 +36,4 @@ enum Language }; bool ParseLanguage(const std::string& str, Language& language); -bool LanguageToString(const Language& language, std::string& str); \ No newline at end of file +bool LanguageToString(const Language& language, std::string& str); diff --git a/src/common/resources/sdl_memory_wrapper.cpp b/src/common/resources/sdl_memory_wrapper.cpp index d265d842..162357f1 100644 --- a/src/common/resources/sdl_memory_wrapper.cpp +++ b/src/common/resources/sdl_memory_wrapper.cpp @@ -21,6 +21,7 @@ #include "common/resources/sdl_memory_wrapper.h" #include "common/logger.h" +#include "common/make_unique.h" #include @@ -42,15 +43,15 @@ CSDLMemoryWrapper::CSDLMemoryWrapper(const std::string& filename) } PHYSFS_sint64 length = PHYSFS_fileLength(file); - m_buffer = new char[length]; - if (PHYSFS_read(file, m_buffer, 1, length) != length) + m_buffer = MakeUniqueArray(length); + if (PHYSFS_read(file, m_buffer.get(), 1, length) != length) { GetLogger()->Error("Unable to read data for \"%s\"\n", filename.c_str()); PHYSFS_close(file); return; } PHYSFS_close(file); - m_rwops = SDL_RWFromMem(m_buffer, length); + m_rwops = SDL_RWFromMem(m_buffer.get(), length); if (m_rwops == nullptr) { @@ -62,7 +63,7 @@ CSDLMemoryWrapper::CSDLMemoryWrapper(const std::string& filename) CSDLMemoryWrapper::~CSDLMemoryWrapper() { SDL_FreeRW(m_rwops); - delete []m_buffer; + m_buffer.reset(); } SDL_RWops* CSDLMemoryWrapper::GetHandler() diff --git a/src/common/resources/sdl_memory_wrapper.h b/src/common/resources/sdl_memory_wrapper.h index f446efdd..0cae6b17 100644 --- a/src/common/resources/sdl_memory_wrapper.h +++ b/src/common/resources/sdl_memory_wrapper.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include @@ -38,5 +39,5 @@ public: private: SDL_RWops* m_rwops; - char *m_buffer; + std::unique_ptr m_buffer; }; diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp index 8f9d9de0..1eb2fb84 100644 --- a/src/graphics/opengl/gl33device.cpp +++ b/src/graphics/opengl/gl33device.cpp @@ -166,8 +166,6 @@ bool CGL33Device::Create() { GetLogger()->Info("Creating CDevice - OpenGL 3.3\n"); - static bool glewInited = false; - if (!InitializeGLEW()) { m_errorMessage = "An error occured while initializing GLEW."; diff --git a/src/graphics/opengl/gl33device.h b/src/graphics/opengl/gl33device.h index 32afa422..79b24560 100644 --- a/src/graphics/opengl/gl33device.h +++ b/src/graphics/opengl/gl33device.h @@ -50,8 +50,8 @@ namespace Gfx */ struct DynamicBuffer { - GLuint vbo; - unsigned int size; + GLuint vbo = 0; + unsigned int size = 0; }; /** diff --git a/src/ui/controls/edit.cpp b/src/ui/controls/edit.cpp index 4bbdc26a..599170fd 100644 --- a/src/ui/controls/edit.cpp +++ b/src/ui/controls/edit.cpp @@ -3242,4 +3242,4 @@ void CEdit::UpdateFocus() CApplication::GetInstancePointer()->SetTextInput(m_bFocus); } -} \ No newline at end of file +}