diff options
author | tsepez <tsepez@chromium.org> | 2016-09-21 19:10:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-21 19:10:19 -0700 |
commit | bb577af2f17467a55c04fbff21a8f0ec1016601a (patch) | |
tree | 5a5321b1aff1bcc6ee6dc19928aa729a4ddc9a3d /fpdfsdk/fpdfsave.cpp | |
parent | 7149abce42b211ad3c0eaa39a340825acd41a1ec (diff) | |
download | pdfium-bb577af2f17467a55c04fbff21a8f0ec1016601a.tar.xz |
Remove some objnum locals with AddIndirectObject
Also, it's idempotent, so simplify some logic in callers to
not care if objnum is zero.
The alternate forms are rarely used, using the objnum form
makes it clear that SetReferenceFor() can't possibly register
the object as a side-effect.
Review-Url: https://codereview.chromium.org/2361713002
Diffstat (limited to 'fpdfsdk/fpdfsave.cpp')
-rw-r--r-- | fpdfsdk/fpdfsave.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index e5938b2542..8293c371dc 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -185,10 +185,12 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, } else { CPDF_Stream* pData = new CPDF_Stream; pData->InitStreamFromFile(pDsfileWrite.get(), pDataDict); - uint32_t objnum = pPDFDocument->AddIndirectObject(pData); iLast = pArray->GetCount() - 2; pArray->InsertAt(iLast, new CPDF_String("datasets", FALSE)); - pArray->InsertAt(iLast + 1, new CPDF_Reference(pPDFDocument, objnum)); + pArray->InsertAt( + iLast + 1, + new CPDF_Reference(pPDFDocument, + pPDFDocument->AddIndirectObject(pData))); } fileList->push_back(std::move(pDsfileWrite)); } @@ -206,10 +208,12 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, } else { CPDF_Stream* pData = new CPDF_Stream; pData->InitStreamFromFile(pfileWrite.get(), pDataDict); - uint32_t objnum = pPDFDocument->AddIndirectObject(pData); iLast = pArray->GetCount() - 2; pArray->InsertAt(iLast, new CPDF_String("form", FALSE)); - pArray->InsertAt(iLast + 1, new CPDF_Reference(pPDFDocument, objnum)); + pArray->InsertAt( + iLast + 1, + new CPDF_Reference(pPDFDocument, + pPDFDocument->AddIndirectObject(pData))); } fileList->push_back(std::move(pfileWrite)); } |