basic/source/comp/dim.cxx | 4 --- chart2/source/controller/main/ChartController_EditData.cxx | 3 -- chart2/source/view/axes/VCartesianAxis.cxx | 12 ++++------ connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx | 5 +--- cppuhelper/source/findsofficepath.c | 5 +--- cui/source/options/treeopt.cxx | 3 -- cui/source/tabpages/chardlg.cxx | 2 - cui/source/tabpages/numfmt.cxx | 3 -- 8 files changed, 13 insertions(+), 24 deletions(-)
New commits: commit c3cd1005568469dc2514627c76378c2f84da2b0d Author: Michaël Lefèvre <lefevr...@yahoo.fr> Date: Thu Mar 12 20:57:33 2015 +0100 CppCheck cleanlyness : reduce variable's scope Change-Id: I5bd18b1a93f7197121eb42f6b82d2d8d87e7671f Reviewed-on: https://gerrit.libreoffice.org/14843 Tested-by: Michael Stahl <mst...@redhat.com> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 8a1e9ae..27ebb4d 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 aebf313..9cba950 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 957b9af..4f9be0c 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 73b0c77..d380f2a 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 37c8bdf..b199e4e 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 88c2cdb..31c4ee5 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 578ce8c..fa7e31f 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 57d5861..97157ba 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 )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits