summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/cfx_breakline.cpp4
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp3
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp7
3 files changed, 7 insertions, 7 deletions
diff --git a/xfa/fgas/layout/cfx_breakline.cpp b/xfa/fgas/layout/cfx_breakline.cpp
index 65860e4013..562f984ffe 100644
--- a/xfa/fgas/layout/cfx_breakline.cpp
+++ b/xfa/fgas/layout/cfx_breakline.cpp
@@ -17,12 +17,12 @@ int32_t CFX_BreakLine::CountChars() const {
}
CFX_Char* CFX_BreakLine::GetChar(int32_t index) {
- ASSERT(index >= 0 && index < pdfium::CollectionSize<int32_t>(m_LineChars));
+ ASSERT(pdfium::IndexInBounds(m_LineChars, index));
return &m_LineChars[index];
}
const CFX_Char* CFX_BreakLine::GetChar(int32_t index) const {
- ASSERT(index >= 0 && index < pdfium::CollectionSize<int32_t>(m_LineChars));
+ ASSERT(pdfium::IndexInBounds(m_LineChars, index));
return &m_LineChars[index];
}
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 37822140c3..68c04a7f64 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -805,8 +805,9 @@ const CFX_BreakPiece* CFX_RTFBreak::GetBreakPieceUnstable(int32_t index) const {
const std::vector<CFX_BreakPiece>& pRTFPieces =
m_RTFLine[m_iReadyLineIndex].m_LinePieces;
- if (index < 0 || index >= pdfium::CollectionSize<int32_t>(pRTFPieces))
+ if (!pdfium::IndexInBounds(pRTFPieces, index))
return nullptr;
+
return &pRTFPieces[index];
}
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index 8bba780382..c42de45411 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -796,11 +796,10 @@ int32_t CFX_TxtBreak::CountBreakPieces() const {
const CFX_BreakPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const {
if (!HasTxtLine())
return nullptr;
- if (index < 0 ||
- index >= pdfium::CollectionSize<int32_t>(
- m_TxtLine[m_iReadyLineIndex].m_LinePieces)) {
+
+ if (!pdfium::IndexInBounds(m_TxtLine[m_iReadyLineIndex].m_LinePieces, index))
return nullptr;
- }
+
return &m_TxtLine[m_iReadyLineIndex].m_LinePieces[index];
}