summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2012-12-28 22:06:35 +0100
committerJulien Nabet <serval2412@yahoo.fr>2012-12-28 22:06:35 +0100
commit05cc878bb4567aa15841fe316b1e898ae43fe7a7 (patch)
treed8e0d0845f64941a58c3b8c6d709356bf56149e1 /sw
parentb2b400770586d545c3066672557a84f1e2f01b55 (diff)
Some cppcheck cleaning in sw
Change-Id: I3dd51a8ddd0c01c453331934869413d5999a826f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/ndsect.cxx5
-rw-r--r--sw/source/core/docnode/nodes.cxx2
-rw-r--r--sw/source/core/edit/edfld.cxx3
-rw-r--r--sw/source/core/frmedt/feshview.cxx5
-rw-r--r--sw/source/core/text/atrstck.cxx12
-rw-r--r--sw/source/core/undo/rolbck.cxx3
-rw-r--r--sw/source/core/undo/undel.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx4
8 files changed, 14 insertions, 22 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 4b52bfbe0d82..7ea4f7e7aba0 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 500f56d855ab..8767e36b8070 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 ac0177b39d6b..ede37d080e52 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 01c295629b73..048eb1d30e3a 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 237b0243a577..e811ed518adc 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 10664f431880..594a081e8607 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 9a53e8c33afa..2387e7adaeed 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 0821e94b03a9..0b9de038c2ed 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 ];