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

Unified Diff: core/fpdfapi/edit/fpdf_edit_create.cpp

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits Created 4 years, 1 month 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 | « no previous file | core/fpdfapi/font/cpdf_fontencoding.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/edit/fpdf_edit_create.cpp
diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp
index c823ab01e16d80b3d220030794edb062e7611a0c..ff126063996203509d0bf1a58772b2bad0efb75c 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);
« no previous file with comments | « no previous file | core/fpdfapi/font/cpdf_fontencoding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698