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/fxcodec/codec | |
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/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/fx_codec_jbig.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 8d20894231..926541f07d 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -14,6 +14,7 @@ #include "core/fxcodec/jbig2/JBig2_Context.h" #include "core/fxcodec/jbig2/JBig2_Image.h" #include "core/fxcrt/fx_memory.h" +#include "third_party/base/ptr_util.h" JBig2_DocumentContext::JBig2_DocumentContext() {} @@ -22,7 +23,7 @@ JBig2_DocumentContext::~JBig2_DocumentContext() {} JBig2_DocumentContext* GetJBig2DocumentContext( std::unique_ptr<JBig2_DocumentContext>* pContextHolder) { if (!pContextHolder->get()) - pContextHolder->reset(new JBig2_DocumentContext()); + *pContextHolder = pdfium::MakeUnique<JBig2_DocumentContext>(); return pContextHolder->get(); } @@ -62,9 +63,9 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( pJbig2Context->m_dest_pitch = dest_pitch; pJbig2Context->m_pPause = pPause; FXSYS_memset(dest_buf, 0, height * dest_pitch); - pJbig2Context->m_pContext.reset(new CJBig2_Context( + pJbig2Context->m_pContext = pdfium::MakeUnique<CJBig2_Context>( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), - pPause, false)); + pPause, false); if (!pJbig2Context->m_pContext) return FXCODEC_STATUS_ERROR; |