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

Unified Diff: fpdfsdk/cpdfsdk_baannot.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/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_baannot.cpp
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 2c637807721169786c6616b5c858053158d6eb0f..836298f50da47af301c480da0191203d70581e4e 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -322,8 +322,8 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
if (!pStream) {
pStream = new CPDF_Stream;
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
- int32_t objnum = pDoc->AddIndirectObject(pStream);
- pParentDict->SetReferenceFor(sAPType, pDoc, objnum);
+ pParentDict->SetReferenceFor(sAPType, pDoc,
+ pDoc->AddIndirectObject(pStream));
}
CPDF_Dictionary* pStreamDict = pStream->GetDict();
@@ -354,14 +354,11 @@ CPDF_Action CPDFSDK_BAAnnot::GetAction() const {
}
void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) {
- ASSERT(action.GetDict());
- if (action.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("A")) {
+ CPDF_Dictionary* pDict = action.GetDict();
+ if (pDict != m_pAnnot->GetAnnotDict()->GetDictFor("A")) {
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
- CPDF_Dictionary* pDict = action.GetDict();
- if (pDict && pDict->GetObjNum() == 0) {
- pDoc->AddIndirectObject(pDict);
- }
- m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc, pDict->GetObjNum());
+ m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc,
+ pDoc->AddIndirectObject(pDict));
}
}
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698