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

Unified Diff: fpdfsdk/formfiller/cba_fontmap.cpp

Issue 2361713002: Remove some objnum locals with AddIndirectObject (Closed)
Patch Set: Same treatment for arrays Created 4 years, 3 months 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
« no previous file with comments | « fpdfsdk/cpdfsdk_widget.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/formfiller/cba_fontmap.cpp
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index fe690f23d5d4971aaa7932642293425e82c776cd..04d6a72ec557527e99861ac9eac4d0c4019976ee 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -154,7 +154,6 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
return;
CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP");
-
if (!pAPDict) {
pAPDict = new CPDF_Dictionary;
m_pAnnotDict->SetFor("AP", pAPDict);
@@ -168,12 +167,11 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType);
if (!pStream) {
pStream = new CPDF_Stream;
- int32_t objnum = m_pDocument->AddIndirectObject(pStream);
- pAPDict->SetReferenceFor(m_sAPType, m_pDocument, objnum);
+ pAPDict->SetReferenceFor(m_sAPType, m_pDocument,
+ m_pDocument->AddIndirectObject(pStream));
}
CPDF_Dictionary* pStreamDict = pStream->GetDict();
-
if (!pStreamDict) {
pStreamDict = new CPDF_Dictionary;
pStream->InitStream(nullptr, 0, pStreamDict);
@@ -185,17 +183,16 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
pStreamResList = new CPDF_Dictionary();
pStreamDict->SetFor("Resources", pStreamResList);
}
-
- if (pStreamResList) {
- CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
- if (!pStreamResFontList) {
- pStreamResFontList = new CPDF_Dictionary;
- int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList);
- pStreamResList->SetReferenceFor("Font", m_pDocument, objnum);
- }
- if (!pStreamResFontList->KeyExist(sAlias))
- pStreamResFontList->SetReferenceFor(sAlias, m_pDocument,
- pFont->GetFontDict());
+ CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
+ if (!pStreamResFontList) {
+ pStreamResFontList = new CPDF_Dictionary;
+ pStreamResList->SetReferenceFor(
+ "Font", m_pDocument,
+ m_pDocument->AddIndirectObject(pStreamResFontList));
+ }
+ if (!pStreamResFontList->KeyExist(sAlias)) {
+ pStreamResFontList->SetReferenceFor(sAlias, m_pDocument,
+ pFont->GetFontDict()->GetObjNum());
}
}
}
« no previous file with comments | « fpdfsdk/cpdfsdk_widget.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698