diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-20 21:09:40 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2014-12-21 20:18:17 +0100 |
commit | 17fc7aa3b8fcd731fb05b5e17e23ee984d166a8f (patch) | |
tree | 247985f50367083dbfd1688e66db12c230d04fc1 /sd | |
parent | be34823092ce05002be61a50d0dbf156bb5095ba (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I390607e002e93cf7a6babc26d9be084d9f185058
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/EffectMigration.cxx | 7 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 3 | ||||
-rw-r--r-- | sd/source/core/drawdoc2.cxx | 12 | ||||
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 6 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 9 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-text.cxx | 2 |
7 files changed, 17 insertions, 25 deletions
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index c434982711cf..855cb9fad204 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -445,10 +445,10 @@ void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEff EffectSequence::iterator aIterAsWhole( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) ); const EffectSequence::iterator aEnd( pMainSequence->getEnd() ); - bool bEffectCreated = false; - if( (aIterOnlyBackground == aEnd) && (aIterAsWhole == aEnd) ) { + bool bEffectCreated = false; + // check if there is already an text effect for this shape EffectSequence::iterator aIterOnlyText( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) ); if( aIterOnlyText != aEnd ) @@ -1402,14 +1402,13 @@ void EffectMigration::CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage) Reference< XTimeContainer > xParentContainer(xOuterSeqTimeContainer, UNO_QUERY_THROW); // prepare loop over objects - SdrObject* pLast = 0; SdrObject* pNext = 0; const double fDurationShow(0.2); const double fDurationHide(0.001); for(sal_uInt32 a(0); a < aObjects.size(); a++) { - pLast = pNext; + SdrObject* pLast = pNext; pNext = aObjects[a]; // create node diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 9e5a422b08b2..d80b5fbf93c2 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -666,12 +666,11 @@ void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode) mbNewOrLoadCompleted = true; // Update all linked pages - SdPage* pPage = NULL; sal_uInt16 nMaxSdPages = GetSdPageCount(PK_STANDARD); for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++) { - pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD); + SdPage* pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD); if (pPage && !pPage->GetFileName().isEmpty() && pPage->GetBookmarkName().getLength()) { diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 7d56290d9ba0..f762e9cc5c68 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -224,10 +224,9 @@ void SdDrawDocument::UpdatePageObjectsInNotes(sal_uInt16 nStartPos) if (pPage && pPage->GetPageKind() == PK_NOTES) { const size_t nObjCount = pPage->GetObjCount(); - SdrObject* pObj = NULL; for (size_t nObj = 0; nObj < nObjCount; ++nObj) { - pObj = pPage->GetObj(nObj); + SdrObject* pObj = pPage->GetObj(nObj); if (pObj->GetObjIdentifier() == OBJ_PAGE && pObj->GetObjInventor() == SdrInventor) { @@ -923,13 +922,12 @@ SdAnimationInfo* SdDrawDocument::GetShapeUserData(SdrObject& rObject, bool bCrea { sal_uInt16 nUD = 0; sal_uInt16 nUDCount = rObject.GetUserDataCount(); - SdrObjUserData* pUD = 0; SdAnimationInfo* pRet = 0; // Can we find animation information within the user data? for (nUD = 0; nUD < nUDCount; nUD++) { - pUD = rObject.GetUserData(nUD); + SdrObjUserData* pUD = rObject.GetUserData(nUD); if((pUD->GetInventor() == SdUDInventor) && (pUD->GetId() == SD_ANIMATIONINFO_ID)) { pRet = dynamic_cast<SdAnimationInfo*>(pUD); @@ -950,14 +948,13 @@ SdIMapInfo* SdDrawDocument::GetIMapInfo( SdrObject* pObject ) const { DBG_ASSERT(pObject, "Without an object there is no IMapInfo"); - SdrObjUserData* pUserData = NULL; SdIMapInfo* pIMapInfo = NULL; sal_uInt16 nCount = pObject->GetUserDataCount(); // Can we find IMap information within the user data? for ( sal_uInt16 i = 0; i < nCount; i++ ) { - pUserData = pObject->GetUserData( i ); + SdrObjUserData* pUserData = pObject->GetUserData( i ); if ( ( pUserData->GetInventor() == SdUDInventor ) && ( pUserData->GetId() == SD_IMAPINFO_ID ) ) pIMapInfo = static_cast<SdIMapInfo*>(pUserData); @@ -1057,7 +1054,6 @@ void SdDrawDocument::CheckMasterPages() } SdPage* pPage = NULL; - SdPage* pNotesPage = NULL; sal_uInt16 nPage; @@ -1073,6 +1069,8 @@ void SdDrawDocument::CheckMasterPages() if( nPage < nMaxPages ) { + SdPage* pNotesPage = NULL; + // there is a fatal error in the master page order, // we need to repair the document bool bChanged = false; diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 6789ad278c87..2741cf2c56c4 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -783,12 +783,11 @@ void SdDrawDocument::StartOnlineSpelling(bool bForceSpelling) // Fill OnlineSpelling list void SdDrawDocument::FillOnlineSpellingList(SdPage* pPage) { - SdrObject* pObj = NULL; SdrObjListIter aIter(*pPage, IM_FLAT); while (aIter.IsMore()) { - pObj = aIter.Next(); + SdrObject* pObj = aIter.Next(); if( !pObj ) continue; @@ -845,11 +844,10 @@ IMPL_LINK_NOARG(SdDrawDocument, OnlineSpellingHdl) SdrObjListIter aGroupIter(*static_cast<SdrObjGroup*>(pObj)->GetSubList(), IM_DEEPNOGROUPS); - SdrObject* pSubObj = NULL; while (aGroupIter.IsMore()) { - pSubObj = aGroupIter.Next(); + SdrObject* pSubObj = aGroupIter.Next(); if (pSubObj->GetOutlinerParaObject() && pSubObj->ISA(SdrTextObj)) { diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 38c1af1d9e9e..b5fcdb47ad10 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -195,16 +195,14 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName, bListsFilled = true; } - SfxStyleSheet* pSheet = NULL; - SfxStyleSheet* pOldSheet = NULL; std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin(); std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin(); while (iterOut != aOutlineStyles.end()) { - pSheet = static_cast<SfxStyleSheet*>(*iterOut); - pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(*iterOut); + SfxStyleSheet* pOldSheet = static_cast<SfxStyleSheet*>(*iterOldOut); if (pSheet != pOldSheet) { @@ -270,14 +268,13 @@ void SdPage::EndListenOutlineText() if( nIndex != -1 ) aTrueLayoutName = aTrueLayoutName.copy(0, nIndex); - SfxStyleSheet *pSheet = NULL; std::vector<SfxStyleSheetBase*> aOutlineStyles; pSPool->CreateOutlineSheetList(aTrueLayoutName,aOutlineStyles); std::vector<SfxStyleSheetBase*>::iterator iter; for (iter = aOutlineStyles.begin(); iter != aOutlineStyles.end(); ++iter) { - pSheet = static_cast<SfxStyleSheet*>(*iter); + SfxStyleSheet *pSheet = static_cast<SfxStyleSheet*>(*iter); pOutlineTextObj->EndListening(*pSheet); } } diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 939751a533b1..ce9cb4d0ef0b 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2231,11 +2231,12 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( bGroup ) { - SvMemoryStream* pTmp = NULL; ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > aXIndexAccess( mXShape, ::com::sun::star::uno::UNO_QUERY ); if ( EnterGroup( aXIndexAccess ) ) { + SvMemoryStream* pTmp = NULL; + if ( bEffect && !mbUseNewAnimations ) { pTmp = new SvMemoryStream( 0x200, 0x200 ); diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index b2c25b55eb27..86bf44bfe3b9 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -88,7 +88,6 @@ PortionObj::PortionObj(::com::sun::star::uno::Reference< ::com::sun::star::text: { OUString aString( rXTextRange->getString() ); OUString aURL; - bool bRTL_endingParen = false; mnTextSize = aString.getLength(); if ( bLast ) @@ -96,6 +95,7 @@ PortionObj::PortionObj(::com::sun::star::uno::Reference< ::com::sun::star::text: if ( mnTextSize ) { + bool bRTL_endingParen = false; mpFieldEntry = NULL; sal_uInt32 nFieldType = 0; |