From 07c29038d0ffb1cb62f47c61f3611b36eaf87f7c Mon Sep 17 00:00:00 2001 From: Gökhan Gurbetoğlu Date: Mon, 16 Apr 2018 17:07:24 +0300 Subject: cppcheck - fix variableScope in some files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduced the scope of some variables in source. Change-Id: I705e7f2587fd81015f06fb301eb8d4a270668d73 Reviewed-on: https://gerrit.libreoffice.org/53042 Tested-by: Jenkins Reviewed-by: Gökhan Gurbetoğlu Reviewed-by: Noel Grandin --- sc/qa/unit/parallelism.cxx | 4 +--- sc/source/core/data/attarray.cxx | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'sc') diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index 896b7c1d8382..ca6dce5c9f2f 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -288,12 +288,10 @@ void ScParallelismTest::testVLOOKUPSUM() m_xDocShell->DoHardRecalc(); - size_t nArg; for (size_t i = 0; i < nNumRows; ++i) { OString aMsg = "At row " + OString::number(i); - nArg = nNumRows - i - 1; - CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 6*nArg + 101, static_cast(m_pDoc->GetValue(3, i, 0))); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 6 * (nNumRows - i - 1) + 101, static_cast(m_pDoc->GetValue(3, i, 0))); } m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index c66fa7e8aa5e..071c7ae30066 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -57,7 +57,6 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr { if ( nCol != -1 && pDefaultColAttrArray && !pDefaultColAttrArray->mvData.empty()) { - bool bNumFormatChanged; ScAddress aAdrStart( nCol, 0, nTab ); ScAddress aAdrEnd( nCol, 0, nTab ); mvData.resize( pDefaultColAttrArray->mvData.size() ); @@ -66,7 +65,7 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr mvData[nIdx].nEndRow = pDefaultColAttrArray->mvData[nIdx].nEndRow; ScPatternAttr aNewPattern( *(pDefaultColAttrArray->mvData[nIdx].pPattern) ); mvData[nIdx].pPattern = static_cast( &pDocument->GetPool()->Put( aNewPattern ) ); - bNumFormatChanged = false; + bool bNumFormatChanged = false; if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, mvData[nIdx].pPattern->GetItemSet(), pDocument->GetDefPattern()->GetItemSet() ) ) { -- cgit