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

Unified Diff: fpdfsdk/fpdf_transformpage.cpp

Issue 2520493002: Make CPDF_Stream() take unique_ptr's to its dictionary. (Closed)
Patch Set: rebase, lint, fix new test. 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/fpdf_flatten.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdf_transformpage.cpp
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index b1e8da06b9136024b97d6b55aad2fd12dc32be14..13d9756bd85026acdffc0f007167427217c14b0a 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -128,13 +128,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
if (!pDoc)
return false;
- CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
- CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(nullptr, 0, pDic);
+ CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(
+ nullptr, 0,
+ pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()));
pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize());
- pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
-
- CPDF_Stream* pEndStream = pDoc->NewIndirect<CPDF_Stream>(nullptr, 0, pDic);
+ CPDF_Stream* pEndStream = pDoc->NewIndirect<CPDF_Stream>(
+ nullptr, 0,
+ pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()));
pEndStream->SetData((const uint8_t*)" Q", 2);
CPDF_Array* pContentArray = nullptr;
@@ -302,8 +303,9 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
if (!pDoc)
return;
- CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
- CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(nullptr, 0, pDic);
+ CPDF_Stream* pStream = pDoc->NewIndirect<CPDF_Stream>(
+ nullptr, 0,
+ pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool()));
pStream->SetData(strClip.GetBuffer(), strClip.GetSize());
CPDF_Array* pArray = ToArray(pContentObj);
« no previous file with comments | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698