summaryrefslogtreecommitdiff
path: root/core/include/fxcrt
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-19 15:25:02 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-19 15:25:02 -0800
commitac121aa23a5ee3290af151dddbbdc0f4644098d4 (patch)
treecb53897892481ba70d327605748308dfd35dfa26 /core/include/fxcrt
parentf348235cce75d378a17f3aee81a97f92049fa0a8 (diff)
downloadpdfium-ac121aa23a5ee3290af151dddbbdc0f4644098d4.tar.xz
Remove IFX_BufferArchive.
Merge it into CFX_FileBufferArchive, since both are in the same header file and it is the only subclass. Also, bTakeOver is always false, and the buf size is always 32K. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1712353002 .
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r--core/include/fxcrt/fx_basic.h38
1 files changed, 9 insertions, 29 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 3e30b1d1a1..018a91462e 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -179,46 +179,26 @@ class CFX_ArchiveLoader {
};
#endif // PDF_ENABLE_XFA
-class IFX_BufferArchive {
+class CFX_FileBufferArchive {
public:
- IFX_BufferArchive(FX_STRSIZE size);
- virtual ~IFX_BufferArchive() {}
-
- virtual void Clear();
-
- FX_BOOL Flush();
+ CFX_FileBufferArchive();
+ void Clear();
+ bool Flush();
int32_t AppendBlock(const void* pBuf, size_t size);
-
int32_t AppendByte(uint8_t byte);
-
int32_t AppendDWord(FX_DWORD i);
-
int32_t AppendString(const CFX_ByteStringC& lpsz);
- protected:
- virtual FX_BOOL DoWork(const void* pBuf, size_t size) = 0;
-
- FX_STRSIZE m_BufSize;
-
- uint8_t* m_pBuffer;
-
- FX_STRSIZE m_Length;
-};
-
-class CFX_FileBufferArchive : public IFX_BufferArchive {
- public:
- CFX_FileBufferArchive(FX_STRSIZE size = 32768);
- ~CFX_FileBufferArchive() override;
-
- void Clear() override;
- FX_BOOL AttachFile(IFX_StreamWrite* pFile, FX_BOOL bTakeover = FALSE);
+ // |pFile| must outlive the CFX_FileBufferArchive.
+ void AttachFile(IFX_StreamWrite* pFile);
private:
- FX_BOOL DoWork(const void* pBuf, size_t size) override;
+ static const size_t kBufSize = 32768;
+ size_t m_Length;
+ std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer;
IFX_StreamWrite* m_pFile;
- FX_BOOL m_bTakeover;
};
class CFX_CharMap {