summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-13 12:48:13 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-13 12:48:13 -0800
commit974b4a6c4bceb50bbe5bf316e9e273b62eaeceac (patch)
treee243d34a04905b88a11e9146e698daaa0cee2416 /core/fxcodec/codec/fx_codec.cpp
parent988599c5d81bbb568f949454580ec6001258f806 (diff)
downloadpdfium-974b4a6c4bceb50bbe5bf316e9e273b62eaeceac.tar.xz
Return unique_ptr<>s from fxcodec/chromium/2951
Review-Url: https://codereview.chromium.org/2572843002
Diffstat (limited to 'core/fxcodec/codec/fx_codec.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec.cpp24
1 files changed, 11 insertions, 13 deletions
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<CCodec_RLScanlineDecoder> pRLScanlineDecoder(
- new CCodec_RLScanlineDecoder);
- if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
- bpc)) {
+std::unique_ptr<CCodec_ScanlineDecoder>
+CCodec_BasicModule::CreateRunLengthDecoder(const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ int bpc) {
+ auto pDecoder = pdfium::MakeUnique<CCodec_RLScanlineDecoder>();
+ if (!pDecoder->Create(src_buf, src_size, width, height, nComps, bpc))
return nullptr;
- }
- return pRLScanlineDecoder.release();
+ return std::move(pDecoder);
}