Index: core/fpdfapi/page/cpdf_contentparser.cpp |
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp |
index 0b8574bfd40791cc80294d6846042737f029b39a..1e0fe62e095773f7e2b8a055e72242e7c261c8cf 100644 |
--- a/core/fpdfapi/page/cpdf_contentparser.cpp |
+++ b/core/fpdfapi/page/cpdf_contentparser.cpp |
@@ -17,6 +17,7 @@ |
#include "core/fpdfapi/parser/cpdf_stream.h" |
#include "core/fpdfapi/parser/cpdf_stream_acc.h" |
#include "core/fxcrt/fx_safe_types.h" |
+#include "third_party/base/ptr_util.h" |
#define PARSE_STEP_LIMIT 100 |
@@ -54,7 +55,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) { |
} |
if (CPDF_Stream* pStream = pContent->AsStream()) { |
m_nStreams = 0; |
- m_pSingleStream.reset(new CPDF_StreamAcc); |
+ m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); |
m_pSingleStream->LoadAllData(pStream, false); |
} else if (CPDF_Array* pArray = pContent->AsArray()) { |
m_nStreams = pArray->GetCount(); |
@@ -94,9 +95,9 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, |
form_bbox.Transform(pParentMatrix); |
} |
CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources"); |
- m_pParser.reset(new CPDF_StreamContentParser( |
+ m_pParser = pdfium::MakeUnique<CPDF_StreamContentParser>( |
pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, |
- pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level)); |
+ pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level); |
m_pParser->GetCurStates()->m_CTM = form_matrix; |
m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; |
if (ClipPath) { |
@@ -111,7 +112,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, |
pState->SetSoftMask(nullptr); |
} |
m_nStreams = 0; |
- m_pSingleStream.reset(new CPDF_StreamAcc); |
+ m_pSingleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); |
m_pSingleStream->LoadAllData(pForm->m_pFormStream, false); |
m_pData = (uint8_t*)m_pSingleStream->GetData(); |
m_Size = m_pSingleStream->GetSize(); |
@@ -153,7 +154,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { |
} else { |
CPDF_Array* pContent = |
m_pObjectHolder->m_pFormDict->GetArrayFor("Contents"); |
- m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc); |
+ m_StreamArray[m_CurrentOffset] = pdfium::MakeUnique<CPDF_StreamAcc>(); |
CPDF_Stream* pStreamObj = ToStream( |
pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr); |
m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false); |
@@ -162,10 +163,10 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { |
} |
if (m_InternalStage == STAGE_PARSE) { |
if (!m_pParser) { |
- m_pParser.reset(new CPDF_StreamContentParser( |
+ m_pParser = pdfium::MakeUnique<CPDF_StreamContentParser>( |
m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, |
nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, |
- &m_pObjectHolder->m_BBox, nullptr, 0)); |
+ &m_pObjectHolder->m_BBox, nullptr, 0); |
m_pParser->GetCurStates()->m_ColorState.SetDefault(); |
} |
if (m_CurrentOffset >= m_Size) { |