summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fxcrt/fx_system.h173
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h6
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp16
-rw-r--r--core/src/fpdfdoc/tagged_int.h2
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp2
-rw-r--r--core/src/fxcrt/extension.h58
-rw-r--r--core/src/fxcrt/fx_arabic.h14
-rw-r--r--core/src/fxge/apple/apple_int.h14
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_dib.cpp2
-rw-r--r--core/src/fxge/win32/fx_win32_dwrite.cpp6
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp4
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp2
15 files changed, 137 insertions, 172 deletions
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index 76c6b59a52..f0ebcf90b1 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -1,29 +1,45 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
#define CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
-#define _FX_WIN32_DESKTOP_ 1
-#define _FX_LINUX_DESKTOP_ 4
-#define _FX_MACOSX_ 7
-#define _FX_ANDROID_ 12
+#include <assert.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+// _FX_OS_ values:
+#define _FX_WIN32_DESKTOP_ 1
+#define _FX_WIN64_DESKTOP_ 2
+#define _FX_LINUX_DESKTOP_ 4
+#define _FX_MACOSX_ 7
+#define _FX_ANDROID_ 12
-#define _FXM_PLATFORM_WINDOWS_ 1
-#define _FXM_PLATFORM_LINUX_ 2
-#define _FXM_PLATFORM_APPLE_ 3
-#define _FXM_PLATFORM_ANDROID_ 4
+// _FXM_PLATFORM_ values;
+#define _FXM_PLATFORM_WINDOWS_ 1 // _FX_WIN32_DESKTOP_ or _FX_WIN64_DESKTOP_.
+#define _FXM_PLATFORM_LINUX_ 2 // _FX_LINUX_DESKTOP_ always.
+#define _FXM_PLATFORM_APPLE_ 3 // _FX_MACOSX_ always.
+#define _FXM_PLATFORM_ANDROID_ 4 // _FX_ANDROID_ always.
#ifndef _FX_OS_
#if defined(__ANDROID__)
#define _FX_OS_ _FX_ANDROID_
#define _FXM_PLATFORM_ _FXM_PLATFORM_ANDROID_
-#elif defined(_WIN32) || defined(_WIN64)
+#elif defined(_WIN32)
#define _FX_OS_ _FX_WIN32_DESKTOP_
#define _FXM_PLATFORM_ _FXM_PLATFORM_WINDOWS_
+#elif defined(_WIN64)
+#define _FX_OS_ _FX_WIN64_DESKTOP_
+#define _FXM_PLATFORM_ _FXM_PLATFORM_WINDOWS_
#elif defined(__linux__)
#define _FX_OS_ _FX_LINUX_DESKTOP_
#define _FXM_PLATFORM_ _FXM_PLATFORM_LINUX_
@@ -31,94 +47,56 @@
#define _FX_OS_ _FX_MACOSX_
#define _FXM_PLATFORM_ _FXM_PLATFORM_APPLE_
#endif
-#endif
+#endif // _FX_OS_
#if !defined(_FX_OS_) || _FX_OS_ == 0
-#error Sorry, can not figure out what OS you are targeting to. Please specify _FX_OS_ macro.
+#error Sorry, can not figure out target OS. Please specify _FX_OS_ macro.
#endif
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define _CRT_SECURE_NO_WARNINGS
#include <sal.h>
#include <windows.h>
-#endif // _FXM_PLATFORM_WINDOWS_
-#define _FX_W32_ 1
-#define _FX_W64_ 2
-#ifndef _FX_WORDSIZE_
-#if defined(_WIN64) || defined(__arm64) || defined(__arm64__) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IA64) || defined(__powerpc64__) || defined(__x86_64__) || __WORDSIZE == 64 || defined(__LP64__)
-#define _FX_WORDSIZE_ _FX_W64_
-#else
-#define _FX_WORDSIZE_ _FX_W32_
-#endif
#endif
-#include <stddef.h>
-#include <stdarg.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <wchar.h>
-
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
#include <libkern/OSAtomic.h>
-#if _FX_OS_ == _FX_MACOSX_
#include <Carbon/Carbon.h>
-#elif _FX_OS_ == _FX_IOS_
-#include <CoreText/CoreText.h>
-#include <CoreGraphics/CoreGraphics.h>
-#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
-typedef void* FX_LPVOID;
-typedef void const* FX_LPCVOID;
-typedef void* FX_POSITION;
-typedef signed char FX_INT8;
-typedef unsigned char FX_UINT8;
-typedef unsigned char FX_BYTE;
-typedef unsigned char* FX_LPBYTE;
-typedef unsigned char const* FX_LPCBYTE;
-typedef short FX_INT16;
-typedef unsigned short FX_UINT16;
-typedef short FX_SHORT;
-typedef unsigned short FX_WORD;
-typedef unsigned short* FX_LPWORD;
-typedef unsigned short const* FX_LPCWORD;
-typedef int FX_INT32;
-typedef float FX_FLOAT;
-typedef int FX_BOOL;
-typedef int FX_ERR;
-#define FX_SUCCEEDED(Status) ((FX_ERR)(Status) >= 0)
-#define FX_FAILED(Status) ((FX_ERR)(Status) < 0)
-typedef char FX_CHAR;
-typedef char* FX_LPSTR;
-typedef char const* FX_LPCSTR;
-#define FX_DWORD_MAX UINT_MAX
-typedef unsigned int FX_DWORD;
-typedef unsigned int* FX_LPDWORD;
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-typedef __int64 FX_INT64;
-typedef unsigned __int64 FX_UINT64;
-#else
-typedef long long int FX_INT64;
-typedef unsigned long long FX_UINT64;
-#endif
-#if _FX_WORDSIZE_ == _FX_W64_
-typedef FX_INT64 FX_INTPTR;
-typedef FX_UINT64 FX_UINTPTR;
-#else
-typedef int FX_INTPTR;
-typedef unsigned int FX_UINTPTR;
-#endif
-typedef wchar_t FX_WCHAR;
-typedef wchar_t* FX_LPWSTR;
-typedef wchar_t const* FX_LPCWSTR;
-typedef FX_DWORD FX_UINT32;
-typedef FX_UINT64 FX_QWORD;
+typedef void* FX_LPVOID; // Deprecate, use with void*.
+typedef void const* FX_LPCVOID; // Deprecate, use with const void*.
+typedef void* FX_POSITION; // Keep until fxcrt containers gone
+typedef signed char FX_INT8; // Deprecate, use int8_t.
+typedef unsigned char FX_UINT8; // Deprecate, use uint8_t.
+typedef unsigned char FX_BYTE; // Deprecate, use uint8_t.
+typedef unsigned char* FX_LPBYTE; // Deprecate, use uint8_t*.
+typedef unsigned char const* FX_LPCBYTE; // Deprecate, use const uint8_t*.
+typedef short FX_INT16; // Deprecate, use int16_t.
+typedef unsigned short FX_UINT16; // Deprecate, use uint16_t.
+typedef short FX_SHORT; // Deprecate, use int16_t.
+typedef unsigned short FX_WORD; // Keep - "an efficient small type"
+typedef unsigned short* FX_LPWORD; // Deprecate, use FX_WORD*.
+typedef unsigned short const* FX_LPCWORD; // Deprecate, use const FX_WORD*.
+typedef int FX_INT32; // Deprecate, use int32_t.
+typedef unsigned int FX_UINT32; // Deprecate, use uint32_t.
+typedef unsigned int FX_DWORD; // Keep - "an efficient type"
+typedef unsigned int* FX_LPDWORD; // Deprecate, use FX_DWORD*.
+typedef int64_t FX_INT64; // Deprecate, use int64_t.
+typedef uint64_t FX_UINT64; // Deprecate, use uint64_t.
+typedef intptr_t FX_INTPTR; // Deprecate, use intptr_t.
+typedef uintptr_t FX_UINTPTR; // Deprecate, use uintptr_t.
+typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
+typedef int FX_BOOL; // Sadly not always 0 or 1.
+typedef char FX_CHAR; // Keep, questionable signedness.
+typedef char* FX_LPSTR; // Deprecate, use FX_CHAR*.
+typedef char const* FX_LPCSTR; // Deprecate, use const FX_CHAR*.
+typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
+typedef wchar_t* FX_LPWSTR; // Deprecate, use FX_WCHAR*.
+typedef wchar_t const* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*.
// PDFium string sizes are limited to 2^31-1, and the value is signed to
// allow -1 as a placeholder for "unknown".
@@ -128,27 +106,28 @@ typedef int FX_STRSIZE;
#if defined(DEBUG) && !defined(_DEBUG)
#define _DEBUG
#endif
-#ifndef TRUE
+#ifndef TRUE
#define TRUE 1
#endif
-#ifndef FALSE
+#ifndef FALSE
#define FALSE 0
#endif
-#ifndef NULL
+#ifndef NULL
#define NULL 0
#endif
+
#define FXSYS_assert assert
#ifndef ASSERT
#ifdef _DEBUG
#define ASSERT FXSYS_assert
#else
-
#define ASSERT(a)
#endif
#endif
+
#define FX_MAX(a, b) (((a) > (b)) ? (a) : (b))
#define FX_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define FX_PI 3.1415926535897932384626433832795f
@@ -192,7 +171,7 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap);
#endif
#else
FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode);
-#endif
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifdef __cplusplus
} // extern "C"
@@ -219,6 +198,7 @@ extern "C" {
#define FXSYS_memchr memchr
#define FXSYS_qsort qsort
#define FXSYS_bsearch bsearch
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FXSYS_GetACP GetACP
#define FXSYS_itoa _itoa
@@ -255,16 +235,13 @@ int FXSYS_stricmp(const char*, const char*);
int FXSYS_wcsicmp(const wchar_t *string1, const wchar_t *string2);
wchar_t* FXSYS_wcslwr(wchar_t* str);
wchar_t* FXSYS_wcsupr(wchar_t* str);
-#endif
+#endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_
+
#define FXSYS_memcpy32 FXSYS_memcpy
#define FXSYS_memcmp32 FXSYS_memcmp
#define FXSYS_memset32 FXSYS_memset
#define FXSYS_memset8 FXSYS_memset
#define FXSYS_memmove32 FXSYS_memmove
-#ifdef __cplusplus
-}
-#endif
-#include <math.h>
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FXSYS_pow(a, b) (FX_FLOAT)powf(a, b)
#else
@@ -282,10 +259,6 @@ wchar_t* FXSYS_wcsupr(wchar_t* str);
#define FXSYS_log10(a) (FX_FLOAT)log10(a)
#define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b)
#define FXSYS_abs abs
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define _FX_LSB_FIRST_
#define FXDWORD_FROM_LSBFIRST(i) (i)
#define FXDWORD_FROM_MSBFIRST(i) (((FX_BYTE)(i) << 24) | ((FX_BYTE)((i) >> 8) << 16) | ((FX_BYTE)((i) >> 16) << 8) | (FX_BYTE)((i) >> 24))
#define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPBYTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0]))
@@ -307,18 +280,6 @@ int FXSYS_round(FX_FLOAT f);
#define FXSYS_sqrt2(a, b) (FX_FLOAT)FXSYS_sqrt((a)*(a) + (b)*(b))
#ifdef __cplusplus
};
-
-#if defined(__clang__) || _MSC_VER >= 1700
-#define FX_FINAL final
-#define FX_OVERRIDE override
-#elif defined(__GNUC__) && __cplusplus >= 201103 && \
- (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
-#define FX_FINAL final
-#define FX_OVERRIDE override
-#else
-#define FX_FINAL
-#define FX_OVERRIDE
-#endif
#endif
// To print a size_t value in a portable way:
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 9d0967978c..e75fd079bf 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -191,7 +191,7 @@ const FX_CharsetUnicodes g_FX_CharsetUnicodes[] = {
{ FXFONT_ARABIC_CHARSET, g_FX_CP1256Unicodes },
{ FXFONT_BALTIC_CHARSET, g_FX_CP1257Unicodes },
};
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_)
+#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_)
static void _InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArray)
{
int size = end - start + 1;
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index adfff6756a..cee68c0029 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -408,14 +408,14 @@ private:
struct TFeatureList FeatureList;
struct TLookupList LookupList;
};
-class CFX_GSUBTable FX_FINAL : public IFX_GSUBTable
+class CFX_GSUBTable final : public IFX_GSUBTable
{
public:
- virtual void Release() FX_OVERRIDE
+ virtual void Release() override
{
delete this;
}
- virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) FX_OVERRIDE;
+ virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
CFX_CTTGSUBTable m_GsubImp;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 09d1d3ed4d..792f6e076f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2718,28 +2718,28 @@ void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size)
}
}
-class CPDF_DataAvail FX_FINAL : public IPDF_DataAvail
+class CPDF_DataAvail final : public IPDF_DataAvail
{
public:
CPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead);
~CPDF_DataAvail();
- virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) FX_OVERRIDE;
+ virtual FX_BOOL IsDocAvail(IFX_DownloadHints* pHints) override;
- virtual void SetDocument(CPDF_Document* pDoc) FX_OVERRIDE;
+ virtual void SetDocument(CPDF_Document* pDoc) override;
- virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) FX_OVERRIDE;
+ virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
- virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) FX_OVERRIDE;
+ virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override;
- virtual FX_INT32 IsLinearizedPDF() FX_OVERRIDE;
+ virtual FX_INT32 IsLinearizedPDF() override;
- virtual FX_BOOL IsLinearized() FX_OVERRIDE
+ virtual FX_BOOL IsLinearized() override
{
return m_bLinearized;
}
- virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize) FX_OVERRIDE;
+ virtual void GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSize) override;
protected:
static const int kMaxDataAvailRecursionDepth = 64;
diff --git a/core/src/fpdfdoc/tagged_int.h b/core/src/fpdfdoc/tagged_int.h
index 75004e51fa..44ba527a60 100644
--- a/core/src/fpdfdoc/tagged_int.h
+++ b/core/src/fpdfdoc/tagged_int.h
@@ -34,7 +34,7 @@ protected:
CFX_ArrayTemplate<CPDF_StructElementImpl*> m_Kids;
friend class CPDF_StructElementImpl;
};
-class CPDF_StructElementImpl FX_FINAL : public CPDF_StructElement
+class CPDF_StructElementImpl final : public CPDF_StructElement
{
public:
CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* pParent, CPDF_Dictionary* pDict);
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index b80facfad6..9dcc87bcdf 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <setjmp.h>
+
#include "../../../include/fxcodec/fx_codec.h"
#include "../../../include/fxcrt/fx_safe_types.h"
#include "../../../include/fxge/fx_dib.h"
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index a59f81e08f..ce66e26402 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -28,7 +28,7 @@ public:
virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
-class CFX_CRTFileStream FX_FINAL : public IFX_FileStream
+class CFX_CRTFileStream final : public IFX_FileStream
{
public:
CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bUseRange(FALSE), m_nOffset(0), m_nSize(0) {}
@@ -38,27 +38,27 @@ public:
m_pFile->Release();
}
}
- virtual IFX_FileStream* Retain() FX_OVERRIDE
+ virtual IFX_FileStream* Retain() override
{
m_dwCount ++;
return this;
}
- virtual void Release() FX_OVERRIDE
+ virtual void Release() override
{
FX_DWORD nCount = -- m_dwCount;
if (!nCount) {
delete this;
}
}
- virtual FX_FILESIZE GetSize() FX_OVERRIDE
+ virtual FX_FILESIZE GetSize() override
{
return m_bUseRange ? m_nSize : m_pFile->GetSize();
}
- virtual FX_BOOL IsEOF() FX_OVERRIDE
+ virtual FX_BOOL IsEOF() override
{
return GetPosition() >= GetSize();
}
- virtual FX_FILESIZE GetPosition() FX_OVERRIDE
+ virtual FX_FILESIZE GetPosition() override
{
FX_FILESIZE pos = m_pFile->GetPosition();
if (m_bUseRange) {
@@ -66,7 +66,7 @@ public:
}
return pos;
}
- virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) FX_OVERRIDE
+ virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) override
{
if (offset < 0 || size < 0) {
return FALSE;
@@ -84,11 +84,11 @@ public:
m_pFile->SetPosition(m_nOffset);
return TRUE;
}
- virtual void ClearRange() FX_OVERRIDE
+ virtual void ClearRange() override
{
m_bUseRange = FALSE;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override
{
if (m_bUseRange && offset < 0) {
return FALSE;
@@ -103,7 +103,7 @@ public:
}
return (FX_BOOL)m_pFile->ReadPos(buffer, size, pos.ValueOrDie());
}
- virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE
+ virtual size_t ReadBlock(void* buffer, size_t size) override
{
if (m_bUseRange) {
FX_FILESIZE availSize = m_nOffset + m_nSize - m_pFile->GetPosition();
@@ -113,14 +113,14 @@ public:
}
return m_pFile->Read(buffer, size);
}
- virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
+ virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override
{
if (m_bUseRange) {
offset += m_nOffset;
}
return (FX_BOOL)m_pFile->WritePos(buffer, size, offset);
}
- virtual FX_BOOL Flush() FX_OVERRIDE
+ virtual FX_BOOL Flush() override
{
return m_pFile->Flush();
}
@@ -133,7 +133,7 @@ public:
#define FX_MEMSTREAM_BlockSize (64 * 1024)
#define FX_MEMSTREAM_Consecutive 0x01
#define FX_MEMSTREAM_TakeOver 0x02
-class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream
+class CFX_MemoryStream final : public IFX_MemoryStream
{
public:
CFX_MemoryStream(FX_BOOL bConsecutive)
@@ -166,12 +166,12 @@ public:
}
m_Blocks.RemoveAll();
}
- virtual IFX_FileStream* Retain() FX_OVERRIDE
+ virtual IFX_FileStream* Retain() override
{
m_dwCount ++;
return this;
}
- virtual void Release() FX_OVERRIDE
+ virtual void Release() override
{
FX_DWORD nCount = -- m_dwCount;
if (nCount) {
@@ -179,15 +179,15 @@ public:
}
delete this;
}
- virtual FX_FILESIZE GetSize() FX_OVERRIDE
+ virtual FX_FILESIZE GetSize() override
{
return m_bUseRange ? (FX_FILESIZE) m_nSize : (FX_FILESIZE)m_nCurSize;
}
- virtual FX_BOOL IsEOF() FX_OVERRIDE
+ virtual FX_BOOL IsEOF() override
{
return m_nCurPos >= (size_t)GetSize();
}
- virtual FX_FILESIZE GetPosition() FX_OVERRIDE
+ virtual FX_FILESIZE GetPosition() override
{
FX_FILESIZE pos = (FX_FILESIZE)m_nCurPos;
if (m_bUseRange) {
@@ -195,7 +195,7 @@ public:
}
return pos;
}
- virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) FX_OVERRIDE
+ virtual FX_BOOL SetRange(FX_FILESIZE offset, FX_FILESIZE size) override
{
if (offset < 0 || size < 0) {
return FALSE;
@@ -211,11 +211,11 @@ public:
m_nCurPos = m_nOffset;
return TRUE;
}
- virtual void ClearRange() FX_OVERRIDE
+ virtual void ClearRange() override
{
m_bUseRange = FALSE;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override
{
if (!buffer || !size) {
return FALSE;
@@ -258,7 +258,7 @@ public:
}
return TRUE;
}
- virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE
+ virtual size_t ReadBlock(void* buffer, size_t size) override
{
if (m_nCurPos >= m_nCurSize) {
return 0;
@@ -275,7 +275,7 @@ public:
}
return nRead;
}
- virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE
+ virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override
{
if (!buffer || !size) {
return FALSE;
@@ -335,15 +335,15 @@ public:
}
return TRUE;
}
- virtual FX_BOOL Flush() FX_OVERRIDE
+ virtual FX_BOOL Flush() override
{
return TRUE;
}
- virtual FX_BOOL IsConsecutive() const FX_OVERRIDE
+ virtual FX_BOOL IsConsecutive() const override
{
return m_dwFlags & FX_MEMSTREAM_Consecutive;
}
- virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) FX_OVERRIDE
+ virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) override
{
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
if (m_Blocks.GetSize() < 1) {
@@ -355,11 +355,11 @@ public:
m_nGrowSize = FX_MAX(nGrowSize, 4096);
}
}
- virtual FX_LPBYTE GetBuffer() const FX_OVERRIDE
+ virtual FX_LPBYTE GetBuffer() const override
{
return m_Blocks.GetSize() ? (FX_LPBYTE)m_Blocks[0] : NULL;
}
- virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) FX_OVERRIDE
+ virtual void AttachBuffer(FX_LPBYTE pBuffer, size_t nSize, FX_BOOL bTakeOver = FALSE) override
{
if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
return;
@@ -371,7 +371,7 @@ public:
m_dwFlags = FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0);
ClearRange();
}
- virtual void DetachBuffer() FX_OVERRIDE
+ virtual void DetachBuffer() override
{
if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) {
return;
diff --git a/core/src/fxcrt/fx_arabic.h b/core/src/fxcrt/fx_arabic.h
index dda26e6d1f..741bfb9c3d 100644
--- a/core/src/fxcrt/fx_arabic.h
+++ b/core/src/fxcrt/fx_arabic.h
@@ -7,22 +7,22 @@
#ifndef CORE_SRC_FXCRT_FX_ARABIC_H_
#define CORE_SRC_FXCRT_FX_ARABIC_H_
-class CFX_BidiChar FX_FINAL : public IFX_BidiChar
+class CFX_BidiChar final : public IFX_BidiChar
{
public:
CFX_BidiChar();
- virtual void Release() FX_OVERRIDE
+ virtual void Release() override
{
delete this;
}
- virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) FX_OVERRIDE
+ virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) override
{
m_bSeparateNeutral = bSeparateNeutral;
}
- virtual FX_BOOL AppendChar(FX_WCHAR wch) FX_OVERRIDE;
- virtual FX_BOOL EndChar() FX_OVERRIDE;
- virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) FX_OVERRIDE;
- virtual void Reset() FX_OVERRIDE;
+ virtual FX_BOOL AppendChar(FX_WCHAR wch) override;
+ virtual FX_BOOL EndChar() override;
+ virtual FX_INT32 GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) override;
+ virtual void Reset() override;
private:
~CFX_BidiChar() { }
diff --git a/core/src/fxge/apple/apple_int.h b/core/src/fxge/apple/apple_int.h
index 5b083d83eb..2466ecbc9a 100644
--- a/core/src/fxge/apple/apple_int.h
+++ b/core/src/fxge/apple/apple_int.h
@@ -186,28 +186,28 @@ protected:
FX_INT32 _horzSize;
FX_INT32 _vertSize;
};
-class CFX_FontProvider FX_FINAL : public IFX_FileRead
+class CFX_FontProvider final : public IFX_FileRead
{
public:
- virtual void Release() FX_OVERRIDE
+ virtual void Release() override
{
delete this;
}
- virtual FX_FILESIZE GetSize() FX_OVERRIDE
+ virtual FX_FILESIZE GetSize() override
{
return (FX_FILESIZE)_totalSize;
}
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE;
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
- virtual FX_BOOL IsEOF() FX_OVERRIDE
+ virtual FX_BOOL IsEOF() override
{
return _offSet == _totalSize;
}
- virtual FX_FILESIZE GetPosition() FX_OVERRIDE
+ virtual FX_FILESIZE GetPosition() override
{
return (FX_FILESIZE)_offSet;
}
- virtual size_t ReadBlock(void* buffer, size_t size) FX_OVERRIDE;
+ virtual size_t ReadBlock(void* buffer, size_t size) override;
public:
CFX_FontProvider(CGFontRef cgFont);
~CFX_FontProvider();
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 74f97d1b2e..c1ea5906ff 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <limits>
+
#include "../../../include/fxge/fx_ge.h"
#include "../../../include/fxge/fx_freetype.h"
#include "text_int.h"
@@ -1365,7 +1367,7 @@ void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path)
if (GET_TT_LONG(buffer) == 0x74746366) {
FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
- if (nFaces > FX_DWORD_MAX / 4) {
+ if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) {
FXSYS_fclose(pFile);
return;
}
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 0717fb1528..4bef988885 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#include "../../../include/fxge/fx_ge_win32.h"
#include <crtdbg.h>
#include "../agg/include/fxfx_agg_clip_liang_barsky.h"
@@ -16,7 +16,7 @@
#include "../agg/include/fx_agg_driver.h"
#include "../../../include/fxge/fx_freetype.h"
#include "../../../include/fxcodec/fx_codec.h"
-class CWin32FontInfo FX_FINAL : public IFX_SystemFontInfo
+class CWin32FontInfo final : public IFX_SystemFontInfo
{
public:
CWin32FontInfo();
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index 46abdb366c..47da880680 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#include <windows.h>
#include "../../../include/fxge/fx_ge_win32.h"
#include "win32_int.h"
diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp
index 7a17c4ad09..0849583384 100644
--- a/core/src/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/src/fxge/win32/fx_win32_dwrite.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#include "../../../include/fxge/fx_ge_win32.h"
#include "dwrite_int.h"
#include <dwrite.h>
@@ -26,7 +26,7 @@ inline InterfaceType* SafeAcquire(InterfaceType* newObject)
}
return newObject;
}
-class CDwFontFileStream FX_FINAL : public IDWriteFontFileStream
+class CDwFontFileStream final : public IDWriteFontFileStream
{
public:
explicit CDwFontFileStream(void const* fontFileReferenceKey, UINT32 fontFileReferenceKeySize);
@@ -46,7 +46,7 @@ private:
void const* resourcePtr_;
DWORD resourceSize_;
};
-class CDwFontFileLoader FX_FINAL : public IDWriteFontFileLoader
+class CDwFontFileLoader final : public IDWriteFontFileLoader
{
public:
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObject);
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index 67aa16242b..e36d283115 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#include <windows.h>
#include <algorithm>
namespace Gdiplus {
@@ -995,7 +995,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData,
CallFunc(GdipDeleteGraphics)(pGraphics);
return TRUE;
}
-class GpStream FX_FINAL : public IStream
+class GpStream final : public IStream
{
LONG m_RefCount;
int m_ReadPos;
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 670622a5fb..d6a44b490f 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../../include/fxge/fx_ge.h"
-#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
+#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
#include <windows.h>
#include "../../../include/fxge/fx_ge_win32.h"
#include "win32_int.h"