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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_document.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 | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_document.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index bd11ed26e6cb66dc07f32af89e275bb91184ef27..1694566f1b26206cca6b467e9b8bdd10357e49fd 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -689,13 +689,12 @@ void CPDF_Document::CreateNewDoc() {
ASSERT(!m_pRootDict && !m_pInfoDict);
m_pRootDict = new CPDF_Dictionary;
m_pRootDict->SetNameFor("Type", "Catalog");
- int objnum = AddIndirectObject(m_pRootDict);
+ AddIndirectObject(m_pRootDict);
CPDF_Dictionary* pPages = new CPDF_Dictionary;
pPages->SetNameFor("Type", "Pages");
pPages->SetNumberFor("Count", 0);
pPages->SetFor("Kids", new CPDF_Array);
- objnum = AddIndirectObject(pPages);
- m_pRootDict->SetReferenceFor("Pages", this, objnum);
+ m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages));
m_pInfoDict = new CPDF_Dictionary;
AddIndirectObject(m_pInfoDict);
}
@@ -754,8 +753,9 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
pArray->AddName(name.IsEmpty() ? ".notdef" : name);
}
pEncodingDict->SetFor("Differences", pArray);
- AddIndirectObject(pEncodingDict);
- pBaseDict->SetReferenceFor("Encoding", this, pEncodingDict);
+ pBaseDict->SetReferenceFor("Encoding", this,
+ AddIndirectObject(pEncodingDict));
+
return i;
}
@@ -822,8 +822,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo);
CPDF_Array* pArray = new CPDF_Array;
pBaseDict->SetFor("DescendantFonts", pArray);
- AddIndirectObject(pFontDict);
- pArray->AddReference(this, pFontDict);
+ pArray->AddReference(this, AddIndirectObject(pFontDict));
return pFontDict;
}
@@ -910,8 +909,8 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
CPDF_Dictionary* pFontDesc =
CalculateFontDesc(basefont, flags, italicangle, pFont->GetAscent(),
pFont->GetDescent(), pBBox, nStemV);
- AddIndirectObject(pFontDesc);
- pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc);
+ pFontDict->SetReferenceFor("FontDescriptor", this,
+ AddIndirectObject(pFontDesc));
return LoadFont(pBaseDict);
}
@@ -1006,8 +1005,8 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
CalculateFontDesc(basefont, flags, italicangle, ascend, descend, pBBox,
pLogFont->lfWeight / 5);
pFontDesc->SetIntegerFor("CapHeight", capheight);
- AddIndirectObject(pFontDesc);
- pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc);
+ pFontDict->SetReferenceFor("FontDescriptor", this,
+ AddIndirectObject(pFontDesc));
hFont = SelectObject(hDC, hFont);
DeleteObject(hFont);
DeleteDC(hDC);
« no previous file with comments | « core/fpdfapi/fpdf_parser/cfdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698