summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2014-08-13 17:12:28 -0700
committerTom Sepez <tsepez@chromium.org>2014-08-13 17:12:28 -0700
commit368ed462dd6e5e63977ca2b2e56a7e83b3a3bdda (patch)
treed6e9f37c824646a245d2753fe93a8404da52dbff /core
parent2fd7b0be4473f4c9877fed2c2ade403c71ded395 (diff)
downloadpdfium-368ed462dd6e5e63977ca2b2e56a7e83b3a3bdda.tar.xz
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
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h32
-rw-r--r--core/include/fxcrt/fx_system.h4
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h4
-rw-r--r--core/src/fxcrt/extension.h54
-rw-r--r--core/src/fxcrt/fx_arabic.h12
-rw-r--r--core/src/fxge/apple/apple_int.h12
6 files changed, 61 insertions, 57 deletions
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_DWORD> FX_SAFE_DWORD;
typedef base::CheckedNumeric<FX_INT32> FX_SAFE_INT32;
typedef base::CheckedNumeric<size_t> 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
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index cc7f8c8752..515b9f9242 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -409,11 +409,11 @@ private:
class CFX_GSUBTable FX_FINAL : public IFX_GSUBTable, public CFX_Object
{
public:
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
delete this;
}
- virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum);
+ virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) FX_OVERRIDE;
CFX_CTTGSUBTable m_GsubImp;
};
#endif
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index bb2a79b9f9..c23a2e3369 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -36,27 +36,27 @@ public:
m_pFile->Release();
}
}
- virtual IFX_FileStream* Retain()
+ virtual IFX_FileStream* Retain() FX_OVERRIDE
{
m_dwCount ++;
return this;
}
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
FX_DWORD nCount = -- m_dwCount;
if (!nCount) {
delete this;
}
}
- virtual FX_FILESIZE GetSize()
+ virtual FX_FILESIZE GetSize() FX_OVERRIDE
{
return m_bUseRange ? m_nSize : m_pFile->GetSize();
}
- virtual FX_BOOL IsEOF()
+ virtual FX_BOOL IsEOF() FX_OVERRIDE
{
return GetPosition() >= GetSize();
}
- virtual FX_FILESIZE GetPosition()
+ virtual FX_FILESIZE GetPosition() FX_OVERRIDE
{
FX_FILESIZE pos = m_pFile->GetPosition();
if (m_bUseRange) {
@@ -64,7 +64,7 @@ public:
}
return pos;
}
- virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size)
+ virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) FX_OVERRIDE
{
if (offset < 0 || size < 0) {
return FALSE;
@@ -82,11 +82,11 @@ public:
m_pFile->SetPosition(m_nOffset);
return TRUE;
}
- virtual void ClearRange()
+ virtual void ClearRange() FX_OVERRIDE
{
m_bUseRange = FALSE;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size)
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
{
if (m_bUseRange && offset < 0) {
return FALSE;
@@ -101,7 +101,7 @@ public:
}
return (FX_BOOL)m_pFile->ReadPos(buffer, size, pos.ValueOrDie());
}
- virtual size_t ReadBlock(void* buffer, size_t size)
+ virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE
{
if (m_bUseRange) {
FX_FILESIZE availSize = m_nOffset + m_nSize - m_pFile->GetPosition();
@@ -111,14 +111,14 @@ public:
}
return m_pFile->Read(buffer, size);
}
- virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size)
+ virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
{
if (m_bUseRange) {
offset += m_nOffset;
}
return (FX_BOOL)m_pFile->WritePos(buffer, size, offset);
}
- virtual FX_BOOL Flush()
+ virtual FX_BOOL Flush() FX_OVERRIDE
{
return m_pFile->Flush();
}
@@ -164,12 +164,12 @@ public:
}
m_Blocks.RemoveAll();
}
- virtual IFX_FileStream* Retain()
+ virtual IFX_FileStream* Retain() FX_OVERRIDE
{
m_dwCount ++;
return this;
}
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
FX_DWORD nCount = -- m_dwCount;
if (nCount) {
@@ -177,15 +177,15 @@ public:
}
delete this;
}
- virtual FX_FILESIZE GetSize()
+ virtual FX_FILESIZE GetSize() FX_OVERRIDE
{
return m_bUseRange ? (FX_FILESIZE) m_nSize : (FX_FILESIZE)m_nCurSize;
}
- virtual FX_BOOL IsEOF()
+ virtual FX_BOOL IsEOF() FX_OVERRIDE
{
return m_nCurPos >= (size_t)GetSize();
}
- virtual FX_FILESIZE GetPosition()
+ virtual FX_FILESIZE GetPosition() FX_OVERRIDE
{
FX_FILESIZE pos = (FX_FILESIZE)m_nCurPos;
if (m_bUseRange) {
@@ -193,7 +193,7 @@ public:
}
return pos;
}
- virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size)
+ virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) FX_OVERRIDE
{
if (offset < 0 || size < 0) {
return FALSE;
@@ -209,11 +209,11 @@ public:
m_nCurPos = m_nOffset;
return TRUE;
}
- virtual void ClearRange()
+ virtual void ClearRange() FX_OVERRIDE
{
m_bUseRange = FALSE;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size)
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
{
if (!buffer || !size) {
return FALSE;
@@ -256,7 +256,7 @@ public:
}
return TRUE;
}
- virtual size_t ReadBlock(void* buffer, size_t size)
+ virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE
{
if (m_nCurPos >= m_nCurSize) {
return 0;
@@ -273,7 +273,7 @@ public:
}
return nRead;
}
- virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size)
+ virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
{
if (!buffer || !size) {
return FALSE;
@@ -333,15 +333,15 @@ public:
}
return TRUE;
}
- virtual FX_BOOL Flush()
+ virtual FX_BOOL Flush() FX_OVERRIDE
{
return TRUE;
}
- virtual FX_BOOL IsConsecutive() const
+ virtual FX_BOOL IsConsecutive() const FX_OVERRIDE
{
return m_dwFlags & FX_MEMSTREAM_Consecutive;
}
- virtual void EstimateSize(size_t nInitSize, size_t nGrowSize)
+ virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) FX_OVERRIDE
{
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
if (m_Blocks.GetSize() < 1) {
@@ -355,11 +355,11 @@ public:
m_nGrowSize = FX_MAX(nGrowSize, 4096);
}
}
- virtual FX_LPBYTE GetBuffer() const
+ virtual FX_LPBYTE GetBuffer() const FX_OVERRIDE
{
return m_Blocks.GetSize() ? (FX_LPBYTE)m_Blocks[0] : NULL;
}
- virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE)
+ virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) FX_OVERRIDE
{
if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
return;
@@ -371,7 +371,7 @@ public:
m_dwFlags = FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0);
ClearRange();
}
- virtual void DetachBuffer()
+ virtual void DetachBuffer() FX_OVERRIDE
{
if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
return;
diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h
index 1dc275b8c3..c404449af0 100644
--- a/core/src/fxcrt/fx_arabic.h
+++ b/core/src/fxcrt/fx_arabic.h
@@ -10,18 +10,18 @@ class CFX_BidiChar FX_FINAL : public IFX_BidiChar, public CFX_Object
{
public:
CFX_BidiChar();
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
delete this;
}
- virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE)
+ virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) FX_OVERRIDE
{
m_bSeparateNeutral = bSeparateNeutral;
}
- virtual FX_BOOL AppendChar(FX_WCHAR wch);
- virtual FX_BOOL EndChar();
- virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount);
- virtual void Reset();
+ virtual FX_BOOL AppendChar(FX_WCHAR wch) FX_OVERRIDE;
+ virtual FX_BOOL EndChar() FX_OVERRIDE;
+ virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) FX_OVERRIDE;
+ virtual void Reset() FX_OVERRIDE;
protected:
FX_BOOL m_bSeparateNeutral;
FX_INT32 m_iCurStart;
diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h
index a8fbe2fbaa..e3794159b8 100644
--- a/core/src/fxge/apple/apple_int.h
+++ b/core/src/fxge/apple/apple_int.h
@@ -188,25 +188,25 @@ protected:
class CFX_FontProvider FX_FINAL : public IFX_FileRead
{
public:
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
delete this;
}
- virtual FX_FILESIZE GetSize()
+ virtual FX_FILESIZE GetSize() FX_OVERRIDE
{
return (FX_FILESIZE)_totalSize;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE;
- virtual FX_BOOL IsEOF()
+ virtual FX_BOOL IsEOF() FX_OVERRIDE
{
return _offSet == _totalSize;
}
- virtual FX_FILESIZE GetPosition()
+ virtual FX_FILESIZE GetPosition() FX_OVERRIDE
{
return (FX_FILESIZE)_offSet;
}
- virtual size_t ReadBlock(void* buffer, size_t size);
+ virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE;
public:
CFX_FontProvider(CGFontRef cgFont);
~CFX_FontProvider();