[colobot] 264/377: Fixed some code style warnings

Didier Raboud odyx at moszumanska.debian.org
Wed Mar 30 13:34:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 55412842df74c26c106142a293822d167fb8c5c2
Author: krzys-h <krzys_h at interia.pl>
Date:   Sat Feb 13 13:46:56 2016 +0100

    Fixed some code style warnings
---
 src/app/controller.h                        | 1 -
 src/common/language.cpp                     | 2 +-
 src/common/language.h                       | 2 +-
 src/common/resources/sdl_memory_wrapper.cpp | 9 +++++----
 src/common/resources/sdl_memory_wrapper.h   | 3 ++-
 src/graphics/opengl/gl33device.cpp          | 2 --
 src/graphics/opengl/gl33device.h            | 4 ++--
 src/ui/controls/edit.cpp                    | 2 +-
 8 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/app/controller.h b/src/app/controller.h
index 985bae3..dc3592e 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<CRobotMain> m_main;
 };
diff --git a/src/common/language.cpp b/src/common/language.cpp
index 94a8e48..3e00496 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 b0988c5..6d6fb08 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 d265d84..162357f 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 <physfs.h>
 
@@ -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<char>(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 f446efd..0cae6b1 100644
--- a/src/common/resources/sdl_memory_wrapper.h
+++ b/src/common/resources/sdl_memory_wrapper.h
@@ -21,6 +21,7 @@
 #pragma once
 
 #include <string>
+#include <memory>
 
 #include <SDL.h>
 
@@ -38,5 +39,5 @@ public:
 
 private:
     SDL_RWops* m_rwops;
-    char *m_buffer;
+    std::unique_ptr<char[]> m_buffer;
 };
diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp
index 8f9d9de..1eb2fb8 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 32afa42..79b2456 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 4bbdc26..599170f 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
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list