summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-08 20:47:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-06-09 10:33:59 +0100
commitcc0e9a37de8bceeb224b03a5bb1827b087e3e7b5 (patch)
tree8d24abeda6b70096c7f96107b681a81fe6378418
parent0eb52534de536fbe33585c91f4f173653b184e24 (diff)
cppcheck: variableScope
Change-Id: If0c56c89e2722d47a401363f3854331229856490
-rw-r--r--basic/source/runtime/methods.cxx3
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx6
-rw-r--r--rsc/source/parser/rscibas.cxx6
-rw-r--r--xmlhelp/source/treeview/tvread.cxx3
4 files changed, 5 insertions, 13 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 5a86549402a8..6ecdf30e1361 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3560,10 +3560,9 @@ RTLFUNC(Randomize)
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
- int nSeed;
if( rPar.Count() == 2 )
{
- nSeed = (int)rPar.Get(1)->GetInteger();
+ int nSeed = (int)rPar.Get(1)->GetInteger();
theRandomNumberGenerator::get().global_rng.seed(nSeed);
}
// without parameter, no need to do anything - RNG is seeded at first use
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index c8ae9e095be7..90f5880165cd 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -713,13 +713,12 @@ bool VCartesianAxis::createTextShapes(
const TickInfo* pPreviousVisibleTickInfo = NULL;
const TickInfo* pPREPreviousVisibleTickInfo = NULL;
- const TickInfo* pLastVisibleNeighbourTickInfo = NULL;
sal_Int32 nTick = 0;
for( TickInfo* pTickInfo = rTickIter.firstInfo()
; pTickInfo
; pTickInfo = rTickIter.nextInfo(), nTick++ )
{
- pLastVisibleNeighbourTickInfo = bIsStaggered ?
+ const TickInfo* pLastVisibleNeighbourTickInfo = bIsStaggered ?
pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo;
//don't create labels which does not fit into the rhythm
@@ -909,13 +908,12 @@ bool VCartesianAxis::createTextShapesSimple(
uno::Any* pLimitedSpaceAny = PropertyMapper::getValuePointerForLimitedSpace(aPropValues,aPropNames,bLimitedHeight);
const TickInfo* pPreviousVisibleTickInfo = NULL;
- const TickInfo* pLastVisibleNeighbourTickInfo = NULL;
sal_Int32 nTick = 0;
for( TickInfo* pTickInfo = rTickIter.firstInfo()
; pTickInfo
; pTickInfo = rTickIter.nextInfo(), nTick++ )
{
- pLastVisibleNeighbourTickInfo = pPreviousVisibleTickInfo;
+ const TickInfo* pLastVisibleNeighbourTickInfo = pPreviousVisibleTickInfo;
//don't create labels which does not fit into the rhythm
if( nTick%rAxisLabelProperties.nRhythm != 0 )
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index 3836b4748d3e..395ba1f032a3 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -150,22 +150,18 @@ void RscLangEnum::Init( RscNameTable& rNames )
Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames )
{
Atom nResult = 0;
- bool bAdd = false;
KEY_STRUCT aStruct;
if( ! rNames.Get( nResult = pHS->getID( pLang ), &aStruct ) )
{
SetConstant( nResult = rNames.Put( pLang, CONSTNAME, mnLangId ), mnLangId );
// insert new lang to ULong_Iso_map
OString aLang( pLang );
- bAdd = (GetLangId( aLang ) == 0);
+ bool bAdd = (GetLangId( aLang ) == 0);
if ( bAdd )
ULong_Iso_map[ aLang ] = mnLangId;
// increase id counter
mnLangId++;
}
-#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, "AddLanguage( '%s' ) = %d (%s)\n", pLang, nResult, (bAdd ? "added" : "exists") );
-#endif
return nResult;
}
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 1954335ec783..a13067b012b1 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -707,7 +707,6 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL );
if( osl::Directory::E_None == aDirectory.open() )
{
- int idx_ = 0;
OUString aFileUrl, aFileName;
while( aDirectory.getNextItem( aDirItem ) == osl::FileBase::E_None &&
aDirItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None &&
@@ -716,7 +715,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
{
aFileUrl = aFileStatus.getFileURL();
aFileName = aFileStatus.getFileName();
- idx_ = aFileName.lastIndexOf( '.' );
+ int idx_ = aFileName.lastIndexOf( '.' );
if( idx_ == -1 )
continue;