[Libreoffice-commits] core.git: svx/source sw/source

Michael Dunphy mdunphy at uwaterloo.ca
Mon Mar 23 01:50:16 PDT 2015


 svx/source/accessibility/svxrectctaccessiblecontext.cxx |    3 +--
 svx/source/dialog/dlgctrl.cxx                           |    3 +--
 svx/source/svdraw/svdglev.cxx                           |    6 +++---
 svx/source/svdraw/svdotextdecomposition.cxx             |    4 ++--
 svx/source/svdraw/svdpage.cxx                           |    3 +--
 svx/source/table/tablecontroller.cxx                    |    2 +-
 sw/source/core/doc/docchart.cxx                         |    2 +-
 sw/source/core/docnode/ndtbl.cxx                        |    3 +--
 sw/source/core/unocore/unocoll.cxx                      |    3 +--
 sw/source/filter/ww8/ww8par.cxx                         |    2 +-
 10 files changed, 13 insertions(+), 18 deletions(-)

New commits:
commit da631972229389d40e0502e02ff4e2c0761ca3fc
Author: Michael Dunphy <mdunphy at uwaterloo.ca>
Date:   Sun Mar 22 01:04:12 2015 +0100

    fdo#39440 cppcheck cleanliness
    
    Reduce scope of local variables.
    
    Change-Id: I5f06dc0d9d16e92a7a0afb599eb3a93d9d5cc878
    Reviewed-on: https://gerrit.libreoffice.org/14943
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index 16c07cd..0fd553d 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -580,11 +580,10 @@ void SvxRectCtlAccessibleContext::FireChildFocus( RECT_POINT eButton )
     if( nNew < nNumOfChildren )
     {
         // select new child
-        SvxRectCtlChildAccessibleContext*   pChild;
         mnSelectedChild = nNew;
         if( nNew != NOCHILDSELECTED )
         {
-            pChild = mpChildren[ nNew ];
+            SvxRectCtlChildAccessibleContext* pChild = mpChildren[ nNew ];
             if( pChild )
             {
                 pChild->FireFocusEvent();
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index d673e2b..6606c64 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1218,14 +1218,13 @@ void HatchingLB::Fill( const XHatchListRef &pList )
         return;
 
     mpList = pList;
-    XHatchEntry* pEntry;
     long nCount = pList->Count();
 
     SetUpdateMode( false );
 
     for( long i = 0; i < nCount; i++ )
     {
-        pEntry = pList->GetHatch( i );
+        XHatchEntry* pEntry = pList->GetHatch( i );
         const Bitmap aBitmap = pList->GetUiBitmap( i );
         if( !aBitmap.IsEmpty() )
             InsertEntry(pEntry->GetName(), Image(aBitmap));
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index c1b21ba..85affa6 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -89,10 +89,10 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
 static void ImpGetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
 {
     sal_uInt16& nRet=*(sal_uInt16*)pnRet;
-    bool& bFirst=*(bool*)pbFirst;
     if (nRet!=FUZZY) {
         sal_uInt16 nEsc = rGP.GetEscDir();
         bool bOn = (nEsc & *(sal_uInt16*)pnThisEsc) != 0;
+        bool& bFirst=*(bool*)pbFirst;
         if (bFirst) {
             nRet = bOn ? 1 : 0;
             bFirst = false;
@@ -131,9 +131,9 @@ void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, bool bOn)
 static void ImpGetPercent(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
 {
     sal_uInt16& nRet=*(sal_uInt16*)pnRet;
-    bool& bFirst=*(bool*)pbFirst;
     if (nRet!=FUZZY) {
         bool bOn=rGP.IsPercent();
+        bool& bFirst=*(bool*)pbFirst;
         if (bFirst) { nRet=sal_uInt16(bOn); bFirst=false; }
         else if ((nRet!=0)!=bOn) nRet=FUZZY;
     }
@@ -168,7 +168,6 @@ void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
 static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
 {
     sal_uInt16& nRet=*(sal_uInt16*)pnRet;
-    bool& bFirst=*(bool*)pbFirst;
     bool& bDontCare=*(bool*)pbDontCare;
     bool bVert=*(bool*)pbVert;
     if (!bDontCare) {
@@ -178,6 +177,7 @@ static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void
         } else {
             nAlg=rGP.GetHorzAlign();
         }
+        bool& bFirst=*(bool*)pbFirst;
         if (bFirst) { nRet=nAlg; bFirst=false; }
         else if (nRet!=nAlg) {
             if (bVert) {
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index fa2dc70..2f1003a 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1194,7 +1194,6 @@ void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryLi
         // get values
         const SfxItemSet& rSet = GetObjectItemSet();
         const sal_uInt32 nRepeat((sal_uInt32)static_cast<const SdrTextAniCountItem&>(rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
-        bool bVisisbleWhenStopped(static_cast<const SdrTextAniStopInsideItem&>(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
         double fDelay((double)static_cast<const SdrTextAniDelayItem&>(rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
 
         if(0.0 == fDelay)
@@ -1214,6 +1213,7 @@ void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryLi
         // add stopped state if loop is not endless
         if(0L != nRepeat)
         {
+            bool bVisisbleWhenStopped(static_cast<const SdrTextAniStopInsideItem&>(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
             drawinglayer::animation::AnimationEntryFixed aStop(ENDLESS_TIME, bVisisbleWhenStopped ? 0.0 : 1.0);
             rAnimList.append(aStop);
         }
@@ -1262,7 +1262,6 @@ void impCreateAlternateTiming(const SfxItemSet& rSet, drawinglayer::animation::A
 
     const double fStartPosition(bForward ? fRelativeTextLength : 1.0 - fRelativeTextLength);
     const double fEndPosition(bForward ? 1.0 - fRelativeTextLength : fRelativeTextLength);
-    bool bVisisbleWhenStopped(static_cast<const SdrTextAniStopInsideItem&>(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
     bool bVisisbleWhenStarted(static_cast<const SdrTextAniStartInsideItem&>(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE )).GetValue());
     const sal_uInt32 nRepeat(static_cast<const SdrTextAniCountItem&>(rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
 
@@ -1304,6 +1303,7 @@ void impCreateAlternateTiming(const SfxItemSet& rSet, drawinglayer::animation::A
 
     if(0L != nRepeat)
     {
+        bool bVisisbleWhenStopped(static_cast<const SdrTextAniStopInsideItem&>(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
         if(bVisisbleWhenStopped)
         {
             // add timing for staying at the end
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 757b517..84bad35 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -742,11 +742,10 @@ void SdrObjList::UnGroupObj( size_t nObjNum )
             // the position at which we insert the members of rUngroupGroup
             size_t nInsertPos( pUngroupGroup->GetOrdNum() );
 
-            SdrObject* pObj;
             const size_t nCount = pSrcLst->GetObjCount();
             for( size_t i=0; i<nCount; ++i )
             {
-                pObj = pSrcLst->RemoveObject(0);
+                SdrObject* pObj = pSrcLst->RemoveObject(0);
                 SdrInsertReason aReason(SDRREASON_VIEWCALL, pUngroupGroup);
                 InsertObject(pObj, nInsertPos, &aReason);
                 ++nInsertPos;
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 119ff78..0abbf7e 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2829,10 +2829,10 @@ void lcl_MergeBorderLine(
     const sal_uInt16 nInnerLine(bBorder ? 0 : ((nValidFlag & VALID_HORI) ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT));
     BoxItemWrapper aBoxItem(rLinesState.rBoxItem, rLinesState.rBoxInfoItem, nLine, nInnerLine, bBorder);
     bool& rbSet(bBorder ? rLinesState.aBorderSet[nLine] : rLinesState.aInnerLineSet[nInnerLine]);
-    bool& rbIndeterminate(bBorder ? rLinesState.aBorderIndeterminate[nLine] : rLinesState.aInnerLineIndeterminate[nInnerLine]);
 
     if (rbSet)
     {
+        bool& rbIndeterminate(bBorder ? rLinesState.aBorderIndeterminate[nLine] : rLinesState.aInnerLineIndeterminate[nInnerLine]);
         if (!rbIndeterminate)
         {
             const SvxBorderLine* const pMergedLine(aBoxItem.getLine());
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 426fd56..6c5b459 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -110,12 +110,12 @@ void SwDoc::DoUpdateAllCharts()
 void SwDoc::_UpdateCharts( const SwTable& rTbl, SwViewShell const & rVSh ) const
 {
     OUString aName( rTbl.GetFrmFmt()->GetName() );
-    SwOLENode *pONd;
     SwStartNode *pStNd;
     SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
     while( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
     {
         ++aIdx;
+        SwOLENode *pONd;
         if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
             aName == pONd->GetChartTblName() &&
             pONd->getLayoutFrm( rVSh.GetLayout() ) )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index fd1bc17..d4d650a 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2945,10 +2945,9 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
 
 bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
 {
-    size_t n;
-
     if( !aPosArr.empty() )
     {
+        size_t n;
         for( n = 0; n < aPosArr.size(); ++n )
         {
             if( aPosArr[ n ] == nOffset )
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index abff749..396b32a 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -147,7 +147,6 @@ public:
             uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
             uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
 
-            bool bMatched = false;
             try
             {
                 uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
@@ -158,7 +157,7 @@ public:
                 for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
                 {
                     uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-                    bMatched = ( xControl == xIf );
+                    bool bMatched = ( xControl == xIf );
                     if ( bMatched )
                     {
                         sCodeName = msThisDocumentCodeName;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0733b3f..3275db8 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1971,11 +1971,11 @@ void SwWW8ImplReader::ImportDop()
         {
             uno::Reference<beans::XPropertySetInfo> xInfo =
                 xDocProps->getPropertySetInfo();
-            bool bValue = false;
             if (xInfo.is())
             {
                 if (xInfo->hasPropertyByName("ApplyFormDesignMode"))
                 {
+                    bool bValue = false;
                     xDocProps->setPropertyValue("ApplyFormDesignMode", css::uno::makeAny(bValue));
                 }
             }


More information about the Libreoffice-commits mailing list