summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_ext.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 350945e328..0a76a0d4be 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
+#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_xml.h"
#include "fpdfsdk/include/fsdk_define.h"
@@ -20,7 +21,7 @@
#define FPDFSDK_UNSUPPORT_CALL 100
-class CFSDK_UnsupportInfo_Adapter {
+class CFSDK_UnsupportInfo_Adapter : public CFX_Deletable {
public:
explicit CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info)
: m_unsp_info(unsp_info) {}
@@ -37,18 +38,13 @@ void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) {
}
}
-void FreeUnsupportInfo(void* pData) {
- CFSDK_UnsupportInfo_Adapter* pAdapter = (CFSDK_UnsupportInfo_Adapter*)pData;
- delete pAdapter;
-}
-
FX_BOOL FPDF_UnSupportError(int nError) {
CFSDK_UnsupportInfo_Adapter* pAdapter =
- (CFSDK_UnsupportInfo_Adapter*)CPDF_ModuleMgr::Get()->GetPrivateData(
- (void*)FPDFSDK_UNSUPPORT_CALL);
-
+ static_cast<CFSDK_UnsupportInfo_Adapter*>(
+ CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter());
if (!pAdapter)
return FALSE;
+
pAdapter->ReportError(nError);
return TRUE;
}
@@ -57,12 +53,9 @@ DLLEXPORT FPDF_BOOL STDCALL
FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
if (!unsp_info || unsp_info->version != 1)
return FALSE;
- CFSDK_UnsupportInfo_Adapter* pAdapter =
- new CFSDK_UnsupportInfo_Adapter(unsp_info);
-
- CPDF_ModuleMgr::Get()->SetPrivateData((void*)FPDFSDK_UNSUPPORT_CALL, pAdapter,
- &FreeUnsupportInfo);
+ CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter(std::unique_ptr<CFX_Deletable>(
+ new CFSDK_UnsupportInfo_Adapter(unsp_info)));
return TRUE;
}