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 /fpdfsdk/formfiller/cba_fontmap.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 'fpdfsdk/formfiller/cba_fontmap.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cba_fontmap.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 7178b902d0..af518fe956 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -166,9 +166,8 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType); if (!pStream) { - pStream = new CPDF_Stream; - pAPDict->SetReferenceFor(m_sAPType, m_pDocument, - m_pDocument->AddIndirectObject(pStream)); + pStream = m_pDocument->AddIndirectStream(); + pAPDict->SetReferenceFor(m_sAPType, m_pDocument, pStream); } CPDF_Dictionary* pStreamDict = pStream->GetDict(); @@ -186,14 +185,12 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font"); if (!pStreamResFontList) { pStreamResFontList = - new CPDF_Dictionary(m_pDocument->GetByteStringPool()); - pStreamResList->SetReferenceFor( - "Font", m_pDocument, - m_pDocument->AddIndirectObject(pStreamResFontList)); + m_pDocument->AddIndirectDictionary(m_pDocument->GetByteStringPool()); + pStreamResList->SetReferenceFor("Font", m_pDocument, pStreamResFontList); } if (!pStreamResFontList->KeyExist(sAlias)) { pStreamResFontList->SetReferenceFor(sAlias, m_pDocument, - pFont->GetFontDict()->GetObjNum()); + pFont->GetFontDict()); } } } |