diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-19 15:25:02 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-19 15:25:02 -0800 |
commit | ac121aa23a5ee3290af151dddbbdc0f4644098d4 (patch) | |
tree | cb53897892481ba70d327605748308dfd35dfa26 /core/include/fxcrt | |
parent | f348235cce75d378a17f3aee81a97f92049fa0a8 (diff) | |
download | pdfium-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.h | 38 |
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 { |