From 193e6ca5e48ee99e620f0e7546f1407ba1a20323 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 14 Mar 2017 15:53:36 -0700 Subject: Add IndexInBounds() convenience routine. Avoid writing |Type| in CollectionSize() so that index type can change without rewriting conditions. Change-Id: I40c94ca39148b379908760ba9b861114b88af7bb Reviewed-on: https://pdfium-review.googlesource.com/3056 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcrt/fx_arabic.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/fxcrt') 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& chars, int32_t iStart, int32_t iCount) { - ASSERT(iStart >= 0 && iStart < pdfium::CollectionSize(chars)); - ASSERT(iCount >= 0 && - iStart + iCount <= pdfium::CollectionSize(chars)); + ASSERT(pdfium::IndexInBounds(chars, iStart)); + ASSERT(pdfium::IndexInBounds(chars, iCount)); + ASSERT(iStart + iCount <= pdfium::CollectionSize(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(chars)); + ASSERT(pdfium::IndexInBounds(chars, iStart)); ASSERT(iStart - iCount > -1); int32_t iLast = iStart - iCount; if (bClass) { -- cgit v1.2.3