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

Unified Diff: fpdfsdk/fpdfsave.cpp

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues 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/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 364f4d2d6f2a7113afe718e878e28245d03a5a26..b5940842188c91be57a587d824c7e15626a3083b 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -184,14 +184,12 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (pDataSetsStream)
pDataSetsStream->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream;
+ CPDF_Stream* pData = pPDFDocument->AddIndirectStream();
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, new CPDF_String("datasets", false));
+ pArray->InsertAt(iLast + 1,
+ new CPDF_Reference(pPDFDocument, pData->GetObjNum()));
}
fileList->push_back(std::move(pDsfileWrite));
}
@@ -208,14 +206,12 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (pFormStream)
pFormStream->InitStreamFromFile(pfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream;
+ CPDF_Stream* pData = pPDFDocument->AddIndirectStream();
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