summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-02 18:50:26 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-02 18:50:26 +0000
commit510bf91c129501206555f7a335241f9b3452ea41 (patch)
tree30b92ffc37aba0b9e0f802d2ac3f14f5840b7844
parent6efab39bf6cbad3fb1b07718ab87fbb84fc4bf61 (diff)
downloadpdfium-510bf91c129501206555f7a335241f9b3452ea41.tar.xz
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 <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.cpp30
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.h4
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.cpp30
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.h10
4 files changed, 37 insertions, 37 deletions
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index 6a4184dcf0..576d2d4533 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -331,7 +331,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine,
if (!m_bPagination) {
if (bAllChars && !bDone) {
int32_t endPos = m_pCurLine->GetLineEnd();
- GetBreakPos(m_pCurLine->m_LineChars, endPos, bAllChars, true);
+ GetBreakPos(m_pCurLine->m_LineChars, bAllChars, true, &endPos);
}
return false;
}
@@ -549,9 +549,9 @@ void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
}
int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
- int32_t& iEndPos,
bool bAllChars,
- bool bOnlyBrk) {
+ bool bOnlyBrk,
+ int32_t* pEndPos) {
int32_t iLength = pdfium::CollectionSize<int32_t>(tca) - 1;
if (iLength < 1)
return iLength;
@@ -562,12 +562,12 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
int32_t iIndirectPos = -1;
int32_t iLast = -1;
int32_t iLastPos = -1;
- if (iEndPos <= m_iLineWidth) {
+ if (*pEndPos <= m_iLineWidth) {
if (!bAllChars)
return iLength;
iBreak = iLength;
- iBreakPos = iEndPos;
+ iBreakPos = *pEndPos;
}
CFX_Char* pCharArray = tca.data();
@@ -580,7 +580,7 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
uint32_t nNext = nCodeProp & 0x003F;
int32_t iCharWidth = pCur->m_iCharWidth;
if (iCharWidth > 0)
- iEndPos -= iCharWidth;
+ *pEndPos -= iCharWidth;
while (iLength >= 0) {
pCur = pCharArray + iLength;
@@ -606,23 +606,23 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
if (!bOnlyBrk) {
iCharWidth = pCur->m_iCharWidth;
- if (iEndPos <= m_iLineWidth || bNeedBreak) {
+ if (*pEndPos <= m_iLineWidth || bNeedBreak) {
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;
}
}
if (iCharWidth > 0)
- iEndPos -= iCharWidth;
+ *pEndPos -= iCharWidth;
}
nNext = nCodeProp & 0x003F;
--iLength;
@@ -631,15 +631,15 @@ int32_t CFX_RTFBreak::GetBreakPos(std::vector<CFX_Char>& tca,
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;
@@ -655,7 +655,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_BreakLine* pCurLine,
int32_t iEndPos = pCurLine->GetLineEnd();
std::vector<CFX_Char>& 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;
diff --git a/xfa/fgas/layout/cfx_rtfbreak.h b/xfa/fgas/layout/cfx_rtfbreak.h
index 67052d23ad..3f302ca7a8 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.h
+++ b/xfa/fgas/layout/cfx_rtfbreak.h
@@ -75,9 +75,9 @@ class CFX_RTFBreak : public CFX_Break {
bool GetPositionedTab(int32_t* iTabPos) const;
int32_t GetBreakPos(std::vector<CFX_Char>& tca,
- int32_t& iEndPos,
bool bAllChars,
- bool bOnlyBrk);
+ bool bOnlyBrk,
+ int32_t* pEndPos);
void SplitTextLine(CFX_BreakLine* pCurLine,
CFX_BreakLine* pNextLine,
bool bAllChars);
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<CFX_Char>& ca,
- int32_t& iEndPos,
bool bAllChars,
- bool bOnlyBrk) {
+ bool bOnlyBrk,
+ int32_t* pEndPos) {
int32_t iLength = pdfium::CollectionSize<int32_t>(ca) - 1;
if (iLength < 1)
return iLength;
@@ -546,12 +546,12 @@ int32_t CFX_TxtBreak::GetBreakPos(std::vector<CFX_Char>& 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<CFX_Char>& 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<CFX_Char>& ca,
if (bAllChars)
pCur->m_nBreakType = static_cast<uint8_t>(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<CFX_Char>& 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<CFX_Char>& 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;
diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h
index a0e034280b..250f5820b1 100644
--- a/xfa/fgas/layout/cfx_txtbreak.h
+++ b/xfa/fgas/layout/cfx_txtbreak.h
@@ -67,7 +67,7 @@ class CFX_TxtBreak : public CFX_Break {
int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos) const;
std::vector<CFX_RectF> GetCharRects(const FX_TXTRUN* pTxtRun,
- bool bCharBBox = false) const;
+ bool bCharBBox) const;
CFX_BreakType AppendChar(wchar_t wch);
private:
@@ -84,12 +84,12 @@ class CFX_TxtBreak : public CFX_Break {
bool bAllChars,
CFX_BreakType dwStatus);
int32_t GetBreakPos(std::vector<CFX_Char>& ca,
- int32_t& iEndPos,
- bool bAllChars = false,
- bool bOnlyBrk = false);
+ bool bAllChars,
+ bool bOnlyBrk,
+ int32_t* pEndPos);
void SplitTextLine(CFX_BreakLine* pCurLine,
CFX_BreakLine* pNextLine,
- bool bAllChars = false);
+ bool bAllChars);
int32_t m_iAlignment;
int32_t m_iCombWidth;