From a27e55e1c8c04fa85e2132e98e92b42d1a084b1f Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 22 Nov 2017 20:05:32 +0000 Subject: Change CPDF_ContentMark to return size_t for counts. Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fpdftext/cpdf_textpage.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/fpdftext') 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()) -- cgit v1.2.3