Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: core/fpdftext/cpdf_textpage.cpp

Issue 2358043003: Make ownership explicit in CPDF_ContentMarkItem (Closed)
Patch Set: cleanup callers Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdftext/cpdf_textpage.cpp
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 105694329221539426e00d15e1be6c98e48f9f0c..d88464bfc45278f197a612f56bd7320f10cf840a 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"));
dsinclair 2016/09/21 19:34:43 Can't this still, possibly be null, if we called S
Tom Sepez 2016/09/21 20:04:44 Either way, pDict is assigned to nullptr, and we c
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");
}

Powered by Google App Engine
This is Rietveld 408576698