From 0bb1333a9eff1190ddd68f34c71d6a779c69dfef Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Mar 2017 16:12:02 -0400 Subject: Add some calls to MakeUnique This CL replaces some new's with pdfium::MakeUnique. Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb Reviewed-on: https://pdfium-review.googlesource.com/3430 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fxcodec/jbig2/JBig2_GrdProc.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/fxcodec/jbig2/JBig2_GrdProc.cpp') diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index d5d4c6d0dc..675de9bcdd 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -12,6 +12,7 @@ #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcodec/jbig2/JBig2_BitStream.h" #include "core/fxcodec/jbig2/JBig2_Image.h" +#include "third_party/base/ptr_util.h" CJBig2_GRDProc::CJBig2_GRDProc() : m_loopIndex(0), @@ -65,7 +66,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); if (!GBREG->m_pData) return nullptr; @@ -164,7 +165,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); GBREG->fill(0); for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -214,7 +215,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); if (!GBREG->m_pData) return nullptr; @@ -312,7 +313,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); GBREG->fill(0); for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -360,7 +361,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); if (!GBREG->m_pData) return nullptr; @@ -458,7 +459,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); GBREG->fill(0); for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -504,7 +505,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); if (!GBREG->m_pData) return nullptr; @@ -590,7 +591,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; - std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + auto GBREG = pdfium::MakeUnique(GBW, GBH); GBREG->fill(0); for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { -- cgit v1.2.3