From 94d9fb7aaea7093b70f9e58eb90a8b10349736d9 Mon Sep 17 00:00:00 2001 From: Keith Brown Date: Mon, 14 Apr 2014 09:46:28 +0100 Subject: [PATCH] Refs #8962 Fixing cppcheck and gcc warnings this should fix the cppcheck and gcc compiler warnings caused by my work on this ticket --- .../Framework/DataHandling/src/LoadReflTBL.cpp | 2 -- .../Framework/DataHandling/src/SaveReflTBL.cpp | 12 ++++++------ .../Framework/DataHandling/test/SaveReflTBLTest.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp b/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp index 7a4759b87b37..3c5798fed89a 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadReflTBL.cpp @@ -246,7 +246,6 @@ namespace Mantid size_t LoadReflTBL::getCells(std::string line, std::vector & cols) const { //first check the number of commas in the line. - size_t pos = 0; size_t found = countCommas(line); if (found == m_expectedCommas) { @@ -263,7 +262,6 @@ namespace Mantid { //More than 16 will need further checks as more is only ok when pairs of quotes surround a comma, meaning it isn't a delimiter std::vector> quoteBounds; - size_t quotepairs = findQuotePairs(line, quoteBounds); //if we didn't find any quotes, then there are too many commas and we definitely have too many delimiters if (quoteBounds.size() == 0) { diff --git a/Code/Mantid/Framework/DataHandling/src/SaveReflTBL.cpp b/Code/Mantid/Framework/DataHandling/src/SaveReflTBL.cpp index 9aec44083b73..06005ddb6401 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveReflTBL.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveReflTBL.cpp @@ -46,7 +46,7 @@ namespace Mantid using namespace API; /// Empty constructor - SaveReflTBL::SaveReflTBL() : m_stichgroups(), m_nogroup(), m_sep(',') + SaveReflTBL::SaveReflTBL() : m_sep(','), m_stichgroups(), m_nogroup() { } @@ -112,11 +112,11 @@ namespace Mantid } typedef std::map>::iterator map_it_type; - for(map_it_type iterator = m_stichgroups.begin(); iterator != m_stichgroups.end(); iterator++) + for(map_it_type iterator = m_stichgroups.begin(); iterator != m_stichgroups.end(); ++iterator) { std::vector & rowNos = iterator->second; - int i = 0; - for (i; i < rowNos.size(); ++i) + size_t i = 0; + for (; i < rowNos.size(); ++i) { //for each row in the group print the first 5 columns to file TableRow row = ws->getRow(rowNos[i]); @@ -126,7 +126,7 @@ namespace Mantid } } //if i comes out of that loop as less than 3, then we need to add the blank runs - for (i; i < 3; ++i) + for (; i < 3; ++i) { for (int j = 0; j < 5; ++j) { @@ -142,7 +142,7 @@ namespace Mantid //now do the same for the ungrouped typedef std::vector::iterator vec_it_type; - for(vec_it_type iterator = m_nogroup.begin(); iterator != m_nogroup.end(); iterator++) + for(vec_it_type iterator = m_nogroup.begin(); iterator != m_nogroup.end(); ++iterator) { TableRow row = ws->getRow(*iterator); for (int j = 0; j < 5; ++j) diff --git a/Code/Mantid/Framework/DataHandling/test/SaveReflTBLTest.h b/Code/Mantid/Framework/DataHandling/test/SaveReflTBLTest.h index 79db4e12af07..ea927d347441 100644 --- a/Code/Mantid/Framework/DataHandling/test/SaveReflTBLTest.h +++ b/Code/Mantid/Framework/DataHandling/test/SaveReflTBLTest.h @@ -204,7 +204,7 @@ class SaveReflTBLTest : public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING(Poco::File(m_abspath).remove()); } - ITableWorkspace_sptr CreateWorkspace(bool colFail = false) + ITableWorkspace_sptr CreateWorkspace() { ITableWorkspace_sptr ws = WorkspaceFactory::Instance().createTable(); AnalysisDataService::Instance().addOrReplace(m_name, ws);