diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-01-09 10:46:50 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-01-09 10:46:50 -0800 |
commit | b9e0190938f62bf21df078e47190a62ba33ddab2 (patch) | |
tree | 474749da63ac6890c008f9535b335bebee1d7cc8 /core | |
parent | b07772a31f5dff723af620bc57c71daa246995c0 (diff) | |
download | pdfium-b9e0190938f62bf21df078e47190a62ba33ddab2.tar.xz |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fpdfapi/fpdf_parser.h | 17 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_render.h | 2 | ||||
-rw-r--r-- | core/include/fpdfdoc/fpdf_ap.h | 3 | ||||
-rw-r--r-- | core/include/fpdfdoc/fpdf_tagged.h | 1 | ||||
-rw-r--r-- | core/include/fpdfdoc/fpdf_vt.h | 7 | ||||
-rw-r--r-- | core/include/fxcodec/fx_codec_provider.h | 4 | ||||
-rw-r--r-- | core/include/fxcrt/fx_arb.h | 3 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 6 | ||||
-rw-r--r-- | core/include/fxcrt/fx_stream.h | 4 | ||||
-rw-r--r-- | core/include/fxge/fpf.h | 5 | ||||
-rw-r--r-- | core/include/fxge/fx_dib.h | 3 | ||||
-rw-r--r-- | core/include/fxge/fx_font.h | 8 | ||||
-rw-r--r-- | core/include/fxge/fx_ge.h | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.h | 5 | ||||
-rw-r--r-- | core/src/fpdfdoc/tagged_int.h | 9 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_Module.h | 1 | ||||
-rw-r--r-- | core/src/fxcrt/fx_arabic.h | 4 |
18 files changed, 60 insertions, 30 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index da22dc72ca..d2fdad4cfb 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -49,7 +49,7 @@ class CFX_PrivateData; class IPDF_EnumPageHandler { public: - + virtual ~IPDF_EnumPageHandler() { } virtual FX_BOOL EnumPage(CPDF_Dictionary* pPageDict) = 0; }; class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects @@ -247,8 +247,7 @@ class CPDF_SyntaxParser : public CFX_Object public: CPDF_SyntaxParser(); - - ~CPDF_SyntaxParser(); + virtual ~CPDF_SyntaxParser(); void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset); @@ -366,7 +365,7 @@ struct PARSE_CONTEXT { class IPDF_DocParser : public CFX_Object { public: - + virtual ~IPDF_DocParser() { } virtual FX_DWORD GetRootObjNum() = 0; virtual FX_DWORD GetInfoObjNum() = 0; @@ -402,8 +401,7 @@ class CPDF_Parser FX_FINAL : public IPDF_DocParser public: CPDF_Parser(); - - ~CPDF_Parser(); + ~CPDF_Parser() override; FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse = FALSE); @@ -853,13 +851,13 @@ protected: class IFX_FileAvail { public: - + virtual ~IFX_FileAvail() { } virtual FX_BOOL IsDataAvail( FX_FILESIZE offset, FX_DWORD size) = 0; }; class IFX_DownloadHints { public: - + virtual ~IFX_DownloadHints() { } virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0; }; #define PDF_IS_LINEARIZED 1 @@ -871,13 +869,12 @@ public: class IPDF_DataAvail { public: + virtual ~IPDF_DataAvail() { } virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) = 0; - virtual void SetDocument(CPDF_Document* pDoc) = 0; - virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) = 0; virtual FX_BOOL IsLinearized() = 0; diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h index c059bedb2b..e2801f61f2 100644 --- a/core/include/fpdfapi/fpdf_render.h +++ b/core/include/fpdfapi/fpdf_render.h @@ -138,7 +138,7 @@ protected: class IPDF_BackgroundDraw { public: - + virtual ~IPDF_BackgroundDraw() { } virtual void OnDrawBackground( CFX_RenderDevice* pBitmapDevice, const CFX_AffineMatrix* pOriginal2Bitmap diff --git a/core/include/fpdfdoc/fpdf_ap.h b/core/include/fpdfdoc/fpdf_ap.h index 78f9676221..02bbf249c4 100644 --- a/core/include/fpdfdoc/fpdf_ap.h +++ b/core/include/fpdfdoc/fpdf_ap.h @@ -13,9 +13,8 @@ class IPVT_FontMap { public: - + virtual ~IPVT_FontMap() { } virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex) = 0; - virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0; }; struct CPVT_Dash { diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h index f3ab01ea28..1a2a5d4ffa 100644 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ b/core/include/fpdfdoc/fpdf_tagged.h @@ -68,6 +68,7 @@ struct CPDF_StructKid { class CPDF_StructElement : public CFX_Object { public: + virtual ~CPDF_StructElement() { } virtual CPDF_StructTree* GetTree() const = 0; diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index 41025cbe2e..3e23c3a1a3 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -275,6 +275,7 @@ struct CPVT_Section { class IPDF_VariableText_Provider { public: + virtual ~IPDF_VariableText_Provider() { } virtual FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) = 0; @@ -291,6 +292,7 @@ public: class IPDF_VariableText_Iterator { public: + virtual ~IPDF_VariableText_Iterator() { } virtual FX_BOOL NextWord() = 0; @@ -323,11 +325,9 @@ public: class IPDF_VariableText { public: - static IPDF_VariableText* NewVariableText(); static void DelVariableText(IPDF_VariableText* pVT); -public: virtual IPDF_VariableText_Provider* SetProvider(IPDF_VariableText_Provider * pProvider) = 0; @@ -440,5 +440,8 @@ public: virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0; virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0; + +protected: + ~IPDF_VariableText() { } }; #endif diff --git a/core/include/fxcodec/fx_codec_provider.h b/core/include/fxcodec/fx_codec_provider.h index a3ef396a27..53733e7b1d 100644 --- a/core/include/fxcodec/fx_codec_provider.h +++ b/core/include/fxcodec/fx_codec_provider.h @@ -9,7 +9,6 @@ class IFX_JpegProvider { public: - virtual void Release() = 0; virtual void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; @@ -49,5 +48,8 @@ public: virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr = NULL) = 0; + +protected: + ~IFX_JpegProvider() { } }; #endif diff --git a/core/include/fxcrt/fx_arb.h b/core/include/fxcrt/fx_arb.h index 4950f81716..a7b25c1877 100644 --- a/core/include/fxcrt/fx_arb.h +++ b/core/include/fxcrt/fx_arb.h @@ -16,5 +16,8 @@ public: virtual FX_BOOL EndChar() = 0; virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) = 0; virtual void Reset() = 0; + +protected: + ~IFX_BidiChar() { } }; #endif diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 98a540c455..62324f5b2a 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -240,7 +240,7 @@ class IFX_BufferArchive { public: IFX_BufferArchive(FX_STRSIZE size); - + virtual ~IFX_BufferArchive() { } virtual void Clear(); @@ -271,7 +271,7 @@ class CFX_FileBufferArchive : public IFX_BufferArchive, public CFX_Object { public: CFX_FileBufferArchive(FX_STRSIZE size = 32768); - ~CFX_FileBufferArchive(); + ~CFX_FileBufferArchive() override; virtual void Clear(); FX_BOOL AttachFile(IFX_StreamWrite *pFile, FX_BOOL bTakeover = FALSE); @@ -1377,7 +1377,7 @@ protected: class IFX_Pause { public: - + virtual ~IFX_Pause() { } virtual FX_BOOL NeedToPauseNow() = 0; }; class CFX_DataFilter : public CFX_Object diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h index 8e298f7727..e54af579b6 100644 --- a/core/include/fxcrt/fx_stream.h +++ b/core/include/fxcrt/fx_stream.h @@ -65,7 +65,7 @@ FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst); class IFX_StreamWrite { public: - + virtual ~IFX_StreamWrite() { } virtual void Release() = 0; virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; @@ -91,6 +91,7 @@ IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename); class IFX_StreamRead { public: + virtual ~IFX_StreamRead() { } virtual void Release() = 0; @@ -103,7 +104,6 @@ public: class IFX_FileRead : IFX_StreamRead { public: - virtual void Release() = 0; virtual FX_FILESIZE GetSize() = 0; diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 99d9b7c999..28d028cfbb 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -12,6 +12,7 @@ class IFPF_Font; class IFPF_DeviceModule { public: + virtual ~IFPF_DeviceModule() { } virtual void Destroy() = 0; virtual IFPF_FontMgr* GetFontMgr() = 0; }; @@ -41,10 +42,14 @@ public: virtual FX_INT32 GetHeight() const = 0; virtual FX_INT32 GetItalicAngle() const = 0; virtual FX_DWORD GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWORD dwSize) = 0; + +protected: + ~IFPF_Font() { } }; class IFPF_FontMgr { public: + virtual ~IFPF_FontMgr() { } virtual void LoadSystemFonts() = 0; virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; virtual void LoadPrivateFont(FX_BSTR bsFileName) = 0; diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index d8a2003548..f7e435d966 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -402,16 +402,15 @@ protected: class IFX_ScanlineComposer { public: + virtual ~IFX_ScanlineComposer() { } virtual void ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBYTE scan_extra_alpha = NULL) = 0; - virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette) = 0; }; class CFX_ScanlineCompositor : public CFX_Object { public: - CFX_ScanlineCompositor(); ~CFX_ScanlineCompositor(); diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index 52f8f30d8d..bf9bb40500 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -243,6 +243,7 @@ public: class IFX_FontEnumerator { public: + virtual ~IFX_FontEnumerator() { } virtual void HitFont() = 0; @@ -251,6 +252,7 @@ public: class IFX_AdditionalFontEnum { public: + virtual ~IFX_AdditionalFontEnum() { } virtual int CountFiles() = 0; virtual IFX_FileStream* GetFontFile(int index) = 0; }; @@ -296,6 +298,7 @@ class IFX_SystemFontInfo : public CFX_Object public: static IFX_SystemFontInfo* CreateDefault(); virtual void Release() = 0; + virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0; virtual void* GetFont(FX_LPCSTR face) = 0; @@ -311,6 +314,8 @@ public: { return NULL; } +protected: + ~IFX_SystemFontInfo() { } }; class CFX_FolderFontInfo : public IFX_SystemFontInfo { @@ -423,6 +428,9 @@ class IFX_GSUBTable public: virtual void Release() = 0; virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; + +protected: + ~IFX_GSUBTable() { } }; IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont); #endif diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h index 82719ffda6..0c4bce8003 100644 --- a/core/include/fxge/fx_ge.h +++ b/core/include/fxge/fx_ge.h @@ -637,9 +637,11 @@ public: class IFX_PSOutput { public: - - virtual void OutputPS(FX_LPCSTR string, int len) = 0; virtual void Release() = 0; + virtual void OutputPS(FX_LPCSTR string, int len) = 0; + +protected: + ~IFX_PSOutput() { } }; class CPSFont; class CFX_PSRenderer : public CFX_Object diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index 42f77de57b..e317aa67fd 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -446,7 +446,7 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { return pGsubTable; } - delete pGsubTable; + pGsubTable->Release(); } return NULL; } diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h index c381a01304..6b1b4f2443 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h @@ -414,6 +414,11 @@ public: delete this; } virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) FX_OVERRIDE; + CFX_CTTGSUBTable m_GsubImp; + +private: + ~CFX_GSUBTable() { } }; #endif + diff --git a/core/src/fpdfdoc/tagged_int.h b/core/src/fpdfdoc/tagged_int.h index d190db6427..7efd682887 100644 --- a/core/src/fpdfdoc/tagged_int.h +++ b/core/src/fpdfdoc/tagged_int.h @@ -6,7 +6,9 @@ #ifndef _FPDF_TAGGED_INT_H_ #define _FPDF_TAGGED_INT_H_ -class CPDF_StructTreeImpl; + +#include "../../include/fpdfdoc/fpdf_tagged.h" + class CPDF_StructElementImpl; class CPDF_StructTreeImpl : public CPDF_StructTree { @@ -36,7 +38,6 @@ class CPDF_StructElementImpl FX_FINAL : public CPDF_StructElement { public: CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* pParent, CPDF_Dictionary* pDict); - ~CPDF_StructElementImpl(); CPDF_StructTree* GetTree() const { return m_pTree; @@ -79,13 +80,15 @@ public: CPDF_StructElementImpl* Retain(); void Release(); protected: + ~CPDF_StructElementImpl(); + CPDF_StructTreeImpl* m_pTree; CFX_ByteString m_Type; CPDF_StructElementImpl* m_pParent; CPDF_Dictionary* m_pDict; CFX_ArrayTemplate<CPDF_StructKid> m_Kids; - int m_RefCount; + friend class CPDF_StructTreeImpl; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 3a01eb094c..711cf4047b 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -10,6 +10,7 @@ class CJBig2_Module { public: + virtual ~CJBig2_Module() { } virtual void *JBig2_Malloc(FX_DWORD dwSize) = 0; diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h index c404449af0..70ffc9c1ac 100644 --- a/core/src/fxcrt/fx_arabic.h +++ b/core/src/fxcrt/fx_arabic.h @@ -22,7 +22,9 @@ public: virtual FX_BOOL EndChar() FX_OVERRIDE; virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) FX_OVERRIDE; virtual void Reset() FX_OVERRIDE; -protected: + +private: + ~CFX_BidiChar() { } FX_BOOL m_bSeparateNeutral; FX_INT32 m_iCurStart; FX_INT32 m_iCurCount; |