chart2/qa/extras/chart2_trendcalculators.cxx | 18 ++++++------------ cui/source/options/optaboutconfig.cxx | 3 +-- editeng/source/rtf/svxrtf.cxx | 3 +-- extensions/source/activex/so_activex.cxx | 8 ++++---- filter/source/graphicfilter/epict/epict.cxx | 3 +-- 5 files changed, 13 insertions(+), 22 deletions(-)
New commits: commit 373e71ee65a90daa9a27ff5bb7a3d6c867e4f393 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Aug 21 13:52:14 2015 +0200 tdf#39440 reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I97726ed32e5aa92e7da7d248380a78b1b201e46e Reviewed-on: https://gerrit.libreoffice.org/17912 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx index 7ee0f12..19d0b00 100644 --- a/chart2/qa/extras/chart2_trendcalculators.cxx +++ b/chart2/qa/extras/chart2_trendcalculators.cxx @@ -112,10 +112,9 @@ void Chart2TrendCalculators::testPotentialRegression1() m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = 2.0 * pow ( d, 3 ); } @@ -129,10 +128,9 @@ void Chart2TrendCalculators::testPotentialRegression2() m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = -2.0 * pow ( d, 3 ); } @@ -146,10 +144,9 @@ void Chart2TrendCalculators::testLinearRegression1() m_xRegressionCurveCalculator->setRegressionProperties( 1, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = - 2.0 * d - 5.0 ; } @@ -163,10 +160,9 @@ void Chart2TrendCalculators::testPolynomialRegression1() m_xRegressionCurveCalculator->setRegressionProperties( 2, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = - 2.0 * d * d + 4 * d - 5; } @@ -179,10 +175,9 @@ void Chart2TrendCalculators::testExponentialRegression1() m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = 2.0 * exp ( 0.3 * d ); } @@ -195,10 +190,9 @@ void Chart2TrendCalculators::testExponentialRegression2() m_xRegressionCurveCalculator->setRegressionProperties( 0, false, 0, 0 ); Sequence< double > xValues( 7 ); Sequence< double > yValues( 7 ); - double d; for (int i=0; i<7; i++) { - d = (double) i; + const double d = (double) i; xValues[i] = d; yValues[i] = -2.0 * exp ( 0.3 * d ); } diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index 37496e3..7b18d07 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -873,13 +873,12 @@ void CuiAboutConfigTabPage::InsertEntry( SvTreeListEntry *pEntry) sal_Int32 index = sPathWithProperty.lastIndexOf(static_cast< SvLBoxString& >(pEntry->GetItem(1)).GetText()); OUString sPath = sPathWithProperty.copy(0, index); index = 0; - int prevIndex; SvTreeListEntry* pParentEntry; SvTreeListEntry* pGrandParentEntry = nullptr; do { - prevIndex = index; + int prevIndex = index; index = sPath.indexOf("/", index+1); OUString sParentName = sPath.copy(prevIndex+1, index - prevIndex - 1); diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index e2d5259..a027bf6 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -770,10 +770,9 @@ void SvxRTFParser::ClearStyleTbl() void SvxRTFParser::ClearAttrStack() { - SvxRTFItemStackType* pTmp; for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt ) { - pTmp = aAttrStack.back(); + SvxRTFItemStackType* pTmp = aAttrStack.back(); aAttrStack.pop_back(); delete pTmp; } diff --git a/extensions/source/activex/so_activex.cxx b/extensions/source/activex/so_activex.cxx index 45c9174..2a73949 100644 --- a/extensions/source/activex/so_activex.cxx +++ b/extensions/source/activex/so_activex.cxx @@ -217,9 +217,6 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc int ind; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - char pActiveXPath[1124]; - char pActiveXPath101[1124]; - // In case SO7 is installed for this user he can have local registry entries that will prevent him from // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. @@ -229,6 +226,9 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc if ( pProgramPath && strlen( pProgramPath ) < 1024 ) { + char pActiveXPath[1124]; + char pActiveXPath101[1124]; + sprintf( pActiveXPath, "%s\\%s", pProgramPath, pLibName ); sprintf( pActiveXPath101, "%s\\%s, 101", pProgramPath, pLibName ); @@ -660,7 +660,6 @@ STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) STDAPI DllRegisterServer() { - char pProgramPath[1024]; HRESULT aResult = E_FAIL; HMODULE aCurModule = GetModuleHandleA( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); @@ -669,6 +668,7 @@ STDAPI DllRegisterServer() if( aCurModule ) { + char pProgramPath[1024]; DWORD nLen = GetModuleFileNameA( aCurModule, pProgramPath, 1024 ); if ( nLen && nLen > nLibNameLen + 1 ) { diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx index 6807e84..b4afb21 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -1393,7 +1393,6 @@ void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { size_t nA, nACount; - const MetaAction* pMA; if( !bStatus) return; @@ -1402,7 +1401,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) for (nA=0; nA < nACount; nA++) { - pMA = rMTF.GetAction(nA); + const MetaAction* pMA = rMTF.GetAction(nA); switch (pMA->GetType()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits