summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-07-18 09:14:35 -0700
committerNico Weber <thakis@chromium.org>2014-07-18 09:14:35 -0700
commit5eb9f7b4542cca34d4af96ea43be362446a4794f (patch)
treeb0a0fdd6b1c525bf3633d6de2b79b70058e2cc7d /core/src
parenta9c29e006f74fefd96d5c3eab9d8233b321b296a (diff)
downloadpdfium-5eb9f7b4542cca34d4af96ea43be362446a4794f.tar.xz
pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.
Calling `delete` on an object of a type that has virtual functions but not a virtual destructor is questionable: Since the object has virtual functions, it likely has subclasses, so if it's deleted through the base pointer and the destructor isn't virtual, the subclass destructor won't be called. In most cases, the classes getting deleted can just be marked final to tell the compiler that it can't possibly have subclasses (this also enables the compiler to generate better code). Two classes didn't have any sub- or superclasses but virtual functions - this doesn't make sense, so make all methods of these classes non-virtual. (Also delete an unused function on one of the two classes.) In one case, a class actually did have a subclass that needs to be deleted virtually, so mark one destructor as virtual. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/370853002
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h2
-rw-r--r--core/src/fpdfdoc/tagged_int.h2
-rw-r--r--core/src/fxcrt/extension.h4
-rw-r--r--core/src/fxcrt/fx_arabic.h2
-rw-r--r--core/src/fxge/apple/apple_int.h2
5 files changed, 6 insertions, 6 deletions
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index bf9c7a4c42..26f67fbd18 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -406,7 +406,7 @@ private:
struct TFeatureList FeatureList;
struct TLookupList LookupList;
};
-class CFX_GSUBTable : public IFX_GSUBTable, public CFX_Object
+class CFX_GSUBTable FX_FINAL : public IFX_GSUBTable, public CFX_Object
{
public:
virtual void Release()
diff --git a/core/src/fpdfdoc/tagged_int.h b/core/src/fpdfdoc/tagged_int.h
index 0ebf4084a4..d190db6427 100644
--- a/core/src/fpdfdoc/tagged_int.h
+++ b/core/src/fpdfdoc/tagged_int.h
@@ -32,7 +32,7 @@ protected:
CFX_ArrayTemplate<CPDF_StructElementImpl*> m_Kids;
friend class CPDF_StructElementImpl;
};
-class CPDF_StructElementImpl : public CPDF_StructElement
+class CPDF_StructElementImpl FX_FINAL : public CPDF_StructElement
{
public:
CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* pParent, CPDF_Dictionary* pDict);
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index db35387908..a736425d57 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -25,7 +25,7 @@ public:
virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
-class CFX_CRTFileStream : public IFX_FileStream, public CFX_Object
+class CFX_CRTFileStream FX_FINAL : public IFX_FileStream, public CFX_Object
{
public:
CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bUseRange(FALSE), m_nOffset(0), m_nSize(0) {}
@@ -117,7 +117,7 @@ public:
#define FX_MEMSTREAM_BlockSize (64 * 1024)
#define FX_MEMSTREAM_Consecutive 0x01
#define FX_MEMSTREAM_TakeOver 0x02
-class CFX_MemoryStream : public IFX_MemoryStream, public CFX_Object
+class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream, public CFX_Object
{
public:
CFX_MemoryStream(FX_BOOL bConsecutive)
diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h
index 503ec01696..1dc275b8c3 100644
--- a/core/src/fxcrt/fx_arabic.h
+++ b/core/src/fxcrt/fx_arabic.h
@@ -6,7 +6,7 @@
#ifndef _FX_ARABIC_IMP
#define _FX_ARABIC_IMP
-class CFX_BidiChar : public IFX_BidiChar, public CFX_Object
+class CFX_BidiChar FX_FINAL : public IFX_BidiChar, public CFX_Object
{
public:
CFX_BidiChar();
diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h
index 42d63628f2..a8fbe2fbaa 100644
--- a/core/src/fxge/apple/apple_int.h
+++ b/core/src/fxge/apple/apple_int.h
@@ -185,7 +185,7 @@ protected:
FX_INT32 _horzSize;
FX_INT32 _vertSize;
};
-class CFX_FontProvider : public IFX_FileRead
+class CFX_FontProvider FX_FINAL : public IFX_FileRead
{
public:
virtual void Release()