diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-10-14 17:45:56 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-10-14 17:45:56 -0700 |
commit | c25a4219431c90a95233a08f25eecc921abbf3ed (patch) | |
tree | bd2ad923d527440785c19623fe2d19cc1a70a92d /fpdfsdk/fpdfppo.cpp | |
parent | 62f367348ff8ff1e64c6f52c1ee5f77c3a89edc1 (diff) | |
download | pdfium-c25a4219431c90a95233a08f25eecc921abbf3ed.tar.xz |
Revert "Update CPDF_IndirectObjectHolder APIs for unique objects."
This reverts commit 3ba098595ae56b64eacc0c25ab76b89a4d78d920.
TBR=thestig@chromium.org,weili@chromium.org
Review URL: https://codereview.chromium.org/2424533003 .
Diffstat (limited to 'fpdfsdk/fpdfppo.cpp')
-rw-r--r-- | fpdfsdk/fpdfppo.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 023c41a750..8a46ea4067 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; |