From 4f7b2ca221efe9f198994c98ac4603c9e4688f11 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Jul 2017 08:33:06 +0200 Subject: loplugin:unusedfields in sc found a couple more by running make build-nocheck to exclude testing code Also, teach unusedfields loplugin about operator<<, since referring to a field in an ostream operator<< does not indicate a real use, it's normally for debugging Change-Id: I3dce22bf5afda2fd09e01de9bf1d0ef85e535aa8 Reviewed-on: https://gerrit.libreoffice.org/39625 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/types.hxx | 1 - sc/qa/unit/ucalc_column.cxx | 5 ----- sc/source/core/data/table7.cxx | 7 +++---- sc/source/core/data/types.cxx | 4 ++-- 4 files changed, 5 insertions(+), 12 deletions(-) (limited to 'sc') diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx index 4cfa434c21cb..51898c291fde 100644 --- a/sc/inc/types.hxx +++ b/sc/inc/types.hxx @@ -104,7 +104,6 @@ struct MultiDataCellState SCCOL mnCol1; //< first non-empty column SCROW mnRow1; //< first non-empty row - SCTAB mnTab1; //< first non-empty sheet MultiDataCellState(); MultiDataCellState( StateType eState ); diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx index 8aeb6f2dbf57..4a64f695a414 100644 --- a/sc/qa/unit/ucalc_column.cxx +++ b/sc/qa/unit/ucalc_column.cxx @@ -140,7 +140,6 @@ void Test::testMultipleDataCellsInRange() CPPUNIT_ASSERT_EQUAL(sc::MultiDataCellState::HasOneCell, aState.meState); CPPUNIT_ASSERT_EQUAL(SCCOL(1), aState.mnCol1); CPPUNIT_ASSERT_EQUAL(SCROW(2), aState.mnRow1); - CPPUNIT_ASSERT_EQUAL(SCTAB(0), aState.mnTab1); // Set another numeric value to B4. m_pDoc->SetValue(ScAddress(1,3,0), 2.0); @@ -149,7 +148,6 @@ void Test::testMultipleDataCellsInRange() CPPUNIT_ASSERT_EQUAL(sc::MultiDataCellState::HasMultipleCells, aState.meState); CPPUNIT_ASSERT_EQUAL(SCCOL(1), aState.mnCol1); CPPUNIT_ASSERT_EQUAL(SCROW(2), aState.mnRow1); - CPPUNIT_ASSERT_EQUAL(SCTAB(0), aState.mnTab1); // Set the query range to B4:B5. Now it should only report one cell, with // B4 being the first non-empty cell. @@ -159,7 +157,6 @@ void Test::testMultipleDataCellsInRange() CPPUNIT_ASSERT_EQUAL(sc::MultiDataCellState::HasOneCell, aState.meState); CPPUNIT_ASSERT_EQUAL(SCCOL(1), aState.mnCol1); CPPUNIT_ASSERT_EQUAL(SCROW(3), aState.mnRow1); - CPPUNIT_ASSERT_EQUAL(SCTAB(0), aState.mnTab1); // Set the query range to A1:C3. The first non-empty cell should be B3. aRange = ScRange(0,0,0,2,2,0); @@ -167,7 +164,6 @@ void Test::testMultipleDataCellsInRange() CPPUNIT_ASSERT_EQUAL(sc::MultiDataCellState::HasOneCell, aState.meState); CPPUNIT_ASSERT_EQUAL(SCCOL(1), aState.mnCol1); CPPUNIT_ASSERT_EQUAL(SCROW(2), aState.mnRow1); - CPPUNIT_ASSERT_EQUAL(SCTAB(0), aState.mnTab1); // Set string cells to D4 and F5, and query D3:F5. D4 should be the first // non-empty cell. @@ -178,7 +174,6 @@ void Test::testMultipleDataCellsInRange() CPPUNIT_ASSERT_EQUAL(sc::MultiDataCellState::HasMultipleCells, aState.meState); CPPUNIT_ASSERT_EQUAL(SCCOL(3), aState.mnCol1); CPPUNIT_ASSERT_EQUAL(SCROW(3), aState.mnRow1); - CPPUNIT_ASSERT_EQUAL(SCTAB(0), aState.mnTab1); // TODO : add more test cases as needed. diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx index acd21d415493..e20f5b44d777 100644 --- a/sc/source/core/data/table7.cxx +++ b/sc/source/core/data/table7.cxx @@ -39,14 +39,13 @@ sc::MultiDataCellState ScTable::HasMultipleDataCells( SCCOL nCol1, SCROW nRow1, if (aCol.empty()) return sc::MultiDataCellState(sc::MultiDataCellState::Empty); - auto setFirstCell = []( sc::MultiDataCellState& rRet, SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) + auto setFirstCell = []( sc::MultiDataCellState& rRet, SCCOL nCurCol, SCROW nCurRow ) { if (rRet.mnCol1 < 0) { // First cell not yet set. Set it. rRet.mnCol1 = nCurCol; rRet.mnRow1 = nCurRow; - rRet.mnTab1 = nCurTab; } }; @@ -61,7 +60,7 @@ sc::MultiDataCellState ScTable::HasMultipleDataCells( SCCOL nCol1, SCROW nRow1, { case sc::MultiDataCellState::HasOneCell: { - setFirstCell(aRet, nCol, nFirstDataRow, nTab); + setFirstCell(aRet, nCol, nFirstDataRow); if (bHasOne) { @@ -74,7 +73,7 @@ sc::MultiDataCellState ScTable::HasMultipleDataCells( SCCOL nCol1, SCROW nRow1, } case sc::MultiDataCellState::HasMultipleCells: { - setFirstCell(aRet, nCol, nFirstDataRow, nTab); + setFirstCell(aRet, nCol, nFirstDataRow); aRet.meState = sc::MultiDataCellState::HasMultipleCells; return aRet; diff --git a/sc/source/core/data/types.cxx b/sc/source/core/data/types.cxx index 6146f77b28ef..4d5d6fa0713c 100644 --- a/sc/source/core/data/types.cxx +++ b/sc/source/core/data/types.cxx @@ -24,10 +24,10 @@ bool RangeMatrix::isRangeValid() const MultiDataCellState::MultiDataCellState() : meState(StateType::Invalid), - mnCol1(-1), mnRow1(-1), mnTab1(-1) {} + mnCol1(-1), mnRow1(-1) {} MultiDataCellState::MultiDataCellState( StateType eState ) : meState(eState), - mnCol1(-1), mnRow1(-1), mnTab1(-1) {} + mnCol1(-1), mnRow1(-1) {} } -- cgit