From 2a80dd7c3c16293bc5e2b6e64a7084f46a95dda5 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 6 Oct 2012 03:42:31 +0000 Subject: [PATCH] - more cppcheck code cleanup --- source/glest_game/ai/ai_rule.cpp | 1 + source/shared_lib/include/graphics/quaternion.h | 10 ++++++++-- source/shared_lib/include/sound/sound_interface.h | 4 +++- source/shared_lib/sources/graphics/gl/shader_gl.cpp | 4 ++++ source/shared_lib/sources/graphics/gl2/shader_gl.cpp | 4 ++++ .../sources/sound/openal/sound_player_openal.cpp | 4 ++++ source/shared_lib/sources/sound/sound.cpp | 1 + 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/source/glest_game/ai/ai_rule.cpp b/source/glest_game/ai/ai_rule.cpp index 1eddf357..e8895c83 100644 --- a/source/glest_game/ai/ai_rule.cpp +++ b/source/glest_game/ai/ai_rule.cpp @@ -357,6 +357,7 @@ AiRuleMassiveAttack::AiRuleMassiveAttack(Ai *ai): AiRule(ai) { ultraAttack=false; + field = fLand; } bool AiRuleMassiveAttack::test(){ diff --git a/source/shared_lib/include/graphics/quaternion.h b/source/shared_lib/include/graphics/quaternion.h index 0960de1b..af3d3fb6 100644 --- a/source/shared_lib/include/graphics/quaternion.h +++ b/source/shared_lib/include/graphics/quaternion.h @@ -31,7 +31,9 @@ public: Vec3f axis; float angle; - AxisAngle(){}; + AxisAngle() { + angle = 0.0f; + } AxisAngle(const Vec3f &axis, float angle); }; @@ -43,7 +45,11 @@ class EulerAngles{ public: float x, y, z; - EulerAngles(){}; + EulerAngles() { + x = 0.0f; + y = 0.0f; + z = 0.0f; + } EulerAngles(float x, float y, float z); }; diff --git a/source/shared_lib/include/sound/sound_interface.h b/source/shared_lib/include/sound/sound_interface.h index 21de8ad0..33eecafb 100644 --- a/source/shared_lib/include/sound/sound_interface.h +++ b/source/shared_lib/include/sound/sound_interface.h @@ -26,7 +26,9 @@ private: SoundFactory *soundFactory; private: - SoundInterface() {} + SoundInterface() { + soundFactory = 0; + } SoundInterface(SoundInterface &); void operator=(SoundInterface &); diff --git a/source/shared_lib/sources/graphics/gl/shader_gl.cpp b/source/shared_lib/sources/graphics/gl/shader_gl.cpp index e06e3e36..d71754d9 100644 --- a/source/shared_lib/sources/graphics/gl/shader_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/shader_gl.cpp @@ -26,6 +26,9 @@ namespace Shared{ namespace Graphics{ namespace Gl{ ShaderProgramGl::ShaderProgramGl(){ inited= false; + vertexShader=0; + fragmentShader=0; + handle=0; } void ShaderProgramGl::init(){ @@ -173,6 +176,7 @@ GLint ShaderProgramGl::getLocation(const string &name){ ShaderGl::ShaderGl(){ inited= false; + handle = 0; } void ShaderGl::load(const string &path){ diff --git a/source/shared_lib/sources/graphics/gl2/shader_gl.cpp b/source/shared_lib/sources/graphics/gl2/shader_gl.cpp index 1cfc3825..8537bb4c 100644 --- a/source/shared_lib/sources/graphics/gl2/shader_gl.cpp +++ b/source/shared_lib/sources/graphics/gl2/shader_gl.cpp @@ -26,6 +26,9 @@ namespace Shared{ namespace Graphics{ namespace Gl{ ShaderProgramGl::ShaderProgramGl(){ inited= false; + vertexShader=0; + fragmentShader=0; + handle=0; } void ShaderProgramGl::init(){ @@ -167,6 +170,7 @@ GLint ShaderProgramGl::getLocation(const string &name){ ShaderGl::ShaderGl(){ inited= false; + handle = 0; } void ShaderGl::load(const string &path){ diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index 9eb50265..3ff5a2f4 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -136,6 +136,7 @@ ALenum SoundSource::getFormat(Sound* sound) StaticSoundSource::StaticSoundSource() { bufferAllocated = false; + buffer = 0; } StaticSoundSource::~StaticSoundSource() { @@ -179,6 +180,8 @@ void StaticSoundSource::play(StaticSound* sound) { StreamSoundSource::StreamSoundSource() { sound = 0; + fadeState = NoFading; + format = 0; alGenBuffers(STREAMFRAGMENTS, buffers); SoundPlayerOpenAL::checkAlError(string(__FILE__) + string(" ") + string(__FUNCTION__) + string(" ") + intToStr(__LINE__)); } @@ -331,6 +334,7 @@ SoundPlayerOpenAL::SoundPlayerOpenAL() { if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); device = 0; + context = 0; initOk = false; if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); diff --git a/source/shared_lib/sources/sound/sound.cpp b/source/shared_lib/sources/sound/sound.cpp index bdea6901..4a47cca8 100644 --- a/source/shared_lib/sources/sound/sound.cpp +++ b/source/shared_lib/sources/sound/sound.cpp @@ -40,6 +40,7 @@ SoundInfo::SoundInfo() { Sound::Sound() { volume= 0.0f; fileName = ""; + soundFileLoader = 0; } // =====================================================