summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-11-22 20:05:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-22 20:05:32 +0000
commita27e55e1c8c04fa85e2132e98e92b42d1a084b1f (patch)
tree615b1f5d4aa301e37fde3886b3ff1a8d9b2f732c /core/fpdftext/cpdf_textpage.cpp
parente6dba0dcc2c399e92b2ed7029a5241726f38938f (diff)
downloadpdfium-a27e55e1c8c04fa85e2132e98e92b42d1a084b1f.tar.xz
Change CPDF_ContentMark to return size_t for counts.
Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdftext/cpdf_textpage.cpp')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 485fba24a8..edd5456c1a 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -810,16 +810,15 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (!pTextObj->m_ContentMark.HasRef())
return FPDFText_MarkedContent::Pass;
- int nContentMark = pTextObj->m_ContentMark.CountItems();
+ size_t nContentMark = pTextObj->m_ContentMark.CountItems();
if (nContentMark < 1)
return FPDFText_MarkedContent::Pass;
WideString actText;
bool bExist = false;
CPDF_Dictionary* pDict = nullptr;
- int n = 0;
- for (n = 0; n < nContentMark; n++) {
- const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
+ for (size_t i = 0; i < nContentMark; ++i) {
+ const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(i);
pDict = item.GetParam();
if (!pDict)
continue;
@@ -832,10 +831,12 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (!bExist)
return FPDFText_MarkedContent::Pass;
- if (m_pPreTextObj && m_pPreTextObj->m_ContentMark.HasRef() &&
- m_pPreTextObj->m_ContentMark.CountItems() == n &&
- pDict == m_pPreTextObj->m_ContentMark.GetItem(n - 1).GetParam()) {
- return FPDFText_MarkedContent::Done;
+ if (m_pPreTextObj) {
+ const CPDF_ContentMark& mark = m_pPreTextObj->m_ContentMark;
+ if (mark.HasRef() && mark.CountItems() == nContentMark &&
+ mark.GetItem(nContentMark - 1).GetParam() == pDict) {
+ return FPDFText_MarkedContent::Done;
+ }
}
if (actText.IsEmpty())