summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_define.h12
-rw-r--r--fpdfsdk/src/fpdf_sysfontinfo.cpp16
-rw-r--r--fpdfsdk/src/fpdfsave.cpp4
-rw-r--r--fpdfsdk/src/fpdfview.cpp30
4 files changed, 16 insertions, 46 deletions
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index 433ff4c184..d249f0887f 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -107,18 +107,14 @@ public:
CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
~CPDF_CustomAccess() {}
- virtual CFX_ByteString GetFullPath() { return ""; }
- virtual FX_FILESIZE GetSize() { return m_FileAccess.m_FileLen; }
+ virtual FX_FILESIZE GetSize() FX_OVERRIDE { return m_FileAccess.m_FileLen; }
- virtual FX_BOOL GetByte(FX_DWORD pos, FX_BYTE& ch);
- virtual FX_BOOL GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);
- virtual void Release() { delete this; }
+ virtual void Release() FX_OVERRIDE { delete this; }
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE;
+private:
FPDF_FILEACCESS m_FileAccess;
- FX_BYTE m_Buffer[512];
- FX_DWORD m_BufferOffset;
};
void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp
index cc75e635b3..0e0114b372 100644
--- a/fpdfsdk/src/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp
@@ -12,14 +12,14 @@ class CSysFontInfo_Ext FX_FINAL : public IFX_SystemFontInfo
public:
FPDF_SYSFONTINFO* m_pInfo;
- virtual void Release()
+ virtual void Release() FX_OVERRIDE
{
if (m_pInfo->Release)
m_pInfo->Release(m_pInfo);
delete this;
}
- virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper)
+ virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) FX_OVERRIDE
{
if (m_pInfo->EnumFonts) {
m_pInfo->EnumFonts(m_pInfo, pMapper);
@@ -28,28 +28,28 @@ public:
return FALSE;
}
- virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact)
+ virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) FX_OVERRIDE
{
if (m_pInfo->MapFont)
return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, family, &bExact);
return NULL;
}
- virtual void* GetFont(FX_LPCSTR family)
+ virtual void* GetFont(FX_LPCSTR family) FX_OVERRIDE
{
if (m_pInfo->GetFont)
return m_pInfo->GetFont(m_pInfo, family);
return NULL;
}
- virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size)
+ virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffer, FX_DWORD size) FX_OVERRIDE
{
if (m_pInfo->GetFontData)
return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
return 0;
}
- virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name)
+ virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) FX_OVERRIDE
{
if (m_pInfo->GetFaceName == NULL) return FALSE;
FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0);
@@ -61,7 +61,7 @@ public:
return TRUE;
}
- virtual FX_BOOL GetFontCharset(void* hFont, int& charset)
+ virtual FX_BOOL GetFontCharset(void* hFont, int& charset) FX_OVERRIDE
{
if (m_pInfo->GetFontCharset) {
charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
@@ -70,7 +70,7 @@ public:
return FALSE;
}
- virtual void DeleteFont(void* hFont)
+ virtual void DeleteFont(void* hFont) FX_OVERRIDE
{
if (m_pInfo->DeleteFont)
m_pInfo->DeleteFont(m_pInfo, hFont);
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 8025946ba8..45dfbf7214 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -19,8 +19,8 @@ class CFX_IFileWrite FX_FINAL : public IFX_StreamWrite
public:
CFX_IFileWrite();
FX_BOOL Init( FPDF_FILEWRITE * pFileWriteStruct );
- virtual FX_BOOL WriteBlock(const void* pData, size_t size);
- virtual void Release(){};
+ virtual FX_BOOL WriteBlock(const void* pData, size_t size) FX_OVERRIDE;
+ virtual void Release() FX_OVERRIDE {}
protected:
FPDF_FILEWRITE* m_pFileWriteStruct;
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)