diff options
author | tsepez <tsepez@chromium.org> | 2016-12-14 05:57:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 05:57:10 -0800 |
commit | a9caab94c1f16929e5acf2676117224617d80f53 (patch) | |
tree | d71ff9a82fae6e6080deb76375f43056127b3ee2 /core/fpdfapi/page/fpdf_page_func.cpp | |
parent | 992ecf7c189e5cabf43e5ad862511cf63d030966 (diff) | |
download | pdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz |
Avoid the ptr.reset(new XXX()) anti-pattern
Be suspicious of |new|. This removes some of the
easy cases.
Review-Url: https://codereview.chromium.org/2571913002
Diffstat (limited to 'core/fpdfapi/page/fpdf_page_func.cpp')
-rw-r--r-- | core/fpdfapi/page/fpdf_page_func.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index a6c73b0e5f..672bfc02be 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -20,6 +20,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" namespace { @@ -495,7 +496,7 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { return false; m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); - m_pSampleStream.reset(new CPDF_StreamAcc); + m_pSampleStream = pdfium::MakeUnique<CPDF_StreamAcc>(); m_pSampleStream->LoadAllData(pStream, false); FX_SAFE_UINT32 nTotalSampleBits = 1; m_EncodeInfo.resize(m_nInputs); @@ -742,13 +743,13 @@ std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) { Type type = IntegerToFunctionType(iType); if (type == Type::kType0Sampled) - pFunc.reset(new CPDF_SampledFunc()); + pFunc = pdfium::MakeUnique<CPDF_SampledFunc>(); else if (type == Type::kType2ExpotentialInterpolation) - pFunc.reset(new CPDF_ExpIntFunc()); + pFunc = pdfium::MakeUnique<CPDF_ExpIntFunc>(); else if (type == Type::kType3Stitching) - pFunc.reset(new CPDF_StitchFunc()); + pFunc = pdfium::MakeUnique<CPDF_StitchFunc>(); else if (type == Type::kType4PostScript) - pFunc.reset(new CPDF_PSFunc()); + pFunc = pdfium::MakeUnique<CPDF_PSFunc>(); if (!pFunc || !pFunc->Init(pFuncObj)) return nullptr; |