diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-05-09 12:36:41 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-09 17:50:54 +0000 |
commit | ae4656edebaea24d18d11a845c663240bf8e9d2d (patch) | |
tree | 51bcfc9916a1e13ca080f76a4cf65b21fa647993 /core/fpdfapi/edit | |
parent | a0b1954794b7a8a279ba00787628cc7f8d1419d9 (diff) | |
download | pdfium-ae4656edebaea24d18d11a845c663240bf8e9d2d.tar.xz |
Move FPDF_FILEWRITE adapter to own file
This Cl moves the adapater out of the fpdfsave.cpp file into its own
h/cpp files. The adapter was renamed for clarity. The CPDF_Creator was
modified to take the adapter as a constructor param and the Create
methods consolidated.
Change-Id: Icb104f195ef532dda053c859aae356a8d4a7a54c
Reviewed-on: https://pdfium-review.googlesource.com/5151
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator.cpp | 13 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator.h | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 32dd28456e..d3cf5b85b7 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -56,7 +56,8 @@ int32_t OutputIndex(CFX_FileBufferArchive* pFile, FX_FILESIZE offset) { } // namespace -CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc) +CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc, + const CFX_RetainPtr<IFX_WriteStream>& pFile) : m_pDocument(pDoc), m_pParser(pDoc->GetParser()), m_bSecurityChanged(false), @@ -73,7 +74,9 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc) m_CurObjNum(0), m_XrefStart(0), m_pIDArray(nullptr), - m_FileVersion(0) {} + m_FileVersion(0) { + m_File.AttachFile(pFile); +} CPDF_Creator::~CPDF_Creator() { Clear(); @@ -911,12 +914,6 @@ void CPDF_Creator::Clear() { m_pIDArray.reset(); } -bool CPDF_Creator::Create(const CFX_RetainPtr<IFX_WriteStream>& pFile, - uint32_t flags) { - m_File.AttachFile(pFile); - return Create(flags); -} - bool CPDF_Creator::Create(uint32_t flags) { m_dwFlags = flags; m_iStage = 0; diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h index 9a15021c25..e263c6cc1d 100644 --- a/core/fpdfapi/edit/cpdf_creator.h +++ b/core/fpdfapi/edit/cpdf_creator.h @@ -29,11 +29,12 @@ class CPDF_XRefStream; class CPDF_Creator { public: - explicit CPDF_Creator(CPDF_Document* pDoc); + explicit CPDF_Creator(CPDF_Document* pDoc, + const CFX_RetainPtr<IFX_WriteStream>& pFile); ~CPDF_Creator(); void RemoveSecurity(); - bool Create(const CFX_RetainPtr<IFX_WriteStream>& pFile, uint32_t flags = 0); + bool Create(uint32_t flags = 0); int32_t Continue(); bool SetFileVersion(int32_t fileVersion = 17); @@ -60,7 +61,6 @@ class CPDF_Creator { bool IsIncremental() const { return !!(m_dwFlags & FPDFCREATE_INCREMENTAL); } private: - bool Create(uint32_t flags); void Clear(); void InitOldObjNumOffsets(); |