summaryrefslogtreecommitdiff
path: root/xfa/fgas/crt
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-18 06:25:37 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-18 06:25:37 -0700
commiteec3a366adbfada36b98f1de651546ee09df8fc0 (patch)
tree794aa8c69392b60d8737a8a5b424732b98bdd4b4 /xfa/fgas/crt
parent4ce94e118d66064715de5baebeb4b2b580dcac66 (diff)
downloadpdfium-eec3a366adbfada36b98f1de651546ee09df8fc0.tar.xz
Make code compile with clang_use_chrome_plugin (final)
This change mainly contains files in xfa/ and fxjse/ directories which were not covered by previous changes. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. After this change, PDFium can be compiled with "clang_use_chrome_plugin=true" for GN build. Since clang_use_chrome_plugin is true by default, we no longer need to set this parameter explicitly. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2072803002
Diffstat (limited to 'xfa/fgas/crt')
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp118
-rw-r--r--xfa/fgas/crt/fgas_utils.cpp22
-rw-r--r--xfa/fgas/crt/fgas_utils.h15
3 files changed, 89 insertions, 66 deletions
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 59eb99bcf0..458cf5edad 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -205,7 +205,8 @@ enum FX_STREAMTYPE {
class CFX_Stream : public IFX_Stream {
public:
CFX_Stream();
- ~CFX_Stream();
+ ~CFX_Stream() override;
+
FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
FX_BOOL LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess);
@@ -214,28 +215,30 @@ class CFX_Stream : public IFX_Stream {
int32_t iFileSize,
uint32_t dwAccess,
FX_BOOL bReleaseBufferRead);
- virtual void Release();
- virtual IFX_Stream* Retain();
- virtual uint32_t GetAccessModes() const { return m_dwAccess; }
- virtual int32_t GetLength() const;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset);
- virtual int32_t GetPosition();
- virtual FX_BOOL IsEOF() const;
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = NULL);
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength);
- virtual void Flush();
- virtual FX_BOOL SetLength(int32_t iLength);
- virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual uint16_t GetCodePage() const;
- virtual uint16_t SetCodePage(uint16_t wCodePage);
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength);
+
+ // IFX_Stream
+ void Release() override;
+ IFX_Stream* Retain() override;
+ uint32_t GetAccessModes() const override;
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ FX_BOOL IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ FX_BOOL& bEOS,
+ int32_t const* pByteSize = NULL) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
+ void Flush() override;
+ FX_BOOL SetLength(int32_t iLength) override;
+ int32_t GetBOM(uint8_t bom[4]) const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+ IFX_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
FX_STREAMTYPE m_eStreamType;
@@ -251,33 +254,31 @@ class CFX_Stream : public IFX_Stream {
class CFX_TextStream : public IFX_Stream {
public:
CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream);
- ~CFX_TextStream();
- virtual void Release();
- virtual IFX_Stream* Retain();
-
- virtual uint32_t GetAccessModes() const;
- virtual int32_t GetLength() const;
- virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset);
- virtual int32_t GetPosition();
- virtual FX_BOOL IsEOF() const;
-
- virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- FX_BOOL& bEOS,
- int32_t const* pByteSize = NULL);
- virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize);
- virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength);
- virtual void Flush();
- virtual FX_BOOL SetLength(int32_t iLength);
+ ~CFX_TextStream() override;
- virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual uint16_t GetCodePage() const;
- virtual uint16_t SetCodePage(uint16_t wCodePage);
-
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength);
+ // IFX_Stream
+ void Release() override;
+ IFX_Stream* Retain() override;
+ uint32_t GetAccessModes() const override;
+ int32_t GetLength() const override;
+ int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
+ int32_t GetPosition() override;
+ FX_BOOL IsEOF() const override;
+ int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ FX_BOOL& bEOS,
+ int32_t const* pByteSize = NULL) override;
+ int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override;
+ int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override;
+ void Flush() override;
+ FX_BOOL SetLength(int32_t iLength) override;
+ int32_t GetBOM(uint8_t bom[4]) const override;
+ uint16_t GetCodePage() const override;
+ uint16_t SetCodePage(uint16_t wCodePage) override;
+ IFX_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
uint16_t m_wCodePage;
@@ -294,10 +295,12 @@ class CFX_TextStream : public IFX_Stream {
class CFGAS_FileRead : public IFX_FileRead {
public:
CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream);
- virtual ~CFGAS_FileRead();
- virtual void Release() { delete this; }
- virtual FX_FILESIZE GetSize();
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+ ~CFGAS_FileRead() override;
+
+ // IFX_FileRead
+ void Release() override;
+ FX_FILESIZE GetSize() override;
+ FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
protected:
FX_BOOL m_bReleaseStream;
@@ -1260,6 +1263,11 @@ IFX_Stream* CFX_Stream::Retain() {
m_iRefCount++;
return this;
}
+
+uint32_t CFX_Stream::GetAccessModes() const {
+ return m_dwAccess;
+}
+
int32_t CFX_Stream::GetLength() const {
if (m_pStreamImp == NULL) {
return -1;
@@ -1510,3 +1518,7 @@ FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer,
int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size);
return iLen == (int32_t)size;
}
+
+void CFGAS_FileRead::Release() {
+ delete this;
+}
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
index 4f15fc4845..6db7aa35ab 100644
--- a/xfa/fgas/crt/fgas_utils.cpp
+++ b/xfa/fgas/crt/fgas_utils.cpp
@@ -12,14 +12,8 @@
class FX_BASEARRAYDATA : public CFX_Target {
public:
- FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize)
- : iGrowSize(growsize),
- iBlockSize(blocksize),
- iTotalCount(0),
- iBlockCount(0),
- pBuffer(nullptr) {}
-
- ~FX_BASEARRAYDATA() { FX_Free(pBuffer); }
+ FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize);
+ ~FX_BASEARRAYDATA() override;
int32_t iGrowSize;
int32_t iBlockSize;
@@ -27,6 +21,18 @@ class FX_BASEARRAYDATA : public CFX_Target {
int32_t iBlockCount;
uint8_t* pBuffer;
};
+
+FX_BASEARRAYDATA::FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize)
+ : iGrowSize(growsize),
+ iBlockSize(blocksize),
+ iTotalCount(0),
+ iBlockCount(0),
+ pBuffer(nullptr) {}
+
+FX_BASEARRAYDATA::~FX_BASEARRAYDATA() {
+ FX_Free(pBuffer);
+}
+
CFX_BaseArray::CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize) {
ASSERT(iGrowSize > 0 && iBlockSize > 0);
m_pData = new FX_BASEARRAYDATA(iGrowSize, iBlockSize);
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index 6fef23d968..f01d115b3e 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -15,7 +15,8 @@ class FX_BASEARRAYDATA;
class CFX_BaseArray : public CFX_Target {
protected:
CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize);
- ~CFX_BaseArray();
+ ~CFX_BaseArray() override;
+
int32_t GetSize() const;
int32_t GetBlockSize() const;
uint8_t* AddSpaceTo(int32_t index);
@@ -184,7 +185,8 @@ class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray {
class CFX_BaseMassArrayImp : public CFX_Target {
public:
CFX_BaseMassArrayImp(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseMassArrayImp();
+ ~CFX_BaseMassArrayImp() override;
+
uint8_t* AddSpace() { return AddSpaceTo(m_iBlockCount); }
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
@@ -213,7 +215,8 @@ class CFX_BaseMassArrayImp : public CFX_Target {
class CFX_BaseMassArray : public CFX_Target {
protected:
CFX_BaseMassArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseMassArray();
+ ~CFX_BaseMassArray() override;
+
int32_t GetSize() const;
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
@@ -360,7 +363,8 @@ class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
class CFX_BaseDiscreteArray : public CFX_Target {
protected:
CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseDiscreteArray();
+ ~CFX_BaseDiscreteArray() override;
+
uint8_t* AddSpaceTo(int32_t index);
uint8_t* GetAt(int32_t index) const;
void RemoveAll();
@@ -391,7 +395,8 @@ typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray;
class CFX_BaseStack : public CFX_Target {
protected:
CFX_BaseStack(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseStack();
+ ~CFX_BaseStack() override;
+
uint8_t* Push();
void Pop();
uint8_t* GetTopElement() const;