summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 22:16:22 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 22:16:22 -0700
commit2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (patch)
tree91eea8ae70b87c632a06fba52ea06c0842e30878 /fpdfsdk/src
parent62b2e912dc2a508972fbf01b25f7449c39ff1543 (diff)
downloadpdfium-2b1a2d528469cda4e9f3e36d3c7a649e0d476480.tar.xz
Merge to XFA: Use override in more classes in fpdfsdk/
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287193005 . (cherry picked from commit 0f6b51c0fdd14f5762bf3c7412ac59c825443cc3) Review URL: https://codereview.chromium.org/1288393004 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp18
-rw-r--r--fpdfsdk/src/fpdf_sysfontinfo.cpp36
-rw-r--r--fpdfsdk/src/fpdfsave.cpp13
-rw-r--r--fpdfsdk/src/fpdfview.cpp2
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp91
-rw-r--r--fpdfsdk/src/fsdk_rendercontext.cpp3
-rw-r--r--fpdfsdk/src/javascript/JS_Context.cpp2
-rw-r--r--fpdfsdk/src/javascript/JS_Object.cpp2
-rw-r--r--fpdfsdk/src/javascript/app.cpp2
-rw-r--r--fpdfsdk/src/javascript/color.cpp3
-rw-r--r--fpdfsdk/src/javascript/event.cpp3
-rw-r--r--fpdfsdk/src/javascript/global.cpp2
-rw-r--r--fpdfsdk/src/javascript/util.cpp3
13 files changed, 91 insertions, 89 deletions
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index 4100fe2db9..b9cf69d647 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -14,10 +14,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);
}
@@ -28,17 +30,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;
@@ -46,12 +50,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 a0fdb5083d..53610b040e 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 f56cc442f0..7a666bceb8 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -22,10 +22,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;
};
@@ -49,6 +51,10 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) {
return TRUE;
}
+void CFX_IFileWrite::Release() {
+ delete this;
+}
+
#define XFA_DATASETS 0
#define XFA_FORMS 1
@@ -311,7 +317,6 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
bRet = FileMaker.Create(pStreamWrite, flags);
_SendPostSaveToXFADoc(pDoc);
- // pDoc->_ClearChangeMark();
for (int i = 0; i < fileList.GetSize(); i++) {
IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i);
@@ -319,7 +324,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
}
fileList.RemoveAll();
- delete pStreamWrite;
+ pStreamWrite->Release();
return bRet;
}
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 87b23c31e3..89571a6f9d 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -323,6 +323,8 @@ class CMemFile final : public IFX_FileRead {
}
private:
+ ~CMemFile() override {}
+
uint8_t* m_pBuf;
FX_FILESIZE m_size;
};
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index d471dc1e83..a119781a46 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -20,81 +20,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 9c142e6b1e..b51b5aa265 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 aff491a084..547446861f 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 c3bf837727..ff915a8b38 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -107,7 +107,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();
CPDFXFA_App::GetInstance()->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;