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

Unified Diff: fpdfsdk/fpdfeditpage.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/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfppo.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfeditpage.cpp
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 92fd39e78b9b005f64a373513f6ac4784981ec1d..9dc8ae9099b0b89bc99589782b4c38a2f00b7093 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -110,10 +110,10 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
return nullptr;
CPDF_Array* pMediaBoxArray = new CPDF_Array;
- pMediaBoxArray->Add(new CPDF_Number(0));
- pMediaBoxArray->Add(new CPDF_Number(0));
- pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width)));
- pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height)));
+ pMediaBoxArray->AddNew<CPDF_Number>(0);
+ pMediaBoxArray->AddNew<CPDF_Number>(0);
+ pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(width));
+ pMediaBoxArray->AddNew<CPDF_Number>(static_cast<FX_FLOAT>(height));
pPageDict->SetFor("MediaBox", pMediaBoxArray);
pPageDict->SetFor("Rotate", new CPDF_Number(0));
pPageDict->SetFor("Resources",
@@ -298,10 +298,10 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
pRectArray = new CPDF_Array;
pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray);
}
- pRectArray->SetAt(0, new CPDF_Number(rect.left));
- pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
- pRectArray->SetAt(2, new CPDF_Number(rect.right));
- pRectArray->SetAt(3, new CPDF_Number(rect.top));
+ pRectArray->SetNewAt<CPDF_Number>(0, rect.left);
+ pRectArray->SetNewAt<CPDF_Number>(1, rect.bottom);
+ pRectArray->SetNewAt<CPDF_Number>(2, rect.right);
+ pRectArray->SetNewAt<CPDF_Number>(3, rect.top);
// TODO: Transform AP's rectangle
}
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698