summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-14 05:57:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-14 05:57:10 -0800
commita9caab94c1f16929e5acf2676117224617d80f53 (patch)
treed71ff9a82fae6e6080deb76375f43056127b3ee2 /core/fxcodec/codec
parent992ecf7c189e5cabf43e5ad862511cf63d030966 (diff)
downloadpdfium-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.cpp7
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;