Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2413)

Unified Diff: core/fxcodec/jbig2/JBig2_SddProc.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcodec/jbig2/JBig2_HtrdProc.cpp ('k') | core/fxcodec/jbig2/JBig2_TrdProc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/jbig2/JBig2_SddProc.cpp
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp
index 7e9ace204696c4db7228dc3500b1b8a1aaf925e7..d27ff680d5205c38e86cd2c5a51ba07140f7957b 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) {
« no previous file with comments | « core/fxcodec/jbig2/JBig2_HtrdProc.cpp ('k') | core/fxcodec/jbig2/JBig2_TrdProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698