summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn1
-rw-r--r--core/include/fpdfapi/fpdf_module.h7
-rw-r--r--core/include/fpdfapi/fpdf_parser.h6
-rw-r--r--core/include/fpdfapi/fpdf_render.h4
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h6
-rw-r--r--core/include/fxcodec/fx_codec.h25
-rw-r--r--core/include/fxcrt/fx_basic.h2
-rw-r--r--core/include/fxge/fx_font.h4
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp30
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h10
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp1
-rw-r--r--core/src/fpdfdoc/doc_bookmark.cpp4
-rw-r--r--core/src/fpdftext/fpdf_text.cpp10
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp8
-rw-r--r--core/src/fxcodec/codec/codec_int.h7
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp2
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp10
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpx_opj.cpp2
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Context.cpp80
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Context.h12
-rw-r--r--core/src/fxcodec/jbig2/JBig2_GrdProc.cpp19
-rw-r--r--core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp11
-rw-r--r--core/src/fxcodec/jbig2/JBig2_GsidProc.cpp13
-rw-r--r--core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp13
-rw-r--r--core/src/fxcodec/jbig2/JBig2_PddProc.cpp11
-rw-r--r--core/src/fxcodec/jbig2/JBig2_SddProc.cpp118
-rw-r--r--core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp4
-rw-r--r--core/src/fxcodec/jbig2/JBig2_SymbolDict.h4
-rw-r--r--core/src/fxcodec/jbig2/JBig2_TrdProc.cpp15
-rw-r--r--fpdfsdk/include/fsdk_actionhandler.h5
-rw-r--r--fpdfsdk/include/fsdk_mgr.h18
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp7
-rw-r--r--fpdfsdk/src/fpdfppo.cpp5
-rw-r--r--fpdfsdk/src/fpdfview.cpp5
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp7
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp6
-rw-r--r--fpdfsdk/src/javascript/Field.cpp2
-rw-r--r--fpdfsdk/src/javascript/JS_Object.h4
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime_Stub.cpp5
-rw-r--r--fpdfsdk/src/javascript/app.cpp5
-rw-r--r--pdfium.gyp1
-rw-r--r--testing/embedder_test.h4
-rw-r--r--testing/js_embedder_test.h4
-rw-r--r--third_party/BUILD.gn2
-rw-r--r--third_party/base/nonstd_unique_ptr.h398
-rw-r--r--third_party/base/nonstd_unique_ptr_unittest.cpp391
-rw-r--r--third_party/base/numerics/safe_conversions_impl.h1
-rw-r--r--third_party/base/numerics/safe_math.h6
-rw-r--r--third_party/base/numerics/safe_math_impl.h111
-rw-r--r--third_party/base/template_util.h79
-rw-r--r--third_party/third_party.gyp2
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_editimp.cpp2
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h7
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h8
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_editimp.h8
-rw-r--r--xfa/src/fwl/src/basewidget/include/fwl_listboximp.h6
-rw-r--r--xfa/src/fwl/src/lightwidget/barcode.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/caret.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/checkbox.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/combobox.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/datetimepicker.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/edit.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/listbox.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/picturebox.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/pushbutton.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/scrollbar.cpp5
-rw-r--r--xfa/src/fwl/src/lightwidget/tooltipctrl.cpp5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp5
-rw-r--r--xfa/src/fxgraphics/src/fx_graphics.cpp5
79 files changed, 416 insertions, 1241 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 80476605ed..db57a29476 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1472,7 +1472,6 @@ test("pdfium_unittests") {
"core/src/fxcrt/fx_bidi_unittest.cpp",
"core/src/fxcrt/fx_extension_unittest.cpp",
"core/src/fxcrt/fx_system_unittest.cpp",
- "third_party/base/nonstd_unique_ptr_unittest.cpp",
]
deps = [
"//testing/gtest",
diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h
index 00aed45d1f..e22b63e544 100644
--- a/core/include/fpdfapi/fpdf_module.h
+++ b/core/include/fpdfapi/fpdf_module.h
@@ -7,9 +7,10 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_
+#include <memory>
+
#include "core/include/fxcrt/fx_coordinates.h"
#include "core/include/fxcrt/fx_system.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CCodec_ModuleMgr;
class CFX_BitmapDevice;
@@ -78,8 +79,8 @@ class CPDF_ModuleMgr {
~CPDF_ModuleMgr();
CCodec_ModuleMgr* m_pCodecModule;
- nonstd::unique_ptr<IPDF_RenderModule> m_pRenderModule;
- nonstd::unique_ptr<IPDF_PageModule> m_pPageModule;
+ std::unique_ptr<IPDF_RenderModule> m_pRenderModule;
+ std::unique_ptr<IPDF_PageModule> m_pPageModule;
FX_BOOL (*m_pDownloadCallback)(const FX_CHAR* module_name);
CFX_PrivateData m_privateData;
};
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 752df789da..a49fb29d9c 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -8,10 +8,10 @@
#define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
#include <map>
+#include <memory>
#include "core/include/fxcrt/fx_system.h"
#include "fpdf_objects.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CFDF_Document;
class CFDF_Parser;
@@ -347,7 +347,7 @@ class CPDF_SyntaxParser {
FX_FILESIZE m_BufOffset;
- nonstd::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
+ std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
@@ -496,7 +496,7 @@ class CPDF_Parser {
FX_BOOL m_bXRefStream;
- nonstd::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
+ std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
FX_BOOL m_bForceUseSecurityHandler;
diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h
index 245a85d502..1c8a99ac7d 100644
--- a/core/include/fpdfapi/fpdf_render.h
+++ b/core/include/fpdfapi/fpdf_render.h
@@ -8,10 +8,10 @@
#define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
#include <map>
+#include <memory>
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxge/fx_ge.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CFX_GraphStateData;
class CFX_PathData;
@@ -151,7 +151,7 @@ class CPDF_ProgressiveRenderer {
CPDF_RenderContext* const m_pContext;
CFX_RenderDevice* const m_pDevice;
const CPDF_RenderOptions* const m_pOptions;
- nonstd::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
+ std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
CFX_FloatRect m_ClipRect;
FX_DWORD m_LayerIndex;
FX_DWORD m_ObjectIndex;
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 3934cfd6af..ce05588f54 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -8,11 +8,11 @@
#define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_
#include <map>
+#include <memory>
#include <vector>
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fpdfapi/fpdf_render.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CFieldTree;
class CPDF_AAction;
@@ -700,7 +700,7 @@ class CPDF_InterForm : public CFX_PrivateData {
std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap;
- nonstd::unique_ptr<CFieldTree> m_pFieldTree;
+ std::unique_ptr<CFieldTree> m_pFieldTree;
CFX_ByteString m_bsEncoding;
@@ -1068,7 +1068,7 @@ class CPDF_Metadata {
const CXML_Element* GetRoot() const;
private:
- nonstd::unique_ptr<CXML_Element> m_pXmlElement;
+ std::unique_ptr<CXML_Element> m_pXmlElement;
};
class CPDF_ViewerPreferences {
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h
index da9cd9260b..b0c1d5710a 100644
--- a/core/include/fxcodec/fx_codec.h
+++ b/core/include/fxcodec/fx_codec.h
@@ -8,12 +8,13 @@
#define CORE_INCLUDE_FXCODEC_FX_CODEC_H_
#include <map>
+#include <memory>
#include <vector>
#include "core/include/fxcodec/fx_codec_def.h"
#include "core/include/fxcrt/fx_basic.h"
#include "core/include/fxcrt/fx_coordinates.h" // For FX_RECT.
-#include "third_party/base/nonstd_unique_ptr.h"
+#include "fx_codec_def.h"
class CFX_DIBSource;
class CJPX_Decoder;
@@ -80,19 +81,19 @@ class CCodec_ModuleMgr {
#endif // PDF_ENABLE_XFA
protected:
- nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule;
- nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule;
- nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule;
- nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule;
- nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module;
- nonstd::unique_ptr<ICodec_IccModule> m_pIccModule;
+ std::unique_ptr<ICodec_BasicModule> m_pBasicModule;
+ std::unique_ptr<ICodec_FaxModule> m_pFaxModule;
+ std::unique_ptr<ICodec_JpegModule> m_pJpegModule;
+ std::unique_ptr<ICodec_JpxModule> m_pJpxModule;
+ std::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module;
+ std::unique_ptr<ICodec_IccModule> m_pIccModule;
#ifdef PDF_ENABLE_XFA
- nonstd::unique_ptr<ICodec_PngModule> m_pPngModule;
- nonstd::unique_ptr<ICodec_GifModule> m_pGifModule;
- nonstd::unique_ptr<ICodec_BmpModule> m_pBmpModule;
- nonstd::unique_ptr<ICodec_TiffModule> m_pTiffModule;
+ std::unique_ptr<ICodec_PngModule> m_pPngModule;
+ std::unique_ptr<ICodec_GifModule> m_pGifModule;
+ std::unique_ptr<ICodec_BmpModule> m_pBmpModule;
+ std::unique_ptr<ICodec_TiffModule> m_pTiffModule;
#endif // PDF_ENABLE_XFA
- nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule;
+ std::unique_ptr<ICodec_FlateModule> m_pFlateModule;
};
class ICodec_BasicModule {
public:
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 52d0f14771..2e9723de1d 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -1060,7 +1060,7 @@ struct FxFreeDeleter {
inline void operator()(void* ptr) const { FX_Free(ptr); }
};
-// Used with nonstd::unique_ptr to Release() objects that can't be deleted.
+// Used with std::unique_ptr to Release() objects that can't be deleted.
template <class T>
struct ReleaseDeleter {
inline void operator()(T* ptr) const { ptr->Release(); }
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 356e94e69c..7d5aa638a1 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -8,10 +8,10 @@
#define CORE_INCLUDE_FXGE_FX_FONT_H_
#include <map>
+#include <memory>
#include "core/include/fxcrt/fx_system.h"
#include "fx_dib.h"
-#include "third_party/base/nonstd_unique_ptr.h"
typedef struct FT_FaceRec_* FXFT_Face;
typedef void* FXFT_Library;
@@ -273,7 +273,7 @@ class CFX_FontMgr {
FXFT_Library GetFTLibrary() const { return m_FTLibrary; }
private:
- nonstd::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
+ std::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap;
FXFT_Library m_FTLibrary;
};
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;
diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h
index 4417280a83..33f127d8c9 100644
--- a/fpdfsdk/include/fsdk_actionhandler.h
+++ b/fpdfsdk/include/fsdk_actionhandler.h
@@ -7,10 +7,11 @@
#ifndef FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
#define FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
+#include <memory>
+
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fxcrt/fx_string.h"
#include "fsdk_baseform.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CFX_PtrList;
class CPDFSDK_Annot;
@@ -116,7 +117,7 @@ class CPDFSDK_ActionHandler {
void DoAction_SetOCGState(CPDFSDK_Document* pDocument,
const CPDF_Action& action);
- nonstd::unique_ptr<CPDFSDK_FormActionHandler> m_pFormActionHandler;
+ std::unique_ptr<CPDFSDK_FormActionHandler> m_pFormActionHandler;
};
#endif // FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index d0da678d34..694b471ab8 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -8,6 +8,7 @@
#define FPDFSDK_INCLUDE_FSDK_MGR_H_
#include <map>
+#include <memory>
#include "core/include/fpdftext/fpdf_text.h"
#include "fsdk_actionhandler.h"
@@ -20,7 +21,6 @@
#include "javascript/IJavaScript.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_fwlevent.h" // cross platform keycode and events define.
-#include "third_party/base/nonstd_unique_ptr.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfxfa/fpdfxfa_doc.h"
@@ -469,14 +469,14 @@ class CPDFDoc_Environment final {
CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present.
private:
- nonstd::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr;
- nonstd::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
- nonstd::unique_ptr<IJS_Runtime> m_pJSRuntime;
+ std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr;
+ std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
+ std::unique_ptr<IJS_Runtime> m_pJSRuntime;
FPDF_FORMFILLINFO* const m_pInfo;
CPDFSDK_Document* m_pSDKDoc;
UnderlyingDocumentType* const m_pUnderlyingDoc;
- nonstd::unique_ptr<CFFL_IFormFiller> m_pIFormFiller;
- nonstd::unique_ptr<IFX_SystemHandler> m_pSysHandler;
+ std::unique_ptr<CFFL_IFormFiller> m_pIFormFiller;
+ std::unique_ptr<IFX_SystemHandler> m_pSysHandler;
};
class CPDFSDK_Document {
@@ -553,10 +553,10 @@ class CPDFSDK_Document {
private:
std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap;
UnderlyingDocumentType* m_pDoc;
- nonstd::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
+ std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
CPDFSDK_Annot* m_pFocusAnnot;
CPDFDoc_Environment* m_pEnv;
- nonstd::unique_ptr<CPDF_OCContext> m_pOccontent;
+ std::unique_ptr<CPDF_OCContext> m_pOccontent;
FX_BOOL m_bChangeMask;
FX_BOOL m_bBeingDestroyed;
};
@@ -649,7 +649,7 @@ class CPDFSDK_PageView final {
CFX_Matrix m_curMatrix;
UnderlyingPageType* m_page;
- nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList;
+ std::unique_ptr<CPDF_AnnotList> m_pAnnotList;
std::vector<CPDFSDK_Annot*> m_fxAnnotArray;
CPDFSDK_Document* m_pSDKDoc;
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index 1f12f5dd3f..366c972c3a 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -6,10 +6,11 @@
#include "public/fpdf_formfill.h"
+#include <memory>
+
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "public/fpdfview.h"
-#include "third_party/base/nonstd_unique_ptr.h"
#ifdef PDF_ENABLE_XFA
#include "../include/fpdfxfa/fpdfxfa_app.h"
@@ -344,9 +345,9 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
clip.bottom = start_y + size_y;
#ifdef _SKIA_SUPPORT_
- nonstd::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice);
+ std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice);
#else
- nonstd::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
+ std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
#endif
pDevice->Attach((CFX_DIBitmap*)bitmap);
pDevice->SaveState();
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 2fce7adfc4..50ef262560 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -6,8 +6,9 @@
#include "public/fpdf_ppo.h"
+#include <memory>
+
#include "fpdfsdk/include/fsdk_define.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CPDF_PageOrganizer {
public:
@@ -91,7 +92,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
int nIndex) {
int curpage = nIndex;
- nonstd::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap);
+ std::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap);
for (int i = 0; i < nPageNum->GetSize(); ++i) {
CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage);
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index a7c38bcdf7..cca56e33fb 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -6,6 +6,8 @@
#include "public/fpdfview.h"
+#include <memory>
+
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxcrt/fx_safe_types.h"
#include "fpdfsdk/include/fsdk_define.h"
@@ -14,7 +16,6 @@
#include "fpdfsdk/include/javascript/IJavaScript.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_progressive.h"
-#include "third_party/base/nonstd_unique_ptr.h"
#include "third_party/base/numerics/safe_conversions_impl.h"
#ifdef PDF_ENABLE_XFA
@@ -816,7 +817,7 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
int height,
int alpha) {
- nonstd::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
+ std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) {
return NULL;
}
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index b76cb75199..12faea2bef 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/fsdk_actionhandler.h"
#include "fpdfsdk/include/fsdk_baseannot.h"
@@ -11,7 +13,6 @@
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/fsdk_mgr.h"
#include "fpdfsdk/include/javascript/IJavaScript.h"
-#include "third_party/base/nonstd_unique_ptr.h"
#ifdef PDF_ENABLE_XFA
#include "../include/fpdfxfa/fpdfxfa_doc.h"
@@ -2055,7 +2056,7 @@ FX_BOOL CPDFSDK_InterForm::HighlightWidgets() {
CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
FX_BOOL bNext) const {
- nonstd::unique_ptr<CBA_AnnotIterator> pIterator(
+ std::unique_ptr<CBA_AnnotIterator> pIterator(
new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", ""));
if (bNext) {
@@ -2555,7 +2556,7 @@ FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
FX_BOOL bIncludeOrExclude,
CFX_ByteTextBuf& textBuf) {
- nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
+ std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
m_pDocument->GetPath(), fields, bIncludeOrExclude));
return pFDF ? pFDF->WriteBuf(textBuf) : FALSE;
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index e27823bea2..8ecc602b09 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -5,6 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <algorithm>
+#include <memory>
#include "fpdfsdk/include/fsdk_mgr.h"
@@ -12,7 +13,6 @@
#include "fpdfsdk/include/fsdk_define.h"
#include "fpdfsdk/include/javascript/IJavaScript.h"
#include "public/fpdf_ext.h"
-#include "third_party/base/nonstd_unique_ptr.h"
#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
@@ -285,7 +285,7 @@ CFX_WideString CPDFDoc_Environment::JS_fieldBrowse() {
if (nRequiredLen <= 0)
return L"";
- nonstd::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
+ std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
memset(pBuff.get(), 0, nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
@@ -308,7 +308,7 @@ CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() {
if (nRequiredLen <= 0)
return L"";
- nonstd::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
+ std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
memset(pBuff.get(), 0, nRequiredLen);
const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 89725ffb7f..7baefd111c 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -3140,7 +3140,7 @@ FX_BOOL Field::getArray(IJS_Context* cc,
CJS_Array FormFieldArray(pRuntime);
for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) {
- nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j));
+ std::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j));
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID);
ASSERT(!pObj.IsEmpty());
diff --git a/fpdfsdk/src/javascript/JS_Object.h b/fpdfsdk/src/javascript/JS_Object.h
index d72696caeb..fe9e5ec5d2 100644
--- a/fpdfsdk/src/javascript/JS_Object.h
+++ b/fpdfsdk/src/javascript/JS_Object.h
@@ -8,11 +8,11 @@
#define FPDFSDK_SRC_JAVASCRIPT_JS_OBJECT_H_
#include <map>
+#include <memory>
#include "JS_Runtime.h"
#include "fpdfsdk/include/fsdk_define.h" // For FX_UINT
#include "fpdfsdk/include/jsapi/fxjs_v8.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CJS_Context;
class CJS_Object;
@@ -68,7 +68,7 @@ class CJS_Object {
v8::Isolate* GetIsolate() { return m_pIsolate; }
protected:
- nonstd::unique_ptr<CJS_EmbedObj> m_pEmbedObj;
+ std::unique_ptr<CJS_EmbedObj> m_pEmbedObj;
v8::Global<v8::Object> m_pV8Object;
v8::Isolate* m_pIsolate;
};
diff --git a/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
index 1d94976edf..e9d5a221f7 100644
--- a/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
@@ -4,9 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
#include "fpdfsdk/include/javascript/IJavaScript.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CJS_ContextStub final : public IJS_Context {
public:
@@ -156,7 +157,7 @@ class CJS_RuntimeStub final : public IJS_Runtime {
protected:
CPDFSDK_Document* m_pDoc;
- nonstd::unique_ptr<CJS_ContextStub> m_pContext;
+ std::unique_ptr<CJS_ContextStub> m_pContext;
};
// static
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index 34b51310ce..1473edbf69 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -6,6 +6,8 @@
#include "app.h"
+#include <memory>
+
#include "Document.h"
#include "JS_Context.h"
#include "JS_Define.h"
@@ -16,7 +18,6 @@
#include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
#include "fpdfsdk/include/javascript/IJavaScript.h"
#include "resource.h"
-#include "third_party/base/nonstd_unique_ptr.h"
BEGIN_JS_STATIC_CONST(CJS_TimerObj)
END_JS_STATIC_CONST()
@@ -803,7 +804,7 @@ FX_BOOL app::response(IJS_Context* cc,
CPDFDoc_Environment* pApp = pContext->GetReaderApp();
const int MAX_INPUT_BYTES = 2048;
- nonstd::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]);
+ std::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]);
memset(pBuff.get(), 0, MAX_INPUT_BYTES + 2);
int nLengthBytes = pApp->JS_appResponse(
swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(),
diff --git a/pdfium.gyp b/pdfium.gyp
index 6dfd42fec9..0b63867a79 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -771,7 +771,6 @@
'core/src/fxcrt/fx_system_unittest.cpp',
'testing/fx_string_testhelpers.h',
'testing/fx_string_testhelpers.cpp',
- 'third_party/base/nonstd_unique_ptr_unittest.cpp',
],
'conditions': [
['pdf_enable_xfa==1', {
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index df2e40a2e8..a544f26543 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -6,6 +6,7 @@
#define TESTING_EMBEDDER_TEST_H_
#include <map>
+#include <memory>
#include <string>
#include "public/fpdf_dataavail.h"
@@ -13,7 +14,6 @@
#include "public/fpdf_formfill.h"
#include "public/fpdfview.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/nonstd_unique_ptr.h"
#ifdef PDF_ENABLE_V8
#include "v8/include/v8.h"
@@ -108,7 +108,7 @@ class EmbedderTest : public ::testing::Test,
protected:
Delegate* delegate_;
- nonstd::unique_ptr<Delegate> default_delegate_;
+ std::unique_ptr<Delegate> default_delegate_;
FPDF_DOCUMENT document_;
FPDF_FORMHANDLE form_handle_;
FPDF_AVAIL avail_;
diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h
index 167aea7ed5..319bd40728 100644
--- a/testing/js_embedder_test.h
+++ b/testing/js_embedder_test.h
@@ -5,11 +5,11 @@
#ifndef TESTING_JS_EMBEDDER_TEST_H_
#define TESTING_JS_EMBEDDER_TEST_H_
+#include <memory>
#include <vector>
#include "fpdfsdk/include/jsapi/fxjs_v8.h"
#include "testing/embedder_test.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class JSEmbedderTest : public EmbedderTest {
public:
@@ -23,7 +23,7 @@ class JSEmbedderTest : public EmbedderTest {
v8::Local<v8::Context> GetV8Context();
private:
- nonstd::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
+ std::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
v8::Isolate* m_pIsolate;
v8::Global<v8::Context> m_pPersistentContext;
std::vector<v8::Global<v8::Object>*> m_StaticObjects;
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 11456b131a..51481dddef 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -379,12 +379,10 @@ source_set("pdfium_base") {
sources = [
"base/logging.h",
"base/macros.h",
- "base/nonstd_unique_ptr.h",
"base/numerics/safe_conversions.h",
"base/numerics/safe_conversions_impl.h",
"base/numerics/safe_math.h",
"base/numerics/safe_math_impl.h",
"base/stl_util.h",
- "base/template_util.h",
]
}
diff --git a/third_party/base/nonstd_unique_ptr.h b/third_party/base/nonstd_unique_ptr.h
deleted file mode 100644
index f056e50397..0000000000
--- a/third_party/base/nonstd_unique_ptr.h
+++ /dev/null
@@ -1,398 +0,0 @@
-// Copyright 2013 Google Inc. All Rights Reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This is a copy of breakpad's standalone scoped_ptr, which has been
-// renamed to nonstd::unique_ptr, and from which more complicated classes
-// have been removed. The reset() method has also been tweaked to more
-// closely match c++11, and an implicit conversion to bool has been added.
-
-// Scopers help you manage ownership of a pointer, helping you easily manage the
-// a pointer within a scope, and automatically destroying the pointer at the
-// end of a scope.
-//
-// A unique_ptr<T> is like a T*, except that the destructor of unique_ptr<T>
-// automatically deletes the pointer it holds (if any).
-// That is, unique_ptr<T> owns the T object that it points to.
-// Like a T*, a unique_ptr<T> may hold either NULL or a pointer to a T object.
-// Also like T*, unique_ptr<T> is thread-compatible, and once you
-// dereference it, you get the thread safety guarantees of T.
-//
-// Example usage (unique_ptr):
-// {
-// unique_ptr<Foo> foo(new Foo("wee"));
-// } // foo goes out of scope, releasing the pointer with it.
-//
-// {
-// unique_ptr<Foo> foo; // No pointer managed.
-// foo.reset(new Foo("wee")); // Now a pointer is managed.
-// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed.
-// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed.
-// foo->Method(); // Foo::Method() called.
-// foo.get()->Method(); // Foo::Method() called.
-// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer
-// // manages a pointer.
-// foo.reset(new Foo("wee4")); // foo manages a pointer again.
-// foo.reset(); // Foo("wee4") destroyed, foo no longer
-// // manages a pointer.
-// } // foo wasn't managing a pointer, so nothing was destroyed.
-//
-// The size of a unique_ptr is small: sizeof(unique_ptr<C>) == sizeof(C*)
-
-#ifndef NONSTD_UNIQUE_PTR_H_
-#define NONSTD_UNIQUE_PTR_H_
-
-// This is an implementation designed to match the anticipated future C++11
-// implementation of the unique_ptr class.
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include <ostream>
-#include <utility>
-
-#include "template_util.h"
-
-namespace nonstd {
-
-// Function object which deletes its parameter, which must be a pointer.
-// If C is an array type, invokes 'delete[]' on the parameter; otherwise,
-// invokes 'delete'. The default deleter for unique_ptr<T>.
-template <class T>
-struct DefaultDeleter {
- DefaultDeleter() {}
- template <typename U>
- DefaultDeleter(const DefaultDeleter<U>& other) {
- // IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor
- // if U* is implicitly convertible to T* and U is not an array type.
- //
- // Correct implementation should use SFINAE to disable this
- // constructor. However, since there are no other 1-argument constructors,
- // using a static_assert() based on is_convertible<> and requiring
- // complete types is simpler and will cause compile failures for equivalent
- // misuses.
- //
- // Note, the is_convertible<U*, T*> check also ensures that U is not an
- // array. T is guaranteed to be a non-array, so any U* where U is an array
- // cannot convert to T*.
- enum { T_must_be_complete = sizeof(T) };
- enum { U_must_be_complete = sizeof(U) };
- static_assert((pdfium::base::is_convertible<U*, T*>::value),
- "U_ptr_must_implicitly_convert_to_T_ptr");
- }
- inline void operator()(T* ptr) const {
- enum { type_must_be_complete = sizeof(T) };
- delete ptr;
- }
-};
-
-// Specialization of DefaultDeleter for array types.
-template <class T>
-struct DefaultDeleter<T[]> {
- inline void operator()(T* ptr) const {
- enum { type_must_be_complete = sizeof(T) };
- delete[] ptr;
- }
-
- private:
- // Disable this operator for any U != T because it is undefined to execute
- // an array delete when the static type of the array mismatches the dynamic
- // type.
- //
- // References:
- // C++98 [expr.delete]p3
- // http://cplusplus.github.com/LWG/lwg-defects.html#938
- template <typename U>
- void operator()(U* array) const;
-};
-
-template <class T, int n>
-struct DefaultDeleter<T[n]> {
- // Never allow someone to declare something like unique_ptr<int[10]>.
- static_assert(sizeof(T) == -1, "do_not_use_array_with_size_as_type");
-};
-
-namespace internal {
-
-// Common implementation for both pointers to elements and pointers to
-// arrays. These are differentiated below based on the need to invoke
-// delete vs. delete[] as appropriate.
-template <class C, class D>
-class unique_ptr_base {
- public:
- // The element type
- typedef C element_type;
-
- explicit unique_ptr_base(C* p) : data_(p) {}
-
- // Initializer for deleters that have data parameters.
- unique_ptr_base(C* p, const D& d) : data_(p, d) {}
-
- // Move constructor.
- unique_ptr_base(unique_ptr_base<C, D>&& that)
- : data_(that.release(), that.get_deleter()) {}
-
- ~unique_ptr_base() {
- enum { type_must_be_complete = sizeof(C) };
- if (data_.ptr != nullptr) {
- // Not using get_deleter() saves one function call in non-optimized
- // builds.
- static_cast<D&>(data_)(data_.ptr);
- }
- }
-
- void reset(C* p = nullptr) {
- C* old = data_.ptr;
- data_.ptr = p;
- if (old != nullptr)
- static_cast<D&>(data_)(old);
- }
-
- C* get() const { return data_.ptr; }
- D& get_deleter() { return data_; }
- const D& get_deleter() const { return data_; }
-
- // Comparison operators.
- // These return whether two unique_ptr refer to the same object, not just to
- // two different but equal objects.
- bool operator==(C* p) const { return data_.ptr == p; }
- bool operator!=(C* p) const { return data_.ptr != p; }
-
- // Swap two unique pointers.
- void swap(unique_ptr_base& p2) {
- Data tmp = data_;
- data_ = p2.data_;
- p2.data_ = tmp;
- }
-
- // Release a pointer.
- // The return value is the current pointer held by this object.
- // If this object holds a NULL pointer, the return value is NULL.
- // After this operation, this object will hold a NULL pointer,
- // and will not own the object any more.
- C* release() {
- C* ptr = data_.ptr;
- data_.ptr = nullptr;
- return ptr;
- }
-
- // Allow promotion to bool for conditional statements.
- explicit operator bool() const { return data_.ptr != nullptr; }
-
- protected:
- // Use the empty base class optimization to allow us to have a D
- // member, while avoiding any space overhead for it when D is an
- // empty class. See e.g. http://www.cantrip.org/emptyopt.html for a good
- // discussion of this technique.
- struct Data : public D {
- explicit Data(C* ptr_in) : ptr(ptr_in) {}
- Data(C* ptr_in, const D& other) : D(other), ptr(ptr_in) {}
- C* ptr;
- };
-
- Data data_;
-};
-
-} // namespace internal
-
-// Implementation for ordinary pointers using delete.
-template <class C, class D = DefaultDeleter<C>>
-class unique_ptr : public internal::unique_ptr_base<C, D> {
- public:
- // Constructor. Defaults to initializing with nullptr.
- unique_ptr() : internal::unique_ptr_base<C, D>(nullptr) {}
-
- // Constructor. Takes ownership of p.
- explicit unique_ptr(C* p) : internal::unique_ptr_base<C, D>(p) {}
-
- // Constructor. Allows initialization of a stateful deleter.
- unique_ptr(C* p, const D& d) : internal::unique_ptr_base<C, D>(p, d) {}
-
- // Constructor. Allows construction from a nullptr.
- unique_ptr(decltype(nullptr)) : internal::unique_ptr_base<C, D>(nullptr) {}
-
- // Move constructor.
- unique_ptr(unique_ptr&& that)
- : internal::unique_ptr_base<C, D>(std::move(that)) {}
-
- // operator=. Allows assignment from a nullptr. Deletes the currently owned
- // object, if any.
- unique_ptr& operator=(decltype(nullptr)) {
- this->reset();
- return *this;
- }
-
- // Move assignment.
- unique_ptr<C>& operator=(unique_ptr<C>&& that) {
- this->reset(that.release());
- return *this;
- }
-
- // Accessors to get the owned object.
- // operator* and operator-> will assert() if there is no current object.
- C& operator*() const {
- assert(this->data_.ptr != nullptr);
- return *this->data_.ptr;
- }
- C* operator->() const {
- assert(this->data_.ptr != nullptr);
- return this->data_.ptr;
- }
-
- // Comparison operators.
- // These return whether two unique_ptr refer to the same object, not just to
- // two different but equal objects.
- bool operator==(const C* p) const { return this->get() == p; }
- bool operator!=(const C* p) const { return this->get() != p; }
-
- private:
- // Disallow evil constructors. It doesn't make sense to make a copy of
- // something that's allegedly unique.
- unique_ptr(const unique_ptr&) = delete;
- void operator=(const unique_ptr&) = delete;
-
- // Forbid comparison of unique_ptr types. If U != C, it totally
- // doesn't make sense, and if U == C, it still doesn't make sense
- // because you should never have the same object owned by two different
- // unique_ptrs.
- template <class U>
- bool operator==(unique_ptr<U> const& p2) const;
- template <class U>
- bool operator!=(unique_ptr<U> const& p2) const;
-};
-
-// Specialization for arrays using delete[].
-template <class C, class D>
-class unique_ptr<C[], D> : public internal::unique_ptr_base<C, D> {
- public:
- // Constructor. Defaults to initializing with nullptr.
- unique_ptr() : internal::unique_ptr_base<C, D>(nullptr) {}
-
- // Constructor. Stores the given array. Note that the argument's type
- // must exactly match T*. In particular:
- // - it cannot be a pointer to a type derived from T, because it is
- // inherently unsafe in the general case to access an array through a
- // pointer whose dynamic type does not match its static type (eg., if
- // T and the derived types had different sizes access would be
- // incorrectly calculated). Deletion is also always undefined
- // (C++98 [expr.delete]p3). If you're doing this, fix your code.
- // - it cannot be const-qualified differently from T per unique_ptr spec
- // (http://cplusplus.github.com/LWG/lwg-active.html#2118). Users wanting
- // to work around this may use const_cast<const T*>().
- explicit unique_ptr(C* p) : internal::unique_ptr_base<C, D>(p) {}
-
- // Constructor. Allows construction from a nullptr.
- unique_ptr(decltype(nullptr)) : internal::unique_ptr_base<C, D>(nullptr) {}
-
- // Move constructor.
- unique_ptr(unique_ptr&& that)
- : internal::unique_ptr_base<C, D>(std::move(that)) {}
-
- // operator=. Allows assignment from a nullptr. Deletes the currently owned
- // array, if any.
- unique_ptr& operator=(decltype(nullptr)) {
- this->reset();
- return *this;
- }
-
- // Move assignment.
- unique_ptr<C>& operator=(unique_ptr<C>&& that) {
- this->reset(that.release());
- return *this;
- }
-
- // Reset. Deletes the currently owned array, if any.
- // Then takes ownership of a new object, if given.
- void reset(C* array = nullptr) {
- static_cast<internal::unique_ptr_base<C, D>*>(this)->reset(array);
- }
-
- // Support indexing since it is holding array.
- C& operator[](size_t i) { return this->data_.ptr[i]; }
-
- // Comparison operators.
- // These return whether two unique_ptr refer to the same object, not just to
- // two different but equal objects.
- bool operator==(C* array) const { return this->get() == array; }
- bool operator!=(C* array) const { return this->get() != array; }
-
- private:
- // Disable initialization from any type other than element_type*, by
- // providing a constructor that matches such an initialization, but is
- // private and has no definition. This is disabled because it is not safe to
- // call delete[] on an array whose static type does not match its dynamic
- // type.
- template <typename U>
- explicit unique_ptr(U* array);
- explicit unique_ptr(int disallow_construction_from_null);
-
- // Disable reset() from any type other than element_type*, for the same
- // reasons as the constructor above.
- template <typename U>
- void reset(U* array);
- void reset(int disallow_reset_from_null);
-
- // Disallow evil constructors. It doesn't make sense to make a copy of
- // something that's allegedly unique.
- unique_ptr(const unique_ptr&) = delete;
- void operator=(const unique_ptr&) = delete;
-
- // Forbid comparison of unique_ptr types. If U != C, it totally
- // doesn't make sense, and if U == C, it still doesn't make sense
- // because you should never have the same object owned by two different
- // unique_ptrs.
- template <class U>
- bool operator==(unique_ptr<U> const& p2) const;
- template <class U>
- bool operator!=(unique_ptr<U> const& p2) const;
-};
-
-// Free functions
-template <class C>
-void swap(unique_ptr<C>& p1, unique_ptr<C>& p2) {
- p1.swap(p2);
-}
-
-template <class C>
-bool operator==(C* p1, const unique_ptr<C>& p2) {
- return p1 == p2.get();
-}
-
-template <class C>
-bool operator!=(C* p1, const unique_ptr<C>& p2) {
- return p1 != p2.get();
-}
-
-template <typename T>
-std::ostream& operator<<(std::ostream& out, const unique_ptr<T>& p) {
- return out << p.get();
-}
-
-} // namespace nonstd
-
-#endif // NONSTD_UNIQUE_PTR_H_
diff --git a/third_party/base/nonstd_unique_ptr_unittest.cpp b/third_party/base/nonstd_unique_ptr_unittest.cpp
deleted file mode 100644
index 1dcfe48b02..0000000000
--- a/third_party/base/nonstd_unique_ptr_unittest.cpp
+++ /dev/null
@@ -1,391 +0,0 @@
-// Copyright 2015 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <sstream>
-#include <utility>
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "macros.h"
-#include "nonstd_unique_ptr.h"
-
-using nonstd::unique_ptr;
-
-namespace {
-
-// Used to test depth subtyping.
-class CtorDtorLoggerParent {
- public:
- virtual ~CtorDtorLoggerParent() {}
-
- virtual void SetPtr(int* ptr) = 0;
-
- virtual int SomeMeth(int x) const = 0;
-};
-
-class CtorDtorLogger : public CtorDtorLoggerParent {
- public:
- CtorDtorLogger() : ptr_(nullptr) {}
- explicit CtorDtorLogger(int* ptr) { SetPtr(ptr); }
- ~CtorDtorLogger() override { --*ptr_; }
-
- void SetPtr(int* ptr) override {
- ptr_ = ptr;
- ++*ptr_;
- }
-
- int SomeMeth(int x) const override { return x; }
-
- private:
- int* ptr_;
-
- // Disallow evil constructors.
- CtorDtorLogger(const CtorDtorLogger&) = delete;
- void operator=(const CtorDtorLogger&) = delete;
-};
-
-struct CountingDeleter {
- explicit CountingDeleter(int* count) : count_(count) {}
- inline void operator()(double* ptr) const { (*count_)++; }
- int* count_;
-};
-
-// Do not delete this function! It's existence is to test that you can
-// return a temporarily constructed version of the scoper.
-unique_ptr<CtorDtorLogger> TestReturnOfType(int* constructed) {
- return unique_ptr<CtorDtorLogger>(new CtorDtorLogger(constructed));
-}
-
-} // namespace
-
-TEST(UniquePtrTest, MoveTest) {
- int constructed = 0;
- int constructed4 = 0;
- {
- unique_ptr<CtorDtorLogger> ptr1(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(ptr1);
-
- unique_ptr<CtorDtorLogger> ptr2(std::move(ptr1));
- EXPECT_EQ(1, constructed);
- EXPECT_FALSE(ptr1);
- EXPECT_TRUE(ptr2);
-
- unique_ptr<CtorDtorLogger> ptr3;
- ptr3 = std::move(ptr2);
- EXPECT_EQ(1, constructed);
- EXPECT_FALSE(ptr2);
- EXPECT_TRUE(ptr3);
-
- unique_ptr<CtorDtorLogger> ptr4(new CtorDtorLogger(&constructed4));
- EXPECT_EQ(1, constructed4);
- ptr4 = std::move(ptr3);
- EXPECT_EQ(0, constructed4);
- EXPECT_FALSE(ptr3);
- EXPECT_TRUE(ptr4);
- }
- EXPECT_EQ(0, constructed);
-}
-
-TEST(UniquePtrTest, UniquePtr) {
- int constructed = 0;
-
- // Ensure size of unique_ptr<> doesn't increase unexpectedly.
- static_assert(sizeof(int*) >= sizeof(unique_ptr<int>),
- "unique_ptr_larger_than_raw_ptr");
-
- {
- unique_ptr<CtorDtorLogger> scoper(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(scoper.get());
-
- EXPECT_EQ(10, scoper->SomeMeth(10));
- EXPECT_EQ(10, scoper.get()->SomeMeth(10));
- EXPECT_EQ(10, (*scoper).SomeMeth(10));
- }
- EXPECT_EQ(0, constructed);
-
- // Test reset() and release()
- {
- unique_ptr<CtorDtorLogger> scoper(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(scoper.get());
-
- scoper.reset(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(scoper.get());
-
- scoper.reset();
- EXPECT_EQ(0, constructed);
- EXPECT_FALSE(scoper.get());
-
- scoper.reset(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(scoper.get());
-
- CtorDtorLogger* take = scoper.release();
- EXPECT_EQ(1, constructed);
- EXPECT_FALSE(scoper.get());
- delete take;
- EXPECT_EQ(0, constructed);
-
- scoper.reset(new CtorDtorLogger(&constructed));
- EXPECT_EQ(1, constructed);
- EXPECT_TRUE(scoper.get());
- }
- EXPECT_EQ(0, constructed);
-
- // Test swap(), == and !=
- {
- unique_ptr<CtorDtorLogger> scoper1;
- unique_ptr<CtorDtorLogger> scoper2;
- EXPECT_TRUE(scoper1 == scoper2.get());
- EXPECT_FALSE(scoper1 != scoper2.get());
-
- CtorDtorLogger* logger = new CtorDtorLogger(&constructed);
- scoper1.reset(logger);
- EXPECT_EQ(logger, scoper1.get());
- EXPECT_FALSE(scoper2.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
-
- scoper2.swap(scoper1);
- EXPECT_EQ(logger, scoper2.get());
- EXPECT_FALSE(scoper1.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
- }
- EXPECT_EQ(0, constructed);
-}
-
-TEST(UniquePtrTest, UniquePtrWithArray) {
- static const int kNumLoggers = 12;
-
- int constructed = 0;
-
- {
- unique_ptr<CtorDtorLogger[]> scoper(new CtorDtorLogger[kNumLoggers]);
- EXPECT_TRUE(scoper);
- EXPECT_EQ(&scoper[0], scoper.get());
- for (int i = 0; i < kNumLoggers; ++i) {
- scoper[i].SetPtr(&constructed);
- }
- EXPECT_EQ(12, constructed);
-
- EXPECT_EQ(10, scoper.get()->SomeMeth(10));
- EXPECT_EQ(10, scoper[2].SomeMeth(10));
- }
- EXPECT_EQ(0, constructed);
-
- // Test reset() and release()
- {
- unique_ptr<CtorDtorLogger[]> scoper;
- EXPECT_FALSE(scoper.get());
- EXPECT_FALSE(scoper.release());
- EXPECT_FALSE(scoper.get());
- scoper.reset();
- EXPECT_FALSE(scoper.get());
-
- scoper.reset(new CtorDtorLogger[kNumLoggers]);
- for (int i = 0; i < kNumLoggers; ++i) {
- scoper[i].SetPtr(&constructed);
- }
- EXPECT_EQ(12, constructed);
- scoper.reset();
- EXPECT_EQ(0, constructed);
-
- scoper.reset(new CtorDtorLogger[kNumLoggers]);
- for (int i = 0; i < kNumLoggers; ++i) {
- scoper[i].SetPtr(&constructed);
- }
- EXPECT_EQ(12, constructed);
- CtorDtorLogger* ptr = scoper.release();
- EXPECT_EQ(12, constructed);
- delete[] ptr;
- EXPECT_EQ(0, constructed);
- }
- EXPECT_EQ(0, constructed);
-
- // Test swap(), ==, !=, and type-safe Boolean.
- {
- unique_ptr<CtorDtorLogger[]> scoper1;
- unique_ptr<CtorDtorLogger[]> scoper2;
- EXPECT_TRUE(scoper1 == scoper2.get());
- EXPECT_FALSE(scoper1 != scoper2.get());
-
- CtorDtorLogger* loggers = new CtorDtorLogger[kNumLoggers];
- for (int i = 0; i < kNumLoggers; ++i) {
- loggers[i].SetPtr(&constructed);
- }
- scoper1.reset(loggers);
- EXPECT_TRUE(scoper1);
- EXPECT_EQ(loggers, scoper1.get());
- EXPECT_FALSE(scoper2);
- EXPECT_FALSE(scoper2.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
-
- scoper2.swap(scoper1);
- EXPECT_EQ(loggers, scoper2.get());
- EXPECT_FALSE(scoper1.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
- }
- EXPECT_EQ(0, constructed);
-}
-
-TEST(UniquePtrTest, ReturnTypeBehavior) {
- int constructed = 0;
-
- // Test that we can return a unique_ptr.
- {
- CtorDtorLogger* logger = new CtorDtorLogger(&constructed);
- unique_ptr<CtorDtorLogger> scoper(logger);
- EXPECT_EQ(1, constructed);
- }
- EXPECT_EQ(0, constructed);
-
- // Test uncaught return type not leak.
- {
- CtorDtorLogger* logger = new CtorDtorLogger(&constructed);
- unique_ptr<CtorDtorLogger> scoper(logger);
- EXPECT_EQ(1, constructed);
- }
- EXPECT_EQ(0, constructed);
-
- // Call TestReturnOfType() so the compiler doesn't warn for an unused
- // function.
- { TestReturnOfType(&constructed); }
- EXPECT_EQ(0, constructed);
-}
-
-TEST(UniquePtrTest, CustomDeleter) {
- double dummy_value; // Custom deleter never touches this value.
- int deletes = 0;
- int alternate_deletes = 0;
-
- // Normal delete support.
- {
- deletes = 0;
- unique_ptr<double, CountingDeleter> scoper(&dummy_value,
- CountingDeleter(&deletes));
- EXPECT_EQ(0, deletes);
- EXPECT_TRUE(scoper.get());
- }
- EXPECT_EQ(1, deletes);
-
- // Test reset() and release().
- deletes = 0;
- {
- unique_ptr<double, CountingDeleter> scoper(nullptr,
- CountingDeleter(&deletes));
- EXPECT_FALSE(scoper.get());
- EXPECT_FALSE(scoper.release());
- EXPECT_FALSE(scoper.get());
- scoper.reset();
- EXPECT_FALSE(scoper.get());
- EXPECT_EQ(0, deletes);
-
- scoper.reset(&dummy_value);
- scoper.reset();
- EXPECT_EQ(1, deletes);
-
- scoper.reset(&dummy_value);
- EXPECT_EQ(&dummy_value, scoper.release());
- }
- EXPECT_EQ(1, deletes);
-
- // Test get_deleter().
- deletes = 0;
- alternate_deletes = 0;
- {
- unique_ptr<double, CountingDeleter> scoper(&dummy_value,
- CountingDeleter(&deletes));
- // Call deleter manually.
- EXPECT_EQ(0, deletes);
- scoper.get_deleter()(&dummy_value);
- EXPECT_EQ(1, deletes);
-
- // Deleter is still there after reset.
- scoper.reset();
- EXPECT_EQ(2, deletes);
- scoper.get_deleter()(&dummy_value);
- EXPECT_EQ(3, deletes);
-
- // Deleter can be assigned into (matches C++11 unique_ptr<> spec).
- scoper.get_deleter() = CountingDeleter(&alternate_deletes);
- scoper.reset(&dummy_value);
- EXPECT_EQ(0, alternate_deletes);
- }
- EXPECT_EQ(3, deletes);
- EXPECT_EQ(1, alternate_deletes);
-
- // Test swap(), ==, !=, and type-safe Boolean.
- {
- unique_ptr<double, CountingDeleter> scoper1(nullptr,
- CountingDeleter(&deletes));
- unique_ptr<double, CountingDeleter> scoper2(nullptr,
- CountingDeleter(&deletes));
- EXPECT_TRUE(scoper1 == scoper2.get());
- EXPECT_FALSE(scoper1 != scoper2.get());
-
- scoper1.reset(&dummy_value);
- EXPECT_TRUE(scoper1);
- EXPECT_EQ(&dummy_value, scoper1.get());
- EXPECT_FALSE(scoper2);
- EXPECT_FALSE(scoper2.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
-
- scoper2.swap(scoper1);
- EXPECT_EQ(&dummy_value, scoper2.get());
- EXPECT_FALSE(scoper1.get());
- EXPECT_FALSE(scoper1 == scoper2.get());
- EXPECT_TRUE(scoper1 != scoper2.get());
- }
-}
-
-unique_ptr<int> NullIntReturn() {
- return nullptr;
-}
-
-TEST(UniquePtrTest, Nullptr) {
- unique_ptr<int> scoper1(nullptr);
- unique_ptr<int> scoper2(new int);
- scoper2 = nullptr;
- unique_ptr<int> scoper3(NullIntReturn());
- unique_ptr<int> scoper4 = NullIntReturn();
- EXPECT_EQ(nullptr, scoper1.get());
- EXPECT_EQ(nullptr, scoper2.get());
- EXPECT_EQ(nullptr, scoper3.get());
- EXPECT_EQ(nullptr, scoper4.get());
-}
-
-unique_ptr<int[]> NullIntArrayReturn() {
- return nullptr;
-}
-
-TEST(UniquePtrTest, NullptrArray) {
- unique_ptr<int[]> scoper1(nullptr);
- unique_ptr<int[]> scoper2(new int[3]);
- scoper2 = nullptr;
- unique_ptr<int[]> scoper3(NullIntArrayReturn());
- unique_ptr<int[]> scoper4 = NullIntArrayReturn();
- EXPECT_EQ(nullptr, scoper1.get());
- EXPECT_EQ(nullptr, scoper2.get());
- EXPECT_EQ(nullptr, scoper3.get());
- EXPECT_EQ(nullptr, scoper4.get());
-}
-
-// Logging a unique_ptr<T> to an ostream shouldn't convert it to a boolean
-// value first.
-TEST(ScopedPtrTest, LoggingDoesntConvertToBoolean) {
- unique_ptr<int> x(new int);
- std::stringstream s1;
- s1 << x;
-
- std::stringstream s2;
- s2 << x.get();
-
- EXPECT_EQ(s2.str(), s1.str());
-}
diff --git a/third_party/base/numerics/safe_conversions_impl.h b/third_party/base/numerics/safe_conversions_impl.h
index c974ee0590..e1c4c3b756 100644
--- a/third_party/base/numerics/safe_conversions_impl.h
+++ b/third_party/base/numerics/safe_conversions_impl.h
@@ -9,7 +9,6 @@
#include <limits>
#include "third_party/base/macros.h"
-#include "third_party/base/template_util.h"
namespace pdfium {
namespace base {
diff --git a/third_party/base/numerics/safe_math.h b/third_party/base/numerics/safe_math.h
index 9540e83321..013af1eb60 100644
--- a/third_party/base/numerics/safe_math.h
+++ b/third_party/base/numerics/safe_math.h
@@ -166,15 +166,15 @@ class CheckedNumeric {
template <typename Src>
static CheckedNumeric<T> cast(
Src u,
- typename enable_if<std::numeric_limits<Src>::is_specialized, int>::type =
- 0) {
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized,
+ int>::type = 0) {
return u;
}
template <typename Src>
static CheckedNumeric<T> cast(
const CheckedNumeric<Src>& u,
- typename enable_if<!is_same<Src, T>::value, int>::type = 0) {
+ typename std::enable_if<!std::is_same<Src, T>::value, int>::type = 0) {
return u;
}
diff --git a/third_party/base/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h
index 4209446694..f219cf52bb 100644
--- a/third_party/base/numerics/safe_math_impl.h
+++ b/third_party/base/numerics/safe_math_impl.h
@@ -10,10 +10,10 @@
#include <cmath>
#include <cstdlib>
#include <limits>
+#include <type_traits>
#include "safe_conversions.h"
#include "third_party/base/macros.h"
-#include "third_party/base/template_util.h"
namespace pdfium {
namespace base {
@@ -65,21 +65,21 @@ struct IntegerForSizeAndSign<8, false> {
template <typename Integer>
struct UnsignedIntegerForSize {
- typedef typename enable_if<
+ typedef typename std::enable_if<
std::numeric_limits<Integer>::is_integer,
typename IntegerForSizeAndSign<sizeof(Integer), false>::type>::type type;
};
template <typename Integer>
struct SignedIntegerForSize {
- typedef typename enable_if<
+ typedef typename std::enable_if<
std::numeric_limits<Integer>::is_integer,
typename IntegerForSizeAndSign<sizeof(Integer), true>::type>::type type;
};
template <typename Integer>
struct TwiceWiderInteger {
- typedef typename enable_if<
+ typedef typename std::enable_if<
std::numeric_limits<Integer>::is_integer,
typename IntegerForSizeAndSign<
sizeof(Integer) * 2,
@@ -88,8 +88,9 @@ struct TwiceWiderInteger {
template <typename Integer>
struct PositionOfSignBit {
- static const typename enable_if<std::numeric_limits<Integer>::is_integer,
- size_t>::type value = 8 * sizeof(Integer) - 1;
+ static const typename std::enable_if<std::numeric_limits<Integer>::is_integer,
+ size_t>::type value =
+ 8 * sizeof(Integer) - 1;
};
// Helper templates for integer manipulations.
@@ -112,7 +113,7 @@ T BinaryComplement(T x) {
// way to coalesce things into the CheckedNumericState specializations below.
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_integer, T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
CheckedAdd(T x, T y, RangeConstraint* validity) {
// Since the value of x+y is undefined if we have a signed type, we compute
// it using the unsigned type of the same size.
@@ -135,7 +136,7 @@ CheckedAdd(T x, T y, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_integer, T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
CheckedSub(T x, T y, RangeConstraint* validity) {
// Since the value of x+y is undefined if we have a signed type, we compute
// it using the unsigned type of the same size.
@@ -162,9 +163,9 @@ CheckedSub(T x, T y, RangeConstraint* validity) {
// slow case we need to manually check that the result won't be truncated by
// checking with division against the appropriate bound.
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer && sizeof(T) * 2 <= sizeof(uintmax_t),
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ sizeof(T) * 2 <= sizeof(uintmax_t),
+ T>::type
CheckedMul(T x, T y, RangeConstraint* validity) {
typedef typename TwiceWiderInteger<T>::type IntermediateType;
IntermediateType tmp =
@@ -174,9 +175,10 @@ CheckedMul(T x, T y, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_integer&& std::numeric_limits<
- T>::is_signed&&(sizeof(T) * 2 > sizeof(uintmax_t)),
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ std::numeric_limits<T>::is_signed &&
+ (sizeof(T) * 2 > sizeof(uintmax_t)),
+ T>::type
CheckedMul(T x, T y, RangeConstraint* validity) {
// If either side is zero then the result will be zero.
if (!x || !y) {
@@ -203,10 +205,10 @@ CheckedMul(T x, T y, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_integer &&
- !std::numeric_limits<T>::is_signed &&
- (sizeof(T) * 2 > sizeof(uintmax_t)),
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ !std::numeric_limits<T>::is_signed &&
+ (sizeof(T) * 2 > sizeof(uintmax_t)),
+ T>::type
CheckedMul(T x, T y, RangeConstraint* validity) {
*validity = (y == 0 || x <= std::numeric_limits<T>::max() / y)
? RANGE_VALID
@@ -216,11 +218,11 @@ CheckedMul(T x, T y, RangeConstraint* validity) {
// Division just requires a check for an invalid negation on signed min/-1.
template <typename T>
-T CheckedDiv(
- T x,
- T y,
- RangeConstraint* validity,
- typename enable_if<std::numeric_limits<T>::is_integer, int>::type = 0) {
+T CheckedDiv(T x,
+ T y,
+ RangeConstraint* validity,
+ typename std::enable_if<std::numeric_limits<T>::is_integer,
+ int>::type = 0) {
if (std::numeric_limits<T>::is_signed && x == std::numeric_limits<T>::min() &&
y == static_cast<T>(-1)) {
*validity = RANGE_OVERFLOW;
@@ -232,27 +234,27 @@ T CheckedDiv(
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer&& std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ std::numeric_limits<T>::is_signed,
+ T>::type
CheckedMod(T x, T y, RangeConstraint* validity) {
*validity = y > 0 ? RANGE_VALID : RANGE_INVALID;
return x % y;
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ !std::numeric_limits<T>::is_signed,
+ T>::type
CheckedMod(T x, T y, RangeConstraint* validity) {
*validity = RANGE_VALID;
return x % y;
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer&& std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ std::numeric_limits<T>::is_signed,
+ T>::type
CheckedNeg(T value, RangeConstraint* validity) {
*validity =
value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
@@ -261,9 +263,9 @@ CheckedNeg(T value, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ !std::numeric_limits<T>::is_signed,
+ T>::type
CheckedNeg(T value, RangeConstraint* validity) {
// The only legal unsigned negation is zero.
*validity = value ? RANGE_UNDERFLOW : RANGE_VALID;
@@ -272,9 +274,9 @@ CheckedNeg(T value, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer&& std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ std::numeric_limits<T>::is_signed,
+ T>::type
CheckedAbs(T value, RangeConstraint* validity) {
*validity =
value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
@@ -282,9 +284,9 @@ CheckedAbs(T value, RangeConstraint* validity) {
}
template <typename T>
-typename enable_if<
- std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
- T>::type
+typename std::enable_if<std::numeric_limits<T>::is_integer &&
+ !std::numeric_limits<T>::is_signed,
+ T>::type
CheckedAbs(T value, RangeConstraint* validity) {
// Absolute value of a positive is just its identiy.
*validity = RANGE_VALID;
@@ -293,12 +295,12 @@ CheckedAbs(T value, RangeConstraint* validity) {
// These are the floating point stubs that the compiler needs to see. Only the
// negation operation is ever called.
-#define BASE_FLOAT_ARITHMETIC_STUBS(NAME) \
- template <typename T> \
- typename enable_if<std::numeric_limits<T>::is_iec559, T>::type \
- Checked##NAME(T, T, RangeConstraint*) { \
- NOTREACHED(); \
- return 0; \
+#define BASE_FLOAT_ARITHMETIC_STUBS(NAME) \
+ template <typename T> \
+ typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type \
+ Checked##NAME(T, T, RangeConstraint*) { \
+ NOTREACHED(); \
+ return 0; \
}
BASE_FLOAT_ARITHMETIC_STUBS(Add)
@@ -310,14 +312,14 @@ BASE_FLOAT_ARITHMETIC_STUBS(Mod)
#undef BASE_FLOAT_ARITHMETIC_STUBS
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedNeg(
+typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedNeg(
T value,
RangeConstraint*) {
return -value;
}
template <typename T>
-typename enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedAbs(
+typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedAbs(
T value,
RangeConstraint*) {
return std::abs(value);
@@ -377,8 +379,8 @@ class CheckedNumericState<T, NUMERIC_INTEGER> {
template <typename Src>
explicit CheckedNumericState(
Src value,
- typename enable_if<std::numeric_limits<Src>::is_specialized, int>::type =
- 0)
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized,
+ int>::type = 0)
: value_(static_cast<T>(value)),
validity_(DstRangeRelationToSrcRange<T>(value)) {}
@@ -402,7 +404,8 @@ class CheckedNumericState<T, NUMERIC_FLOATING> {
CheckedNumericState(
Src value,
RangeConstraint validity,
- typename enable_if<std::numeric_limits<Src>::is_integer, int>::type = 0) {
+ typename std::enable_if<std::numeric_limits<Src>::is_integer, int>::type =
+ 0) {
switch (DstRangeRelationToSrcRange<T>(value)) {
case RANGE_VALID:
value_ = static_cast<T>(value);
@@ -428,8 +431,8 @@ class CheckedNumericState<T, NUMERIC_FLOATING> {
template <typename Src>
explicit CheckedNumericState(
Src value,
- typename enable_if<std::numeric_limits<Src>::is_specialized, int>::type =
- 0)
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized,
+ int>::type = 0)
: value_(static_cast<T>(value)) {}
// Copy constructor.
diff --git a/third_party/base/template_util.h b/third_party/base/template_util.h
deleted file mode 100644
index 719f3f1c3a..0000000000
--- a/third_party/base/template_util.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
-#define PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
-
-#include <cstddef> // For size_t.
-
-namespace pdfium {
-namespace base {
-
-template<class T, T v>
-struct integral_constant {
- static const T value = v;
- typedef T value_type;
- typedef integral_constant<T, v> type;
-};
-
-typedef integral_constant<bool, true> true_type;
-typedef integral_constant<bool, false> false_type;
-
-template <class T, class U> struct is_same : public false_type {};
-template <class T>
-struct is_same<T, T> : true_type {};
-
-template<bool B, class T = void>
-struct enable_if {};
-
-template<class T>
-struct enable_if<true, T> { typedef T type; };
-
-namespace internal {
-
-// Types YesType and NoType are guaranteed such that sizeof(YesType) <
-// sizeof(NoType).
-typedef char YesType;
-
-struct NoType {
- YesType dummy[2];
-};
-
-// This class is an implementation detail for is_convertible, and you
-// don't need to know how it works to use is_convertible. For those
-// who care: we declare two different functions, one whose argument is
-// of type To and one with a variadic argument list. We give them
-// return types of different size, so we can use sizeof to trick the
-// compiler into telling us which function it would have chosen if we
-// had called it with an argument of type From. See Alexandrescu's
-// _Modern C++ Design_ for more details on this sort of trick.
-
-struct ConvertHelper {
- template <typename To>
- static YesType Test(To);
-
- template <typename To>
- static NoType Test(...);
-
- template <typename From>
- static From& Create();
-};
-
-} // namespace internal
-
-// Inherits from true_type if From is convertible to To, false_type otherwise.
-//
-// Note that if the type is convertible, this will be a true_type REGARDLESS
-// of whether or not the conversion would emit a warning.
-template <typename From, typename To>
-struct is_convertible
- : integral_constant<bool,
- sizeof(internal::ConvertHelper::Test<To>(
- internal::ConvertHelper::Create<From>())) ==
- sizeof(internal::YesType)> {};
-
-} // namespace base
-} // namespace pdfium
-
-#endif // PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp
index 639b9af4a9..89a4632633 100644
--- a/third_party/third_party.gyp
+++ b/third_party/third_party.gyp
@@ -314,13 +314,11 @@
'sources': [
'base/logging.h',
'base/macros.h',
- 'base/nonstd_unique_ptr.h',
'base/numerics/safe_conversions.h',
'base/numerics/safe_conversions_impl.h',
'base/numerics/safe_math.h',
'base/numerics/safe_math_impl.h',
'base/stl_util.h',
- 'base/template_util.h',
],
},
],
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
index a35d1e60bf..c9ce62ece7 100644
--- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp
@@ -1314,7 +1314,7 @@ FX_BOOL CFWL_EditImp::UpdateOffset() {
}
FX_BOOL CFWL_EditImp::UpdateOffset(IFWL_ScrollBar* pScrollBar,
FX_FLOAT fPosChanged) {
- if (pScrollBar == m_pHorzScrollBar) {
+ if (pScrollBar == m_pHorzScrollBar.get()) {
m_fScrollOffsetX += fPosChanged;
} else {
m_fScrollOffsetY += fPosChanged;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
index 000036d7c1..f315af2fed 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h
@@ -7,7 +7,8 @@
#ifndef _FWL_COMBOBOX_IMP_H
#define _FWL_COMBOBOX_IMP_H
-#include "third_party/base/nonstd_unique_ptr.h"
+#include <memory>
+
#include "xfa/src/fwl/src/basewidget/include/fwl_editimp.h"
#include "xfa/src/fwl/src/basewidget/include/fwl_listboximp.h"
@@ -164,8 +165,8 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
CFX_RectF m_rtList;
CFX_RectF m_rtProxy;
CFX_RectF m_rtHandler;
- nonstd::unique_ptr<IFWL_Edit> m_pEdit;
- nonstd::unique_ptr<IFWL_ListBox> m_pListBox;
+ std::unique_ptr<IFWL_Edit> m_pEdit;
+ std::unique_ptr<IFWL_ListBox> m_pListBox;
IFWL_Form* m_pForm;
FX_BOOL m_bLButtonDown;
FX_BOOL m_bUpFormHandler;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
index 118d11ff17..1fc82fb281 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h
@@ -7,7 +7,7 @@
#ifndef _FWL_DATETIMEPICKER_IMP_H
#define _FWL_DATETIMEPICKER_IMP_H
-#include "third_party/base/nonstd_unique_ptr.h"
+#include <memory>
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
@@ -180,9 +180,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
int32_t m_iMonth;
int32_t m_iDay;
FX_BOOL m_bLBtnDown;
- nonstd::unique_ptr<IFWL_DateTimeEdit> m_pEdit;
- nonstd::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal;
- nonstd::unique_ptr<IFWL_DateTimeForm> m_pForm;
+ std::unique_ptr<IFWL_DateTimeEdit> m_pEdit;
+ std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal;
+ std::unique_ptr<IFWL_DateTimeForm> m_pForm;
FX_FLOAT m_fBtn;
class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP {
public:
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
index 1a610c74b0..650523cf16 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h
@@ -7,7 +7,7 @@
#ifndef _FWL_EDIT_IMP_H
#define _FWL_EDIT_IMP_H
-#include "third_party/base/nonstd_unique_ptr.h"
+#include <memory>
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
@@ -164,9 +164,9 @@ class CFWL_EditImp : public CFWL_WidgetImp, public IFDE_TxtEdtEventSink {
FX_BOOL m_bSetRange;
int32_t m_iMin;
int32_t m_iMax;
- nonstd::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
- nonstd::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
- nonstd::unique_ptr<IFWL_Caret> m_pCaret;
+ std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
+ std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
+ std::unique_ptr<IFWL_Caret> m_pCaret;
CFX_WideString m_wsCache;
friend class CFWL_TxtEdtEventSink;
friend class CFWL_EditImpDelegate;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
index d7a7d9062c..7700f49eb4 100644
--- a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
+++ b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h
@@ -7,7 +7,7 @@
#ifndef _FWL_LISTBOX_IMP_H
#define _FWL_LISTBOX_IMP_H
-#include "third_party/base/nonstd_unique_ptr.h"
+#include <memory>
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
@@ -86,8 +86,8 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp {
CFX_RectF m_rtClient;
CFX_RectF m_rtStatic;
CFX_RectF m_rtConent;
- nonstd::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
- nonstd::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
+ std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
+ std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
FX_DWORD m_dwTTOStyles;
int32_t m_iTTOAligns;
FWL_HLISTITEM m_hAnchor;
diff --git a/xfa/src/fwl/src/lightwidget/barcode.cpp b/xfa/src/fwl/src/lightwidget/barcode.cpp
index a0704c4bd9..1868b12686 100644
--- a/xfa/src/fwl/src/lightwidget/barcode.cpp
+++ b/xfa/src/fwl/src/lightwidget/barcode.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_Barcode* CFWL_Barcode::Create() {
return new CFWL_Barcode;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_Barcode> pBarcode(IFWL_Barcode::Create(
+ std::unique_ptr<IFWL_Barcode> pBarcode(IFWL_Barcode::Create(
m_pProperties->MakeWidgetImpProperties(&m_barcodeData)));
FWL_ERR ret = pBarcode->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/caret.cpp b/xfa/src/fwl/src/lightwidget/caret.cpp
index f0ee8a5166..dcf6852ec0 100644
--- a/xfa/src/fwl/src/lightwidget/caret.cpp
+++ b/xfa/src/fwl/src/lightwidget/caret.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_Caret* CFWL_Caret::Create() {
return new CFWL_Caret;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create(
+ std::unique_ptr<IFWL_Caret> pCaret(IFWL_Caret::Create(
m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
FWL_ERR ret = pCaret->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/checkbox.cpp b/xfa/src/fwl/src/lightwidget/checkbox.cpp
index b1b938435b..ea72cb622d 100644
--- a/xfa/src/fwl/src/lightwidget/checkbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/checkbox.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_CheckBox* CFWL_CheckBox::Create() {
return new CFWL_CheckBox;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_CheckBox> pCheckBox(IFWL_CheckBox::Create(
+ std::unique_ptr<IFWL_CheckBox> pCheckBox(IFWL_CheckBox::Create(
m_pProperties->MakeWidgetImpProperties(&m_checkboxData), nullptr));
FWL_ERR ret = pCheckBox->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/combobox.cpp b/xfa/src/fwl/src/lightwidget/combobox.cpp
index 556601f32f..5756a6d832 100644
--- a/xfa/src/fwl/src/lightwidget/combobox.cpp
+++ b/xfa/src/fwl/src/lightwidget/combobox.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_ComboBox* CFWL_ComboBox::Create() {
return new CFWL_ComboBox;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create(
+ std::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create(
m_pProperties->MakeWidgetImpProperties(&m_comboBoxData)));
FWL_ERR ret = pComboBox->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
index 2b897943f1..1ceb4698e5 100644
--- a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
+++ b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_DateTimePicker* CFWL_DateTimePicker::Create() {
return new CFWL_DateTimePicker;
}
@@ -15,7 +18,7 @@ FWL_ERR CFWL_DateTimePicker::Initialize(
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_DateTimePicker> pDateTimePicker(
+ std::unique_ptr<IFWL_DateTimePicker> pDateTimePicker(
IFWL_DateTimePicker::Create(
m_pProperties->MakeWidgetImpProperties(&m_DateTimePickerDP),
nullptr));
diff --git a/xfa/src/fwl/src/lightwidget/edit.cpp b/xfa/src/fwl/src/lightwidget/edit.cpp
index a8a16850bf..d16c57b964 100644
--- a/xfa/src/fwl/src/lightwidget/edit.cpp
+++ b/xfa/src/fwl/src/lightwidget/edit.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_Edit* CFWL_Edit::Create() {
return new CFWL_Edit;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create(
+ std::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create(
m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
FWL_ERR ret = pEdit->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/listbox.cpp b/xfa/src/fwl/src/lightwidget/listbox.cpp
index ae8b6b944e..541baf4fed 100644
--- a/xfa/src/fwl/src/lightwidget/listbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/listbox.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_ListBox* CFWL_ListBox::Create() {
return new CFWL_ListBox;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_ListBox> pListBox(IFWL_ListBox::Create(
+ std::unique_ptr<IFWL_ListBox> pListBox(IFWL_ListBox::Create(
m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr));
FWL_ERR ret = pListBox->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/picturebox.cpp b/xfa/src/fwl/src/lightwidget/picturebox.cpp
index 6979966e38..33ca399c78 100644
--- a/xfa/src/fwl/src/lightwidget/picturebox.cpp
+++ b/xfa/src/fwl/src/lightwidget/picturebox.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_PictureBox* CFWL_PictureBox::Create() {
return new CFWL_PictureBox;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create(
+ std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create(
m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr));
FWL_ERR ret = pPictureBox->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/pushbutton.cpp b/xfa/src/fwl/src/lightwidget/pushbutton.cpp
index a3df89106d..9efe11cba1 100644
--- a/xfa/src/fwl/src/lightwidget/pushbutton.cpp
+++ b/xfa/src/fwl/src/lightwidget/pushbutton.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_PushButton* CFWL_PushButton::Create() {
return new CFWL_PushButton;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create(
+ std::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create(
m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr));
FWL_ERR ret = pPushButton->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/scrollbar.cpp b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
index 2b9fc8be1c..6bca86c98c 100644
--- a/xfa/src/fwl/src/lightwidget/scrollbar.cpp
+++ b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
+
CFWL_ScrollBar* CFWL_ScrollBar::Create() {
return new CFWL_ScrollBar;
}
@@ -14,7 +17,7 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create(
+ std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create(
m_pProperties->MakeWidgetImpProperties(nullptr), nullptr));
FWL_ERR ret = pScrollBar->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
index c2ee5636ce..908fe3d357 100644
--- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
+++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "../../../foxitlib.h"
#include "../core/include/fwl_targetimp.h"
#include "../core/include/fwl_noteimp.h"
@@ -11,6 +13,7 @@
#include "../core/include/fwl_panelimp.h"
#include "../core/include/fwl_formimp.h"
#include "../core/include/fwl_threadimp.h"
+
CFWL_ToolTip* CFWL_ToolTip::Create() {
return new CFWL_ToolTip;
}
@@ -20,7 +23,7 @@ FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) {
if (pProperties) {
*m_pProperties = *pProperties;
}
- nonstd::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create(
+ std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create(
m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr));
FWL_ERR ret = pToolTip->Initialize();
if (ret != FWL_ERR_Succeeded) {
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
index 1a6afa7e1e..662e773af3 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -22,10 +22,11 @@
#include "BC_OneDimWriter.h"
+#include <memory>
+
#include "../BC_Writer.h"
#include "../barcode.h"
#include "../common/BC_CommonBitMatrix.h"
-#include "third_party/base/nonstd_unique_ptr.h"
CBC_OneDimWriter::CBC_OneDimWriter() {
m_locTextLoc = BC_TEXT_LOC_BELOWEMBED;
@@ -132,7 +133,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text,
FX_FLOAT geWidth,
int32_t fontSize,
FX_FLOAT& charsLen) {
- nonstd::unique_ptr<CFX_UnicodeEncodingEx> encoding(
+ std::unique_ptr<CFX_UnicodeEncodingEx> encoding(
FX_CreateFontEncodingEx(cFont));
int32_t length = text.GetLength();
diff --git a/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp
index d983b5d6f8..69069817aa 100644
--- a/xfa/src/fxgraphics/src/fx_graphics.cpp
+++ b/xfa/src/fxgraphics/src/fx_graphics.cpp
@@ -4,9 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <memory>
+
#include "fx_path_generator.h"
#include "pre.h"
-#include "third_party/base/nonstd_unique_ptr.h"
class CAGG_Graphics {
public:
@@ -1099,7 +1100,7 @@ FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text,
FX_DWORD* charCodes,
FXTEXT_CHARPOS* charPos,
CFX_RectF& rect) {
- nonstd::unique_ptr<CFX_UnicodeEncoding> encoding(
+ std::unique_ptr<CFX_UnicodeEncoding> encoding(
new CFX_UnicodeEncoding(_info._font));
int32_t length = text.GetLength();
FX_FLOAT penX = (FX_FLOAT)rect.left;