From 5eb9f7b4542cca34d4af96ea43be362446a4794f Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 18 Jul 2014 09:14:35 -0700 Subject: 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 --- fpdfsdk/src/fpdf_sysfontinfo.cpp | 2 +- fpdfsdk/src/fpdfsave.cpp | 2 +- fpdfsdk/src/fpdfview.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp index 4c6b784981..cc75e635b3 100644 --- a/fpdfsdk/src/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp @@ -7,7 +7,7 @@ #include "../include/fsdk_define.h" #include "../include/fpdf_sysfontinfo.h" -class CSysFontInfo_Ext : public IFX_SystemFontInfo +class CSysFontInfo_Ext FX_FINAL : public IFX_SystemFontInfo { public: FPDF_SYSFONTINFO* m_pInfo; diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index 6637c784fe..8025946ba8 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -13,7 +13,7 @@ #include #endif -class CFX_IFileWrite:public IFX_StreamWrite +class CFX_IFileWrite FX_FINAL : public IFX_StreamWrite { public: diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 8a97c286aa..b6b89289e4 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -283,7 +283,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BY extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); -class CMemFile: public IFX_FileRead, public CFX_Object +class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object { public: CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} -- cgit v1.2.3