From 368ed462dd6e5e63977ca2b2e56a7e83b3a3bdda Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 13 Aug 2014 17:12:28 -0700 Subject: Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes. Should there be cases where this fails to compile, it indicates a mistake, either an incorrectly declared overrriden virtual method, or a method that should be declared non-virtual. The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(), and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere, and are removed. Two members are removed that are no longer needed once those methods are removed. R=jam@chromium.org, jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/454983003 --- core/include/fpdfapi/fpdf_parser.h | 32 ++++++++++++++++---------------- core/include/fxcrt/fx_system.h | 4 ++++ 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'core/include') diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index feac6c67dc..7cab2117a2 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -413,9 +413,9 @@ public: void CloseParser(FX_BOOL bReParse = FALSE); - virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); + virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) FX_OVERRIDE; - virtual FX_BOOL IsOwner(); + virtual FX_BOOL IsOwner() FX_OVERRIDE; void SetPassword(const FX_CHAR* password) { @@ -463,16 +463,16 @@ public: return &m_Trailers; } - virtual FX_DWORD GetRootObjNum(); - virtual FX_DWORD GetInfoObjNum(); - virtual CPDF_Array* GetIDArray(); - virtual CPDF_Dictionary* GetEncryptDict() + virtual FX_DWORD GetRootObjNum() FX_OVERRIDE; + virtual FX_DWORD GetInfoObjNum() FX_OVERRIDE; + virtual CPDF_Array* GetIDArray() FX_OVERRIDE; + virtual CPDF_Dictionary* GetEncryptDict() FX_OVERRIDE { return m_pEncryptDict; } - virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL); - virtual FX_DWORD GetLastObjNum(); - virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); + virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) FX_OVERRIDE; + virtual FX_DWORD GetLastObjNum() FX_OVERRIDE; + virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) FX_OVERRIDE; FX_FILESIZE GetObjectOffset(FX_DWORD objnum); @@ -952,24 +952,24 @@ public: CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead); ~CPDF_DataAvail(); - virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints); + virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) FX_OVERRIDE; - virtual void SetDocument(CPDF_Document* pDoc); + virtual void SetDocument(CPDF_Document* pDoc) FX_OVERRIDE; - virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints); + virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) FX_OVERRIDE; - virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints); + virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) FX_OVERRIDE; - virtual FX_INT32 IsLinearizedPDF(); + virtual FX_INT32 IsLinearizedPDF() FX_OVERRIDE; - virtual FX_BOOL IsLinearized() + virtual FX_BOOL IsLinearized() FX_OVERRIDE { return m_bLinearized; } - virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize); + virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize) FX_OVERRIDE; IFX_FileRead* GetFileRead() const { return m_pFileRead; diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index 6d659e2c10..36050f35dc 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -280,13 +280,17 @@ int FXSYS_round(FX_FLOAT f); typedef base::CheckedNumeric FX_SAFE_DWORD; typedef base::CheckedNumeric FX_SAFE_INT32; typedef base::CheckedNumeric FX_SAFE_SIZE_T; + #if defined(__clang__) || _MSC_VER >= 1700 #define FX_FINAL final +#define FX_OVERRIDE override #elif defined(__GNUC__) && __cplusplus >= 201103 && \ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 #define FX_FINAL final +#define FX_OVERRIDE override #else #define FX_FINAL +#define FX_OVERRIDE #endif #endif #endif -- cgit v1.2.3