summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_interform.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-09 13:28:26 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-09 13:28:26 -0800
commit335cf093231c984a23cb9ea113148ea1f19621ba (patch)
treee9c7803b0ce71269beb3d423549a2d6a0ac7784a /core/fpdfdoc/cpdf_interform.cpp
parent3ff4deea307c38462393e4f83dabe32949338168 (diff)
downloadpdfium-335cf093231c984a23cb9ea113148ea1f19621ba.tar.xz
Return unique_ptr from CPDF_Object::Clone().
Because that's what clone does. There are numerous release() calls that will go away as more code is converted. Review-Url: https://codereview.chromium.org/2484033002
Diffstat (limited to 'core/fpdfdoc/cpdf_interform.cpp')
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index f709c57961..2a02e890c3 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -1105,22 +1105,22 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
if (pFieldDict->KeyExist("FT")) {
CPDF_Object* pFTValue = pFieldDict->GetDirectObjectFor("FT");
if (pFTValue)
- pParent->SetFor("FT", pFTValue->Clone());
+ pParent->SetFor("FT", pFTValue->Clone().release());
}
if (pFieldDict->KeyExist("Ff")) {
CPDF_Object* pFfValue = pFieldDict->GetDirectObjectFor("Ff");
if (pFfValue)
- pParent->SetFor("Ff", pFfValue->Clone());
+ pParent->SetFor("Ff", pFfValue->Clone().release());
}
}
pField = new CPDF_FormField(this, pParent);
CPDF_Object* pTObj = pDict->GetObjectFor("T");
if (ToReference(pTObj)) {
- CPDF_Object* pClone = pTObj->CloneDirectObject();
+ std::unique_ptr<CPDF_Object> pClone = pTObj->CloneDirectObject();
if (pClone)
- pDict->SetFor("T", pClone);
+ pDict->SetFor("T", pClone.release());
else
pDict->SetNameFor("T", "");
}
@@ -1251,7 +1251,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
} else {
CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V");
if (pV)
- pFieldDict->SetFor("V", pV->CloneDirectObject());
+ pFieldDict->SetFor("V", pV->CloneDirectObject().release());
}
pFields->Add(pFieldDict);
}
@@ -1304,7 +1304,8 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) &&
pFieldDict->KeyExist("Opt")) {
pField->m_pDict->SetFor(
- "Opt", pFieldDict->GetDirectObjectFor("Opt")->CloneDirectObject());
+ "Opt",
+ pFieldDict->GetDirectObjectFor("Opt")->CloneDirectObject().release());
}
if (bNotify && m_pFormNotify) {