oox/source/export/chartexport.cxx | 3 +-- oox/source/export/drawingml.cxx | 2 +- oox/source/vml/vmlformatting.cxx | 6 +----- sal/rtl/cipher.cxx | 7 +++---- sc/qa/unit/parallelism.cxx | 4 +--- sc/source/core/data/attarray.cxx | 3 +-- 6 files changed, 8 insertions(+), 17 deletions(-)
New commits: commit 07c29038d0ffb1cb62f47c61f3611b36eaf87f7c Author: Gökhan Gurbetoğlu <gokhan.gurbeto...@pardus.org.tr> Date: Mon Apr 16 17:07:24 2018 +0300 cppcheck - fix variableScope in some files Reduced the scope of some variables in source. Change-Id: I705e7f2587fd81015f06fb301eb8d4a270668d73 Reviewed-on: https://gerrit.libreoffice.org/53042 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Gökhan Gurbetoğlu <gokhan.gurbeto...@pardus.org.tr> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index aad1c41ad8fe..bd91390d5f3c 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -2979,7 +2979,6 @@ void writeCustomLabel( const FSHelperPtr& pFS, ChartExport* pChartExport, pFS->singleElement(FSNS(XML_a, XML_bodyPr), FSEND); OUString sFieldType; - bool bNewParagraph; pFS->startElement(FSNS(XML_a, XML_p), FSEND); for (auto& rField : rCustomLabelFields) @@ -2987,7 +2986,7 @@ void writeCustomLabel( const FSHelperPtr& pFS, ChartExport* pChartExport, Reference<XPropertySet> xPropertySet(rField, UNO_QUERY); chart2::DataPointCustomLabelFieldType aType = rField->getFieldType(); sFieldType.clear(); - bNewParagraph = false; + bool bNewParagraph = false; if (aType == chart2::DataPointCustomLabelFieldType_NEWLINE) bNewParagraph = true; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e18c0ce93fd2..1c0be28fdaf9 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1205,10 +1205,10 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs ::Color nColor = COL_WHITE; sal_Int32 nAlpha = 0; - bool isBackgroundFilled = false; if ( GetProperty( rXPropSet, "FillBackground" ) ) { + bool isBackgroundFilled = false; mAny >>= isBackgroundFilled; if( isBackgroundFilled ) { diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 1e8c1318f832..17a730a2f8d8 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -960,7 +960,6 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen if (!moTrim.has() || !moTrim.get()) { OUString sText = moString.get(); - double fRatio = 0; VclPtr<VirtualDevice> pDevice = VclPtr<VirtualDevice>::Create(); vcl::Font aFont = pDevice->GetFont(); aFont.SetFamilyName(sFont); @@ -970,10 +969,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen auto nTextWidth = pDevice->GetTextWidth(sText); if (nTextWidth) { - fRatio = pDevice->GetTextHeight(); - fRatio /= nTextWidth; - - sal_Int32 nNewHeight = fRatio * xShape->getSize().Width; + sal_Int32 nNewHeight = (static_cast<double>(pDevice->GetTextHeight()) / nTextWidth) * xShape->getSize().Width; xShape->setSize(awt::Size(xShape->getSize().Width, nNewHeight)); } } diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index 62f3104be3ed..bd913c38faf1 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -1069,7 +1069,7 @@ static rtlCipherError rtl_cipherARCFOUR_init_Impl( { unsigned int K[CIPHER_CBLOCK_ARCFOUR]; unsigned int *L, *S; - unsigned int x, y, t; + unsigned int x, y; sal_Size n, k; S = &(ctx->m_S[0]); @@ -1099,7 +1099,7 @@ static rtlCipherError rtl_cipherARCFOUR_init_Impl( { y = (y + S[x] + K[x]) % CIPHER_CBLOCK_ARCFOUR; /* swap S[x] and S[y] */ - t = S[x]; + unsigned int t = S[x]; S[x] = S[y]; S[y] = t; } @@ -1117,7 +1117,6 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl( sal_uInt8 *pBuffer, sal_Size nBufLen) { unsigned int *S; - unsigned int t; sal_Size k; /* Check arguments. */ @@ -1140,7 +1139,7 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl( ctx->m_Y = y; /* Swap S[x] and S[y]. */ - t = S[x]; + unsigned int t = S[x]; S[x] = S[y]; S[y] = t; 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<size_t>(m_pDoc->GetValue(3, i, 0))); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 6 * (nNumRows - i - 1) + 101, static_cast<size_t>(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<const ScPatternAttr*>( &pDocument->GetPool()->Put( aNewPattern ) ); - bNumFormatChanged = false; + bool bNumFormatChanged = false; if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, mvData[nIdx].pPattern->GetItemSet(), pDocument->GetDefPattern()->GetItemSet() ) ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits