diff options
author | weili <weili@chromium.org> | 2016-07-06 18:10:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-06 18:10:35 -0700 |
commit | 44105d862bfcaf9fce0ee0dfe283337bf5980337 (patch) | |
tree | 9c4f3e31b7c1e7ec0ea6eff56c1b81407ce79870 /core/fpdfapi/fpdf_page | |
parent | 2f6d1480a1be2b1f82c94219c2d99e67d7e0660d (diff) | |
download | pdfium-44105d862bfcaf9fce0ee0dfe283337bf5980337.tar.xz |
Change class member variables in raw pointer type into unique_ptr
Also did some cleanups such as removing an unused member variables and some unused structs.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2119013002
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_formobject.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_formobject.h | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_formobject.cpp b/core/fpdfapi/fpdf_page/cpdf_formobject.cpp index 567c156af0..dc93ed3c54 100644 --- a/core/fpdfapi/fpdf_page/cpdf_formobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_formobject.cpp @@ -8,11 +8,9 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" -CPDF_FormObject::CPDF_FormObject() : m_pForm(nullptr) {} +CPDF_FormObject::CPDF_FormObject() {} -CPDF_FormObject::~CPDF_FormObject() { - delete m_pForm; -} +CPDF_FormObject::~CPDF_FormObject() {} void CPDF_FormObject::Transform(const CFX_Matrix& matrix) { m_FormMatrix.Concat(matrix); @@ -35,7 +33,7 @@ CPDF_FormObject* CPDF_FormObject::Clone() const { CPDF_FormObject* obj = new CPDF_FormObject; obj->CopyData(this); - obj->m_pForm = m_pForm->Clone(); + obj->m_pForm.reset(m_pForm->Clone()); obj->m_FormMatrix = m_FormMatrix; return obj; } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 0d16994bbe..1881244a0f 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -751,8 +751,8 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { std::unique_ptr<CPDF_FormObject> pFormObj(new CPDF_FormObject); - pFormObj->m_pForm = - new CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources); + pFormObj->m_pForm.reset( + new CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources)); pFormObj->m_FormMatrix = m_pCurStates->m_CTM; pFormObj->m_FormMatrix.Concat(m_mtContentToUser); CPDF_AllStates status; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h index 1a8db34e8f..03e117a132 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h @@ -7,6 +7,8 @@ #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_ #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_ +#include <memory> + #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" #include "core/fxcrt/include/fx_coordinates.h" @@ -27,7 +29,7 @@ class CPDF_FormObject : public CPDF_PageObject { void CalcBoundingBox(); - CPDF_Form* m_pForm; + std::unique_ptr<CPDF_Form> m_pForm; CFX_Matrix m_FormMatrix; }; |