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/jbig2/JBig2_SddProc.cpp | |
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/jbig2/JBig2_SddProc.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index 7e9ace2046..d27ff680d5 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -18,6 +18,7 @@ #include "core/fxcodec/jbig2/JBig2_SymbolDict.h" #include "core/fxcodec/jbig2/JBig2_TrdProc.h" #include "core/fxcrt/fx_basic.h" +#include "third_party/base/ptr_util.h" CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, @@ -59,7 +60,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( while ((uint32_t)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp++; } - IAID.reset(new CJBig2_ArithIaidDecoder((uint8_t)nTmp)); + IAID = pdfium::MakeUnique<CJBig2_ArithIaidDecoder>((uint8_t)nTmp); SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*)); @@ -258,7 +259,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( goto failed; } - pDict.reset(new CJBig2_SymbolDict); + pDict = pdfium::MakeUnique<CJBig2_SymbolDict>(); I = J = 0; for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) { if (EXFLAGS[I] && J < SDNUMEXSYMS) { @@ -562,8 +563,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } EXINDEX = 0; CUREXFLAG = 0; - pTable.reset(new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size, - HuffmanTable_HTOOB_B1)); + pTable = pdfium::MakeUnique<CJBig2_HuffmanTable>( + HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1); EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS); num_ex_syms = 0; while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { |