diff options
author | Nicolas Pena <npm@chromium.org> | 2017-07-13 10:06:15 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-13 14:29:34 +0000 |
commit | 17453d03c3bdd18a893ae86058a6184939aee026 (patch) | |
tree | 2a87278c98e851744f20cd9aaa1460f849ef097e /core/fxcodec/jbig2/JBig2_PddProc.cpp | |
parent | 360d1fce569b57aa2c487f6e171ba19b9dc8885e (diff) | |
download | pdfium-17453d03c3bdd18a893ae86058a6184939aee026.tar.xz |
More unique_ptrs in JBig2 code
This CL makes CJBig2_Segment own the results: symbol, pattern, huffman,
and huffman. This causes a lot more unique_ptr usage in JBig2 code.
Change-Id: I1f0a5bfaaf85053658b467bef5325c72d1f496c7
Reviewed-on: https://pdfium-review.googlesource.com/7690
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_PddProc.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_PddProc.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index 040ee6666b..7a44dc7e39 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -13,12 +13,12 @@ #include "core/fxcodec/jbig2/JBig2_PatternDict.h" #include "third_party/base/ptr_util.h" -CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( +std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { uint32_t GRAY; - CJBig2_Image* BHDC = nullptr; + std::unique_ptr<CJBig2_Image> BHDC; auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>(); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); @@ -53,13 +53,13 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( pDict->HDPATS[GRAY] = BHDC->subImage(HDPW * GRAY, 0, HDPW, HDPH); GRAY = GRAY + 1; } - delete BHDC; - return pDict.release(); + return pDict; } -CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream) { +std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_MMR( + CJBig2_BitStream* pStream) { uint32_t GRAY; - CJBig2_Image* BHDC = nullptr; + std::unique_ptr<CJBig2_Image> BHDC; auto pDict = pdfium::MakeUnique<CJBig2_PatternDict>(); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); @@ -78,6 +78,5 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream) { pDict->HDPATS[GRAY] = BHDC->subImage(HDPW * GRAY, 0, HDPW, HDPH); GRAY = GRAY + 1; } - delete BHDC; - return pDict.release(); + return pDict; } |