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

Unified Diff: fpdfsdk/fpdfppo.cpp

Issue 2424533003: Revert "Update CPDF_IndirectObjectHolder APIs for unique objects." (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfppo.cpp
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 023c41a7501f4e29e6c36a1b26608ac8ce0f809c..8a46ea4067db55a118df3fc6a47353e745cee908 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -70,9 +70,9 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
- pNewPages =
- pDestPDFDoc->AddIndirectDictionary(pDestPDFDoc->GetByteStringPool());
- pNewRoot->SetReferenceFor("Pages", pDestPDFDoc, pNewPages);
+ pNewPages = new CPDF_Dictionary(pDestPDFDoc->GetByteStringPool());
+ pNewRoot->SetReferenceFor("Pages", pDestPDFDoc,
+ pDestPDFDoc->AddIndirectObject(pNewPages));
}
CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
@@ -83,7 +83,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
if (!pNewPages->GetArrayFor("Kids")) {
pNewPages->SetIntegerFor("Count", 0);
pNewPages->SetReferenceFor("Kids", pDestPDFDoc,
- pDestPDFDoc->AddIndirectArray());
+ pDestPDFDoc->AddIndirectObject(new CPDF_Array));
}
return TRUE;
@@ -277,7 +277,7 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
if (!pDirect)
return 0;
- UniqueObject pClone(pDirect->Clone());
+ CPDF_Object* pClone = pDirect->Clone();
if (!pClone)
return 0;
@@ -294,11 +294,10 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc,
}
}
}
- CPDF_Object* pUnowned = pDoc->AddIndirectObject(std::move(pClone));
- dwNewObjNum = pUnowned->GetObjNum();
+ dwNewObjNum = pDoc->AddIndirectObject(pClone);
(*pObjNumberMap)[dwObjnum] = dwNewObjNum;
- if (!UpdateReference(pUnowned, pDoc, pObjNumberMap)) {
- pDoc->DeleteIndirectObject(dwNewObjNum);
+ if (!UpdateReference(pClone, pDoc, pObjNumberMap)) {
+ pClone->Release();
return 0;
}
return dwNewObjNum;
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698