Kaydet (Commit) 373e71ee authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Thorsten Behrens

tdf#39440 reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: I97726ed32e5aa92e7da7d248380a78b1b201e46e
Reviewed-on: https://gerrit.libreoffice.org/17912Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst d0489d08
......@@ -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 );
}
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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 )
{
......
......@@ -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())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment