sw/inc/txatbase.hxx | 6 +++--- sw/source/core/access/accpara.cxx | 6 +++--- sw/source/core/crsr/findattr.cxx | 10 +++++----- sw/source/core/doc/docruby.cxx | 4 ++-- sw/source/core/fields/reffld.cxx | 2 +- sw/source/core/text/itratr.cxx | 10 +++++----- sw/source/core/text/pormulti.cxx | 8 ++++---- sw/source/core/text/txtfld.cxx | 4 ++-- sw/source/core/text/txtfrm.cxx | 4 ++-- sw/source/core/tox/ToxTextGenerator.cxx | 2 +- sw/source/core/txtnode/ndhints.cxx | 18 +++++++++--------- sw/source/core/undo/rolbck.cxx | 8 ++++---- sw/source/core/unocore/unoportenum.cxx | 2 +- sw/source/filter/ww8/wrtw8nds.cxx | 2 +- 14 files changed, 43 insertions(+), 43 deletions(-)
New commits: commit 2eebd9119bebb94f9c9f2bf718f5321511276a84 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sat May 25 14:52:57 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu May 30 18:22:42 2019 +0200 GetAnyEnd does not need to return a pointer Change-Id: I1350a340eddad180447c46175b6b21ce787802f3 Reviewed-on: https://gerrit.libreoffice.org/72952 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index 0e2aebdb846f..90509a929309 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -86,7 +86,7 @@ public: virtual void SetEnd(sal_Int32); inline const sal_Int32* End() const; /// end (if available), else start - inline const sal_Int32* GetAnyEnd() const; + inline sal_Int32 GetAnyEnd() const; inline void SetDontExpand( bool bDontExpand ); bool DontExpand() const { return m_bDontExpand; } @@ -150,10 +150,10 @@ inline const sal_Int32* SwTextAttr::End() const return GetEnd(); } -inline const sal_Int32* SwTextAttr::GetAnyEnd() const +inline sal_Int32 SwTextAttr::GetAnyEnd() const { const sal_Int32* pEnd = End(); - return pEnd ? pEnd : &m_nStart; + return pEnd ? *pEnd : m_nStart; } inline const SfxPoolItem& SwTextAttr::GetAttr() const diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index dc87d1ebe943..31d00a30021e 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2776,7 +2776,7 @@ const SwTextAttr *SwHyperlinkIter_Impl::next(SwTextNode const** ppNode) if (RES_TXTATR_INETFMT == pHt->Which()) { const TextFrameIndex nHtStt(m_rFrame.MapModelToView(pNode, pHt->GetStart())); - const TextFrameIndex nHtEnd(m_rFrame.MapModelToView(pNode, *pHt->GetAnyEnd())); + const TextFrameIndex nHtEnd(m_rFrame.MapModelToView(pNode, pHt->GetAnyEnd())); if (nHtEnd > nHtStt && ((nHtStt >= m_nStt && nHtStt < m_nEnd) || (nHtEnd > m_nStt && nHtEnd <= m_nEnd))) @@ -2839,7 +2839,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL if (!xRet.is()) { TextFrameIndex const nHintStart(pTextFrame->MapModelToView(pNode, pHt->GetStart())); - TextFrameIndex const nHintEnd(pTextFrame->MapModelToView(pNode, *pHt->GetAnyEnd())); + TextFrameIndex const nHintEnd(pTextFrame->MapModelToView(pNode, pHt->GetAnyEnd())); const sal_Int32 nTmpHStt = GetPortionData().GetAccessiblePosition( max(aHIter.startIdx(), nHintStart)); const sal_Int32 nTmpHEnd = GetPortionData().GetAccessiblePosition( @@ -2891,7 +2891,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde SwTextNode const* pNode(nullptr); const SwTextAttr *pHt = aHIter.next(&pNode); while (pHt && !(nIdx >= pTextFrame->MapModelToView(pNode, pHt->GetStart()) - && nIdx < pTextFrame->MapModelToView(pNode, *pHt->GetAnyEnd()))) + && nIdx < pTextFrame->MapModelToView(pNode, pHt->GetAnyEnd()))) { pHt = aHIter.next(&pNode); nPos++; diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index d826878b4e23..c77dc2065979 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -339,7 +339,7 @@ lcl_IsAttributeIgnorable(sal_Int32 const nNdStart, sal_Int32 const nNdEnd, bool SwAttrCheckArr::SetAttrFwd( const SwTextAttr& rAttr ) { - SwSrchChrAttr aTmp( rAttr.GetAttr(), rAttr.GetStart(), *rAttr.GetAnyEnd() ); + SwSrchChrAttr aTmp( rAttr.GetAttr(), rAttr.GetStart(), rAttr.GetAnyEnd() ); // ignore all attributes not in search range if (lcl_IsAttributeIgnorable(m_nNodeStart, m_nNodeEnd, aTmp)) @@ -493,7 +493,7 @@ bool SwAttrCheckArr::SetAttrFwd( const SwTextAttr& rAttr ) bool SwAttrCheckArr::SetAttrBwd( const SwTextAttr& rAttr ) { - SwSrchChrAttr aTmp( rAttr.GetAttr(), rAttr.GetStart(), *rAttr.GetAnyEnd() ); + SwSrchChrAttr aTmp( rAttr.GetAttr(), rAttr.GetStart(), rAttr.GetAnyEnd() ); // ignore all attributes not in search range if (lcl_IsAttributeIgnorable(m_nNodeStart, m_nNodeEnd, aTmp)) @@ -799,7 +799,7 @@ static bool lcl_SearchBackward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpA while( nPos ) if( !rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetSortedByEnd( --nPos )) ) ) { - nSttPos = *pAttr->GetAnyEnd(); + nSttPos = pAttr->GetAnyEnd(); if( nSttPos < rCmpArr.GetNdEnd() ) { // found end @@ -827,9 +827,9 @@ static bool lcl_SearchBackward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpA // Do multiple start at that position? Do also check those: if( nPos ) { - nEndPos = *pAttr->GetAnyEnd(); + nEndPos = pAttr->GetAnyEnd(); while( --nPos && nEndPos == - *( pAttr = rHtArr.GetSortedByEnd( nPos ))->GetAnyEnd() && + ( pAttr = rHtArr.GetSortedByEnd( nPos ))->GetAnyEnd() && rCmpArr.SetAttrBwd( *pAttr ) ) ; } diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 7db3cadc81d5..8eff14a5531e 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -210,7 +210,7 @@ bool SwDoc::SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry ) { const SwTextAttr* pHt = pHts->Get(nHtIdx); if( RES_TXTATR_CJK_RUBY == pHt->Which() && - *pHt->GetAnyEnd() > nStart ) + pHt->GetAnyEnd() > nStart ) { if( pHt->GetStart() < nEnd ) { @@ -252,7 +252,7 @@ bool SwDoc::SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry ) if( !rPam.HasMark() ) { rPam.SetMark(); - pPos->nContent = *pAttr->GetAnyEnd(); + pPos->nContent = pAttr->GetAnyEnd(); if( pPos->nContent.GetIndex() > nEnd ) pPos->nContent = nEnd; rEntry.SetRubyAttr( pAttr->GetRuby() ); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 6c7efa8ce3c2..8aa35aa6f283 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1153,7 +1153,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark pTextNd = const_cast<SwTextNode*>(&pRef->GetTextRefMark()->GetTextNode()); *pStt = pRef->GetTextRefMark()->GetStart(); if( pEnd ) - *pEnd = *pRef->GetTextRefMark()->GetAnyEnd(); + *pEnd = pRef->GetTextRefMark()->GetAnyEnd(); } } break; diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 28263abd9eaa..9b1f0236ccf2 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -272,7 +272,7 @@ void SwAttrIter::SeekFwd(const sal_Int32 nOldPos, const sal_Int32 nNewPos) // As long as we've not yet reached the end of EndArray and the // TextAttribute ends before or at the new position ... while ((m_nEndIndex < pHints->Count()) && - (*(pTextAttr = pHints->GetSortedByEnd(m_nEndIndex))->GetAnyEnd() <= nNewPos)) + ((pTextAttr = pHints->GetSortedByEnd(m_nEndIndex))->GetAnyEnd() <= nNewPos)) { // Close the TextAttributes, whose StartPos were before or at // the old nPos and are currently open @@ -283,7 +283,7 @@ void SwAttrIter::SeekFwd(const sal_Int32 nOldPos, const sal_Int32 nNewPos) else // skip the not opened ends { while ((m_nEndIndex < pHints->Count()) && - (*pHints->GetSortedByEnd(m_nEndIndex)->GetAnyEnd() <= nNewPos)) + (pHints->GetSortedByEnd(m_nEndIndex)->GetAnyEnd() <= nNewPos)) { m_nEndIndex++; } @@ -296,7 +296,7 @@ void SwAttrIter::SeekFwd(const sal_Int32 nOldPos, const sal_Int32 nNewPos) { // open the TextAttributes, whose ends lie behind the new position - if ( *pTextAttr->GetAnyEnd() > nNewPos ) Chg( pTextAttr ); + if ( pTextAttr->GetAnyEnd() > nNewPos ) Chg( pTextAttr ); m_nStartIndex++; } @@ -542,7 +542,7 @@ static bool CanSkipOverRedline( } } assert(nEndIndex == pStartHints->Count() || - pRLEnd->nContent.GetIndex() < *pStartHints->GetSortedByEnd(nEndIndex)->GetAnyEnd()); + pRLEnd->nContent.GetIndex() < pStartHints->GetSortedByEnd(nEndIndex)->GetAnyEnd()); } if (&rStartNode != &pRLEnd->nNode.GetNode()) @@ -693,7 +693,7 @@ static sal_Int32 GetNextAttrImpl(SwTextNode const*const pTextNode, SwTextAttr *const pAttr(pHints->GetSortedByEnd(i)); if (!pAttr->IsFormatIgnoreEnd()) { - sal_Int32 const nNextEnd = *pAttr->GetAnyEnd(); + sal_Int32 const nNextEnd = pAttr->GetAnyEnd(); nNext = std::min(nNext, nNextEnd); // pick nearest one break; } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 875d3c1b90a0..ee3f89035e9d 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -982,7 +982,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex & { break; } - if (startPos.second < *pAttr->GetAnyEnd()) + if (startPos.second < pAttr->GetAnyEnd()) { // sw_redlinehide: ruby *always* splits if (RES_TXTATR_CJK_RUBY == pAttr->Which()) @@ -1128,7 +1128,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex & TextFrameIndex nTmpEnd; if (pTmp) { - nTmpEnd = m_pFrame->MapModelToView(pNode, *pTmp->GetAnyEnd()); + nTmpEnd = m_pFrame->MapModelToView(pNode, pTmp->GetAnyEnd()); if (nTmpEnd <= rPos) continue; nTmpStart = m_pFrame->MapModelToView(pNode, pTmp->GetStart()); @@ -1233,7 +1233,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex & TextFrameIndex nTmpEnd; if (pTmp) { - nTmpEnd = m_pFrame->MapModelToView(pNode, *pTmp->GetAnyEnd()); + nTmpEnd = m_pFrame->MapModelToView(pNode, pTmp->GetAnyEnd()); if (nTmpEnd <= n2Start) continue; nTmpStart = m_pFrame->MapModelToView(pNode, pTmp->GetStart()); @@ -1334,7 +1334,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex & TextFrameIndex nTmpEnd; if (pTmp) { - nTmpEnd = m_pFrame->MapModelToView(pNode, *pTmp->GetAnyEnd()); + nTmpEnd = m_pFrame->MapModelToView(pNode, pTmp->GetAnyEnd()); if (nTmpEnd <= rPos) continue; nTmpStart = m_pFrame->MapModelToView(pNode, pTmp->GetStart()); diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 9138a35eacdc..a568c2554523 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -331,7 +331,7 @@ SwExpandPortion * SwTextFormatter::TryNewNoLengthPortion(SwTextFormatInfo const { SwTextAttr & rHint(const_cast<SwTextAttr&>(*pHint)); TextFrameIndex const nEnd( - rInfo.GetTextFrame()->MapModelToView(pNode, *rHint.GetAnyEnd())); + rInfo.GetTextFrame()->MapModelToView(pNode, rHint.GetAnyEnd())); if (nEnd > nIdx) { m_pByEndIter->PrevAttr(); @@ -425,7 +425,7 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm pHint = iter.PrevAttr(&pNode)) { TextFrameIndex const nHintEnd( - rInf.GetTextFrame()->MapModelToView(pNode, *pHint->GetAnyEnd())); + rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetAnyEnd())); if (nHintEnd < nTextLen) { break; // only those at para end are interesting diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 931fbd75a4fa..3125b2362510 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -239,7 +239,7 @@ namespace sw { { SwTextAttr *const pHint( pHints->GetSortedByEnd(m_CurrentHint - 1)); - if (*pHint->GetAnyEnd() < rExtent.nStart + if (pHint->GetAnyEnd() < rExtent.nStart // <= if it has end and isn't empty || (pHint->GetEnd() && *pHint->GetEnd() != pHint->GetStart() @@ -248,7 +248,7 @@ namespace sw { break; } --m_CurrentHint; - if (*pHint->GetAnyEnd() <= rExtent.nEnd) + if (pHint->GetAnyEnd() <= rExtent.nEnd) { if (ppNode) { diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index ee51d5b9a219..9b046f9c4c22 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -334,7 +334,7 @@ void ToxTextGenerator::GetAttributesForNode( // mapping going on here, can't use the usual merged attr iterators :( sal_Int32 const nStart(aConversionMap.ConvertToViewPosition(pHint->GetStart())); - sal_Int32 const nEnd(aConversionMap.ConvertToViewPosition(*pHint->GetAnyEnd())); + sal_Int32 const nEnd(aConversionMap.ConvertToViewPosition(pHint->GetAnyEnd())); if (nStart != nEnd) // might be in delete redline, and useless anyway { std::unique_ptr<SwFormatAutoFormat> pClone( diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index c77d31e31a89..8e3ee6025375 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -38,8 +38,8 @@ static bool CompareSwpHtStart( const SwTextAttr* lhs, const SwTextAttr* rhs ) const SwTextAttr &rHt2 = *rhs; if ( rHt1.GetStart() == rHt2.GetStart() ) { - const sal_Int32 nHt1 = *rHt1.GetAnyEnd(); - const sal_Int32 nHt2 = *rHt2.GetAnyEnd(); + const sal_Int32 nHt1 = rHt1.GetAnyEnd(); + const sal_Int32 nHt2 = rHt2.GetAnyEnd(); if ( nHt1 == nHt2 ) { const sal_uInt16 nWhich1 = rHt1.Which(); @@ -94,8 +94,8 @@ bool CompareSwpHtWhichStart::operator()( const SwTextAttr* lhs, const SwTextAttr if ( nS1 != nS2 ) // robust return nS1 < nS2; } - const sal_Int32 nEnd1 = *rHt1.GetAnyEnd(); - const sal_Int32 nEnd2 = *rHt2.GetAnyEnd(); + const sal_Int32 nEnd1 = rHt1.GetAnyEnd(); + const sal_Int32 nEnd2 = rHt2.GetAnyEnd(); if ( nEnd1 > nEnd2 ) return true; if ( nEnd1 < nEnd2 ) @@ -107,14 +107,14 @@ bool CompareSwpHtWhichStart::operator()( const SwTextAttr* lhs, const SwTextAttr /// (char style: sort number), at last the pointer(reverse) bool CompareSwpHtEnd::operator()( sal_Int32 nEndPos, const SwTextAttr* rhs ) const { - return nEndPos < *rhs->GetAnyEnd(); + return nEndPos < rhs->GetAnyEnd(); } bool CompareSwpHtEnd::operator()( const SwTextAttr* lhs, const SwTextAttr* rhs ) const { const SwTextAttr &rHt1 = *lhs; const SwTextAttr &rHt2 = *rhs; - const sal_Int32 nHt1 = *rHt1.GetAnyEnd(); - const sal_Int32 nHt2 = *rHt2.GetAnyEnd(); + const sal_Int32 nHt1 = rHt1.GetAnyEnd(); + const sal_Int32 nHt2 = rHt2.GetAnyEnd(); if ( nHt1 == nHt2 ) { if ( rHt1.GetStart() == rHt2.GetStart() ) @@ -241,7 +241,7 @@ bool SwpHints::Check(bool bPortionsMerged) const CHECK_ERR( 0xFF != *reinterpret_cast<unsigned char const *>(pHtEnd), "HintsCheck: end ptr was deleted" ); // 3b) end sort order? - nIdx = *pHtEnd->GetAnyEnd(); + nIdx = pHtEnd->GetAnyEnd(); CHECK_ERR( nIdx >= nLastEnd, "HintsCheck: ends are unsorted" ); // 4b) IsLessEnd consistency @@ -333,7 +333,7 @@ bool SwpHints::Check(bool bPortionsMerged) const { break; // done } - else if (pOther->GetStart() == *pOther->GetAnyEnd()) + else if (pOther->GetStart() == pOther->GetAnyEnd()) { continue; // empty hint: ignore } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 48fe37b27b7a..751d88ad4fb7 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -194,7 +194,7 @@ SwHistorySetText::SwHistorySetText( SwTextAttr* pTextHt, sal_uLong nNodePos ) : SwHistoryHint( HSTRY_SETTXTHNT ) , m_nNodeIndex( nNodePos ) , m_nStart( pTextHt->GetStart() ) - , m_nEnd( *pTextHt->GetAnyEnd() ) + , m_nEnd( pTextHt->GetAnyEnd() ) , m_bFormatIgnoreStart(pTextHt->IsFormatIgnoreStart()) , m_bFormatIgnoreEnd (pTextHt->IsFormatIgnoreEnd ()) { @@ -314,7 +314,7 @@ SwHistorySetRefMark::SwHistorySetRefMark( SwTextRefMark* pTextHt, sal_uLong nNod , m_RefName( pTextHt->GetRefMark().GetRefName() ) , m_nNodeIndex( nNodePos ) , m_nStart( pTextHt->GetStart() ) - , m_nEnd( *pTextHt->GetAnyEnd() ) + , m_nEnd( pTextHt->GetAnyEnd() ) { } @@ -343,7 +343,7 @@ SwHistorySetTOXMark::SwHistorySetTOXMark( SwTextTOXMark* pTextHt, sal_uLong nNod , m_eTOXTypes( m_TOXMark.GetTOXType()->GetType() ) , m_nNodeIndex( nNodePos ) , m_nStart( pTextHt->GetStart() ) - , m_nEnd( *pTextHt->GetAnyEnd() ) + , m_nEnd( pTextHt->GetAnyEnd() ) { m_TOXMark.EndListeningAll(); } @@ -1045,7 +1045,7 @@ void SwHistory::Add( SwTextAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr ) else { pHt.reset( new SwHistoryResetText( pHint->Which(), pHint->GetStart(), - *pHint->GetAnyEnd(), nNodeIdx ) ); + pHint->GetAnyEnd(), nNodeIdx ) ); } m_SwpHstry.push_back( std::move(pHt) ); } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 3c3f7d1f9404..bba492871701 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -1010,7 +1010,7 @@ lcl_ExportHints( nEndIndex = 0; nNextEnd = 0; while(nEndIndex < pHints->Count() && - nCurrentIndex >= (nNextEnd = (*pHints->GetSortedByEnd(nEndIndex)->GetAnyEnd()))) + nCurrentIndex >= (nNextEnd = pHints->GetSortedByEnd(nEndIndex)->GetAnyEnd())) nEndIndex++; sal_Int32 nNextPos = diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index c059b151a1dd..d10e54aa2993 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1310,7 +1310,7 @@ int SwWW8AttrIter::OutAttrWithRange(const SwTextNode& rNode, sal_Int32 nPos) } break; } - if (nPos < *pHt->GetAnyEnd()) + if (nPos < pHt->GetAnyEnd()) break; // sorted by end } for ( size_t i = 0; i < pTextAttrs->Count(); ++i ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits