summaryrefslogtreecommitdiff
path: root/core/include/fxcrt
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-07 17:03:30 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-07 17:03:30 -0500
commitc582c0ddfea8ba01c8449ed7841cdb33c12e0a98 (patch)
treeb93867f4e7b5bfbc191837b3e7beab61f92b4ef2 /core/include/fxcrt
parent051348757b75bd527d9a8bfffeaf5231b7c24449 (diff)
downloadpdfium-c582c0ddfea8ba01c8449ed7841cdb33c12e0a98.tar.xz
Fix chromium-style errors.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1772543003 .
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r--core/include/fxcrt/fx_basic.h26
-rw-r--r--core/include/fxcrt/fx_stream.h32
2 files changed, 22 insertions, 36 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 006b2b377d..11c573be6e 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -45,6 +45,7 @@ class CFX_BinaryBuf {
public:
CFX_BinaryBuf();
explicit CFX_BinaryBuf(FX_STRSIZE size);
+ ~CFX_BinaryBuf();
uint8_t* GetBuffer() const { return m_pBuffer.get(); }
FX_STRSIZE GetSize() const { return m_DataSize; }
@@ -182,6 +183,7 @@ class CFX_ArchiveLoader {
class CFX_FileBufferArchive {
public:
CFX_FileBufferArchive();
+ ~CFX_FileBufferArchive();
void Clear();
bool Flush();
@@ -694,13 +696,12 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
}
};
#endif // PDF_ENABLE_XFA
+
class CFX_PtrList {
protected:
struct CNode {
CNode* pNext;
-
CNode* pPrev;
-
void* data;
};
@@ -708,7 +709,6 @@ class CFX_PtrList {
CFX_PtrList(int nBlockSize = 10);
FX_POSITION GetHeadPosition() const { return (FX_POSITION)m_pNodeHead; }
-
FX_POSITION GetTailPosition() const { return (FX_POSITION)m_pNodeTail; }
void* GetNext(FX_POSITION& rPosition) const {
@@ -737,60 +737,49 @@ class CFX_PtrList {
}
int GetCount() const { return m_nCount; }
-
FX_POSITION AddTail(void* newElement);
-
FX_POSITION AddHead(void* newElement);
void SetAt(FX_POSITION pos, void* newElement) {
CNode* pNode = (CNode*)pos;
pNode->data = newElement;
}
-
FX_POSITION InsertAfter(FX_POSITION pos, void* newElement);
FX_POSITION Find(void* searchValue, FX_POSITION startAfter = NULL) const;
-
FX_POSITION FindIndex(int index) const;
void RemoveAt(FX_POSITION pos);
-
void RemoveAll();
protected:
CNode* m_pNodeHead;
-
CNode* m_pNodeTail;
-
int m_nCount;
-
CNode* m_pNodeFree;
-
struct CFX_Plex* m_pBlocks;
-
int m_nBlockSize;
CNode* NewNode(CNode* pPrev, CNode* pNext);
-
void FreeNode(CNode* pNode);
public:
~CFX_PtrList();
};
typedef void (*PD_CALLBACK_FREEDATA)(void* pData);
+
struct FX_PRIVATEDATA {
void FreeData();
void* m_pModuleId;
-
void* m_pData;
-
PD_CALLBACK_FREEDATA m_pCallback;
-
FX_BOOL m_bSelfDestruct;
};
+
class CFX_PrivateData {
public:
+ CFX_PrivateData();
~CFX_PrivateData();
void ClearAll();
@@ -798,11 +787,9 @@ class CFX_PrivateData {
void SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback);
-
void SetPrivateObj(void* module_id, CFX_DestructObject* pObj);
void* GetPrivateData(void* module_id);
-
FX_BOOL LookupPrivateData(void* module_id, void*& pData) const {
if (!module_id) {
return FALSE;
@@ -827,6 +814,7 @@ class CFX_PrivateData {
PD_CALLBACK_FREEDATA callback,
FX_BOOL bSelfDestruct);
};
+
class CFX_BitStream {
public:
void Init(const uint8_t* pData, FX_DWORD dwSize);
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index 4e2f0f97ce..d15d286031 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -20,20 +20,25 @@ FX_BOOL FX_GetNextFile(void* handle,
FX_BOOL& bFolder);
void FX_CloseFolder(void* handle);
FX_WCHAR FX_GetFolderSeparator();
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FX_FILESIZE int32_t
#else
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
+
#ifndef O_BINARY
#define O_BINARY 0
-#endif
+#endif // O_BINARY
+
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
-#endif
+#endif // O_LARGEFILE
+
#define FX_FILESIZE off_t
-#endif
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+
#define FX_GETBYTEOFFSET32(a) 0
#define FX_GETBYTEOFFSET40(a) 0
#define FX_GETBYTEOFFSET48(a) 0
@@ -56,10 +61,7 @@ class IFX_StreamWrite {
class IFX_FileWrite : public IFX_StreamWrite {
public:
// IFX_StreamWrite:
- FX_BOOL WriteBlock(const void* pData, size_t size) override {
- return WriteBlock(pData, GetSize(), size);
- }
-
+ FX_BOOL WriteBlock(const void* pData, size_t size) override;
virtual FX_FILESIZE GetSize() = 0;
virtual FX_BOOL Flush() = 0;
virtual FX_BOOL WriteBlock(const void* pData,
@@ -81,9 +83,9 @@ class IFX_FileRead : IFX_StreamRead {
public:
// IFX_StreamRead:
void Release() override = 0;
- FX_BOOL IsEOF() override { return FALSE; }
- FX_FILESIZE GetPosition() override { return 0; }
- size_t ReadBlock(void* buffer, size_t size) override { return 0; }
+ FX_BOOL IsEOF() override;
+ FX_FILESIZE GetPosition() override;
+ size_t ReadBlock(void* buffer, size_t size) override;
virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
virtual FX_FILESIZE GetSize() = 0;
@@ -108,9 +110,7 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite {
FX_BOOL WriteBlock(const void* buffer,
FX_FILESIZE offset,
size_t size) override = 0;
- FX_BOOL WriteBlock(const void* buffer, size_t size) override {
- return WriteBlock(buffer, GetSize(), size);
- }
+ FX_BOOL WriteBlock(const void* buffer, size_t size) override;
FX_BOOL Flush() override = 0;
};
@@ -132,21 +132,19 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
class IFX_MemoryStream : public IFX_FileStream {
public:
virtual FX_BOOL IsConsecutive() const = 0;
-
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
-
virtual uint8_t* GetBuffer() const = 0;
-
virtual void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
FX_BOOL bTakeOver = FALSE) = 0;
-
virtual void DetachBuffer() = 0;
};
+
IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
size_t nSize,
FX_BOOL bTakeOver = FALSE);
IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
+
class IFX_BufferRead : public IFX_StreamRead {
public:
// IFX_StreamRead: