summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-05 16:55:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-05 16:55:48 +0000
commit6c4ca9f597ae84550e0b8a4323e44b188f9bb274 (patch)
tree6f1cb0f180279e943d5e6ed463bfb17edf154bd8 /core/fpdftext/cpdf_textpage.cpp
parent3fab31fb8e35eca693322ac292228e993b508102 (diff)
downloadpdfium-6c4ca9f597ae84550e0b8a4323e44b188f9bb274.tar.xz
Delete CPDF_ContentMark::HasRef()
This is called by many client to make sure CountItems() does not crash. Moving the check to CountItems() makes HasRef() unnecessary. Bug: pdfium:1037 Change-Id: I4f21f33a88c9aad54f0dae18a38b370c6ceaec80 Reviewed-on: https://pdfium-review.googlesource.com/37133 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdftext/cpdf_textpage.cpp')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 60e574558b..4c3196427a 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -838,9 +838,6 @@ void CPDF_TextPage::ProcessTextObject(
FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get();
- if (!pTextObj->m_ContentMark.HasRef())
- return FPDFText_MarkedContent::Pass;
-
size_t nContentMark = pTextObj->m_ContentMark.CountItems();
if (nContentMark == 0)
return FPDFText_MarkedContent::Pass;
@@ -864,7 +861,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (m_pPreTextObj) {
const CPDF_ContentMark& mark = m_pPreTextObj->m_ContentMark;
- if (mark.HasRef() && mark.CountItems() == nContentMark &&
+ if (mark.CountItems() == nContentMark &&
mark.GetItem(nContentMark - 1).GetParam() == pDict) {
return FPDFText_MarkedContent::Done;
}
@@ -900,15 +897,13 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj.Get();
- if (!pTextObj->m_ContentMark.HasRef())
- return;
- int nContentMark = pTextObj->m_ContentMark.CountItems();
- if (nContentMark < 1)
+ size_t nContentMark = pTextObj->m_ContentMark.CountItems();
+ if (nContentMark == 0)
return;
WideString actText;
- for (int n = 0; n < nContentMark; n++) {
+ for (size_t n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
const CPDF_Dictionary* pDict = item.GetParam();
if (pDict)