diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-08-22 08:05:06 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-09-06 12:08:20 +0200 |
commit | 507cc73f1fa49eb23e8e52e67add69885f6b7972 (patch) | |
tree | a8704141e0b668298e303045ad0a2b3353fdb22f /sw | |
parent | da44e4cce8061b57afdea51c4ea9b53b6e9355a0 (diff) |
sal_uInt16: constify, avoid temporaries, reduce scope
Change-Id: I8033385b5edd6baa7b64ef77ca242d76f6bf30f3
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/txtnode/atrtox.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/txatritr.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtatr2.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/rolbck.cxx | 18 |
4 files changed, 14 insertions, 18 deletions
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx index 46379ba01bac..81077385112f 100644 --- a/sw/source/core/txtnode/atrtox.cxx +++ b/sw/source/core/txtnode/atrtox.cxx @@ -56,7 +56,7 @@ void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc ) { SwTOXMark& rTOX = (SwTOXMark&)GetTOXMark(); TOXTypes eType = rTOX.GetTOXType()->GetType(); - sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType ); + const sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType ); const SwTOXType* pType = 0; const OUString rNm = rTOX.GetTOXType()->GetTypeName(); diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx index ae43b262a864..132554012ff4 100644 --- a/sw/source/core/txtnode/txatritr.cxx +++ b/sw/source/core/txtnode/txatritr.cxx @@ -136,9 +136,9 @@ bool SwTxtAttrIterator::Next() if( RES_TXTATR_CHARFMT == pHt->Which() ) { - sal_uInt16 nWId = bIsUseGetWhichOfScript ? - GetWhichOfScript( nWhichId, - aSIter.GetCurrScript() ) : nWhichId; + const sal_uInt16 nWId = bIsUseGetWhichOfScript + ? GetWhichOfScript( nWhichId, aSIter.GetCurrScript() ) + : nWhichId; pCurItem = &pHt->GetCharFmt().GetCharFmt()->GetFmtAttr(nWId); } else diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index 818454eb9620..9f5856fbcd2d 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -54,7 +54,7 @@ SwTxtCharFmt::~SwTxtCharFmt( ) void SwTxtCharFmt::ModifyNotification( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { - sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtCharFmt::Modify(): unknown Modify"); @@ -166,7 +166,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt() void SwTxtINetFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { - sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtINetFmt::Modify(): unknown Modify"); @@ -215,7 +215,7 @@ SwTxtRuby::~SwTxtRuby() void SwTxtRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; OSL_ENSURE( isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich) || (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich), "SwTxtRuby::Modify(): unknown Modify"); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index f39252fb9ed5..d5c38bca2721 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -107,8 +107,7 @@ OUString SwHistorySetFmt::GetDescription() const { OUString aResult; - sal_uInt16 nWhich = m_pAttr->Which(); - switch (nWhich) + switch (m_pAttr->Which()) { case RES_BREAK: switch ((static_cast<SvxFmtBreakItem &>(*m_pAttr)).GetBreak()) @@ -207,8 +206,7 @@ SwHistorySetTxt::SwHistorySetTxt( SwTxtAttr* pTxtHt, sal_uLong nNodePos ) // a little bit complicated but works: first assign a copy of the // default value and afterwards the values from text attribute - sal_uInt16 nWhich = pTxtHt->Which(); - if ( RES_TXTATR_CHARFMT == nWhich ) + if ( RES_TXTATR_CHARFMT == pTxtHt->Which() ) { m_pAttr.reset( new SwFmtCharFmt( pTxtHt->GetCharFmt().GetCharFmt() ) ); } @@ -361,7 +359,7 @@ void SwHistorySetTOXMark::SetInDoc( SwDoc* pDoc, bool ) return; // search for respective TOX type - sal_uInt16 nCnt = pDoc->GetTOXTypeCount( m_eTOXTypes ); + const sal_uInt16 nCnt = pDoc->GetTOXTypeCount( m_eTOXTypes ); SwTOXType* pToxType = 0; for ( sal_uInt16 n = 0; n < nCnt; ++n ) { @@ -878,7 +876,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) { ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - sal_uInt16 nPos = pDoc->GetSpzFrmFmts()->GetPos( &m_rFmt ); + const sal_uInt16 nPos = pDoc->GetSpzFrmFmts()->GetPos( &m_rFmt ); if ( USHRT_MAX != nPos ) // Format does still exist { SwFmtAnchor aTmp( m_rFmt.GetAnchor() ); @@ -1021,12 +1019,10 @@ void SwHistory::Add( SwTxtAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr ) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); - SwHistoryHint * pHt; - sal_uInt16 nAttrWhich = pHint->Which(); - + SwHistoryHint * pHt = 0; if( !bNewAttr ) { - switch ( nAttrWhich ) + switch ( pHint->Which() ) { case RES_TXTATR_FTN: pHt = new SwHistorySetFootnote( @@ -1192,7 +1188,7 @@ sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd ) { OSL_ENSURE( nNewTmpEnd <= Count(), "SwHistory::SetTmpEnd: out of bounds" ); - sal_uInt16 nOld = Count() - m_nEndDiff; + const sal_uInt16 nOld = Count() - m_nEndDiff; m_nEndDiff = Count() - nNewTmpEnd; // for every SwHistoryFlyCnt, call the Redo of its UndoObject. |