summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-21 13:30:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-21 13:30:29 -0700
commit17103b84ebde9ab2b05dff38d473b5d44f723ff2 (patch)
treed200ac5050cfbb2454bacbef3a97b2c89c542183 /core/fpdftext
parentc0f60dc29db66262bbc0082fcd51170a570b0d1f (diff)
downloadpdfium-17103b84ebde9ab2b05dff38d473b5d44f723ff2.tar.xz
Make ownership explicit in CPDF_ContentMarkItem.
The old SetParam() method had "maybe take ownership" semanitcs based upon the type argument. Make GetParam() handle the None case and simplify callers based upon that behaviour. Review-Url: https://codereview.chromium.org/2358043003
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 1056943292..d88464bfc4 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -818,11 +818,10 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
int n = 0;
for (n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
- if (item.GetParamType() == CPDF_ContentMarkItem::ParamType::None)
- continue;
pDict = item.GetParam();
- CPDF_String* temp =
- ToString(pDict ? pDict->GetObjectFor("ActualText") : nullptr);
+ if (!pDict)
+ continue;
+ CPDF_String* temp = ToString(pDict->GetObjectFor("ActualText"));
if (temp) {
bExist = true;
actText = temp->GetUnicodeText();
@@ -877,12 +876,9 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
return;
CFX_WideString actText;
- CPDF_Dictionary* pDict = nullptr;
for (int n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
- if (item.GetParamType() == CPDF_ContentMarkItem::ParamType::None)
- continue;
- pDict = item.GetParam();
+ CPDF_Dictionary* pDict = item.GetParam();
if (pDict)
actText = pDict->GetUnicodeTextFor("ActualText");
}