diff options
author | tsepez <tsepez@chromium.org> | 2016-10-14 16:59:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-14 16:59:10 -0700 |
commit | 3ba098595ae56b64eacc0c25ab76b89a4d78d920 (patch) | |
tree | 5c4db47295ea64cdf236c32ef7d5af5b8e7af232 /core/fpdfdoc/cpdf_interform.cpp | |
parent | 1d023881cd53485303c0fcc0b5878e700dc470fd (diff) | |
download | pdfium-3ba098595ae56b64eacc0c25ab76b89a4d78d920.tar.xz |
Update CPDF_IndirectObjectHolder APIs for unique objects.
Doing so highlights a few places where ownership is dubious.
Add convenience functions to return an unowned reference to
a newly-created indirect object.
Review-Url: https://codereview.chromium.org/2419173002
Diffstat (limited to 'core/fpdfdoc/cpdf_interform.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_interform.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 3bef85ef9c..cafc912569 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -59,9 +59,9 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { return; if (!pFormDict) { - pFormDict = new CPDF_Dictionary(pDocument->GetByteStringPool()); - pDocument->GetRoot()->SetReferenceFor( - "AcroForm", pDocument, pDocument->AddIndirectObject(pFormDict)); + pFormDict = + pDocument->AddIndirectDictionary(pDocument->GetByteStringPool()); + pDocument->GetRoot()->SetReferenceFor("AcroForm", pDocument, pFormDict); } CFX_ByteString csDA; @@ -274,8 +274,7 @@ void AddFont(CPDF_Dictionary*& pFormDict, csNameTag.Remove(' '); csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag.c_str()); - pFonts->SetReferenceFor(csNameTag, pDocument, - pFont->GetFontDict()->GetObjNum()); + pFonts->SetReferenceFor(csNameTag, pDocument, pFont->GetFontDict()); } CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict, |