From 5fd907b8266766152377a9836abfcac0161832fc Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 19 Nov 2015 22:20:59 -0800 Subject: Merge to XFA: Add more overrides. Using Chromium's clang + build options, there's more override warnings. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1453643002 . (cherry picked from commit 126ba519bdd489ec6c285d1410dcae773e8ef673) Review URL: https://codereview.chromium.org/1458373002 . --- core/src/fpdfapi/fpdf_font/ttgsubtable.h | 5 +- core/src/fxcodec/codec/codec_int.h | 123 ++++++++++++++++--------------- core/src/fxcodec/codec/fx_codec_jbig.cpp | 2 +- core/src/fxcrt/extension.h | 40 +++++----- 4 files changed, 87 insertions(+), 83 deletions(-) (limited to 'core/src') diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h index 7dd8cce36c..e3c9965654 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h @@ -260,7 +260,7 @@ class CFX_CTTGSUBTable { TSingleSubstFormat2() : Coverage(NULL), GlyphCount(0), Substitute(NULL) { SubstFormat = 2; } - ~TSingleSubstFormat2() { + ~TSingleSubstFormat2() override { delete Coverage; delete[] Substitute; } @@ -356,8 +356,7 @@ class CFX_CTTGSUBTable { class CFX_GSUBTable final : public IFX_GSUBTable { public: ~CFX_GSUBTable() override {} - virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, - FX_DWORD* vglyphnum) override; + FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override; CFX_CTTGSUBTable m_GsubImp; }; diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index eeaac886dd..199df82512 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -21,20 +21,21 @@ class CFX_IccTransformCache; class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); - virtual FX_BOOL A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); - virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, - FX_DWORD src_size, - int width, - int height, - int nComps, - int bpc); + // ICodec_BasicModule: + FX_BOOL RunLengthEncode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) override; + FX_BOOL A85Encode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size) override; + ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int nComps, + int bpc) override; }; class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { @@ -101,22 +102,23 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { class CCodec_FaxModule : public ICodec_FaxModule { public: - virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, - int width, - int height, - int K, - FX_BOOL EndOfLine, - FX_BOOL EncodedByteAlign, - FX_BOOL BlackIs1, - int Columns, - int Rows); + // ICodec_FaxModule: + ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, + FX_DWORD src_size, + int width, + int height, + int K, + FX_BOOL EndOfLine, + FX_BOOL EncodedByteAlign, + FX_BOOL BlackIs1, + int Columns, + int Rows) override; FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size); + FX_DWORD& dest_size) override; }; class CCodec_FlateModule : public ICodec_FlateModule { @@ -258,42 +260,45 @@ class CCodec_BmpModule : public ICodec_BmpModule { }; class CCodec_IccModule : public ICodec_IccModule { public: - virtual IccCS GetProfileCS(const uint8_t* pProfileData, - unsigned int dwProfileSize); - virtual IccCS GetProfileCS(IFX_FileRead* pFile); - virtual void* CreateTransform( - ICodec_IccModule::IccParam* pInputParam, - ICodec_IccModule::IccParam* pOutputParam, - ICodec_IccModule::IccParam* pProofParam = NULL, - FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, - FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, - FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, - FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING); - virtual void* CreateTransform_sRGB(const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - int32_t& nComponents, - int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); - virtual void* CreateTransform_CMYK(const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - int32_t& nSrcComponents, - const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, - int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT); - virtual void DestroyTransform(void* pTransform); - virtual void Translate(void* pTransform, - FX_FLOAT* pSrcValues, - FX_FLOAT* pDestValues); - virtual void TranslateScanline(void* pTransform, - uint8_t* pDest, - const uint8_t* pSrc, - int pixels); - virtual void SetComponents(FX_DWORD nComponents) { + ~CCodec_IccModule() override; + + // ICodec_IccModule: + IccCS GetProfileCS(const uint8_t* pProfileData, + unsigned int dwProfileSize) override; + IccCS GetProfileCS(IFX_FileRead* pFile) override; + void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, + ICodec_IccModule::IccParam* pOutputParam, + ICodec_IccModule::IccParam* pProofParam = NULL, + FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, + FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, + FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, + FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; + void* CreateTransform_sRGB( + const uint8_t* pProfileData, + FX_DWORD dwProfileSize, + int32_t& nComponents, + int32_t intent = 0, + FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) override; + void* CreateTransform_CMYK( + const uint8_t* pSrcProfileData, + FX_DWORD dwSrcProfileSize, + int32_t& nSrcComponents, + const uint8_t* pDstProfileData, + FX_DWORD dwDstProfileSize, + int32_t intent = 0, + FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, + FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) override; + void DestroyTransform(void* pTransform) override; + void Translate(void* pTransform, + FX_FLOAT* pSrcValues, + FX_FLOAT* pDestValues) override; + void TranslateScanline(void* pTransform, + uint8_t* pDest, + const uint8_t* pSrc, + int pixels) override; + void SetComponents(FX_DWORD nComponents) override { m_nComponents = nComponents; } - virtual ~CCodec_IccModule(); protected: enum Icc_CLASS { diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index aa9f1811b7..8c7f1bcc7a 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -14,7 +14,7 @@ class JBig2DocumentContext : public CFX_DestructObject { return &m_SymbolDictCache; } - ~JBig2DocumentContext() { + ~JBig2DocumentContext() override { for (auto it : m_SymbolDictCache) { delete it.second; } diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 038fa30e70..718c8f0423 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -136,23 +136,23 @@ class CFX_MemoryStream final : public IFX_MemoryStream { } m_Blocks.RemoveAll(); } - virtual IFX_FileStream* Retain() override { + + // IFX_MemoryStream: + IFX_FileStream* Retain() override { m_dwCount++; return this; } - virtual void Release() override { + void Release() override { FX_DWORD nCount = --m_dwCount; if (nCount) { return; } delete this; } - virtual FX_FILESIZE GetSize() override { return (FX_FILESIZE)m_nCurSize; } - virtual FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); } - virtual FX_FILESIZE GetPosition() override { return (FX_FILESIZE)m_nCurPos; } - virtual FX_BOOL ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) override { + FX_FILESIZE GetSize() override { return (FX_FILESIZE)m_nCurSize; } + FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); } + FX_FILESIZE GetPosition() override { return (FX_FILESIZE)m_nCurPos; } + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { if (!buffer || !size) { return FALSE; } @@ -185,7 +185,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { } return TRUE; } - virtual size_t ReadBlock(void* buffer, size_t size) override { + size_t ReadBlock(void* buffer, size_t size) override { if (m_nCurPos >= m_nCurSize) { return 0; } @@ -195,9 +195,9 @@ class CFX_MemoryStream final : public IFX_MemoryStream { } return nRead; } - virtual FX_BOOL WriteBlock(const void* buffer, - FX_FILESIZE offset, - size_t size) override { + FX_BOOL WriteBlock(const void* buffer, + FX_FILESIZE offset, + size_t size) override { if (!buffer || !size) { return FALSE; } @@ -255,11 +255,11 @@ class CFX_MemoryStream final : public IFX_MemoryStream { } return TRUE; } - virtual FX_BOOL Flush() override { return TRUE; } - virtual FX_BOOL IsConsecutive() const override { + FX_BOOL Flush() override { return TRUE; } + FX_BOOL IsConsecutive() const override { return m_dwFlags & FX_MEMSTREAM_Consecutive; } - virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) override { + void EstimateSize(size_t nInitSize, size_t nGrowSize) override { if (m_dwFlags & FX_MEMSTREAM_Consecutive) { if (m_Blocks.GetSize() < 1) { uint8_t* pBlock = FX_Alloc(uint8_t, FX_MAX(nInitSize, 4096)); @@ -270,12 +270,12 @@ class CFX_MemoryStream final : public IFX_MemoryStream { m_nGrowSize = FX_MAX(nGrowSize, 4096); } } - virtual uint8_t* GetBuffer() const override { + uint8_t* GetBuffer() const override { return m_Blocks.GetSize() ? (uint8_t*)m_Blocks[0] : NULL; } - virtual void AttachBuffer(uint8_t* pBuffer, - size_t nSize, - FX_BOOL bTakeOver = FALSE) override { + void AttachBuffer(uint8_t* pBuffer, + size_t nSize, + FX_BOOL bTakeOver = FALSE) override { if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) { return; } @@ -286,7 +286,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { m_dwFlags = FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); } - virtual void DetachBuffer() override { + void DetachBuffer() override { if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) { return; } -- cgit v1.2.3