From 974b4a6c4bceb50bbe5bf316e9e273b62eaeceac Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 13 Dec 2016 12:48:13 -0800 Subject: Return unique_ptr<>s from fxcodec/ Review-Url: https://codereview.chromium.org/2572843002 --- core/fxcodec/codec/fx_codec.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'core/fxcodec/codec/fx_codec.cpp') diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 2f4a81155c..aa2ecef345 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -14,6 +14,7 @@ #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/logging.h" +#include "third_party/base/ptr_util.h" CCodec_ModuleMgr::CCodec_ModuleMgr() : m_pBasicModule(new CCodec_BasicModule), @@ -302,19 +303,16 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { m_Operator = 257 - count; } -CCodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder( - const uint8_t* src_buf, - uint32_t src_size, - int width, - int height, - int nComps, - int bpc) { - std::unique_ptr pRLScanlineDecoder( - new CCodec_RLScanlineDecoder); - if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, - bpc)) { +std::unique_ptr +CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf, + uint32_t src_size, + int width, + int height, + int nComps, + int bpc) { + auto pDecoder = pdfium::MakeUnique(); + if (!pDecoder->Create(src_buf, src_size, width, height, nComps, bpc)) return nullptr; - } - return pRLScanlineDecoder.release(); + return std::move(pDecoder); } -- cgit v1.2.3