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

Unified Diff: fpdfsdk/formfiller/cba_fontmap.cpp

Issue 2489283003: Make AddIndirectObject() take a unique_ptr. (Closed)
Patch Set: Fix test Created 4 years, 1 month 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
Index: fpdfsdk/formfiller/cba_fontmap.cpp
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 26feaf765d68a9877c9ad87a2581d0fd884b4f6a..2d962ad276b16a599080cc6e30b4d98145a65302 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,

Powered by Google App Engine
This is Rietveld 408576698