From 29da478bd5622bb659694eefee8fa9d398b3c02b Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 6 Nov 2012 03:52:27 +0000 Subject: [PATCH] - more cppcheck code cleanup --- source/glest_game/game/chat_manager.cpp | 6 +++--- source/shared_lib/include/xml/rapidxml/rapidxml.hpp | 10 ++++++++-- .../shared_lib/include/xml/rapidxml/rapidxml_print.hpp | 1 + .../shared_lib/sources/graphics/d3d9/context_d3d9.cpp | 2 ++ .../shared_lib/sources/graphics/d3d9/shader_d3d9.cpp | 2 ++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source/glest_game/game/chat_manager.cpp b/source/glest_game/game/chat_manager.cpp index 6b14a970..8fe546f8 100644 --- a/source/glest_game/game/chat_manager.cpp +++ b/source/glest_game/game/chat_manager.cpp @@ -388,14 +388,14 @@ void ChatManager::appendText(const wchar_t *addText, bool validateChars, bool ad } else if (key < 0x800) { buf[0] = (0xC0 | key >> 6); - buf[1] = (0x80 | key & 0x3F); + buf[1] = (0x80 | (key & 0x3F)); textCharLength.push_back(2); //printf("2 char, textCharLength = %d\n",textCharLength.size()); } else { buf[0] = (0xE0 | key >> 12); - buf[1] = (0x80 | key >> 6 & 0x3F); - buf[2] = (0x80 | key & 0x3F); + buf[1] = (0x80 | (key >> 6 & 0x3F)); + buf[2] = (0x80 | (key & 0x3F)); textCharLength.push_back(3); //printf("3 char, textCharLength = %d\n",textCharLength.size()); } diff --git a/source/shared_lib/include/xml/rapidxml/rapidxml.hpp b/source/shared_lib/include/xml/rapidxml/rapidxml.hpp index 6b82f20a..fa7a79d6 100644 --- a/source/shared_lib/include/xml/rapidxml/rapidxml.hpp +++ b/source/shared_lib/include/xml/rapidxml/rapidxml.hpp @@ -658,6 +658,8 @@ namespace rapidxml : m_name(0) , m_value(0) , m_parent(0) + , m_name_size(0) + , m_value_size(0) { } @@ -807,7 +809,7 @@ namespace rapidxml //! Constructs an empty attribute with the specified type. //! Consider using memory_pool of appropriate xml_document if allocating attributes manually. - xml_attribute() + xml_attribute() : m_next_attribute(0), m_prev_attribute(0) { } @@ -902,6 +904,10 @@ namespace rapidxml : m_type(type) , m_first_node(0) , m_first_attribute(0) + , m_last_attribute(0) + , m_last_node(0) + , m_next_sibling(0) + , m_prev_sibling(0) { } @@ -1849,7 +1855,7 @@ namespace rapidxml // Other character, skip it default: ++text; - + break; } } diff --git a/source/shared_lib/include/xml/rapidxml/rapidxml_print.hpp b/source/shared_lib/include/xml/rapidxml/rapidxml_print.hpp index 84f738ad..5b171da2 100644 --- a/source/shared_lib/include/xml/rapidxml/rapidxml_print.hpp +++ b/source/shared_lib/include/xml/rapidxml/rapidxml_print.hpp @@ -73,6 +73,7 @@ namespace rapidxml break; default: *out++ = *begin; // No expansion, copy character + break; } } ++begin; // Step to next character diff --git a/source/shared_lib/sources/graphics/d3d9/context_d3d9.cpp b/source/shared_lib/sources/graphics/d3d9/context_d3d9.cpp index 773d2b9f..e62e9316 100644 --- a/source/shared_lib/sources/graphics/d3d9/context_d3d9.cpp +++ b/source/shared_lib/sources/graphics/d3d9/context_d3d9.cpp @@ -28,6 +28,8 @@ namespace Shared{ namespace Graphics{ namespace D3d9{ ContextD3d9::ContextD3d9(){ windowed= true; hardware= true; + d3dObject=NULL; + d3dDevice=NULL; } void ContextD3d9::init(){ diff --git a/source/shared_lib/sources/graphics/d3d9/shader_d3d9.cpp b/source/shared_lib/sources/graphics/d3d9/shader_d3d9.cpp index 26a183da..dcb16d8e 100644 --- a/source/shared_lib/sources/graphics/d3d9/shader_d3d9.cpp +++ b/source/shared_lib/sources/graphics/d3d9/shader_d3d9.cpp @@ -29,6 +29,8 @@ ShaderProgramD3d9::ShaderProgramD3d9(){ d3dDevice= static_cast(gi.getCurrentContext())->getD3dDevice(); vertexShader= NULL; pixelShader= NULL; + d3dVsConstantTable=NULL; + d3dPsConstantTable=NULL; } void ShaderProgramD3d9::attach(VertexShader *vs, FragmentShader *fs){