diff options
author | Tom Sepez <tsepez@chromium.org> | 2014-08-13 17:12:28 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2014-08-13 17:12:28 -0700 |
commit | 368ed462dd6e5e63977ca2b2e56a7e83b3a3bdda (patch) | |
tree | d6e9f37c824646a245d2753fe93a8404da52dbff /fpdfsdk/src/fpdfview.cpp | |
parent | 2fd7b0be4473f4c9877fed2c2ade403c71ded395 (diff) | |
download | pdfium-368ed462dd6e5e63977ca2b2e56a7e83b3a3bdda.tar.xz |
Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.
Should there be cases where this fails to compile, it indicates a mistake,
either an incorrectly declared overrriden virtual method, or a method that
should be declared non-virtual.
The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(),
and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere,
and are removed. Two members are removed that are no longer needed once those
methods are removed.
R=jam@chromium.org, jun_fang@foxitsoftware.com
Review URL: https://codereview.chromium.org/454983003
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 2e1bca3a66..70494e02a2 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -13,34 +13,8 @@ CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) { - m_FileAccess = *pFileAccess; - m_BufferOffset = (FX_DWORD)-1; -} - -FX_BOOL CPDF_CustomAccess::GetByte(FX_DWORD pos, FX_BYTE& ch) -{ - if (pos >= m_FileAccess.m_FileLen) return FALSE; - if (m_BufferOffset == (FX_DWORD)-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(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size) -{ - FX_SAFE_DWORD newPos = size; - newPos += pos; - if (!newPos.IsValid() || newPos.ValueOrDie() > m_FileAccess.m_FileLen) { - return FALSE; - } - return m_FileAccess.m_GetBlock(m_FileAccess.m_Param, pos, pBuf, size); + if (pFileAccess) + m_FileAccess = *pFileAccess; } FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) |