diff options
author | tsepez <tsepez@chromium.org> | 2016-11-18 16:22:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-18 16:22:41 -0800 |
commit | 0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch) | |
tree | 07c55fac710b191cf5d1d6595c63b90ca52e3cbb /fpdfsdk/fpdf_transformpage.cpp | |
parent | 430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff) | |
download | pdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz |
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors
as invoked by the templated methods.
Many release() calls go away, a few WrapUniques() are
introduced to avoid going deeper into other code.
Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index beaa6c4d98..b1e8da06b9 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -26,12 +26,11 @@ void SetBoundingBox(CPDF_Page* page, float bottom, float right, float top) { - CPDF_Array* pBoundingBoxArray = new CPDF_Array; + CPDF_Array* pBoundingBoxArray = page->m_pFormDict->SetNewFor<CPDF_Array>(key); pBoundingBoxArray->AddNew<CPDF_Number>(left); pBoundingBoxArray->AddNew<CPDF_Number>(bottom); pBoundingBoxArray->AddNew<CPDF_Number>(right); pBoundingBoxArray->AddNew<CPDF_Number>(top); - page->m_pFormDict->SetFor(key, pBoundingBoxArray); } bool GetBoundingBox(CPDF_Page* page, @@ -158,7 +157,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, pContentArray->AddNew<CPDF_Reference>(pDoc, pStream->GetObjNum()); pContentArray->AddNew<CPDF_Reference>(pDoc, pDirectObj->GetObjNum()); pContentArray->AddNew<CPDF_Reference>(pDoc, pEndStream->GetObjNum()); - pPageDic->SetReferenceFor("Contents", pDoc, pContentArray); + pPageDic->SetNewFor<CPDF_Reference>("Contents", pDoc, + pContentArray->GetObjNum()); } } } @@ -169,7 +169,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern"); if (pPattenDict) { for (const auto& it : *pPattenDict) { - CPDF_Object* pObj = it.second; + CPDF_Object* pObj = it.second.get(); if (pObj->IsReference()) pObj = pObj->GetDirect(); @@ -328,6 +328,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, CPDF_Array* pContentArray = pDoc->NewIndirect<CPDF_Array>(); pContentArray->AddNew<CPDF_Reference>(pDoc, pStream->GetObjNum()); pContentArray->AddNew<CPDF_Reference>(pDoc, pDirectObj->GetObjNum()); - pPageDic->SetReferenceFor("Contents", pDoc, pContentArray); + pPageDic->SetNewFor<CPDF_Reference>("Contents", pDoc, + pContentArray->GetObjNum()); } } |