Make CPDF_Object containers hold objects via unique pointers.
This tweaks the implementation while leaving the API the
same. The API change is more disruptive, so break this
part off first.
Review-Url: https://codereview.chromium.org/2385293002
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index f41f904..8a46ea4 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -105,8 +105,8 @@
// Clone the page dictionary
for (const auto& it : *pSrcPageDict) {
const CFX_ByteString& cbSrcKeyStr = it.first;
- CPDF_Object* pObj = it.second;
- if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) {
+ CPDF_Object* pObj = it.second.get();
+ if (cbSrcKeyStr.Compare("Type") && cbSrcKeyStr.Compare("Parent")) {
if (pCurPageDict->KeyExist(cbSrcKeyStr))
pCurPageDict->RemoveFor(cbSrcKeyStr);
pCurPageDict->SetFor(cbSrcKeyStr, pObj->Clone());
@@ -219,7 +219,7 @@
auto it = pDict->begin();
while (it != pDict->end()) {
const CFX_ByteString& key = it->first;
- CPDF_Object* pNextObj = it->second;
+ CPDF_Object* pNextObj = it->second.get();
++it;
if (key == "Parent" || key == "Prev" || key == "First")
continue;