diff options
author | weili <weili@chromium.org> | 2016-07-24 08:08:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-24 08:08:24 -0700 |
commit | 9f515bcccb40e8ae251bbe8afc1ef6c4db1f05a8 (patch) | |
tree | 83db93367d20abf65f8b4eb459f54d9f60a05732 /fpdfsdk/fpdf_ext.cpp | |
parent | 8f19e4bc617d19e871137be55a34992e421585ad (diff) | |
download | pdfium-9f515bcccb40e8ae251bbe8afc1ef6c4db1f05a8.tar.xz |
Use actual type instead CFX_Deletable
Change two places that used CFX_Deletable to use actual types. This makes
the type more obvious, and avoids unnecessary casts.
Review-Url: https://codereview.chromium.org/2180443002
Diffstat (limited to 'fpdfsdk/fpdf_ext.cpp')
-rw-r--r-- | fpdfsdk/fpdf_ext.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index d262e3c0a5..bb2c9ff0a5 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -12,6 +12,7 @@ #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_memory.h" #include "core/fxcrt/include/fx_xml.h" #include "fpdfsdk/include/fsdk_define.h" @@ -19,33 +20,15 @@ #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" #endif // PDF_ENABLE_XFA -#define FPDFSDK_UNSUPPORT_CALL 100 - -class CFSDK_UnsupportInfo_Adapter : public CFX_Deletable { - public: - explicit CFSDK_UnsupportInfo_Adapter(UNSUPPORT_INFO* unsp_info) - : m_unsp_info(unsp_info) {} - - void ReportError(int nErrorType); - - private: - UNSUPPORT_INFO* const m_unsp_info; -}; - -void CFSDK_UnsupportInfo_Adapter::ReportError(int nErrorType) { - if (m_unsp_info && m_unsp_info->FSDK_UnSupport_Handler) { - m_unsp_info->FSDK_UnSupport_Handler(m_unsp_info, nErrorType); - } -} - FX_BOOL FPDF_UnSupportError(int nError) { CFSDK_UnsupportInfo_Adapter* pAdapter = - static_cast<CFSDK_UnsupportInfo_Adapter*>( - CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter()); + CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); if (!pAdapter) return FALSE; - pAdapter->ReportError(nError); + UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo()); + if (info && info->FSDK_UnSupport_Handler) + info->FSDK_UnSupport_Handler(info, nError); return TRUE; } @@ -54,8 +37,8 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { if (!unsp_info || unsp_info->version != 1) return FALSE; - CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter(std::unique_ptr<CFX_Deletable>( - new CFSDK_UnsupportInfo_Adapter(unsp_info))); + CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( + WrapUnique(new CFSDK_UnsupportInfo_Adapter(unsp_info))); return TRUE; } |