From 510bf91c129501206555f7a335241f9b3452ea41 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 2 May 2018 18:50:26 +0000 Subject: Transform in/out params from ref to pointer in CFX_(Txt|RTF)Break. Remove some default parameters while we're at it. Change-Id: Ifa51f580d9773ca9cf8d08016361a0283b2d4794 Reviewed-on: https://pdfium-review.googlesource.com/31953 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- xfa/fgas/layout/cfx_txtbreak.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'xfa/fgas/layout/cfx_txtbreak.cpp') diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index 67140c4711..526fd64c96 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp @@ -305,7 +305,7 @@ bool CFX_TxtBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine, CFX_BreakPiece tp; if (bAllChars && !bDone) { int32_t iEndPos = m_pCurLine->m_iWidth; - GetBreakPos(m_pCurLine->m_LineChars, iEndPos, bAllChars, true); + GetBreakPos(m_pCurLine->m_LineChars, bAllChars, true, &iEndPos); } return false; } @@ -533,9 +533,9 @@ CFX_BreakType CFX_TxtBreak::EndBreak(CFX_BreakType dwStatus) { } int32_t CFX_TxtBreak::GetBreakPos(std::vector& ca, - int32_t& iEndPos, bool bAllChars, - bool bOnlyBrk) { + bool bOnlyBrk, + int32_t* pEndPos) { int32_t iLength = pdfium::CollectionSize(ca) - 1; if (iLength < 1) return iLength; @@ -546,12 +546,12 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector& ca, int32_t iIndirectPos = -1; int32_t iLast = -1; int32_t iLastPos = -1; - if (m_bSingleLine || iEndPos <= m_iLineWidth) { + if (m_bSingleLine || *pEndPos <= m_iLineWidth) { if (!bAllChars) return iLength; iBreak = iLength; - iBreakPos = iEndPos; + iBreakPos = *pEndPos; } FX_LINEBREAKTYPE eType; @@ -566,7 +566,7 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector& ca, nNext = nCodeProp & 0x003F; int32_t iCharWidth = pCur->m_iCharWidth; if (iCharWidth > 0) - iEndPos -= iCharWidth; + *pEndPos -= iCharWidth; while (iLength >= 0) { pCur = &ca[iLength]; @@ -579,25 +579,25 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector& ca, if (bAllChars) pCur->m_nBreakType = static_cast(eType); if (!bOnlyBrk) { - if (m_bSingleLine || iEndPos <= m_iLineWidth || + if (m_bSingleLine || *pEndPos <= m_iLineWidth || nCur == kBreakPropertySpace) { if (eType == FX_LBT_DIRECT_BRK && iBreak < 0) { iBreak = iLength; - iBreakPos = iEndPos; + iBreakPos = *pEndPos; if (!bAllChars) return iLength; } else if (eType == FX_LBT_INDIRECT_BRK && iIndirect < 0) { iIndirect = iLength; - iIndirectPos = iEndPos; + iIndirectPos = *pEndPos; } if (iLast < 0) { iLast = iLength; - iLastPos = iEndPos; + iLastPos = *pEndPos; } } iCharWidth = pCur->m_iCharWidth; if (iCharWidth > 0) - iEndPos -= iCharWidth; + *pEndPos -= iCharWidth; } nNext = nCodeProp & 0x003F; iLength--; @@ -605,15 +605,15 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector& ca, if (bOnlyBrk) return 0; if (iBreak > -1) { - iEndPos = iBreakPos; + *pEndPos = iBreakPos; return iBreak; } if (iIndirect > -1) { - iEndPos = iIndirectPos; + *pEndPos = iIndirectPos; return iIndirect; } if (iLast > -1) { - iEndPos = iLastPos; + *pEndPos = iLastPos; return iLast; } return 0; @@ -629,7 +629,7 @@ void CFX_TxtBreak::SplitTextLine(CFX_BreakLine* pCurLine, int32_t iEndPos = pCurLine->m_iWidth; std::vector& curChars = pCurLine->m_LineChars; - int32_t iCharPos = GetBreakPos(curChars, iEndPos, bAllChars, false); + int32_t iCharPos = GetBreakPos(curChars, bAllChars, false, &iEndPos); if (iCharPos < 0) iCharPos = 0; -- cgit v1.2.3