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

Unified Diff: fpdfsdk/fpdfsave.cpp

Issue 2489283003: Make AddIndirectObject() take a unique_ptr. (Closed)
Patch Set: Address review comments Created 4 years, 1 month 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/fpdfppo.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfsave.cpp
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index 1b639b7cc4cdae35e2ca823850ad1e491be84875..e5d7a409ae0de6c979f92d2bf6a35c1128036633 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -180,14 +180,12 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext,
if (pDataSetsStream)
pDataSetsStream->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream;
+ CPDF_Stream* pData = pPDFDocument->NewIndirect<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,
- pPDFDocument->AddIndirectObject(pData)));
+ pArray->InsertAt(iLast + 1,
+ new CPDF_Reference(pPDFDocument, pData->GetObjNum()));
}
fileList->push_back(std::move(pDsfileWrite));
}
@@ -204,14 +202,12 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext,
if (pFormStream)
pFormStream->InitStreamFromFile(pfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream;
+ CPDF_Stream* pData = pPDFDocument->NewIndirect<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,
- pPDFDocument->AddIndirectObject(pData)));
+ pArray->InsertAt(iLast + 1,
+ new CPDF_Reference(pPDFDocument, pData->GetObjNum()));
}
fileList->push_back(std::move(pfileWrite));
}
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698