From e88da630ef7d61dfca86f76d088dcb088940e1f8 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 8 Jun 2018 20:27:14 +0000 Subject: Remove unused methods in CPDF_Creator, mark others as private. Also remove the member variable m_dwEncryptObjNum which is never read. Change-Id: Ieb674d6d9783ef298ba3ece1544437b15ad0afe2 Reviewed-on: https://pdfium-review.googlesource.com/34694 Reviewed-by: Lei Zhang Commit-Queue: Henrique Nakashima --- core/fpdfapi/edit/cpdf_creator.cpp | 2 -- core/fpdfapi/edit/cpdf_creator.h | 27 ++++----------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 1935c7362f..5c6da1d4fa 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -146,7 +146,6 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc, m_pParser(pDoc->GetParser()), m_bSecurityChanged(false), m_pEncryptDict(m_pParser ? m_pParser->GetEncryptDict() : nullptr), - m_dwEncryptObjNum(0), m_pSecurityHandler(m_pParser ? m_pParser->GetSecurityHandler() : nullptr), m_dwLastObjNum(m_pDocument->GetLastObjNum()), m_Archive(pdfium::MakeUnique(archive)), @@ -462,7 +461,6 @@ int32_t CPDF_Creator::WriteDoc_Stage2() { return -1; m_ObjectOffsets[m_dwLastObjNum] = saveOffset; - m_dwEncryptObjNum = m_dwLastObjNum; if (IsIncremental()) m_NewObjNumArray.push_back(m_dwLastObjNum); } diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h index 2b36fdd136..47f279f653 100644 --- a/core/fpdfapi/edit/cpdf_creator.h +++ b/core/fpdfapi/edit/cpdf_creator.h @@ -35,30 +35,10 @@ class CPDF_Creator { void RemoveSecurity(); bool Create(uint32_t flags); - int32_t Continue(); bool SetFileVersion(int32_t fileVersion); - IFX_ArchiveStream* GetArchive() { return m_Archive.get(); } - - uint32_t GetNextObjectNumber() { return ++m_dwLastObjNum; } - uint32_t GetLastObjectNumber() const { return m_dwLastObjNum; } - CPDF_CryptoHandler* GetCryptoHandler(); - CPDF_Document* GetDocument() const { return m_pDocument.Get(); } - CPDF_Array* GetIDArray() const { return m_pIDArray.get(); } - CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict.Get(); } - uint32_t GetEncryptObjectNumber() const { return m_dwEncryptObjNum; } - - uint32_t GetObjectOffset(uint32_t objnum) { return m_ObjectOffsets[objnum]; } - bool HasObjectNumber(uint32_t objnum) { - return m_ObjectOffsets.find(objnum) != m_ObjectOffsets.end(); - } - void SetObjectOffset(uint32_t objnum, FX_FILESIZE offset) { - m_ObjectOffsets[objnum] = offset; - } - bool IsIncremental() const { return !!(m_dwFlags & FPDFCREATE_INCREMENTAL); } - bool IsOriginal() const { return !(m_dwFlags & FPDFCREATE_NO_ORIGINAL); } - private: + int32_t Continue(); void Clear(); void InitNewObjNumOffsets(); @@ -79,13 +59,14 @@ class CPDF_Creator { uint32_t objnum, CPDF_CryptoHandler* pCrypto); - bool IsXRefNeedEnd(); + CPDF_CryptoHandler* GetCryptoHandler(); + bool IsIncremental() const { return !!(m_dwFlags & FPDFCREATE_INCREMENTAL); } + bool IsOriginal() const { return !(m_dwFlags & FPDFCREATE_NO_ORIGINAL); } UnownedPtr const m_pDocument; UnownedPtr const m_pParser; bool m_bSecurityChanged; UnownedPtr m_pEncryptDict; - uint32_t m_dwEncryptObjNum; fxcrt::MaybeOwned m_pSecurityHandler; UnownedPtr m_pMetadata; uint32_t m_dwLastObjNum; -- cgit v1.2.3