summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_arabic.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 /core/fxcrt/fx_arabic.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 'core/fxcrt/fx_arabic.cpp')
-rw-r--r--core/fxcrt/fx_arabic.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index 103271cd02..76f2e38663 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -415,9 +415,9 @@ class CFX_BidiLineTemplate {
void FX_BidiReverseString(std::vector<CFX_Char>& chars,
int32_t iStart,
int32_t iCount) {
- ASSERT(iStart >= 0 && iStart < pdfium::CollectionSize<int32_t>(chars));
- ASSERT(iCount >= 0 &&
- iStart + iCount <= pdfium::CollectionSize<int32_t>(chars));
+ ASSERT(pdfium::IndexInBounds(chars, iStart));
+ ASSERT(pdfium::IndexInBounds(chars, iCount));
+ ASSERT(iStart + iCount <= pdfium::CollectionSize<int32_t>(chars));
std::reverse(chars.begin() + iStart, chars.begin() + iStart + iCount);
}
@@ -426,7 +426,7 @@ class CFX_BidiLineTemplate {
int32_t iStart,
int32_t iCount,
int32_t iValue) {
- ASSERT(iStart >= 0 && iStart <= pdfium::CollectionSize<int32_t>(chars));
+ ASSERT(pdfium::IndexInBounds(chars, iStart));
ASSERT(iStart - iCount > -1);
int32_t iLast = iStart - iCount;
if (bClass) {