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

Unified Diff: fpdfsdk/fpdf_flatten.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 | « fpdfsdk/cpdfsdk_baannot.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdf_flatten.cpp
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index b11e4a621d5099c16f2d1a8041c5a18140f4e736..cb0a625e2362abb7a1c088c3042c05a1d63a31e3 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_number.h"
+#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fpdfdoc/cpdf_annot.h"
@@ -205,12 +206,13 @@ void SetPageContents(const CFX_ByteString& key,
CFX_ByteString((const FX_CHAR*)acc.GetData(), acc.GetSize());
sStream = sStream + sBody + "\nQ";
pContentsStream->SetData(sStream.raw_str(), sStream.GetLength());
- pContentsArray->AddReference(pDocument, pContentsStream->GetObjNum());
+ pContentsArray->AddNew<CPDF_Reference>(pDocument,
+ pContentsStream->GetObjNum());
pPage->SetReferenceFor("Contents", pDocument, pContentsArray);
}
if (!key.IsEmpty()) {
- pContentsArray->AddReference(pDocument,
- NewIndirectContentsStream(key, pDocument));
+ pContentsArray->AddNew<CPDF_Reference>(
+ pDocument, NewIndirectContentsStream(key, pDocument));
}
}
@@ -270,19 +272,19 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!rcOriginalMB.IsEmpty()) {
CPDF_Array* pMediaBox = new CPDF_Array();
- pMediaBox->Add(new CPDF_Number(rcOriginalMB.left));
- pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom));
- pMediaBox->Add(new CPDF_Number(rcOriginalMB.right));
- pMediaBox->Add(new CPDF_Number(rcOriginalMB.top));
+ pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.left);
+ pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.bottom);
+ pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.right);
+ pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.top);
pPageDict->SetFor("MediaBox", pMediaBox);
}
if (!rcOriginalCB.IsEmpty()) {
CPDF_Array* pCropBox = new CPDF_Array();
- pCropBox->Add(new CPDF_Number(rcOriginalCB.left));
- pCropBox->Add(new CPDF_Number(rcOriginalCB.bottom));
- pCropBox->Add(new CPDF_Number(rcOriginalCB.right));
- pCropBox->Add(new CPDF_Number(rcOriginalCB.top));
+ pCropBox->AddNew<CPDF_Number>(rcOriginalCB.left);
+ pCropBox->AddNew<CPDF_Number>(rcOriginalCB.bottom);
+ pCropBox->AddNew<CPDF_Number>(rcOriginalCB.right);
+ pCropBox->AddNew<CPDF_Number>(rcOriginalCB.top);
pPageDict->SetFor("ArtBox", pCropBox);
}
« no previous file with comments | « fpdfsdk/cpdfsdk_baannot.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698