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

Michael Weghorn m.weghorn at posteo.de
Sun Jan 18 22:16:07 PST 2015


 sw/source/core/docnode/nodes.cxx        |    6 ++----
 sw/source/core/docnode/section.cxx      |    3 ++-
 sw/source/core/edit/acorrect.cxx        |    2 +-
 sw/source/core/edit/autofmt.cxx         |    3 +--
 sw/source/core/edit/edfld.cxx           |    8 ++++++--
 sw/source/core/fields/docufld.cxx       |    4 +++-
 sw/source/core/fields/expfld.cxx        |   10 ++++++++--
 sw/source/core/frmedt/fecopy.cxx        |    4 +++-
 sw/source/core/frmedt/fefly1.cxx        |    3 +--
 sw/source/core/frmedt/tblsel.cxx        |   10 ++++------
 sw/source/core/graphic/ndgrf.cxx        |    3 ++-
 sw/source/core/layout/pagechg.cxx       |    3 +--
 sw/source/core/layout/tabfrm.cxx        |   10 ++++------
 sw/source/core/layout/trvlfrm.cxx       |    4 ++--
 sw/source/core/layout/wsfrm.cxx         |    7 +++----
 sw/source/core/swg/SwXMLTextBlocks1.cxx |    3 ++-
 sw/source/core/table/swnewtable.cxx     |    9 +++------
 sw/source/core/table/swtable.cxx        |    3 +--
 18 files changed, 49 insertions(+), 46 deletions(-)

New commits:
commit d1aecd4353bd6ac3961a30df67de78f4b8f0a66b
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Fri Jan 16 13:00:37 2015 +0000

    fdo#39440 sw: reduce scope of local variables
    
    This addresses some cppcheck warnings.
    
    Change-Id: Iccdd4bebd46f274697597b13746c820aaadc99a4
    Reviewed-on: https://gerrit.libreoffice.org/13960
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index b9c91ad..0530e2c 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -96,11 +96,10 @@ SwNodes::~SwNodes()
     delete pOutlineNds;
 
     {
-        SwNode *pNode;
         SwNodeIndex aNdIdx( *this );
         while( true )
         {
-            pNode = &aNdIdx.GetNode();
+            SwNode *pNode = &aNdIdx.GetNode();
             if( pNode == pEndOfContent )
                 break;
 
@@ -1023,7 +1022,6 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
  */
 void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd )
 {
-    SwNode * pAktNode;
     SwNodeIndex aTmpIdx( aStart, +1 );
     // array forms a stack, holding all StartOfSelections
     SwSttNdPtrs aSttNdStack;
@@ -1034,7 +1032,7 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEn
     // (the indices are updated from the end node backwards to the start)
     for( ;; ++aTmpIdx )
     {
-        pAktNode = &aTmpIdx.GetNode();
+        SwNode * pAktNode = &aTmpIdx.GetNode();
         pAktNode->pStartOfSection = aSttNdStack[ aSttNdStack.size()-1 ];
 
         if( pAktNode->GetStartNode() )
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 7e8953e..909edf4 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1129,7 +1129,6 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
         return ;
 
     const OUString sName( pDShell->GetMedium()->GetName() );
-    SwBaseLink* pBLink;
     const OUString sMimeType( SotExchange::GetFormatMimeType( FORMAT_FILE ));
     uno::Any aValue;
     aValue <<= sName; // Arbitrary name
@@ -1137,6 +1136,8 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
     const ::sfx2::SvBaseLinks& rLnks = pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
     for( sal_uInt16 n = rLnks.size(); n; )
     {
+        SwBaseLink* pBLink;
+
         ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
         if( pLnk && pLnk != &rUpdLnk &&
             OBJECT_CLIENT_FILE == pLnk->GetObjType() &&
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 216a033..ff480c7 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -487,7 +487,6 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
         {
             const size_t nSize = pTxtNd->GetpSwpHints()->Count();
             sal_Int32 nAttrStart;
-            const sal_Int32* pAttrEnd;
 
             for( size_t n = 0; n < nSize; ++n )
             {
@@ -496,6 +495,7 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
                 if( nAttrStart > nStart )       // beyond the area
                     break;
 
+                const sal_Int32* pAttrEnd;
                 if( 0 != ( pAttrEnd = pHt->End() ) &&
                     ( ( nAttrStart < nStart &&
                         ( pHt->DontExpand() ? nStart < *pAttrEnd
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 4b81d4c..9fd46c1 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1192,9 +1192,8 @@ void SwAutoFormat::DelMoreLinesBlanks( bool bWithLineBreaks )
         SwTxtFrmInfo aFInfo( m_pCurTxtFrm );
         aFInfo.GetSpaces( m_aDelPam, !m_aFlags.bAFmtByInput || bWithLineBreaks );
 
-        SwPaM* pNxt;
         do {
-            pNxt = m_aDelPam.GetNext();
+            SwPaM* pNxt = m_aDelPam.GetNext();
             if( pNxt->HasMark() && *pNxt->GetPoint() != *pNxt->GetMark() )
             {
                 bool bHasBlnks = HasSelBlanks( *pNxt );
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 8377fb3..6d83602 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -221,30 +221,34 @@ static SwTxtFld* lcl_FindInputFld( SwDoc* pDoc, SwField& rFld )
     SwTxtFld* pTFld = 0;
     if( RES_INPUTFLD == rFld.Which() )
     {
-        const SfxPoolItem* pItem = NULL;
         const sal_uInt32 nMaxItems =
             pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INPUTFIELD );
         for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+        {
+            const SfxPoolItem* pItem = NULL;
             if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_INPUTFIELD, n ) )
                 && static_cast<const SwFmtFld*>(pItem)->GetField() == &rFld )
             {
                 pTFld = const_cast<SwFmtFld*>(static_cast<const SwFmtFld*>(pItem))->GetTxtFld();
                 break;
             }
+        }
     }
     else if( RES_SETEXPFLD == rFld.Which()
         && static_cast<SwSetExpField&>(rFld).GetInputFlag() )
     {
-        const SfxPoolItem* pItem = NULL;
         const sal_uInt32 nMaxItems =
             pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
         for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+        {
+            const SfxPoolItem* pItem = NULL;
             if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )
                 && static_cast<const SwFmtFld*>(pItem)->GetField() == &rFld )
             {
                 pTFld = const_cast<SwFmtFld*>(static_cast<const SwFmtFld*>(pItem))->GetTxtFld();
                 break;
             }
+        }
     }
     return pTFld;
 }
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index f112a44..862db52 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -149,9 +149,10 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc,
     {
         // check the flag since the layout NEVER sets it back
         const SfxItemPool &rPool = pDoc->GetAttrPool();
-        const SwFmtPageDesc *pDesc;
         sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC );
         for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+        {
+            const SwFmtPageDesc *pDesc;
             if( 0 != (pDesc = static_cast<const SwFmtPageDesc*>(rPool.GetItem2( RES_PAGEDESC, n )) )
                 && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
             {
@@ -168,6 +169,7 @@ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc,
                     break;
                 }
             }
+        }
     }
 }
 
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 47c5e6c..a200cb7 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -543,12 +543,16 @@ sal_uInt16 SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
 
     // check if number is already used and if a new one needs to be created
     SwIterator<SwFmtFld,SwFieldType> aIter( *this );
-    const SwTxtNode* pNd;
     for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
+    {
+        const SwTxtNode* pNd;
         if( pF->GetField() != &rFld && pF->GetTxtFld() &&
             0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) &&
             pNd->GetNodes().IsDocNodes() )
+        {
             InsertSort( aArr, static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() );
+        }
+    }
 
     // check first if number already exists
     sal_uInt16 nNum = rFld.GetSeqNumber();
@@ -578,8 +582,9 @@ size_t SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList )
     rList.Clear();
 
     SwIterator<SwFmtFld,SwFieldType> aIter( *this );
-    const SwTxtNode* pNd;
     for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
+    {
+        const SwTxtNode* pNd;
         if( pF->GetTxtFld() &&
             0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) &&
             pNd->GetNodes().IsDocNodes() )
@@ -589,6 +594,7 @@ size_t SwSetExpFieldType::GetSeqFldList( SwSeqFldList& rList )
                     static_cast<SwSetExpField*>(pF->GetField())->GetSeqNumber() );
             rList.InsertSort( pNew );
         }
+    }
 
     return rList.Count();
 }
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 2fb7377..dee853a 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -696,7 +696,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
     aCpyPam.SetMark();
     aCpyPam.Move( fnMoveForward, fnGoDoc );
 
-    bool bRet = true, bDelTbl = true;
+    bool bRet = true;
     StartAllAction();
     GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
     GetDoc()->getIDocumentFieldsAccess().LockExpFlds();
@@ -812,6 +812,8 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
     }
     else
     {
+        bool bDelTbl = true;
+
         for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
         {
 
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index de8917d..4426640 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -389,7 +389,6 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt )
     bool bFlyFrame = pObj->ISA(SwVirtFlyDrawObj);
 
     SwFlyFrm* pFly = 0L;
-    const SwFrm* pOldAnch;
     const SwFrm* pFooterOrHeader = NULL;
 
     if( bFlyFrame )
@@ -401,7 +400,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt )
         pFly = pCntnt->FindFlyFrm();
         if ( !pFly )
             return aRet;
-        pOldAnch = pFly->GetAnchorFrm();
+        const SwFrm* pOldAnch = pFly->GetAnchorFrm();
         if( !pOldAnch )
             return aRet;
         if ( FLY_AT_PAGE != nAnchorId )
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index b3402ae..27f9045 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -250,12 +250,11 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
 
     int bChkProtected = nsSwTblSearchType::TBLSEARCH_PROTECT & eSearchType;
 
-    bool bTblIsValid;
     // #i55421# Reduced value 10
     int nLoopMax = 10;
 
     do {
-        bTblIsValid = true;
+        bool bTblIsValid = true;
 
         // First, compute tables and rectangles
         SwSelUnions aUnions;
@@ -451,13 +450,13 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
     const SwLayoutFrm *pEnd = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aNullPos )->GetUpper();
     OSL_ENSURE( pEnd, "without frame nothing works" );
 
-    bool bTblIsValid, bValidChartSel;
+    bool bValidChartSel;
     // #i55421# Reduced value 10
     int nLoopMax = 10;      //JP 28.06.99: max 100 loops - Bug 67292
     sal_uInt16 i = 0;
 
     do {
-        bTblIsValid = true;
+        bool bTblIsValid = true;
         bValidChartSel = true;
 
         sal_uInt16 nRowCells = USHRT_MAX;
@@ -1325,7 +1324,6 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
     //Block to delete  SwPaM, SwPosition from stack
     if( !aPosArr.empty() )
     {
-        SwTxtNode* pTxtNd = 0;
         SwPosition aInsPos( *(*ppMergeBox)->GetSttNd() );
         SwNodeIndex& rInsPosNd = aInsPos.nNode;
 
@@ -1369,7 +1367,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
             // skip the first TextNode
             rInsPosNd.Assign( pDoc->GetNodes(),
                             rInsPosNd.GetNode().EndOfSectionIndex() - 2 );
-            pTxtNd = rInsPosNd.GetNode().GetTxtNode();
+            SwTxtNode* pTxtNd = rInsPosNd.GetNode().GetTxtNode();
             if( pTxtNd )
                 aInsPos.nContent.Assign(pTxtNd, pTxtNd->GetTxt().getLength());
         }
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 1ae848c..987e4fe 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -997,10 +997,11 @@ void DelAllGrfCacheEntries( SwDoc* pDoc )
         // delete all Graphic-Links with this name from cache
         const sfx2::LinkManager& rLnkMgr = pDoc->getIDocumentLinksAdministration().GetLinkManager();
         const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
-        SwGrfNode* pGrfNd;
         OUString sFileNm;
         for( size_t n = rLnks.size(); n; )
         {
+            SwGrfNode* pGrfNd;
+
             ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
             if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
                 rLnkMgr.GetDisplayNames( pLnk, 0, &sFileNm ) &&
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 9360a01..b811352 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -354,7 +354,6 @@ static void lcl_MakeObjs( const SwFrmFmts &rTbl, SwPageFrm *pPage )
 
     for ( size_t i = 0; i < rTbl.size(); ++i )
     {
-        SdrObject *pSdrObj;
         SwFrmFmt *pFmt = rTbl[i];
         const SwFmtAnchor &rAnch = pFmt->GetAnchor();
         if ( rAnch.GetPageNum() == pPage->GetPhyPageNum() )
@@ -373,7 +372,7 @@ static void lcl_MakeObjs( const SwFrmFmts &rTbl, SwPageFrm *pPage )
 
             // is it a border or a SdrObject?
             bool bSdrObj = RES_DRAWFRMFMT == pFmt->Which();
-            pSdrObj = 0;
+            SdrObject *pSdrObj = 0;
             if ( bSdrObj  && 0 == (pSdrObj = pFmt->FindSdrObject()) )
             {
                 OSL_FAIL( "DrawObject not found." );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 705411b..a0699f0 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1159,12 +1159,11 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee
     //such situations).
     if ( bNewFollow )
     {
-        SwFrm* pNxt = 0;
         SwFrm* pInsertBehind = pFoll->GetLastLower();
 
         while ( pRow )
         {
-            pNxt = pRow->GetNext();
+            SwFrm* pNxt = pRow->GetNext();
             nRet += (pRow->Frm().*fnRect->fnGetHeight)();
             // The footnotes do not have to be moved, this is done in the
             // MoveFwd of the follow table!!!
@@ -1177,14 +1176,13 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee
     }
     else
     {
-        SwFrm* pNxt = 0;
         SwFrm* pPasteBefore = HasFollowFlowLine() ?
                               pFollowRow->GetNext() :
                               pFoll->GetFirstNonHeadlineRow();
 
         while ( pRow )
         {
-            pNxt = pRow->GetNext();
+            SwFrm* pNxt = pRow->GetNext();
             nRet += (pRow->Frm().*fnRect->fnGetHeight)();
 
             // The footnotes have to be moved:
@@ -1750,7 +1748,6 @@ void SwTabFrm::MakeAll()
     // gets set to true when the Frm is split
     bool bSplit = false;
     const bool bFtnsInDoc = !GetFmt()->GetDoc()->GetFtnIdxs().empty();
-    bool bMoveable;
     const bool bFly     = IsInFly();
 
     SwBorderAttrAccess  *pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
@@ -1836,7 +1833,8 @@ void SwTabFrm::MakeAll()
     SWRECTFN( this )
     while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
     {
-        if ( (bMoveable = IsMoveable()) )
+        const bool bMoveable = IsMoveable();
+        if (bMoveable)
             if ( CheckMoveFwd( bMakePage, bKeep && KEEPTAB, bMovedBwd ) )
             {
                 bMovedFwd = true;
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index b589558..b4820e0 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1813,11 +1813,11 @@ sal_uInt16 SwFrm::GetVirtPageNum() const
     const SwPageFrm *pVirtPage = 0;
     const SwFrm *pFrm = 0;
     const SfxItemPool &rPool = pPage->GetFmt()->GetDoc()->GetAttrPool();
-    const SfxPoolItem* pItem;
     sal_uInt32 nMaxItems = rPool.GetItemCount2( RES_PAGEDESC );
     for( sal_uInt32 n = 0; n < nMaxItems; ++n )
     {
-        if( 0 == (pItem = rPool.GetItem2( RES_PAGEDESC, n ) ))
+        const SfxPoolItem* pItem = rPool.GetItem2( RES_PAGEDESC, n );
+        if ( 0 == pItem )
             continue;
 
         const SwFmtPageDesc *pDesc = static_cast<const SwFmtPageDesc*>(pItem);
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index ada2e1e..3b2abee 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1045,10 +1045,10 @@ void SwLayoutFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
     _InvalidatePos();
     const SwPageFrm *pPage = FindPageFrm();
     InvalidatePage( pPage );
-    SwFrm *pFrm;
     if( !IsColumnFrm() )
     {
-        if( 0 != ( pFrm = GetIndNext() ) )
+        SwFrm *pFrm = GetIndNext();
+        if( 0 != pFrm )
         {
             pFrm->_InvalidatePos();
             if( IsInFtn() )
@@ -3317,7 +3317,6 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs,
             }
             pCol = static_cast<SwLayoutFrm*>(Lower());
             // OD 28.03.2003 #108446# - initialize local variable
-            SwFrm *pLow = NULL;
             SwTwips nDiff = 0;
             SwTwips nMaxFree = 0;
             SwTwips nAllFree = LONG_MAX;
@@ -3479,7 +3478,7 @@ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs,
                     pCol = static_cast<SwLayoutFrm*>(Lower()->GetNext());
                     while ( pCol )
                     {
-                        pLow = pCol->Lower();
+                        SwFrm *pLow = pCol->Lower();
                         if ( pLow )
                             pLow->_InvalidatePos();
                         pCol = static_cast<SwLayoutFrm*>(pCol->GetNext());
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 3eca795..afb847d 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -276,13 +276,14 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText )
 {
     sal_uLong n = 0;
-    bool bTextOnly = true;
     OUString aFolderName = GeneratePackageName ( rShort );
     OUString aStreamName = aFolderName + ".xml";
     rText.clear();
 
     try
     {
+        bool bTextOnly = true;
+
         xRoot = xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ );
         uno::Reference < container::XNameAccess > xAccess( xRoot, uno::UNO_QUERY );
         if ( !xAccess->hasByName( aStreamName ) || !xRoot->isStreamElement( aStreamName ) )
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 1f04887..8051639 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -384,7 +384,6 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
         SwSelBoxes *pBoxes = new SwSelBoxes();
         long nLeft = 0;
         long nRight = 0;
-        long nRowSpan = 1;
         const size_t nCount = pLine->GetTabBoxes().size();
         for( size_t nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
         {
@@ -392,7 +391,7 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
             OSL_ENSURE( pBox, "Missing table box" );
             nLeft = nRight;
             nRight += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
-            nRowSpan = pBox->getRowSpan();
+            long nRowSpan = pBox->getRowSpan();
             if( nRight <= nMin )
             {
                 if( nRight == nMin && nLeftSpanCnt )
@@ -1831,11 +1830,10 @@ void SwTable::ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax
     {
         SwTableLine* pLine = aLines[nRow];
         const size_t nCols = pLine->GetTabBoxes().size();
-        long nLeft = 0;
         long nRight = 0;
         for( size_t nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
         {
-            nLeft = nRight;
+            long nLeft = nRight;
             SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
             nRight += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
             if( nLeft >= rMin && nRight <= rMax )
@@ -1861,11 +1859,10 @@ void SwTable::PrepareDeleteCol( long nMin, long nMax )
     {
         SwTableLine* pLine = aLines[nRow];
         const size_t nCols = pLine->GetTabBoxes().size();
-        long nLeft = 0;
         long nRight = 0;
         for( size_t nCurrBox = 0; nCurrBox < nCols; ++nCurrBox )
         {
-            nLeft = nRight;
+            long nLeft = nRight;
             SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
             nRight += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
             if( nRight < nMin )
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index e4d2fc4..6e460da 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1400,7 +1400,6 @@ const SwTableBox* SwTable::GetTblBox( const OUString& rName,
     const SwTableBox* pBox = 0;
     const SwTableLine* pLine;
     const SwTableLines* pLines;
-    const SwTableBoxes* pBoxes;
 
     sal_uInt16 nLine, nBox;
     OUString aNm( rName );
@@ -1425,7 +1424,7 @@ const SwTableBox* SwTable::GetTblBox( const OUString& rName,
         pLine = (*pLines)[ nLine-1 ];
 
         // determine box
-        pBoxes = &pLine->GetTabBoxes();
+        const SwTableBoxes* pBoxes = &pLine->GetTabBoxes();
         if( nBox >= pBoxes->size() )
             return 0;
         pBox = (*pBoxes)[ nBox ];


More information about the Libreoffice-commits mailing list