diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-24 19:13:32 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-24 19:13:32 -0800 |
commit | aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776 (patch) | |
tree | a5a435608eb527db39e2c9324737bd230e762030 /core/src | |
parent | 25ae22692cdd5b4ae4783ecb27eba79b3c794b2c (diff) | |
download | pdfium-aa8bf7e42b8c73a9bc07ed6781364ba05f5a9776.tar.xz |
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 .
Diffstat (limited to 'core/src')
31 files changed, 220 insertions, 218 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 9c96a3027c..e1c39fbb16 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -846,7 +846,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { } CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; pBaseDict->SetAtName("Type", "Font"); - nonstd::unique_ptr<CFX_UnicodeEncoding> pEncoding( + std::unique_ptr<CFX_UnicodeEncoding> pEncoding( new CFX_UnicodeEncoding(pFont)); CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index a3de6f2777..003825b898 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -1700,7 +1700,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { if (!pStream) return nullptr; - nonstd::unique_ptr<CPDF_Type3Char> pNewChar(new CPDF_Type3Char(new CPDF_Form( + std::unique_ptr<CPDF_Type3Char> pNewChar(new CPDF_Type3Char(new CPDF_Form( m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, nullptr))); diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index b10aa6952a..09930bee2d 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -6,9 +6,10 @@ #include "ttgsubtable.h" +#include <memory> + #include "core/include/fxge/fx_freetype.h" #include "core/include/fxge/fx_ge.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/stl_util.h" CFX_GlyphMap::CFX_GlyphMap() {} @@ -405,7 +406,7 @@ IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, pFont->GetSubData(), NULL); if (!error && pFont->GetSubData()) { - nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); + std::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { return pGsubTable.release(); } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 118f1cd5a3..15222fc594 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -8,12 +8,12 @@ #include <limits.h> +#include <memory> #include <vector> #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fxcrt/fx_safe_types.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/numerics/safe_conversions_impl.h" class CPDF_PSEngine; @@ -768,7 +768,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (pSub == pObj) { return FALSE; } - nonstd::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); + std::unique_ptr<CPDF_Function> pFunc(CPDF_Function::Load(pSub)); if (!pFunc) { return FALSE; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 02ac27ac0f..1c4cc24208 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -92,7 +92,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { } CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1, m_pSyntax->GetWordSize() - 1); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( m_pSyntax->ReadNextObject()); if (!key.IsEmpty()) { FX_DWORD dwObjNum = pObj ? pObj->GetObjNum() : 0; diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index d5a035fe2b..f41a987e34 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -8,10 +8,10 @@ #define CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ #include <map> +#include <memory> #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "third_party/base/nonstd_unique_ptr.h" class CPDF_AllStates; class CPDF_ParseOptions; @@ -319,7 +319,7 @@ class CPDF_StreamContentParser { FX_DWORD m_ParamStartPos; FX_DWORD m_ParamCount; CPDF_StreamParser* m_pSyntax; - nonstd::unique_ptr<CPDF_AllStates> m_pCurStates; + std::unique_ptr<CPDF_AllStates> m_pCurStates; CPDF_ContentMark m_CurContentMark; CFX_ArrayTemplate<CPDF_TextObject*> m_ClipTextList; CPDF_TextObject* m_pLastTextObject; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 05f407bfd3..1115a1e560 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -6,6 +6,7 @@ #include "parser_int.h" +#include <memory> #include <set> #include <utility> #include <vector> @@ -16,7 +17,6 @@ #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/src/fpdfapi/fpdf_page/pageint.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "third_party/base/stl_util.h" namespace { @@ -94,7 +94,7 @@ bool CanReadFromBitStream(const CFX_BitStream* hStream, // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal. // Come up or wait for something better. using ScopedFileStream = - nonstd::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; + std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) { CPDF_Object* pType = pDict->GetElementValue("Type"); @@ -307,7 +307,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { if (!m_pSecurityHandler->OnInit(this, m_pEncryptDict)) { return err; } - nonstd::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( + std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( m_pSecurityHandler->CreateCryptoHandler()); if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) { return PDFPARSE_ERROR_HANDLER; @@ -315,7 +315,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { m_Syntax.SetEncrypt(pCryptoHandler.release()); } else if (m_pEncryptDict) { CFX_ByteString filter = m_pEncryptDict->GetString("Filter"); - nonstd::unique_ptr<CPDF_SecurityHandler> pSecurityHandler; + std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler; FX_DWORD err = PDFPARSE_ERROR_HANDLER; if (filter == "Standard") { pSecurityHandler.reset(FPDF_CreateStandardSecurityHandler()); @@ -328,7 +328,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() { return err; } m_pSecurityHandler = std::move(pSecurityHandler); - nonstd::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( + std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler( m_pSecurityHandler->CreateCryptoHandler()); if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get())) { return PDFPARSE_ERROR_HANDLER; @@ -385,7 +385,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) { while (xrefpos) { CrossRefList.InsertAt(0, xrefpos); LoadCrossRefV4(xrefpos, 0, TRUE); - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( LoadTrailerV4()); if (!pDict) return FALSE; @@ -1456,7 +1456,7 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() { if (m_Syntax.GetKeyword() != "trailer") return nullptr; - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( m_Syntax.GetObject(m_pDocument, 0, 0, 0)); if (!ToDictionary(pObj.get())) return nullptr; @@ -2095,7 +2095,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; @@ -2233,7 +2233,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (word == "[") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_ARRAY; - nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( + std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( new CPDF_Array); while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) pArray->Add(pObj); @@ -2251,7 +2251,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (pContext) pContext->m_DictStart = SavedPos; - nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( + std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; @@ -2271,7 +2271,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( continue; key = PDF_NameDecode(key); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj( GetObject(pObjList, objnum, gennum)); if (!obj) { uint8_t ch; @@ -2884,7 +2884,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { std::set<FX_DWORD> m_pageMapCheckState; std::set<FX_DWORD> m_pagesLoadState; - nonstd::unique_ptr<CPDF_HintTables> m_pHintTables; + std::unique_ptr<CPDF_HintTables> m_pHintTables; FX_BOOL m_bSupportHintTable; }; @@ -3599,9 +3599,9 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) { return FALSE; } m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset); - nonstd::unique_ptr<CPDF_HintTables> pHintTables( + std::unique_ptr<CPDF_HintTables> pHintTables( new CPDF_HintTables(this, pDict)); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream( ParseIndirectObjectAt(szHSStart, 0)); CPDF_Stream* pStream = ToStream(pHintStream.get()); if (pStream && pHintTables->LoadHintStream(pStream)) @@ -3981,7 +3981,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) { } ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE)); m_syntaxParser.InitParser(file.get(), 0); - nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer( + std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pTrailer( m_syntaxParser.GetObject(nullptr, 0, 0)); if (!pTrailer) { m_Pos += m_syntaxParser.SavePos(); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp index 3fd8dcf35a..3014ca280e 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp @@ -97,7 +97,7 @@ class CPDF_TestParser : public CPDF_Parser { // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal. // Come up or wait for something better. using ScopedFileStream = - nonstd::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; + std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; TEST(fpdf_parser_parser, ReadHexString) { { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 1c46583e59..6a821ec069 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -650,7 +650,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, return; } - nonstd::unique_ptr<CFX_PathData> pTextClippingPath; + std::unique_ptr<CFX_PathData> pTextClippingPath; for (int i = 0; i < textcount; ++i) { CPDF_TextObject* pText = ClipPath.GetText(i); if (pText) { @@ -811,7 +811,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, int width = FXSYS_round((FX_FLOAT)rect.Width() * scaleX); int height = FXSYS_round((FX_FLOAT)rect.Height() * scaleY); CFX_FxgeDevice bitmap_device; - nonstd::unique_ptr<CFX_DIBitmap> oriDevice; + std::unique_ptr<CFX_DIBitmap> oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { oriDevice.reset(new CFX_DIBitmap); if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height)) @@ -827,7 +827,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, CFX_Matrix new_matrix = *pObj2Device; new_matrix.TranslateI(-rect.left, -rect.top); new_matrix.Scale(scaleX, scaleY); - nonstd::unique_ptr<CFX_DIBitmap> pTextMask; + std::unique_ptr<CFX_DIBitmap> pTextMask; if (bTextClip) { pTextMask.reset(new CFX_DIBitmap); if (!pTextMask->Create(width, height, FXDIB_8bppMask)) @@ -861,7 +861,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix, sizeof smask_matrix); smask_matrix.Concat(*pObj2Device); - nonstd::unique_ptr<CFX_DIBSource> pSMaskSource( + std::unique_ptr<CFX_DIBSource> pSMaskSource( LoadSMask(pSMaskDict, &rect, &smask_matrix)); if (pSMaskSource) bitmap->MultiplyAlpha(pSMaskSource.get()); @@ -896,7 +896,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); int width = FXSYS_round(bbox.Width() * scaleX); int height = FXSYS_round(bbox.Height() * scaleY); - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap); if (bBackAlphaRequired && !m_bDropObjects) pBackdrop->Create(width, height, FXDIB_Argb); else @@ -1190,7 +1190,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { return pTransferCounter->AddRef(); } - nonstd::unique_ptr<CPDF_Function> pFuncs[3]; + std::unique_ptr<CPDF_Function> pFuncs[3]; FX_BOOL bUniTransfer = TRUE; FX_BOOL bIdentity = TRUE; if (CPDF_Array* pArray = pObj->AsArray()) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index d39d30f2a3..640adb14da 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -107,7 +107,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int back_left, back_top; FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop( + std::unique_ptr<CFX_DIBitmap> pBackdrop( GetBackdrop(m_pCurObj, rect, back_left, back_top, blend_mode > FXDIB_BLEND_NORMAL && bIsolated)); if (!pBackdrop) @@ -123,7 +123,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, pDIBitmap, mask_argb, 0, 0, blend_mode); } - nonstd::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap); pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(), FXDIB_Rgb32); pBackdrop1->Clear((FX_DWORD)-1); @@ -760,7 +760,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() { FX_RECT dest_clip( dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); - nonstd::unique_ptr<CFX_DIBitmap> pStretched( + std::unique_ptr<CFX_DIBitmap> pStretched( m_pDIBSource->StretchTo(dest_width, dest_height, m_Flags, &dest_clip)); if (pStretched) { m_pRenderStatus->CompositeDIBitmap(pStretched.get(), dest_rect.left, @@ -785,7 +785,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) { int left, top; - nonstd::unique_ptr<CFX_DIBitmap> pTransformed( + std::unique_ptr<CFX_DIBitmap> pTransformed( pAlphaMask->TransformTo(&m_ImageMatrix, left, top)); if (!pTransformed) return TRUE; @@ -874,7 +874,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (!pGroup) { return NULL; } - nonstd::unique_ptr<CPDF_Function> pFunc; + std::unique_ptr<CPDF_Function> pFunc; CPDF_Object* pFuncObj = pSMaskDict->GetElementValue("TR"); if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) pFunc.reset(CPDF_Function::Load(pFuncObj)); @@ -947,7 +947,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity); status.RenderObjectList(&form, &matrix); - nonstd::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); + std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); if (!pMask->Create(width, height, FXDIB_8bppMask)) return nullptr; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 6bb8033686..c74aea9a21 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -6,6 +6,7 @@ #include "render_int.h" +#include <memory> #include <vector> #include "core/include/fpdfapi/fpdf_module.h" @@ -15,7 +16,6 @@ #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxge/fx_ge.h" #include "core/src/fpdfapi/fpdf_page/pageint.h" -#include "third_party/base/nonstd_unique_ptr.h" namespace { @@ -63,7 +63,7 @@ bool IsAllowedBPCValue(int bpc) { return bpc == 1 || bpc == 2 || bpc == 4 || bpc == 8 || bpc == 16; } -// Wrapper class to use with nonstd::unique_ptr for CJPX_Decoder. +// Wrapper class to use with std::unique_ptr for CJPX_Decoder. class JpxBitMapContext { public: explicit JpxBitMapContext(ICodec_JpxModule* jpx_module) @@ -199,7 +199,7 @@ CFX_DIBitmap* CPDF_DIBSource::GetBitmap() const { return m_pCachedBitmap ? m_pCachedBitmap.get() : Clone(); } void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const { - if (pBitmap && pBitmap != m_pCachedBitmap) { + if (pBitmap && pBitmap != m_pCachedBitmap.get()) { delete pBitmap; } } @@ -682,8 +682,7 @@ void CPDF_DIBSource::LoadJpxBitmap() { if (!pJpxModule) return; - nonstd::unique_ptr<JpxBitMapContext> context( - new JpxBitMapContext(pJpxModule)); + std::unique_ptr<JpxBitMapContext> context(new JpxBitMapContext(pJpxModule)); context->set_decoder(pJpxModule->CreateDecoder( m_pStreamAcc->GetData(), m_pStreamAcc->GetSize(), m_pColorSpace)); if (!context->decoder()) diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index 6a63f61c06..5530754ab0 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -8,10 +8,10 @@ #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ #include <map> +#include <memory> #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_render.h" -#include "third_party/base/nonstd_unique_ptr.h" class CFX_GlyphBitmap; class CFX_ImageTransformer; @@ -254,7 +254,7 @@ class CPDF_RenderStatus { const CPDF_PageObject* m_pStopObj; CPDF_GraphicStates m_InitialStates; int m_HalftoneLimit; - nonstd::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; + std::unique_ptr<IPDF_ObjectRenderer> m_pObjectRenderer; FX_BOOL m_bPrint; int m_Transparency; int m_DitherBits; @@ -392,7 +392,7 @@ class CPDF_ScaledRenderBuffer { CPDF_RenderContext* m_pContext; FX_RECT m_Rect; const CPDF_PageObject* m_pObject; - nonstd::unique_ptr<CFX_FxgeDevice> m_pBitmapDevice; + std::unique_ptr<CFX_FxgeDevice> m_pBitmapDevice; CFX_Matrix m_Matrix; }; @@ -414,7 +414,7 @@ class CPDF_DeviceBuffer { CPDF_RenderContext* m_pContext; FX_RECT m_Rect; const CPDF_PageObject* m_pObject; - nonstd::unique_ptr<CFX_DIBitmap> m_pBitmap; + std::unique_ptr<CFX_DIBitmap> m_pBitmap; CFX_Matrix m_Matrix; }; @@ -589,7 +589,7 @@ class CPDF_DIBSource : public CFX_DIBSource { DIB_COMP_DATA* m_pCompData; uint8_t* m_pLineBuf; uint8_t* m_pMaskedLine; - nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; + std::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index f4a75e6afc..814496ff7f 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -6,7 +6,6 @@ #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "third_party/base/nonstd_unique_ptr.h" CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) : m_pDocument(pPage->m_pDocument) { diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp index c59b1955a8..b435fc619c 100644 --- a/core/src/fpdfdoc/doc_bookmark.cpp +++ b/core/src/fpdfdoc/doc_bookmark.cpp @@ -4,10 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <memory> #include <vector> #include "core/include/fpdfdoc/fpdf_doc.h" -#include "third_party/base/nonstd_unique_ptr.h" CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( const CPDF_Bookmark& parent) const { @@ -60,7 +60,7 @@ CFX_WideString CPDF_Bookmark::GetTitle() const { if (!len) { return CFX_WideString(); } - nonstd::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]); + std::unique_ptr<FX_WCHAR[]> buf(new FX_WCHAR[len]); for (int i = 0; i < len; i++) { FX_WCHAR w = title[i]; buf[i] = w > 0x20 ? w : 0x20; diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index 1e56bf901d..4aea797c39 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -4,6 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <cctype> +#include <cwctype> +#include <memory> + #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_resource.h" @@ -11,12 +15,8 @@ #include "core/include/fxcrt/fx_bidi.h" #include "core/include/fxcrt/fx_ucd.h" #include "text_int.h" -#include "third_party/base/nonstd_unique_ptr.h" #include "txtproc.h" -#include <cctype> -#include <cwctype> - CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* defchar) { @@ -314,7 +314,7 @@ void NormalizeString(CFX_WideString& str) { return; } CFX_WideString sBuffer; - nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); + std::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); CFX_WordArray order; FX_BOOL bR2L = FALSE; int32_t start = 0, count = 0, i = 0; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index d7a9c47519..cf6cde1169 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -4,9 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <algorithm> #include <cctype> #include <cwctype> -#include <algorithm> +#include <memory> #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" @@ -17,7 +18,6 @@ #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_ucd.h" #include "text_int.h" -#include "third_party/base/nonstd_unique_ptr.h" namespace { @@ -1053,7 +1053,7 @@ void CPDF_TextPage::CloseTempLine() { if (count1 <= 0) { return; } - nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); + std::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); CFX_WideString str = m_TempTextBuf.GetWideString(); CFX_WordArray order; FX_BOOL bR2L = FALSE; @@ -1441,7 +1441,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend, FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, const CPDF_Font* pFont, int nItems) const { - nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); + std::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar); int32_t nR2L = 0; int32_t nL2R = 0; int32_t start = 0, count = 0; 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 <limits.h> + #include <list> #include <map> +#include <memory> #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<uint8_t, FxFreeDeleter> m_Data; + std::unique_ptr<uint8_t, FxFreeDeleter> 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<ImageDataCache> m_pDataCache; + std::unique_ptr<ImageDataCache> 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<ImageDataCache> cache( + std::unique_ptr<ImageDataCache> 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 <memory> + #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<uint8_t, FxFreeDeleter> guess_buf( + std::unique_ptr<uint8_t, FxFreeDeleter> 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<CLZWDecoder> decoder(new CLZWDecoder); + std::unique_ptr<CLZWDecoder> 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<CLZWDecoder> decoder(new CLZWDecoder); + std::unique_ptr<CLZWDecoder> 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<CJPX_Decoder> decoder(new CJPX_Decoder(cs)); + std::unique_ptr<CJPX_Decoder> 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<CJBig2_Segment> pSegment(new CJBig2_Segment); + std::unique_ptr<CJBig2_Segment> 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<JBig2PageInfo> pPageInfo(new JBig2PageInfo); + std::unique_ptr<JBig2PageInfo> 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<CJBig2_SDDProc> pSymbolDictDecoder(new CJBig2_SDDProc); + std::unique_ptr<CJBig2_SDDProc> 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<CJBig2_Image*, FxFreeDeleter> SDINSYMS; + std::unique_ptr<CJBig2_Image*, FxFreeDeleter> 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<CJBig2_HuffmanTable> Table_B1; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B2; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B3; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B4; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B5; + std::unique_ptr<CJBig2_HuffmanTable> Table_B1; + std::unique_ptr<CJBig2_HuffmanTable> Table_B2; + std::unique_ptr<CJBig2_HuffmanTable> Table_B3; + std::unique_ptr<CJBig2_HuffmanTable> Table_B4; + std::unique_ptr<CJBig2_HuffmanTable> 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<CJBig2_SymbolDict> copy(it->second->DeepCopy()); + std::unique_ptr<CJBig2_SymbolDict> 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<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_SymbolDict> value = + std::unique_ptr<CJBig2_SymbolDict> 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<CJBig2_TRDProc> pTRD(new CJBig2_TRDProc); + std::unique_ptr<CJBig2_TRDProc> 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<CJBig2_Image*, FxFreeDeleter> SBSYMS; + std::unique_ptr<CJBig2_Image*, FxFreeDeleter> 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<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES; + std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> 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<CJBig2_HuffmanTable> Table_B1; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B6; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B7; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B8; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B9; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B10; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B11; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B12; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B13; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B14; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B15; + std::unique_ptr<CJBig2_HuffmanTable> Table_B1; + std::unique_ptr<CJBig2_HuffmanTable> Table_B6; + std::unique_ptr<CJBig2_HuffmanTable> Table_B7; + std::unique_ptr<CJBig2_HuffmanTable> Table_B8; + std::unique_ptr<CJBig2_HuffmanTable> Table_B9; + std::unique_ptr<CJBig2_HuffmanTable> Table_B10; + std::unique_ptr<CJBig2_HuffmanTable> Table_B11; + std::unique_ptr<CJBig2_HuffmanTable> Table_B12; + std::unique_ptr<CJBig2_HuffmanTable> Table_B13; + std::unique_ptr<CJBig2_HuffmanTable> Table_B14; + std::unique_ptr<CJBig2_HuffmanTable> 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<JBig2ArithCtx, FxFreeDeleter> grContext; + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> 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<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_PDDProc> pPDD(new CJBig2_PDDProc); + std::unique_ptr<CJBig2_PDDProc> 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<JBig2ArithCtx, FxFreeDeleter> gbContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_HTRDProc> pHRD(new CJBig2_HTRDProc); + std::unique_ptr<CJBig2_HTRDProc> 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<JBig2ArithCtx, FxFreeDeleter> gbContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc); + std::unique_ptr<CJBig2_GRDProc> 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<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc); + std::unique_ptr<CJBig2_GRRDProc> 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<JBig2ArithCtx, FxFreeDeleter> grContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_HuffmanTable> pHuff( + std::unique_ptr<CJBig2_HuffmanTable> 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<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( + std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> 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 <list> +#include <memory> #include <utility> #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<CJBig2_BitStream> m_pStream; + std::unique_ptr<CJBig2_BitStream> m_pStream; CJBig2_List<CJBig2_Segment> m_SegmentList; CJBig2_List<JBig2PageInfo> m_PageInfoList; - nonstd::unique_ptr<CJBig2_Image> m_pPage; + std::unique_ptr<CJBig2_Image> 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<CJBig2_ArithDecoder> m_pArithDecoder; - nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD; + std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder; + std::unique_ptr<CJBig2_GRDProc> m_pGRD; JBig2ArithCtx* m_gbContext; - nonstd::unique_ptr<CJBig2_Segment> m_pSegment; + std::unique_ptr<CJBig2_Segment> m_pSegment; FX_DWORD m_dwOffset; JBig2RegionInfo m_ri; std::list<CJBig2_CachePair>* 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 <memory> + #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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> 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 <memory> + #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<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> 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 <memory> + #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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> 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<FX_DWORD, FxFreeDeleter> GSVALS( + std::unique_ptr<FX_DWORD, FxFreeDeleter> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; - nonstd::unique_ptr<CJBig2_Image*> GSPLANES(FX_Alloc(CJBig2_Image*, GSBPP)); + std::unique_ptr<CJBig2_Image*> 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<FX_DWORD> GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); + std::unique_ptr<FX_DWORD> 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 <memory> + #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<CJBig2_Image> HSKIP; - nonstd::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr<CJBig2_Image> HSKIP; + std::unique_ptr<CJBig2_Image> 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<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); + std::unique_ptr<CJBig2_GSIDProc> 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<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); FX_DWORD HBPP = 1; while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - nonstd::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); + std::unique_ptr<CJBig2_GSIDProc> 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 <memory> + #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<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); + std::unique_ptr<CJBig2_PatternDict> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> 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<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); + std::unique_ptr<CJBig2_PatternDict> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> 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 <memory> #include <vector> #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<CJBig2_ArithIaidDecoder> IAID; - nonstd::unique_ptr<CJBig2_SymbolDict> pDict; - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADH(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAAI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDY(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAEX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAFS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAIT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIaidDecoder> IAID; + std::unique_ptr<CJBig2_SymbolDict> pDict; + std::unique_ptr<CJBig2_ArithIntDecoder> IADH(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADW(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAAI(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDX(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDY(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAEX(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADT(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAFS(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADS(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAIT(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARI(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> 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<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); + std::unique_ptr<CJBig2_TRDProc> 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<CJBig2_HuffmanTable> SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> 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<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> 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<CJBig2_HuffmanDecoder> pHuffmanDecoder( + std::unique_ptr<CJBig2_HuffmanDecoder> 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<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); - nonstd::unique_ptr<CJBig2_HuffmanTable> pTable; + std::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); + std::unique_ptr<CJBig2_HuffmanTable> pTable; HCHEIGHT = 0; NSYMSDECODED = 0; @@ -370,7 +367,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } BS = nullptr; if (REFAGGNINST > 1) { - nonstd::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); + std::unique_ptr<CJBig2_TRDProc> 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<CJBig2_HuffmanTable> SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> 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<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> 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<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> 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<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> 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> CJBig2_SymbolDict::DeepCopy() const { +std::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const { const CJBig2_SymbolDict* src = this; - nonstd::unique_ptr<CJBig2_SymbolDict> dst(new CJBig2_SymbolDict); + std::unique_ptr<CJBig2_SymbolDict> 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 <memory> #include <vector> #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<CJBig2_SymbolDict> DeepCopy() const; + std::unique_ptr<CJBig2_SymbolDict> 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 <memory> + #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<CJBig2_HuffmanDecoder> pHuffmanDecoder( + std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); - nonstd::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> 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<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> 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<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr<CJBig2_Image> 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<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; |