summaryrefslogtreecommitdiff
path: root/xfa/fde/tto/fde_textout.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-14 15:53:36 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-15 00:03:38 +0000
commit193e6ca5e48ee99e620f0e7546f1407ba1a20323 (patch)
tree11d920c59a89247d28fe590d77ab6d6a9ce37a0c /xfa/fde/tto/fde_textout.cpp
parentcd5139a291113f177d3494990efbcaf388d1f3bf (diff)
downloadpdfium-193e6ca5e48ee99e620f0e7546f1407ba1a20323.tar.xz
Add IndexInBounds() convenience routine.
Avoid writing |Type| in CollectionSize<Type>() so that index type can change without rewriting conditions. Change-Id: I40c94ca39148b379908760ba9b861114b88af7bb Reviewed-on: https://pdfium-review.googlesource.com/3056 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde/tto/fde_textout.cpp')
-rw-r--r--xfa/fde/tto/fde_textout.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index c9f5ec84ef..f816176841 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -775,10 +775,7 @@ int32_t CFDE_TTOLine::GetSize() const {
}
FDE_TTOPIECE* CFDE_TTOLine::GetPtrAt(int32_t index) {
- if (index < 0 || index >= pdfium::CollectionSize<int32_t>(m_pieces))
- return nullptr;
-
- return &m_pieces[index];
+ return pdfium::IndexInBounds(m_pieces, index) ? &m_pieces[index] : nullptr;
}
void CFDE_TTOLine::RemoveLast(int32_t icount) {