summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.cpp
diff options
context:
space:
mode:
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())