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/jbig2/JBig2_Context.cpp | 80 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'core/src/fxcodec/jbig2/JBig2_Context.cpp') 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; -- cgit v1.2.3