From 2f2b58c45dbe369c72d29d2be89605467b082f39 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 21 Oct 2016 15:04:28 -0700 Subject: Remove dead code in CPDF_CustomAccess Review-Url: https://chromiumcodereview.appspot.com/2441653004 --- fpdfsdk/fpdfview.cpp | 40 ++-------------------------------------- fpdfsdk/fsdk_define.h | 10 ---------- 2 files changed, 2 insertions(+), 48 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 3ab81fe112..e0c24ec792 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -175,44 +175,8 @@ FX_BOOL CFPDF_FileStream::Flush() { } #endif // PDF_ENABLE_XFA -CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) { - m_FileAccess = *pFileAccess; -#ifdef PDF_ENABLE_XFA - m_BufferOffset = (uint32_t)-1; -#endif // PDF_ENABLE_XFA -} - -#ifdef PDF_ENABLE_XFA -CFX_ByteString CPDF_CustomAccess::GetFullPath() { - return ""; -} - -FX_BOOL CPDF_CustomAccess::GetByte(uint32_t pos, uint8_t& ch) { - if (pos >= m_FileAccess.m_FileLen) - return FALSE; - if (m_BufferOffset == (uint32_t)-1 || pos < m_BufferOffset || - pos >= m_BufferOffset + 512) { - // Need to read from file access - m_BufferOffset = pos; - int size = 512; - if (pos + 512 > m_FileAccess.m_FileLen) - size = m_FileAccess.m_FileLen - pos; - if (!m_FileAccess.m_GetBlock(m_FileAccess.m_Param, m_BufferOffset, m_Buffer, - size)) - return FALSE; - } - ch = m_Buffer[pos - m_BufferOffset]; - return TRUE; -} - -FX_BOOL CPDF_CustomAccess::GetBlock(uint32_t pos, - uint8_t* pBuf, - uint32_t size) { - if (pos + size > m_FileAccess.m_FileLen) - return FALSE; - return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size); -} -#endif // PDF_ENABLE_XFA +CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) + : m_FileAccess(*pFileAccess) {} FX_FILESIZE CPDF_CustomAccess::GetSize() { return m_FileAccess.m_FileLen; diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index 372ceb31e9..b59a3c2657 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -35,18 +35,8 @@ class CPDF_CustomAccess final : public IFX_FileRead { void Release() override; FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; -#ifdef PDF_ENABLE_XFA - virtual CFX_ByteString GetFullPath(); - virtual FX_BOOL GetByte(uint32_t pos, uint8_t& ch); - virtual FX_BOOL GetBlock(uint32_t pos, uint8_t* pBuf, uint32_t size); -#endif // PDF_ENABLE_XFA - private: FPDF_FILEACCESS m_FileAccess; -#ifdef PDF_ENABLE_XFA - uint8_t m_Buffer[512]; - uint32_t m_BufferOffset; -#endif // PDF_ENABLE_XFA }; #ifdef PDF_ENABLE_XFA -- cgit v1.2.3