diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-14 14:23:57 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-14 14:23:57 -0700 |
commit | 0f6b51c0fdd14f5762bf3c7412ac59c825443cc3 (patch) | |
tree | 782b1fe38da61394477cabc08c712c11e57e50dd /fpdfsdk/src | |
parent | c2c3f7b5f0396409451a9d344f35ec1929a76e9f (diff) | |
download | pdfium-0f6b51c0fdd14f5762bf3c7412ac59c825443cc3.tar.xz |
Use override in more classes in fpdfsdk/
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1287193005 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r-- | fpdfsdk/src/fpdf_dataavail.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/src/fpdf_sysfontinfo.cpp | 36 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfsave.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/src/fsdk_mgr.cpp | 91 | ||||
-rw-r--r-- | fpdfsdk/src/fsdk_rendercontext.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Context.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Object.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/color.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/event.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/global.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/util.cpp | 3 |
13 files changed, 95 insertions, 91 deletions
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index 8f9638d90a..cc0833bc98 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.cpp @@ -11,10 +11,12 @@ extern void ProcessParseError(FX_DWORD err_code); class CFPDF_FileAvailWrap : public IFX_FileAvail { public: CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } + ~CFPDF_FileAvailWrap() override {} void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } - virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) { + // IFX_FileAvail + FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); } @@ -25,17 +27,19 @@ class CFPDF_FileAvailWrap : public IFX_FileAvail { class CFPDF_FileAccessWrap : public IFX_FileRead { public: CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } + ~CFPDF_FileAccessWrap() override {} void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } - virtual FX_FILESIZE GetSize() { return m_pFileAccess->m_FileLen; } + // IFX_FileRead + FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, (uint8_t*)buffer, size); } - virtual void Release() {} + void Release() override {} private: FPDF_FILEACCESS* m_pFileAccess; @@ -43,12 +47,14 @@ class CFPDF_FileAccessWrap : public IFX_FileRead { class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { public: - CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { + explicit CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { m_pDownloadHints = pDownloadHints; } + ~CFPDF_DownloadHintsWrap() override {} public: - virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) { + // IFX_DownloadHints + void AddSegment(FX_FILESIZE offset, FX_DWORD size) override { m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); } diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp index 804efe3020..a004e86ba1 100644 --- a/fpdfsdk/src/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp @@ -10,15 +10,15 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { public: - CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {} + explicit CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {} - virtual void Release() override { + void Release() override { if (m_pInfo->Release) m_pInfo->Release(m_pInfo); delete this; } - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { + FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { if (m_pInfo->EnumFonts) { m_pInfo->EnumFonts(m_pInfo, pMapper); return TRUE; @@ -26,34 +26,34 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return FALSE; } - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* family, - int& iExact) override { + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* family, + int& iExact) override { if (m_pInfo->MapFont) return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, family, &iExact); return NULL; } - virtual void* GetFont(const FX_CHAR* family) override { + void* GetFont(const FX_CHAR* family) override { if (m_pInfo->GetFont) return m_pInfo->GetFont(m_pInfo, family); return NULL; } - virtual FX_DWORD GetFontData(void* hFont, - FX_DWORD table, - uint8_t* buffer, - FX_DWORD size) override { + FX_DWORD GetFontData(void* hFont, + FX_DWORD table, + uint8_t* buffer, + FX_DWORD size) override { if (m_pInfo->GetFontData) return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); return 0; } - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { + FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { if (m_pInfo->GetFaceName == NULL) return FALSE; FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); @@ -66,7 +66,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return TRUE; } - virtual FX_BOOL GetFontCharset(void* hFont, int& charset) override { + FX_BOOL GetFontCharset(void* hFont, int& charset) override { if (m_pInfo->GetFontCharset) { charset = m_pInfo->GetFontCharset(m_pInfo, hFont); return TRUE; @@ -74,13 +74,13 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return FALSE; } - virtual void DeleteFont(void* hFont) override { + void DeleteFont(void* hFont) override { if (m_pInfo->DeleteFont) m_pInfo->DeleteFont(m_pInfo, hFont); } private: - ~CFX_ExternalFontInfo() {} + ~CFX_ExternalFontInfo() override {} FPDF_SYSFONTINFO* const m_pInfo; }; diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 54c9253d2e..36553092ee 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -18,10 +18,12 @@ class CFX_IFileWrite final : public IFX_StreamWrite { public: CFX_IFileWrite(); FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct); - virtual FX_BOOL WriteBlock(const void* pData, size_t size) override; - virtual void Release() override {} + FX_BOOL WriteBlock(const void* pData, size_t size) override; + void Release() override; protected: + ~CFX_IFileWrite() override {} + FPDF_FILEWRITE* m_pFileWriteStruct; }; @@ -45,6 +47,10 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) { return TRUE; } +void CFX_IFileWrite::Release() { + delete this; +} + FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, FPDF_FILEWRITE* pFileWrite, FPDF_DWORD flags, @@ -70,7 +76,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, pStreamWrite = new CFX_IFileWrite; pStreamWrite->Init(pFileWrite); bRet = FileMaker.Create(pStreamWrite, flags); - delete pStreamWrite; + pStreamWrite->Release(); return bRet; } diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 2700aebddc..a1d5689c79 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -71,9 +71,10 @@ CCodec_ModuleMgr* g_pCodecModule = nullptr; class CFontMapper : public IPDF_FontMapper { public: CFontMapper(); - virtual ~CFontMapper(); + ~CFontMapper() override; - virtual FT_Face FindSubstFont( + // IPDF_FontMapper + FT_Face FindSubstFont( CPDF_Document* pDoc, // [IN] The PDF document const CFX_ByteString& face_name, // [IN] Original name FX_BOOL bTrueType, // [IN] TrueType or Type1 @@ -82,7 +83,7 @@ class CFontMapper : public IPDF_FontMapper { int CharsetCP, // [IN] code page for charset (see Win32 GetACP()) FX_BOOL bVertical, CPDF_SubstFont* pSubstFont // [OUT] Subst font data - ); + ) override; FT_Face m_SysFace; }; @@ -204,6 +205,8 @@ class CMemFile final : public IFX_FileRead { } private: + ~CMemFile() {} + uint8_t* m_pBuf; FX_FILESIZE m_size; }; diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index df9a0ff316..67dea80d0d 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -17,81 +17,64 @@ #include <ctime> #endif -// extern CPDFDoc_Environment* g_pFormFillApp; class CFX_SystemHandler : public IFX_SystemHandler { public: CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {} + ~CFX_SystemHandler() override {} public: - virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect); - virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect); - - virtual FX_BOOL IsSelectionImplemented(); - - virtual CFX_WideString GetClipboardText(FX_HWND hWnd) { return L""; } - virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) { + // IFX_SystemHandler + void InvalidateRect(FX_HWND hWnd, FX_RECT rect) override; + void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) override; + FX_BOOL IsSelectionImplemented() override; + CFX_WideString GetClipboardText(FX_HWND hWnd) override { return L""; } + FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) override { return FALSE; } - - virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) {} - virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) {} - - /*cursor style - FXCT_ARROW - FXCT_NESW - FXCT_NWSE - FXCT_VBEAM - FXCT_HBEAM - FXCT_HAND - */ - virtual void SetCursor(int32_t nCursorType); - - virtual FX_HMENU CreatePopupMenu() { return NULL; } - virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, - int32_t nIDNewItem, - CFX_WideString string) { + void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) override {} + void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) override {} + void SetCursor(int32_t nCursorType) override; + FX_HMENU CreatePopupMenu() override { return NULL; } + FX_BOOL AppendMenuItem(FX_HMENU hMenu, + int32_t nIDNewItem, + CFX_WideString string) override { return FALSE; } - virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, - int32_t nIDItem, - FX_BOOL bEnabled) { + FX_BOOL EnableMenuItem(FX_HMENU hMenu, + int32_t nIDItem, + FX_BOOL bEnabled) override { return FALSE; } - virtual int32_t TrackPopupMenu(FX_HMENU hMenu, - int32_t x, - int32_t y, - FX_HWND hParent) { + int32_t TrackPopupMenu(FX_HMENU hMenu, + int32_t x, + int32_t y, + FX_HWND hParent) override { return -1; } - virtual void DestroyMenu(FX_HMENU hMenu) {} - - virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset); - virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, - CFX_ByteString sFontFaceName); - virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, - CFX_ByteString sFontFaceName, - uint8_t nCharset); - - virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc); - virtual void KillTimer(int32_t nID); - - virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) { + void DestroyMenu(FX_HMENU hMenu) override {} + CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) override; + FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, + CFX_ByteString sFontFaceName) override; + CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, + CFX_ByteString sFontFaceName, + uint8_t nCharset) override; + int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) override; + void KillTimer(int32_t nID) override; + FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsSHIFTKeyDown(nFlag); } - virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) { + FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsCTRLKeyDown(nFlag); } - virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) { + FX_BOOL IsALTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsALTKeyDown(nFlag); } - virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) { + FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsINSERTKeyDown(nFlag); } - - virtual FX_SYSTEMTIME GetLocalTime(); - - virtual int32_t GetCharSet() { return m_nCharSet; } - virtual void SetCharSet(int32_t nCharSet) { m_nCharSet = nCharSet; } + FX_SYSTEMTIME GetLocalTime() override; + int32_t GetCharSet() override { return m_nCharSet; } + void SetCharSet(int32_t nCharSet) override { m_nCharSet = nCharSet; } private: CPDFDoc_Environment* m_pEnv; diff --git a/fpdfsdk/src/fsdk_rendercontext.cpp b/fpdfsdk/src/fsdk_rendercontext.cpp index 1320824236..e282d01db7 100644 --- a/fpdfsdk/src/fsdk_rendercontext.cpp +++ b/fpdfsdk/src/fsdk_rendercontext.cpp @@ -36,6 +36,9 @@ IFSDK_PAUSE_Adapter::IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause) { m_IPause = IPause; } +IFSDK_PAUSE_Adapter::~IFSDK_PAUSE_Adapter() { +} + FX_BOOL IFSDK_PAUSE_Adapter::NeedToPauseNow() { if (m_IPause->NeedToPauseNow) { return m_IPause->NeedToPauseNow(m_IPause); diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index 6e935e8647..3fedd13b21 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -19,7 +19,7 @@ CJS_Context::CJS_Context(CJS_Runtime* pRuntime) m_pEventHandler = new CJS_EventHandler(this); } -CJS_Context::~CJS_Context(void) { +CJS_Context::~CJS_Context() { delete m_pEventHandler; } diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index 96e1d1d564..02978982d8 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -89,7 +89,7 @@ CJS_Object::CJS_Object(JSFXObject pObject) : m_pEmbedObj(NULL) { m_pObject.Reset(m_pIsolate, pObject); }; -CJS_Object::~CJS_Object(void) { +CJS_Object::~CJS_Object() { m_pObject.Reset(); }; diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 1b84508fd6..8d895ab260 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -112,7 +112,7 @@ IMPLEMENT_JS_CLASS(CJS_App, app) app::app(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject), m_bCalculate(true), m_bRuntimeHighLight(false) {} -app::~app(void) { +app::~app() { for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) delete m_aTimer[i]; diff --git a/fpdfsdk/src/javascript/color.cpp b/fpdfsdk/src/javascript/color.cpp index 0659ab94a4..c6d13fc284 100644 --- a/fpdfsdk/src/javascript/color.cpp +++ b/fpdfsdk/src/javascript/color.cpp @@ -65,7 +65,8 @@ color::color(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) { m_crLTGray = CPWL_Color(COLORTYPE_GRAY, 0.75); } -color::~color(void) {} +color::~color() { +} void color::ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array) { switch (color.nColorType) { diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp index 4bcdcce3a0..492f225d18 100644 --- a/fpdfsdk/src/javascript/event.cpp +++ b/fpdfsdk/src/javascript/event.cpp @@ -50,7 +50,8 @@ IMPLEMENT_JS_CLASS(CJS_Event, event) event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {} -event::~event(void) {} +event::~event() { +} FX_BOOL event::change(IFXJS_Context* cc, CJS_PropValue& vp, diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index ee0591b950..17aa00e31d 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -106,7 +106,7 @@ FX_BOOL CJS_Global::InitInstance(IFXJS_Context* cc) { global_alternate::global_alternate(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject), m_pApp(NULL) {} -global_alternate::~global_alternate(void) { +global_alternate::~global_alternate() { DestroyGlobalPersisitentVariables(); m_pApp->GetRuntimeFactory()->ReleaseGlobalData(); } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index c735b971dc..85092dab17 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -48,7 +48,8 @@ IMPLEMENT_JS_CLASS(CJS_Util, util) util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} -util::~util(void) {} +util::~util() { +} struct stru_TbConvert { const FX_WCHAR* lpszJSMark; |