From 9350b16c4af80f9b4b7623c55beabb3958065bce Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 14 Nov 2013 16:42:22 +0000 Subject: [PATCH] cleanup from cppcheck 1.62 --- source/glest_game/global/config.cpp | 2 -- source/glest_game/main/battle_end.h | 2 -- source/glest_game/main/intro.h | 2 -- source/glest_game/main/main.cpp | 2 +- source/shared_lib/sources/graphics/font.cpp | 6 +++--- source/tests/shared_lib/graphics/font_test.cpp | 4 ++-- source/tests/shared_lib/xml/xml_parser_test.cpp | 12 ++++++------ source/tools/glexemel/g2xml.c | 8 ++++---- 8 files changed, 16 insertions(+), 22 deletions(-) diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index 736d86fa..703abcef 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -111,8 +111,6 @@ Config::Config() { fileName.second = ""; fileNameParameter.first = ""; fileNameParameter.second = ""; - fileLoaded.first = false; - fileLoaded.second = false; } bool Config::tryCustomPath(std::pair &type, std::pair &file, string custom_path) { diff --git a/source/glest_game/main/battle_end.h b/source/glest_game/main/battle_end.h index 91570855..c1691d4d 100644 --- a/source/glest_game/main/battle_end.h +++ b/source/glest_game/main/battle_end.h @@ -39,8 +39,6 @@ private: Stats stats; GraphicButton buttonExit; - int mouseX; - int mouseY; int mouse2d; GraphicMessageBox mainMessageBox; Texture2D *renderToTexture; diff --git a/source/glest_game/main/intro.h b/source/glest_game/main/intro.h index 451ef506..80417742 100644 --- a/source/glest_game/main/intro.h +++ b/source/glest_game/main/intro.h @@ -87,8 +87,6 @@ private: private: vector texts; int timer; - int mouseX; - int mouseY; int mouse2d; //Model *mainModel; diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index fab47ba9..cfc3e7c1 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -269,7 +269,7 @@ static void cleanupProcessObjects() { for(int i = 0; i < Thread::getThreadList().size(); ++i) { BaseThread *baseThread = dynamic_cast(Thread::getThreadList()[i]); - printf("Thread index: %d ptr [%p] isBaseThread: %d, Name: [%s]\n",i,baseThread,(baseThread != NULL),(baseThread != NULL ? baseThread->getUniqueID().c_str() : "")); + printf("Thread index: %d ptr [%p] isBaseThread: %d, Name: [%s]\n",i,baseThread,(baseThread != NULL ? 1 : 0),(baseThread != NULL ? baseThread->getUniqueID().c_str() : "")); } } } diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index fa4cf3af..94263296 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -421,7 +421,7 @@ bool next_word_is_ASCII(const string &str_,int start_index) { int length = end_index-start_index+1; string word = str_.substr(start_index,length); //printf("Line: %d word [%s] length: %d\n",__LINE__,word.c_str(),length); - int alphaCount = 0; + //int alphaCount = 0; for(int index = 0; index < word.size(); ++index) { //printf("%c = %d,",word[index],isalnum(word[index])); if(isalnum(word[index]) != 0) { @@ -644,7 +644,7 @@ void Font::bidi_cvt(string &str_) { vtol = new FriBidiStrIndex[size * 3]; FriBidiCharType base; - size_t len, orig_len; + size_t len; //A bool type to see if conversion succeded fribidi_boolean log2vis; @@ -657,7 +657,7 @@ void Font::bidi_cvt(string &str_) { strcpy(ip, str_.c_str()); //Find length of originall text - orig_len = len = strlen( ip ); + len = strlen( ip ); //Insert ip to logical as unicode (and find it's size now) len = fribidi_charset_to_unicode (char_set_num, ip, (FriBidiStrIndex)len, logical); diff --git a/source/tests/shared_lib/graphics/font_test.cpp b/source/tests/shared_lib/graphics/font_test.cpp index 451facb5..d17630d2 100644 --- a/source/tests/shared_lib/graphics/font_test.cpp +++ b/source/tests/shared_lib/graphics/font_test.cpp @@ -57,7 +57,7 @@ public: CPPUNIT_ASSERT_EQUAL( 45,(int)IntroText1.size() ); std::vector > result = Font::extract_mixed_LTR_RTL_map(IntroText1); - //CPPUNIT_ASSERT_EQUAL( 30, (int)result.size() ); + CPPUNIT_ASSERT_EQUAL( 30, (int)result.size() ); #ifdef HAVE_FRIBIDI IntroText1 = expected; @@ -76,7 +76,7 @@ public: CPPUNIT_ASSERT_EQUAL( 44,(int)LuaDisableSecuritySandbox.size() ); result = Font::extract_mixed_LTR_RTL_map(LuaDisableSecuritySandbox); - //CPPUNIT_ASSERT_EQUAL( 7, (int)result.size() ); + CPPUNIT_ASSERT_EQUAL( 4, (int)result.size() ); //printf("Result: [%s]\n",LuaDisableSecuritySandbox.c_str()); diff --git a/source/tests/shared_lib/xml/xml_parser_test.cpp b/source/tests/shared_lib/xml/xml_parser_test.cpp index e5d65e8b..7ada263f 100644 --- a/source/tests/shared_lib/xml/xml_parser_test.cpp +++ b/source/tests/shared_lib/xml/xml_parser_test.cpp @@ -104,7 +104,7 @@ public: CPPUNIT_ASSERT_EQUAL( false, newInstance.isInitialized() ); } void test_load_file_missing() { - XmlNode *rootNode = XmlIo::getInstance().load("/some/path/that/does/not exist", std::map()); + XmlIo::getInstance().load("/some/path/that/does/not exist", std::map()); } void test_load_file_valid() { const string test_filename = "xml_test_valid.xml"; @@ -121,7 +121,7 @@ public: createMalformedXMLTestFile(test_filename); SafeRemoveTestFile deleteFile(test_filename); - XmlNode *rootNode = XmlIo::getInstance().load(test_filename, std::map()); + XmlIo::getInstance().load(test_filename, std::map()); } void test_save_file_null_node() { @@ -174,7 +174,7 @@ public: CPPUNIT_ASSERT_EQUAL( false, newInstance.isInitialized() ); } void test_load_file_missing() { - XmlNode *rootNode = XmlIoRapid::getInstance().load("/some/path/that/does/not exist", std::map()); + XmlIoRapid::getInstance().load("/some/path/that/does/not exist", std::map()); } void test_load_file_valid() { const string test_filename = "xml_test_valid.xml"; @@ -190,7 +190,7 @@ public: const string test_filename = "xml_test_malformed.xml"; createMalformedXMLTestFile(test_filename); SafeRemoveTestFile deleteFile(test_filename); - XmlNode *rootNode = XmlIoRapid::getInstance().load(test_filename, std::map()); + XmlIoRapid::getInstance().load(test_filename, std::map()); } void test_save_file_null_node() { @@ -548,7 +548,7 @@ public: CPPUNIT_ASSERT_EQUAL( string(""),attr.getValue() ); attr.setValue("-123456"); - int value = attr.getIntValue(1, 10); + attr.getIntValue(1, 10); } void test_node_attributes_float_outofrange() { const string test_filename = "xml_test_valid.xml"; @@ -562,7 +562,7 @@ public: XmlAttribute attr(node, mapTagReplacementValues); attr.setValue("-123456.01"); - float value = attr.getFloatValue(-123456.999f, -123456.123456f); + attr.getFloatValue(-123456.999f, -123456.123456f); } }; diff --git a/source/tools/glexemel/g2xml.c b/source/tools/glexemel/g2xml.c index 54100da6..423a8c59 100644 --- a/source/tools/glexemel/g2xml.c +++ b/source/tools/glexemel/g2xml.c @@ -188,10 +188,10 @@ int g3d2xml(FILE *infile, FILE *outfile) /* write out XML mesh header */ fprintf(outfile, "\t\n"); for (kk=0; kk < meshHeader.indexCount; kk++) { - fprintf(outfile, "\t\t\t\n", + fprintf(outfile, "\t\t\t\n", idata[kk]); } fprintf(outfile, "\t\t\n");