From aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 24 Dec 2015 19:13:32 -0800 Subject: Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr. TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1547833002 . (cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8) Review URL: https://codereview.chromium.org/1545183002 . --- core/src/fxcodec/codec/codec_int.h | 7 +- core/src/fxcodec/codec/fx_codec.cpp | 2 +- core/src/fxcodec/codec/fx_codec_flate.cpp | 10 ++- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 2 +- core/src/fxcodec/jbig2/JBig2_Context.cpp | 80 +++++++++---------- core/src/fxcodec/jbig2/JBig2_Context.h | 12 +-- core/src/fxcodec/jbig2/JBig2_GrdProc.cpp | 19 ++--- core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp | 11 +-- core/src/fxcodec/jbig2/JBig2_GsidProc.cpp | 13 +-- core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp | 13 +-- core/src/fxcodec/jbig2/JBig2_PddProc.cpp | 11 +-- core/src/fxcodec/jbig2/JBig2_SddProc.cpp | 118 +++++++++++++--------------- core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp | 4 +- core/src/fxcodec/jbig2/JBig2_SymbolDict.h | 4 +- core/src/fxcodec/jbig2/JBig2_TrdProc.cpp | 15 ++-- 15 files changed, 162 insertions(+), 159 deletions(-) (limited to 'core/src/fxcodec') diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index 2950cfe2ae..707088e1a9 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -8,12 +8,13 @@ #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ #include + #include #include +#include #include "core/include/fxcodec/fx_codec.h" #include "core/src/fxcodec/jbig2/JBig2_Context.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. class CFX_IccProfileCache; @@ -78,7 +79,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { const int m_Height; const FX_DWORD m_Pitch; int m_nCachedLines; - nonstd::unique_ptr m_Data; + std::unique_ptr m_Data; }; virtual FX_BOOL v_Rewind() = 0; @@ -98,7 +99,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { FX_BOOL m_bColorTransformed; int m_NextLine; uint8_t* m_pLastScanline; - nonstd::unique_ptr m_pDataCache; + std::unique_ptr m_pDataCache; }; class CCodec_FaxModule : public ICodec_FaxModule { diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index f856f43958..82a6ae67da 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -141,7 +141,7 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) { return; } - nonstd::unique_ptr cache( + std::unique_ptr cache( new ImageDataCache(m_OutputWidth, m_OutputHeight, m_Pitch)); if (!cache->AllocateCache()) return; diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index b293781318..17f20da1de 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -5,9 +5,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "codec_int.h" + +#include + #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcodec/fx_codec_flate.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/zlib_v128/zlib.h" extern "C" { @@ -639,7 +641,7 @@ void FlateUncompress(const uint8_t* src_buf, if (!context) return; - nonstd::unique_ptr guess_buf( + std::unique_ptr guess_buf( FX_Alloc(uint8_t, guess_size + 1)); guess_buf.get()[guess_size] = '\0'; @@ -933,7 +935,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, } if (bLZW) { { - nonstd::unique_ptr decoder(new CLZWDecoder); + std::unique_ptr decoder(new CLZWDecoder); dest_size = (FX_DWORD)-1; offset = src_size; int err = decoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange); @@ -942,7 +944,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, } } { - nonstd::unique_ptr decoder(new CLZWDecoder); + std::unique_ptr decoder(new CLZWDecoder); dest_buf = FX_Alloc(uint8_t, dest_size + 1); dest_buf[dest_size] = '\0'; decoder->Decode(dest_buf, dest_size, src_buf, offset, bEarlyChange); diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index d3276450c9..c185d224f0 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -865,7 +865,7 @@ CCodec_JpxModule::~CCodec_JpxModule() { CJPX_Decoder* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, CPDF_ColorSpace* cs) { - nonstd::unique_ptr decoder(new CJPX_Decoder(cs)); + std::unique_ptr decoder(new CJPX_Decoder(cs)); return decoder->Init(src_buf, src_size) ? decoder.release() : nullptr; } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 9503fed95e..566b84e54d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -138,7 +138,7 @@ int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { int32_t nRet; while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { - nonstd::unique_ptr pSegment(new CJBig2_Segment); + std::unique_ptr pSegment(new CJBig2_Segment); nRet = parseSegmentHeader(pSegment.get()); if (nRet != JBIG2_SUCCESS) { return nRet; @@ -377,7 +377,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, return parseGenericRefinementRegion(pSegment); case 48: { FX_WORD wTemp; - nonstd::unique_ptr pPageInfo(new JBig2PageInfo); + std::unique_ptr pPageInfo(new JBig2PageInfo); if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 || m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 || m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 || @@ -436,7 +436,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, if (m_pStream->readShortInteger(&wFlags) != 0) return JBIG2_ERROR_TOO_SHORT; - nonstd::unique_ptr pSymbolDictDecoder(new CJBig2_SDDProc); + std::unique_ptr pSymbolDictDecoder(new CJBig2_SDDProc); pSymbolDictDecoder->SDHUFF = wFlags & 0x0001; pSymbolDictDecoder->SDREFAGG = (wFlags >> 1) & 0x0001; pSymbolDictDecoder->SDTEMPLATE = (wFlags >> 10) & 0x0003; @@ -482,7 +482,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } } - nonstd::unique_ptr SDINSYMS; + std::unique_ptr SDINSYMS; if (pSymbolDictDecoder->SDNUMINSYMS != 0) { SDINSYMS.reset(FX_Alloc(CJBig2_Image*, pSymbolDictDecoder->SDNUMINSYMS)); FX_DWORD dwTemp = 0; @@ -499,11 +499,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } pSymbolDictDecoder->SDINSYMS = SDINSYMS.get(); - nonstd::unique_ptr Table_B1; - nonstd::unique_ptr Table_B2; - nonstd::unique_ptr Table_B3; - nonstd::unique_ptr Table_B4; - nonstd::unique_ptr Table_B5; + std::unique_ptr Table_B1; + std::unique_ptr Table_B2; + std::unique_ptr Table_B3; + std::unique_ptr Table_B4; + std::unique_ptr Table_B5; if (pSymbolDictDecoder->SDHUFF == 1) { if (cSDHUFFDH == 2 || cSDHUFFDW == 2) return JBIG2_ERROR_FATAL; @@ -607,7 +607,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, for (auto it = m_pSymbolDictCache->begin(); it != m_pSymbolDictCache->end(); ++it) { if (it->first == key) { - nonstd::unique_ptr copy(it->second->DeepCopy()); + std::unique_ptr copy(it->second->DeepCopy()); pSegment->m_Result.sd = copy.release(); m_pSymbolDictCache->push_front(*it); m_pSymbolDictCache->erase(it); @@ -618,7 +618,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } if (!cache_hit) { if (bUseGbContext) { - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.sd = pSymbolDictDecoder->decode_Arith( pArithDecoder.get(), &gbContext, &grContext); @@ -635,7 +635,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, m_pStream->alignByte(); } if (m_bIsGlobal && kSymbolDictCacheMaxSize > 0) { - nonstd::unique_ptr value = + std::unique_ptr value = pSegment->m_Result.sd->DeepCopy(); while (m_pSymbolDictCache->size() >= kSymbolDictCacheMaxSize) { delete m_pSymbolDictCache->back().second; @@ -661,7 +661,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { return JBIG2_ERROR_TOO_SHORT; } - nonstd::unique_ptr pTRD(new CJBig2_TRDProc); + std::unique_ptr pTRD(new CJBig2_TRDProc); pTRD->SBW = ri.width; pTRD->SBH = ri.height; pTRD->SBHUFF = wFlags & 0x0001; @@ -722,7 +722,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } } - nonstd::unique_ptr SBSYMS; + std::unique_ptr SBSYMS; if (pTRD->SBNUMSYMS > 0) { SBSYMS.reset(FX_Alloc(CJBig2_Image*, pTRD->SBNUMSYMS)); dwTemp = 0; @@ -741,7 +741,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMS = NULL; } - nonstd::unique_ptr SBSYMCODES; + std::unique_ptr SBSYMCODES; if (pTRD->SBHUFF == 1) { SBSYMCODES.reset( decodeSymbolIDHuffmanTable(m_pStream.get(), pTRD->SBNUMSYMS)); @@ -758,17 +758,17 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } - nonstd::unique_ptr Table_B1; - nonstd::unique_ptr Table_B6; - nonstd::unique_ptr Table_B7; - nonstd::unique_ptr Table_B8; - nonstd::unique_ptr Table_B9; - nonstd::unique_ptr Table_B10; - nonstd::unique_ptr Table_B11; - nonstd::unique_ptr Table_B12; - nonstd::unique_ptr Table_B13; - nonstd::unique_ptr Table_B14; - nonstd::unique_ptr Table_B15; + std::unique_ptr Table_B1; + std::unique_ptr Table_B6; + std::unique_ptr Table_B7; + std::unique_ptr Table_B8; + std::unique_ptr Table_B9; + std::unique_ptr Table_B10; + std::unique_ptr Table_B11; + std::unique_ptr Table_B12; + std::unique_ptr Table_B13; + std::unique_ptr Table_B14; + std::unique_ptr Table_B15; if (pTRD->SBHUFF == 1) { if (cSBHUFFFS == 2 || cSBHUFFRDW == 2 || cSBHUFFRDH == 2 || cSBHUFFRDX == 2 || cSBHUFFRDY == 2) { @@ -929,14 +929,14 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRSIZE = pSeg->m_Result.ht; } } - nonstd::unique_ptr grContext; + std::unique_ptr grContext; if (pTRD->SBREFINE == 1) { const size_t size = GetRefAggContextSize(pTRD->SBRTEMPLATE); grContext.reset(FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); } if (pTRD->SBHUFF == 0) { - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Result.im = @@ -972,7 +972,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, IFX_Pause* pPause) { uint8_t cFlags; - nonstd::unique_ptr pPDD(new CJBig2_PDDProc); + std::unique_ptr pPDD(new CJBig2_PDDProc); if (m_pStream->read1Byte(&cFlags) != 0 || m_pStream->read1Byte(&pPDD->HDPW) != 0 || m_pStream->read1Byte(&pPDD->HDPH) != 0 || @@ -987,10 +987,10 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, pSegment->m_nResultType = JBIG2_PATTERN_DICT_POINTER; if (pPDD->HDMMR == 0) { const size_t size = GetHuffContextSize(pPDD->HDTEMPLATE); - nonstd::unique_ptr gbContext( + std::unique_ptr gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.pd = pPDD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); @@ -1012,7 +1012,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause) { uint8_t cFlags; JBig2RegionInfo ri; - nonstd::unique_ptr pHRD(new CJBig2_HTRDProc); + std::unique_ptr pHRD(new CJBig2_HTRDProc); if (parseRegionInfo(&ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0 || m_pStream->readInteger(&pHRD->HGW) != 0 || @@ -1053,10 +1053,10 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, pSegment->m_nResultType = JBIG2_IMAGE_POINTER; if (pHRD->HMMR == 0) { const size_t size = GetHuffContextSize(pHRD->HTEMPLATE); - nonstd::unique_ptr gbContext( + std::unique_ptr gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.im = pHRD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); @@ -1090,7 +1090,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause) { if (!m_pGRD) { - nonstd::unique_ptr pGRD(new CJBig2_GRDProc); + std::unique_ptr pGRD(new CJBig2_GRDProc); uint8_t cFlags; if (parseRegionInfo(&m_ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0) { @@ -1203,7 +1203,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { m_pStream->read1Byte(&cFlags) != 0) { return JBIG2_ERROR_TOO_SHORT; } - nonstd::unique_ptr pGRRD(new CJBig2_GRRDProc); + std::unique_ptr pGRRD(new CJBig2_GRRDProc); pGRRD->GRW = ri.width; pGRRD->GRH = ri.height; pGRRD->GRTEMPLATE = cFlags & 0x01; @@ -1237,10 +1237,10 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { pGRRD->GRREFERENCEDX = 0; pGRRD->GRREFERENCEDY = 0; const size_t size = GetRefAggContextSize(pGRRD->GRTEMPLATE); - nonstd::unique_ptr grContext( + std::unique_ptr grContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Result.im = pGRRD->decode(pArithDecoder.get(), grContext.get()); @@ -1268,7 +1268,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER; pSegment->m_Result.ht = nullptr; - nonstd::unique_ptr pHuff( + std::unique_ptr pHuff( new CJBig2_HuffmanTable(m_pStream.get())); if (!pHuff->IsOK()) return JBIG2_ERROR_FATAL; @@ -1301,7 +1301,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( } huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); - nonstd::unique_ptr SBSYMCODES( + std::unique_ptr SBSYMCODES( FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); int32_t run; int32_t i = 0; diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index 1b8b391f9d..dd63bcd1b0 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -8,6 +8,7 @@ #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ #include +#include #include #include "JBig2_List.h" @@ -15,7 +16,6 @@ #include "JBig2_Segment.h" #include "core/include/fpdfapi/fpdf_objects.h" #include "core/include/fxcodec/fx_codec_def.h" -#include "third_party/base/nonstd_unique_ptr.h" class CJBig2_ArithDecoder; class CJBig2_GRDProc; @@ -110,20 +110,20 @@ class CJBig2_Context { private: CJBig2_Context* m_pGlobalContext; - nonstd::unique_ptr m_pStream; + std::unique_ptr m_pStream; CJBig2_List m_SegmentList; CJBig2_List m_PageInfoList; - nonstd::unique_ptr m_pPage; + std::unique_ptr m_pPage; size_t m_nSegmentDecoded; bool m_bInPage; bool m_bBufSpecified; int32_t m_PauseStep; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProcessingStatus; - nonstd::unique_ptr m_pArithDecoder; - nonstd::unique_ptr m_pGRD; + std::unique_ptr m_pArithDecoder; + std::unique_ptr m_pGRD; JBig2ArithCtx* m_gbContext; - nonstd::unique_ptr m_pSegment; + std::unique_ptr m_pSegment; FX_DWORD m_dwOffset; JBig2RegionInfo m_ri; std::list* const m_pSymbolDictCache; diff --git a/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp index fc654c0da8..803e4a70d4 100644 --- a/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -6,11 +6,12 @@ #include "JBig2_GrdProc.h" +#include + #include "JBig2_ArithDecoder.h" #include "JBig2_BitStream.h" #include "JBig2_Image.h" #include "core/include/fxcodec/fx_codec.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_GRDProc::CJBig2_GRDProc() : m_loopIndex(0), @@ -71,7 +72,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -158,7 +159,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -209,7 +210,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -295,7 +296,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -343,7 +344,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -429,7 +430,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -476,7 +477,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -548,7 +549,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2; LTP = 0; - nonstd::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { diff --git a/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp index 549669a72f..e1c5e19fa6 100644 --- a/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -6,10 +6,11 @@ #include "JBig2_GrrdProc.h" +#include + #include "JBig2_ArithDecoder.h" #include "JBig2_BitStream.h" #include "JBig2_Image.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { @@ -37,7 +38,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - nonstd::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -162,7 +163,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - nonstd::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); if (!GRREG->m_pData) return nullptr; @@ -289,7 +290,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - nonstd::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -400,7 +401,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - nonstd::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr GRREG(new CJBig2_Image(GRW, GRH)); if (!GRREG->m_pData) return nullptr; diff --git a/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp b/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp index 53af1fd16e..5871efb16d 100644 --- a/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp @@ -6,17 +6,18 @@ #include "JBig2_GsidProc.h" +#include + #include "JBig2_BitStream.h" #include "JBig2_GrdProc.h" #include "JBig2_Image.h" #include "JBig2_List.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; @@ -55,7 +56,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (i < GSBPP - 1) pImage->composeFrom(0, 0, GSPLANES.get(i + 1), JBIG2_COMPOSE_XOR); } - nonstd::unique_ptr GSVALS( + std::unique_ptr GSVALS( FX_Alloc2D(FX_DWORD, GSW, GSH)); JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); for (FX_DWORD y = 0; y < GSH; ++y) { @@ -70,12 +71,12 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; - nonstd::unique_ptr GSPLANES(FX_Alloc(CJBig2_Image*, GSBPP)); + std::unique_ptr GSPLANES(FX_Alloc(CJBig2_Image*, GSBPP)); JBIG2_memset(GSPLANES.get(), 0, sizeof(CJBig2_Image*) * GSBPP); FXCODEC_STATUS status = pGRD->Start_decode_MMR(&GSPLANES.get()[GSBPP - 1], pStream, nullptr); @@ -106,7 +107,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, JBIG2_COMPOSE_XOR); J = J - 1; } - nonstd::unique_ptr GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); + std::unique_ptr GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); for (FX_DWORD y = 0; y < GSH; ++y) { for (FX_DWORD x = 0; x < GSW; ++x) { diff --git a/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp index 127ef0333c..377af58dfa 100644 --- a/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -6,9 +6,10 @@ #include "JBig2_HtrdProc.h" +#include + #include "JBig2_GsidProc.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -17,8 +18,8 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, int32_t x, y; FX_DWORD HBPP; FX_DWORD* GI; - nonstd::unique_ptr HSKIP; - nonstd::unique_ptr HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr HSKIP; + std::unique_ptr HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); if (HENABLESKIP == 1) { HSKIP.reset(new CJBig2_Image(HGW, HGH)); @@ -39,7 +40,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - nonstd::unique_ptr pGID(new CJBig2_GSIDProc()); + std::unique_ptr pGID(new CJBig2_GSIDProc()); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; @@ -71,13 +72,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, FX_DWORD ng, mg; int32_t x, y; FX_DWORD* GI; - nonstd::unique_ptr HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); FX_DWORD HBPP = 1; while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - nonstd::unique_ptr pGID(new CJBig2_GSIDProc()); + std::unique_ptr pGID(new CJBig2_GSIDProc()); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; diff --git a/core/src/fxcodec/jbig2/JBig2_PddProc.cpp b/core/src/fxcodec/jbig2/JBig2_PddProc.cpp index fbe9e4b17f..179077466c 100644 --- a/core/src/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_PddProc.cpp @@ -6,10 +6,11 @@ #include "JBig2_PddProc.h" +#include + #include "JBig2_GrdProc.h" #include "JBig2_Image.h" #include "JBig2_PatternDict.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, @@ -17,12 +18,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = nullptr; - nonstd::unique_ptr pDict(new CJBig2_PatternDict()); + std::unique_ptr pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; @@ -60,12 +61,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = nullptr; - nonstd::unique_ptr pDict(new CJBig2_PatternDict()); + std::unique_ptr pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; diff --git a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp index e9ce932d91..faa70621ab 100644 --- a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp @@ -6,6 +6,7 @@ #include "core/src/fxcodec/jbig2/JBig2_SddProc.h" +#include #include #include "core/include/fxcrt/fx_basic.h" @@ -17,7 +18,6 @@ #include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h" #include "core/src/fxcodec/jbig2/JBig2_SymbolDict.h" #include "core/src/fxcodec/jbig2/JBig2_TrdProc.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, @@ -39,21 +39,21 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( uint8_t SBSYMCODELEN; int32_t RDXI, RDYI; CJBig2_Image** SBSYMS; - nonstd::unique_ptr IAID; - nonstd::unique_ptr pDict; - nonstd::unique_ptr IADH(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IADW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IAAI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IARDX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IARDY(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IAEX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IADT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IAFS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IADS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IAIT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IARI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IARDW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr IARDH(new CJBig2_ArithIntDecoder); + std::unique_ptr IAID; + std::unique_ptr pDict; + std::unique_ptr IADH(new CJBig2_ArithIntDecoder); + std::unique_ptr IADW(new CJBig2_ArithIntDecoder); + std::unique_ptr IAAI(new CJBig2_ArithIntDecoder); + std::unique_ptr IARDX(new CJBig2_ArithIntDecoder); + std::unique_ptr IARDY(new CJBig2_ArithIntDecoder); + std::unique_ptr IAEX(new CJBig2_ArithIntDecoder); + std::unique_ptr IADT(new CJBig2_ArithIntDecoder); + std::unique_ptr IAFS(new CJBig2_ArithIntDecoder); + std::unique_ptr IADS(new CJBig2_ArithIntDecoder); + std::unique_ptr IAIT(new CJBig2_ArithIntDecoder); + std::unique_ptr IARI(new CJBig2_ArithIntDecoder); + std::unique_ptr IARDW(new CJBig2_ArithIntDecoder); + std::unique_ptr IARDH(new CJBig2_ArithIntDecoder); nTmp = 0; while ((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp++; @@ -92,7 +92,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } TOTWIDTH = TOTWIDTH + SYMWIDTH; if (SDREFAGG == 0) { - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = 0; pGRD->GBW = SYMWIDTH; pGRD->GBH = HCHEIGHT; @@ -114,7 +114,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } else { IAAI->decode(pArithDecoder, (int*)&REFAGGNINST); if (REFAGGNINST > 1) { - nonstd::unique_ptr pDecoder(new CJBig2_TRDProc()); + std::unique_ptr pDecoder(new CJBig2_TRDProc()); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -139,35 +139,32 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( pDecoder->TRANSPOSED = 0; pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT; pDecoder->SBDSOFFSET = 0; - nonstd::unique_ptr SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr SBHUFFRDW( + std::unique_ptr SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDH( + std::unique_ptr SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDX( + std::unique_ptr SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDY( + std::unique_ptr SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRSIZE( + std::unique_ptr SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -218,7 +215,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( FX_Free(SBSYMS); goto failed; } - nonstd::unique_ptr pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -315,7 +312,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image** SBSYMS; - nonstd::unique_ptr pHuffmanDecoder( + std::unique_ptr pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*)); @@ -325,8 +322,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SDNEWSYMWIDTHS = FX_Alloc(FX_DWORD, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(FX_DWORD)); } - nonstd::unique_ptr pDict(new CJBig2_SymbolDict()); - nonstd::unique_ptr pTable; + std::unique_ptr pDict(new CJBig2_SymbolDict()); + std::unique_ptr pTable; HCHEIGHT = 0; NSYMSDECODED = 0; @@ -370,7 +367,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } BS = nullptr; if (REFAGGNINST > 1) { - nonstd::unique_ptr pDecoder(new CJBig2_TRDProc()); + std::unique_ptr pDecoder(new CJBig2_TRDProc()); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -399,35 +396,32 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( pDecoder->TRANSPOSED = 0; pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT; pDecoder->SBDSOFFSET = 0; - nonstd::unique_ptr SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr SBHUFFRDW( + std::unique_ptr SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDH( + std::unique_ptr SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDX( + std::unique_ptr SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRDY( + std::unique_ptr SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRSIZE( + std::unique_ptr SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -483,11 +477,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } } FX_Free(SBSYMCODES); - nonstd::unique_ptr SBHUFFRDX( + std::unique_ptr SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr SBHUFFRSIZE( + std::unique_ptr SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -502,7 +496,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); - nonstd::unique_ptr pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -514,7 +508,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( pGRRD->GRAT[1] = SDRAT[1]; pGRRD->GRAT[2] = SDRAT[2]; pGRRD->GRAT[3] = SDRAT[3]; - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(pStream)); BS = pGRRD->decode(pArithDecoder.get(), grContext->data()); if (!BS) { @@ -555,7 +549,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( goto failed; } } else { - nonstd::unique_ptr pGRD(new CJBig2_GRDProc()); + std::unique_ptr pGRD(new CJBig2_GRDProc()); pGRD->MMR = 1; pGRD->GBW = TOTWIDTH; pGRD->GBH = HCHEIGHT; diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp index b1e56c0061..1e949c5d26 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp @@ -15,9 +15,9 @@ CJBig2_SymbolDict::CJBig2_SymbolDict() { CJBig2_SymbolDict::~CJBig2_SymbolDict() { } -nonstd::unique_ptr CJBig2_SymbolDict::DeepCopy() const { +std::unique_ptr CJBig2_SymbolDict::DeepCopy() const { const CJBig2_SymbolDict* src = this; - nonstd::unique_ptr dst(new CJBig2_SymbolDict); + std::unique_ptr dst(new CJBig2_SymbolDict); for (size_t i = 0; i < src->m_SDEXSYMS.size(); ++i) { CJBig2_Image* image = src->m_SDEXSYMS.get(i); dst->m_SDEXSYMS.push_back(image ? new CJBig2_Image(*image) : nullptr); diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h index 5c7fe3c479..6f6b303640 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h @@ -7,12 +7,12 @@ #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ #define CORE_SRC_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ +#include #include #include "JBig2_ArithDecoder.h" #include "JBig2_List.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" class CJBig2_Image; @@ -21,7 +21,7 @@ class CJBig2_SymbolDict { CJBig2_SymbolDict(); ~CJBig2_SymbolDict(); - nonstd::unique_ptr DeepCopy() const; + std::unique_ptr DeepCopy() const; // Takes ownership of |image|. void AddImage(CJBig2_Image* image) { m_SDEXSYMS.push_back(image); } diff --git a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp index d76beea8e2..e3fd47894e 100644 --- a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -6,11 +6,12 @@ #include "JBig2_TrdProc.h" +#include + #include "JBig2_ArithDecoder.h" #include "JBig2_ArithIntDecoder.h" #include "JBig2_GrrdProc.h" #include "JBig2_HuffmanDecoder.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, JBig2ArithCtx* grContext) { @@ -28,9 +29,9 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, FX_BOOL bFirst; FX_DWORD nTmp; int32_t nVal, nBits; - nonstd::unique_ptr pHuffmanDecoder( + std::unique_ptr pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); - nonstd::unique_ptr SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr SBREG(new CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) return nullptr; @@ -123,7 +124,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) return nullptr; - nonstd::unique_ptr pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; @@ -137,7 +138,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, pGRRD->GRAT[3] = SBRAT[3]; { - nonstd::unique_ptr pArithDecoder( + std::unique_ptr pArithDecoder( new CJBig2_ArithDecoder(pStream)); IBI = pGRRD->decode(pArithDecoder.get(), grContext); if (!IBI) @@ -255,7 +256,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, IAID = new CJBig2_ArithIaidDecoder(SBSYMCODELEN); bRetained = FALSE; } - nonstd::unique_ptr SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr SBREG(new CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); IADT->decode(pArithDecoder, &STRIPT); STRIPT *= SBSTRIPS; @@ -312,7 +313,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { goto failed; } - nonstd::unique_ptr pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; -- cgit v1.2.3