summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Lefèvre <lefevre00@yahoo.fr>2015-03-12 20:57:33 +0100
committerMichael Stahl <mstahl@redhat.com>2015-03-12 22:28:38 +0000
commitc3cd1005568469dc2514627c76378c2f84da2b0d (patch)
tree5457b8cda8b2afeea297e551ce45b3bb80985e98
parent6d15c85759d25807cf88561ac3d05cae5f15a169 (diff)
CppCheck cleanlyness : reduce variable's scope
Change-Id: I5bd18b1a93f7197121eb42f6b82d2d8d87e7671f Reviewed-on: https://gerrit.libreoffice.org/14843 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--basic/source/comp/dim.cxx4
-rw-r--r--chart2/source/controller/main/ChartController_EditData.cxx3
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx12
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx5
-rw-r--r--cppuhelper/source/findsofficepath.c5
-rw-r--r--cui/source/options/treeopt.cxx3
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--cui/source/tabpages/numfmt.cxx3
8 files changed, 13 insertions, 24 deletions
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 8a1e9ae9f16e..27ebb4d6ec29 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -737,8 +737,6 @@ void SbiParser::DefEnum( bool bPrivate )
default:
{
// TODO: Check existing!
- bool bDefined = false;
-
pDim = NULL;
pElem = VarDecl( &pDim, false, true );
if( !pElem )
@@ -760,7 +758,7 @@ void SbiParser::DefEnum( bool bPrivate )
Next();
SbiConstExpression aExpr( this );
- if( !bDefined && aExpr.IsValid() )
+ if( aExpr.IsValid() )
{
SbxVariableRef xConvertVar = new SbxVariable();
if( aExpr.GetType() == SbxSTRING )
diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index aebf313603cc..9cba950495b9 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -46,8 +46,6 @@ void ChartController::executeDispatch_EditData()
Reference< chart2::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
if( xChartDoc.is())
{
- vcl::Window* pParent( NULL );
-
Reference< ::com::sun::star::chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider());
{
@@ -56,6 +54,7 @@ void ChartController::executeDispatch_EditData()
UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData(
SCH_RESSTR( STR_ACTION_EDIT_CHART_DATA ),
m_xUndoManager );
+ vcl::Window* pParent( NULL );
DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC );
if (aDataEditorDialog.Execute() == RET_OK)
aDataEditorDialog.ApplyChangesToModel();
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 957b9af5dc26..4f9be0c43b82 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -697,10 +697,6 @@ bool VCartesianAxis::createTextShapes(
if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories )
pCategories = &m_aTextLabels;
- const TickInfo* pPreviousVisibleTickInfo = NULL;
- const TickInfo* pPREPreviousVisibleTickInfo = NULL;
- const TickInfo* pLastVisibleNeighbourTickInfo = NULL;
-
bool bLimitedHeight = fabs(aTextToTickDistance.getX()) > fabs(aTextToTickDistance.getY());
//prepare properties for multipropertyset-interface of shape
@@ -715,6 +711,9 @@ bool VCartesianAxis::createTextShapes(
uno::Any* pLimitedSpaceAny = PropertyMapper::getValuePointerForLimitedSpace(aPropValues,aPropNames,bLimitedHeight);
+ const TickInfo* pPreviousVisibleTickInfo = NULL;
+ const TickInfo* pPREPreviousVisibleTickInfo = NULL;
+ const TickInfo* pLastVisibleNeighbourTickInfo = NULL;
sal_Int32 nTick = 0;
for( TickInfo* pTickInfo = rTickIter.firstInfo()
; pTickInfo
@@ -895,9 +894,6 @@ bool VCartesianAxis::createTextShapesSimple(
if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories )
pCategories = &m_aTextLabels;
- const TickInfo* pPreviousVisibleTickInfo = NULL;
- const TickInfo* pLastVisibleNeighbourTickInfo = NULL;
-
bool bLimitedHeight = fabs(aTextToTickDistance.getX()) > fabs(aTextToTickDistance.getY());
//prepare properties for multipropertyset-interface of shape
@@ -912,6 +908,8 @@ 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
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
index 73b0c77d20d3..d380f2a9e56a 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
@@ -173,7 +173,6 @@ static nsresult insertPABDescription()
}
}
PR_FREEIF (value);
- value=nsnull;
if (bSetted == sal_True)
{
const char* pHisDescription = static_cast< const char* >( getHisDescription( ) );
@@ -218,7 +217,7 @@ static nsresult getSubsFromParent(const OString& aParent, nsIEnumerator **aSubs)
nsCOMPtr<nsIRDFDataSource> rdfDirectory ;
OString dir("rdf:addressdirectory");
- retCode = rdfService->GetDataSource(dir.getStr(),getter_AddRefs(rdfDirectory)) ;
+ rdfService->GetDataSource(dir.getStr(),getter_AddRefs(rdfDirectory)) ;
@@ -665,7 +664,6 @@ MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon )
{
const sal_Unicode QUERY_CHAR = '?';
const sal_Char* MOZ_SCHEMA = "moz-abldapdirectory://";
- const sal_Char* LDAP_SCHEMA = "ldap://";
OString sAbURI;
OUString sAbBindDN;
@@ -681,6 +679,7 @@ MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon )
sal_Int32 pos = sAbURI.indexOf( MOZ_SCHEMA );
if ( pos != -1 ) {
+ const sal_Char* LDAP_SCHEMA = "ldap://";
sAbURI = sAbURI.replaceAt (pos, rtl_str_getLength( MOZ_SCHEMA ), OString(LDAP_SCHEMA) );
}
diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c
index 37c8bdfc5e07..b199e4e84aa2 100644
--- a/cppuhelper/source/findsofficepath.c
+++ b/cppuhelper/source/findsofficepath.c
@@ -124,8 +124,6 @@ static char* platformSpecific(void)
char* env = NULL;
char* str = NULL;
char* dir = NULL;
- char* file = NULL;
- char* resolved = NULL;
char* sep = NULL;
char buffer[PATH_MAX];
@@ -146,7 +144,8 @@ static char* platformSpecific(void)
while ( dir )
{
/* construct soffice file path */
- file = (char*) malloc( strlen( dir ) + strlen( APPENDIX ) + 1 );
+ char* resolved = NULL;
+ char* file = (char*) malloc( strlen( dir ) + strlen( APPENDIX ) + 1 );
if (file == NULL)
{
free(str);
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 88c2cdb9a006..31c4ee59aad8 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -1236,7 +1236,6 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
if ( pViewFrame )
{
const SfxPoolItem* pItem = NULL;
- SfxPoolItem* pClone = NULL;
SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem))
pRet->Put(SfxUInt16Item(SID_ATTR_LANGUAGE, static_cast<const SvxLanguageItem*>(pItem)->GetLanguage()));
@@ -1248,7 +1247,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
pRet->Put(aHyphen);
if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
{
- pClone = pItem->Clone();
+ SfxPoolItem* pClone = pItem->Clone();
pRet->Put(*pClone);
delete pClone;
}
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 578ce8cb5c51..fa7e31f7ebf2 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -3253,8 +3253,6 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
rSet->InvalidateItem(nWhich);
- bChanged = true;
-
// Pair-Kerning
nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN );
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 57d586122507..97157ba57c8a 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -1276,7 +1276,6 @@ IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb )
IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
{
- bool bAdded = false;
bool bDeleted = false;
sal_uLong nReturn = 0;
const sal_uLong nReturnChanged = 0x1; // THE boolean return value
@@ -1294,7 +1293,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB)
sal_Int32 nErrPos=0;
pNumFmtShell->SetCurCurrencyEntry(NULL);
- bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
+ bool bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
nCatLbSelPos, nFmtLbSelPos,
aEntryList);
if ( bAdded )