From b9e0190938f62bf21df078e47190a62ba33ddab2 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 9 Jan 2015 10:46:50 -0800 Subject: Fix -Wnon-virtual-dtor compiler warnings. This is done by explicitly adding a virtual dtor to interface classes, since the cost is small given that there are already virtual functions. The exceptions are for classes that have a Release() or Delete() method, in which case it is non-virtual and protected to indicate that the virtual class is never the deletion point. BUG= R=brucedawson@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/810883005 --- fpdfsdk/include/fsdk_annothandler.h | 22 ++++++++++++---------- fpdfsdk/include/fxedit/fx_edit.h | 26 +++++++++++++++++--------- fpdfsdk/include/javascript/IJavaScript.h | 9 ++++++--- fpdfsdk/include/pdfwindow/PWL_Edit.h | 1 + fpdfsdk/include/pdfwindow/PWL_EditCtrl.h | 1 + fpdfsdk/include/pdfwindow/PWL_IconList.h | 1 + fpdfsdk/include/pdfwindow/PWL_Note.h | 3 +++ fpdfsdk/include/pdfwindow/PWL_Wnd.h | 4 ++++ 8 files changed, 45 insertions(+), 22 deletions(-) (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h index 9f97c52596..5b8b42f60e 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -217,26 +217,28 @@ typedef int (*AI_COMPARE) (CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); class CPDFSDK_AnnotIterator { -protected: - CPDFSDK_Annot* NextAnnot (const CPDFSDK_Annot* pCurrent) ; - CPDFSDK_Annot* PrevAnnot (const CPDFSDK_Annot* pCurrent) ; - CPDFSDK_Annot* NextAnnot(int& index ) ; - CPDFSDK_Annot* PrevAnnot(int& index ) ; public: CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView, FX_BOOL bReverse, - FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL); + FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL); + virtual ~CPDFSDK_AnnotIterator() { } + virtual CPDFSDK_Annot* Next (const CPDFSDK_Annot* pCurrent) ; virtual CPDFSDK_Annot* Prev (const CPDFSDK_Annot* pCurrent) ; virtual CPDFSDK_Annot* Next(int& index ) ; virtual CPDFSDK_Annot* Prev(int& index ) ; virtual int Count(){return m_pIteratorAnnotList.GetSize();} - + virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView * pPageView,CFX_PtrArray* pList=NULL); - + void InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pCompare); + protected: - // CFX_PtrList m_pIteratorAnnotList; - CFX_PtrArray m_pIteratorAnnotList; + CPDFSDK_Annot* NextAnnot (const CPDFSDK_Annot* pCurrent) ; + CPDFSDK_Annot* PrevAnnot (const CPDFSDK_Annot* pCurrent) ; + CPDFSDK_Annot* NextAnnot(int& index ) ; + CPDFSDK_Annot* PrevAnnot(int& index ) ; + + CFX_PtrArray m_pIteratorAnnotList; FX_BOOL m_bReverse; FX_BOOL m_bIgnoreTopmost; FX_BOOL m_bCircle; diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index 95b9096159..a8cd711e11 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -44,6 +44,7 @@ class IFX_SystemHandler; class IFX_Edit_FontMap { public: + virtual ~IFX_Edit_FontMap() { } //map a fontindex to pdf font. virtual CPDF_Font * GetPDFFont(FX_INT32 nFontIndex) = 0; //get the alias of a pdf font. @@ -58,8 +59,8 @@ public: class IFX_Edit_Notify { - //this class is implemented by user public: + virtual ~IFX_Edit_Notify() { } //set the horizontal scrollbar information. virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, FX_FLOAT fContentMin, FX_FLOAT fContentMax, @@ -84,8 +85,9 @@ public: class IFX_Edit_OprNotify { - //this class is implemented by user public: + virtual ~IFX_Edit_OprNotify() { } + //OprType: 0 virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; //OprType: 1 @@ -143,10 +145,13 @@ public: class IFX_Edit_UndoItem { public: + virtual void Release() = 0; virtual void Undo() = 0; virtual void Redo() = 0; virtual CFX_WideString GetUndoTitle() = 0; - virtual void Release() = 0; + +protected: + ~IFX_Edit_UndoItem() { } }; class FXET_CLASS IFX_Edit @@ -155,8 +160,7 @@ public: static IFX_Edit* NewEdit(); static void DelEdit(IFX_Edit* pEdit); -public: - //set a IFX_Edit_FontMap pointer implemented by user. + //set a IFX_Edit_FontMap pointer implemented by user. virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; //if user don't like to use FontMap, implement VTProvider and set it directly. virtual void SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0; @@ -371,7 +375,6 @@ public: virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0; -public: static CFX_ByteString GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL, FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0); @@ -388,12 +391,15 @@ public: const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate& ObjArray); static void GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color); + +protected: + ~IFX_Edit() { } }; class IFX_List_Notify { - //this class is implemented by user public: + virtual ~IFX_List_Notify() { } //set the horizontal scrollbar information. virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, FX_FLOAT fContentMin, FX_FLOAT fContentMax, @@ -416,7 +422,6 @@ public: static IFX_List* NewList(); static void DelList(IFX_List* pList); -public: virtual void SetFontMap(IFX_Edit_FontMap * pFontMap) = 0; virtual void SetNotify(IFX_List_Notify * pNotify) = 0; @@ -465,7 +470,10 @@ public: virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0; virtual void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0; virtual FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0; + +protected: + ~IFX_List() { } }; -#endif +#endif diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index 7633bbb486..8ea9a4e89f 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -11,13 +11,13 @@ namespace v8 { class Platform; } -class IFXJS_Context +class IFXJS_Context { public: + virtual ~IFXJS_Context() { } virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) = 0; virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info) = 0; -public: virtual void OnApp_Init() = 0; virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0; @@ -31,7 +31,7 @@ public: virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0; virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0; virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0; - + virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0; virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0; virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0; @@ -88,6 +88,9 @@ public: virtual void Exit() = 0; virtual void Enter() = 0; virtual FX_BOOL IsEntered() = 0; + +protected: + ~IFXJS_Runtime() { } }; class CPDFDoc_Environment; diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index d86cb77d2c..7a4caaa6ef 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -14,6 +14,7 @@ class IPWL_SpellCheck; class IPWL_Filler_Notify { public: + virtual ~IPWL_Filler_Notify() { } virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top) virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h index b13d5e1e79..c9d87b217c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h @@ -30,6 +30,7 @@ class CPWL_Edit; class IPWL_Edit_Notify { public: + virtual ~IPWL_Edit_Notify() { } //when the position of caret is changed in edit virtual void OnCaretMove(FX_INT32 x1, FX_INT32 y1, FX_INT32 x2, FX_INT32 y2) {} virtual void OnContentChange(const CPDF_Rect& rcContent){} diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h index effabd0713..6b3d577504 100644 --- a/fpdfsdk/include/pdfwindow/PWL_IconList.h +++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h @@ -16,6 +16,7 @@ class CPWL_Label; class IPWL_IconList_Notify { public: + virtual ~IPWL_IconList_Notify() { } virtual void OnNoteListSelChanged(FX_INT32 nItemIndex) = 0; }; diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h index b3f73581b1..125271f48f 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Note.h +++ b/fpdfsdk/include/pdfwindow/PWL_Note.h @@ -27,6 +27,7 @@ class IPopup_Note; class IPWL_NoteNotify { public: + virtual ~IPWL_NoteNotify() { } virtual void OnNoteMove(const FX_RECT& rtWin) = 0; virtual void OnNoteShow(FX_BOOL bShow) = 0; virtual void OnNoteActivate(FX_BOOL bActive) = 0; @@ -45,12 +46,14 @@ public: class IPWL_NoteHandler { public: + virtual ~IPWL_NoteHandler() { } virtual void OnNoteColorChanged(const CPWL_Color& color) = 0; }; class IPWL_NoteItem { public: + virtual ~IPWL_NoteItem() { } virtual void SetPrivateData(void* pData) = 0; virtual void SetBkColor(const CPWL_Color& color) = 0; virtual void SetSubjectName(const CFX_WideString& sName) = 0; diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index c3dd9b7a70..51a3058993 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -168,6 +168,7 @@ inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2) class IPWL_SpellCheck { public: + virtual ~IPWL_SpellCheck() { } virtual FX_BOOL CheckWord(FX_LPCSTR sWord) = 0; virtual void SuggestWords(FX_LPCSTR sWord, CFX_ByteStringArray & sSuggest) = 0; }; @@ -175,6 +176,8 @@ public: class IPWL_Provider { public: + virtual ~IPWL_Provider() { } + //get a matrix which map user space to CWnd client space virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0; @@ -193,6 +196,7 @@ public: class IPWL_FocusHandler { public: + virtual ~IPWL_FocusHandler() { } virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0; virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0; }; -- cgit v1.2.3