[Libreoffice-commits] .: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 28 13:08:17 PST 2012


 sw/source/core/docnode/ndsect.cxx  |    5 ++---
 sw/source/core/docnode/nodes.cxx   |    2 +-
 sw/source/core/edit/edfld.cxx      |    3 +--
 sw/source/core/frmedt/feshview.cxx |    5 ++---
 sw/source/core/text/atrstck.cxx    |   12 ++++--------
 sw/source/core/undo/rolbck.cxx     |    3 +--
 sw/source/core/undo/undel.cxx      |    2 +-
 sw/source/filter/ww8/ww8par3.cxx   |    4 ++--
 8 files changed, 14 insertions(+), 22 deletions(-)

New commits:
commit 05cc878bb4567aa15841fe316b1e898ae43fe7a7
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Fri Dec 28 22:06:35 2012 +0100

    Some cppcheck cleaning in sw
    
    Change-Id: I3dd51a8ddd0c01c453331934869413d5999a826f

diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 4b52bfb..7ea4f7e 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -241,7 +241,6 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
                 }
             }
 
-            const SwCntntNode* pCNd;
             if( pPrvNd && 1 == nRegionRet )
             {
                 pSttPos->nNode.Assign( *pPrvNd );
@@ -259,7 +258,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
             }
             else
             {
-                pCNd = pEndPos->nNode.GetNode().GetCntntNode();
+                const SwCntntNode* pCNd = pEndPos->nNode.GetNode().GetCntntNode();
                 if( pCNd && pCNd->Len() != pEndPos->nContent.GetIndex() )
                 {
                     xub_StrLen nCntnt = pSttPos->nContent.GetIndex();
@@ -807,10 +806,10 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
         }
         else
         {
-            SwNode* pNd;
             ++aInsPos;
             if (!lcl_IsTOXSection(rSectionData))
             {
+                SwNode* pNd;
                 while( aInsPos.GetIndex() < Count() - 1 &&
                         ( pNd = &aInsPos.GetNode())->IsEndNode() &&
                         pNd->StartOfSectionNode()->IsSectionNode())
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 500f56d..8767e36 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1481,7 +1481,6 @@ sal_Bool SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& r
 *************************************************************************/
 void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
 {
-    int bUpdateNum = 0;
     sal_uLong nSttIdx = rStart.GetIndex();
 
     if( !nSttIdx && nCnt == GetEndOfContent().GetIndex()+1 )
@@ -1509,6 +1508,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
     }
     else
     {
+        int bUpdateNum = 0;
         for( sal_uLong n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n )
         {
             SwNode* pNd = (*this)[ n ];
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index ac0177b..ede37d0 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -316,7 +316,6 @@ void SwEditShell::UpdateFlds( SwField &rFld )
     SET_CURR_SHELL( this );
     StartAllAction();
     {
-        SwField *pCurFld = 0;
 
         // Wenn es keine Selektionen gibt, gilt der Wert der aktuellen
         // Cursor-Position.
@@ -377,7 +376,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
                     if( 0 != (pTxtFld = GetDocTxtFld( pCurStt )) )
                     {
                         pFmtFld = (SwFmtFld*)&pTxtFld->GetFld();
-                        pCurFld = pFmtFld->GetFld();
+                        SwField *pCurFld = pFmtFld->GetFld();
 
                         // bei gemischten Feldtypen
                         if( pCurFld->GetTyp()->Which() !=
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 01c2956..048eb1d3 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2579,7 +2579,7 @@ sal_Bool SwFEShell::IsAlignPossible() const
 }
 
 
-// temporary fix till  SS of JOE is availale
+// temporary fix till  SS of JOE is available
 void SwFEShell::CheckUnboundObjects()
 {
     SET_CURR_SHELL( this );
@@ -2611,9 +2611,8 @@ void SwFEShell::CheckUnboundObjects()
                             Imp()->GetDrawView()->GetCurrentObjIdentifier() : 0xFFFF;
 
             SwFmtAnchor aAnch;
-            const SwFrm *pAnch = 0;
             {
-            pAnch = ::FindAnchor( pPage, aPt, sal_True );
+            const SwFrm *pAnch = ::FindAnchor( pPage, aPt, sal_True );
             SwPosition aPos( *((SwCntntFrm*)pAnch)->GetNode() );
             aAnch.SetType( FLY_AT_PARA );
             aAnch.SetAnchor( &aPos );
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 237b024..e811ed5 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -644,12 +644,11 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
         // check, if an rotation attribute has to be applied
         sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
         sal_Bool bTwoLineAct = sal_False;
-        const SfxPoolItem* pTwoLineItem = 0;
         const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
 
         if ( pTwoLineAttr )
         {
-             pTwoLineItem = CharFmt::GetItem( *pTwoLineAttr, RES_CHRATR_TWO_LINES );
+             const SfxPoolItem* pTwoLineItem = CharFmt::GetItem( *pTwoLineAttr, RES_CHRATR_TWO_LINES );
              bTwoLineAct = ((SvxTwoLinesItem*)pTwoLineItem)->GetValue();
         }
         else
@@ -661,12 +660,11 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
 
         // eventually, an rotate attribute has to be activated
         sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
-        const SfxPoolItem* pRotateItem = 0;
         const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
 
         if ( pRotateAttr )
         {
-            pRotateItem = CharFmt::GetItem( *pRotateAttr, RES_CHRATR_ROTATE );
+            const SfxPoolItem* pRotateItem = CharFmt::GetItem( *pRotateAttr, RES_CHRATR_ROTATE );
             rFnt.SetVertical( ((SvxCharRotateItem*)pRotateItem)->GetValue(),
                                bVertLayout );
         }
@@ -844,12 +842,11 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu
 
             sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
             sal_Bool bTwoLineAct = sal_False;
-            const SfxPoolItem* pTwoLineItem = 0;
             const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
 
             if ( pTwoLineAttr )
             {
-                pTwoLineItem = CharFmt::GetItem( *pTwoLineAttr, RES_CHRATR_TWO_LINES );
+                const SfxPoolItem* pTwoLineItem = CharFmt::GetItem( *pTwoLineAttr, RES_CHRATR_TWO_LINES );
                 bTwoLineAct = ((SvxTwoLinesItem*)pTwoLineItem)->GetValue();
             }
             else
@@ -884,12 +881,11 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu
                 break;
 
             sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
-            const SfxPoolItem* pRotateItem = 0;
             const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
 
             if ( pRotateAttr )
             {
-                pRotateItem = CharFmt::GetItem( *pRotateAttr, RES_CHRATR_ROTATE );
+                const SfxPoolItem* pRotateItem = CharFmt::GetItem( *pRotateAttr, RES_CHRATR_ROTATE );
                 rFnt.SetVertical( ((SvxCharRotateItem*)pRotateItem)->GetValue(),
                                    bVertLayout );
             }
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 10664f4..594a081 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1059,11 +1059,10 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
 {
     OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
 
-    SwHistoryHint * pHint;
     const sal_uInt16 nWh = rFmt.Which();
     if( RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh )
     {
-        pHint = new SwHistoryTxtFlyCnt( &rFmt );
+        SwHistoryHint * pHint = new SwHistoryTxtFlyCnt( &rFmt );
         m_SwpHstry.push_back( pHint );
 
         const SwFmtChain* pChainItem;
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 9a53e8c..2387e7a 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -644,7 +644,6 @@ String DenoteSpecialCharacters(const String & rStr)
 SwRewriter SwUndoDelete::GetRewriter() const
 {
     SwRewriter aResult;
-    String * pStr = NULL;
 
     if (nNode != 0)
     {
@@ -673,6 +672,7 @@ SwRewriter SwUndoDelete::GetRewriter() const
         }
         else
         {
+            String * pStr = NULL;
             if (pSttStr != NULL)
                 pStr = pSttStr;
             else if (pEndStr != NULL)
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 0821e94..0b9de03 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -925,8 +925,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
 {
     bNewCharFmtCreated = false;
     SfxItemSet* pThisLevelItemSet;
-    SfxItemSet* pLowerLevelItemSet;
-    sal_uInt8        nIdenticalItemSetLevel;
+    sal_uInt8 nIdenticalItemSetLevel;
     const SfxPoolItem* pItem;
 
     SwNumFmt aNumFmt  = rNumRule.Get( nLevel );
@@ -937,6 +936,7 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
     {
         nIdenticalItemSetLevel = nMaxLevel;
         SfxItemIter aIter( *pThisLevelItemSet );
+        SfxItemSet* pLowerLevelItemSet;
         for (sal_uInt8 nLowerLevel = 0; nLowerLevel < nLevel; ++nLowerLevel)
         {
             pLowerLevelItemSet = rListItemSet[ nLowerLevel ];


More information about the Libreoffice-commits mailing list