diff options
author | tsepez <tsepez@chromium.org> | 2016-11-16 12:26:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-16 12:26:06 -0800 |
commit | 8a3aa459fc5284f51bcd7e98e95bf6214f47bb67 (patch) | |
tree | 13fb383936d679aded19054f4e7a0387dd52de76 /core/fpdfapi/edit | |
parent | 14a60c50b10de1d9e4edd3629ea210a816940a75 (diff) | |
download | pdfium-8a3aa459fc5284f51bcd7e98e95bf6214f47bb67.tar.xz |
Make CPDF_Array take unique_ptrs
BUG=
Review-Url: https://codereview.chromium.org/2498223005
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/fpdf_edit_create.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp index c823ab01e1..ff12606399 100644 --- a/core/fpdfapi/edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/edit/fpdf_edit_create.cpp @@ -1931,12 +1931,12 @@ void CPDF_Creator::InitID(bool bDefault) { m_pIDArray.reset(new CPDF_Array); CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : nullptr; if (pID1) { - m_pIDArray->Add(pID1->Clone().release()); + m_pIDArray->Add(pID1->Clone()); } else { std::vector<uint8_t> buffer = PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); CFX_ByteString bsBuffer(buffer.data(), buffer.size()); - m_pIDArray->Add(new CPDF_String(bsBuffer, true)); + m_pIDArray->AddNew<CPDF_String>(bsBuffer, true); } } if (!bDefault) { @@ -1945,21 +1945,20 @@ void CPDF_Creator::InitID(bool bDefault) { if (pOldIDArray) { CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1); if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { - m_pIDArray->Add(pID2->Clone().release()); + m_pIDArray->Add(pID2->Clone()); return; } std::vector<uint8_t> buffer = PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); CFX_ByteString bsBuffer(buffer.data(), buffer.size()); - m_pIDArray->Add(new CPDF_String(bsBuffer, true)); + m_pIDArray->AddNew<CPDF_String>(bsBuffer, true); return; } - m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone().release()); + m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { if (m_pEncryptDict->GetStringFor("Filter") == "Standard") { CFX_ByteString user_pass = m_pParser->GetPassword(); uint32_t flag = PDF_ENCRYPT_CONTENT; - CPDF_SecurityHandler handler; handler.OnCreate(m_pEncryptDict, m_pIDArray.get(), user_pass.raw_str(), user_pass.GetLength(), flag); |