summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfsave.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-10-14 17:45:56 -0700
committerTom Sepez <tsepez@chromium.org>2016-10-14 17:45:56 -0700
commitc25a4219431c90a95233a08f25eecc921abbf3ed (patch)
treebd2ad923d527440785c19623fe2d19cc1a70a92d /fpdfsdk/fpdfsave.cpp
parent62f367348ff8ff1e64c6f52c1ee5f77c3a89edc1 (diff)
downloadpdfium-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/fpdfsave.cpp')
-rw-r--r--fpdfsdk/fpdfsave.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index b594084218..364f4d2d6f 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -184,12 +184,14 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (pDataSetsStream)
pDataSetsStream->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = pPDFDocument->AddIndirectStream();
+ CPDF_Stream* pData = new CPDF_Stream;
pData->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
iLast = pArray->GetCount() - 2;
- pArray->InsertAt(iLast, new CPDF_String("datasets", false));
- pArray->InsertAt(iLast + 1,
- new CPDF_Reference(pPDFDocument, pData->GetObjNum()));
+ pArray->InsertAt(iLast, new CPDF_String("datasets", FALSE));
+ pArray->InsertAt(
+ iLast + 1,
+ new CPDF_Reference(pPDFDocument,
+ pPDFDocument->AddIndirectObject(pData)));
}
fileList->push_back(std::move(pDsfileWrite));
}
@@ -206,12 +208,14 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (pFormStream)
pFormStream->InitStreamFromFile(pfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = pPDFDocument->AddIndirectStream();
+ CPDF_Stream* pData = new CPDF_Stream;
pData->InitStreamFromFile(pfileWrite.get(), pDataDict);
iLast = pArray->GetCount() - 2;
pArray->InsertAt(iLast, new CPDF_String("form", FALSE));
- pArray->InsertAt(iLast + 1,
- new CPDF_Reference(pPDFDocument, pData->GetObjNum()));
+ pArray->InsertAt(
+ iLast + 1,
+ new CPDF_Reference(pPDFDocument,
+ pPDFDocument->AddIndirectObject(pData)));
}
fileList->push_back(std::move(pfileWrite));
}