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_fax.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'core/fxcodec/codec/fx_codec_fax.cpp') diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 5102c778a4..62ad38e19f 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -5,10 +5,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include +#include #include #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/fx_codec.h" +#include "third_party/base/ptr_util.h" namespace { @@ -580,16 +582,17 @@ void FaxG4Decode(const uint8_t* src_buf, *pbitpos = bitpos; } -CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, - uint32_t src_size, - int width, - int height, - int K, - bool EndOfLine, - bool EncodedByteAlign, - bool BlackIs1, - int Columns, - int Rows) { +std::unique_ptr CCodec_FaxModule::CreateDecoder( + const uint8_t* src_buf, + uint32_t src_size, + int width, + int height, + int K, + bool EndOfLine, + bool EncodedByteAlign, + bool BlackIs1, + int Columns, + int Rows) { int actual_width = Columns ? Columns : width; int actual_height = Rows ? Rows : height; @@ -602,6 +605,7 @@ CCodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, return nullptr; uint32_t pitch = (static_cast(actual_width) + 31) / 32 * 4; - return new CCodec_FaxDecoder(src_buf, src_size, actual_width, actual_height, - pitch, K, EndOfLine, EncodedByteAlign, BlackIs1); + return pdfium::MakeUnique( + src_buf, src_size, actual_width, actual_height, pitch, K, EndOfLine, + EncodedByteAlign, BlackIs1); } -- cgit v1.2.3