diff options
author | tsepez <tsepez@chromium.org> | 2016-11-15 11:33:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-15 11:33:44 -0800 |
commit | 70c4afd5c3c5c44cd24f814423a23a6ef05bba02 (patch) | |
tree | cbe593d0b6c0bfc6fd5038bf60a77a94e49c69c9 /fpdfsdk/formfiller | |
parent | f16f6b8b52277348f5d571b7641bb0bbd5239589 (diff) | |
download | pdfium-70c4afd5c3c5c44cd24f814423a23a6ef05bba02.tar.xz |
Make AddIndirectObject() take a unique_ptr.
Add convenience routines to create and add object in
one step.
Review-Url: https://codereview.chromium.org/2489283003
Diffstat (limited to 'fpdfsdk/formfiller')
-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 26feaf765d..2d962ad276 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->NewIndirect<CPDF_Stream>(); + pAPDict->SetReferenceFor(m_sAPType, m_pDocument, pStream); } CPDF_Dictionary* pStreamDict = pStream->GetDict(); @@ -185,11 +184,9 @@ 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)); + pStreamResFontList = m_pDocument->NewIndirect<CPDF_Dictionary>( + m_pDocument->GetByteStringPool()); + pStreamResList->SetReferenceFor("Font", m_pDocument, pStreamResFontList); } if (!pStreamResFontList->KeyExist(sAlias)) { pStreamResFontList->SetReferenceFor(sAlias, m_pDocument, |