Replace _FX_PLATFORM_WINDOWS_ with defined(OS_WIN).
Use build/build_config.h to standarize on Chromium's platform defines.
Replace many instances of _FX_PLATFORM_WINDOWS_ usage.
Change-Id: I3a94bce3759cbb41194a89b8ad44a51ffda9909c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53714
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 73c4985..91c5301 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -262,7 +262,7 @@
if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() && m_pCMap->IsLoaded())
return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
wchar_t unicode;
int charsize = 1;
if (charcode > 255) {
@@ -310,7 +310,7 @@
return static_cast<uint32_t>(unicode);
if (m_pCMap->GetCoding() == CIDCODING_CID)
return 0;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
uint8_t buffer[32];
int ret = FXSYS_WideCharToMultiByte(
g_CharsetCPs[m_pCMap->GetCoding()], 0, &unicode, 1,
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 30cfa6b..2d0e4f7 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/cpdf_modulemgr.h"
#include "core/fpdfapi/font/cpdf_fontencoding.h"
#include "core/fpdfapi/page/cpdf_docpagedata.h"
@@ -59,7 +60,7 @@
pWidthArray1->AddNew<CPDF_Number>(w);
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
void InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArray) {
std::vector<int> widths(end - start + 1);
GetCharWidth(hDC, start, end, widths.data());
@@ -77,7 +78,7 @@
}
return result;
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
void InsertWidthArray1(CFX_Font* pFont,
CFX_UnicodeEncoding* pEncoding,
@@ -805,7 +806,7 @@
return LoadFont(pBaseDict);
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont) {
pLogFont->lfHeight = -1000;
pLogFont->lfWidth = 0;
@@ -885,7 +886,7 @@
DeleteDC(hDC);
return LoadFont(pBaseDict);
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
CPDF_Document::StockFontClearer::StockFontClearer(CPDF_Document* pDoc)
: m_pDoc(pDoc) {}
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index 6ff6c0e..3ef4ff6 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/page/cpdf_image.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_object.h"
@@ -125,7 +126,7 @@
const CPDF_FontEncoding* pEncoding);
CPDF_Font* AddFont(CFX_Font* pFont, int charset);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont);
#endif
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
index f4b1f32..ea8796d 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
@@ -119,7 +119,7 @@
ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
#if defined(OS_MACOSX)
const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kExpectedMd5sum[] = "795b7ce1626931aa06af0fa23b7d80bb";
#else
const char kExpectedMd5sum[] = "2baa4c0e1758deba1b9c908e1fbd04ed";
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 2d670bb..1e22e2f 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -20,7 +20,7 @@
namespace {
-#if defined(OS_MACOSX) || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_MACOSX) || defined(OS_WIN)
WideString ChangeSlashToPlatform(const wchar_t* str) {
WideString result;
while (*str) {
@@ -50,7 +50,7 @@
}
return result;
}
-#endif // defined(OS_MACOSX) || _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_MACOSX) || defined(OS_WIN)
} // namespace
@@ -73,7 +73,7 @@
if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
return ChangeSlashToPlatform(filepath.c_str() + 1);
return ChangeSlashToPlatform(filepath.c_str());
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
if (filepath[0] != L'/')
return ChangeSlashToPlatform(filepath.c_str());
@@ -170,7 +170,7 @@
if (filepath.GetLength() <= 1)
return WideString();
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
if (filepath[1] == L':') {
WideString result(L'/');
result += filepath[0];
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 82315f2..e3149e9 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -23,7 +23,7 @@
{L"", L""},
// only file name.
{L"test.pdf", L"test.pdf"},
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
// With drive identifier.
{L"r:\\pdfdocs\\spec.pdf", L"/r/pdfdocs/spec.pdf"},
// Relative path.
@@ -61,7 +61,7 @@
{
// String object.
static const pdfium::NullTermWstrFuncTestData test_data = {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
L"/C/docs/test.pdf",
L"C:\\docs\\test.pdf"
#elif defined(OS_MACOSX)
@@ -79,7 +79,7 @@
{
// Dictionary object.
static const pdfium::NullTermWstrFuncTestData test_data[] = {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
{L"/C/docs/test.pdf", L"C:\\docs\\test.pdf"},
{L"/D/docs/test.pdf", L"D:\\docs\\test.pdf"},
{L"/E/docs/test.pdf", L"E:\\docs\\test.pdf"},
@@ -126,7 +126,7 @@
TEST(cpdf_filespec, SetFileName) {
static const pdfium::NullTermWstrFuncTestData test_data = {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
L"C:\\docs\\test.pdf",
L"/C/docs/test.pdf"
#elif defined(OS_MACOSX)
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 5507763..6d8c3c8 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "constants/form_fields.h"
#include "constants/stream_dict_common.h"
#include "core/fpdfapi/font/cpdf_font.h"
@@ -340,7 +341,7 @@
const wchar_t* m_pEnd;
};
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
struct PDF_FONTDATA {
bool bFind;
LOGFONTA lf;
@@ -386,7 +387,7 @@
}
return RetrieveSpecificFont(lf);
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
} // namespace
@@ -626,7 +627,7 @@
ByteString CPDF_InteractiveForm::GetNativeFont(uint8_t charSet,
void* pLogFont) {
ByteString csFontName;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
LOGFONTA lf = {};
if (charSet == FX_CHARSET_ANSI) {
csFontName = CFX_Font::kDefaultAnsiFontName;
@@ -667,7 +668,7 @@
if (!pDocument)
return nullptr;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
LOGFONTA lf;
ByteString csFontName = GetNativeFont(charSet, &lf);
if (!csFontName.IsEmpty()) {
diff --git a/core/fxcodec/codec/ccodec_faxmodule.cpp b/core/fxcodec/codec/ccodec_faxmodule.cpp
index 3616443..8979826 100644
--- a/core/fxcodec/codec/ccodec_faxmodule.cpp
+++ b/core/fxcodec/codec/ccodec_faxmodule.cpp
@@ -11,6 +11,7 @@
#include <memory>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcodec/codec/ccodec_scanlinedecoder.h"
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
@@ -617,7 +618,7 @@
EncodedByteAlign, BlackIs1);
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
namespace {
const uint8_t BlackRunTerminator[128] = {
0x37, 10, 0x02, 3, 0x03, 2, 0x02, 2, 0x03, 3, 0x03, 4, 0x02, 4,
@@ -809,4 +810,4 @@
encoder.Encode(dest_buf, dest_size);
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
diff --git a/core/fxcodec/codec/ccodec_faxmodule.h b/core/fxcodec/codec/ccodec_faxmodule.h
index e43aea3..608cffa 100644
--- a/core/fxcodec/codec/ccodec_faxmodule.h
+++ b/core/fxcodec/codec/ccodec_faxmodule.h
@@ -9,6 +9,7 @@
#include <memory>
+#include "build/build_config.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_system.h"
#include "third_party/base/span.h"
@@ -28,14 +29,14 @@
int Columns,
int Rows);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
static void FaxEncode(const uint8_t* src_buf,
int width,
int height,
int pitch,
std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf,
uint32_t* dest_size);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
// Return the ending bit position.
static int FaxG4Decode(const uint8_t* src_buf,
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.cpp b/core/fxcodec/codec/ccodec_jpegmodule.cpp
index a50bf65..4d5838b 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.cpp
+++ b/core/fxcodec/codec/ccodec_jpegmodule.cpp
@@ -11,6 +11,7 @@
#include <memory>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcodec/codec/ccodec_scanlinedecoder.h"
#include "core/fxcodec/codec/cfx_codec_memory.h"
#include "core/fxcodec/fx_codec.h"
@@ -90,13 +91,13 @@
static void error_do_nothing2(j_common_ptr cinfo, char*) {}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
static void dest_do_nothing(j_compress_ptr cinfo) {}
static boolean dest_empty(j_compress_ptr cinfo) {
return false;
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
} // extern "C"
#ifdef PDF_ENABLE_XFA
@@ -474,7 +475,7 @@
return static_cast<CJpegContext*>(pContext)->GetJumpMark();
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#define JPEG_BLOCK_SIZE 1048576
bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBBase>& pSource,
uint8_t** dest_buf,
@@ -575,4 +576,4 @@
return true;
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index 98c94e3..e0286fc 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -10,6 +10,7 @@
#include <csetjmp>
#include <memory>
+#include "build/build_config.h"
#include "core/fxcodec/codec/codec_module_iface.h"
#include "third_party/base/span.h"
@@ -53,11 +54,11 @@
bool StartScanline(Context* pContext, int down_scale);
bool ReadScanline(Context* pContext, uint8_t* dest_buf);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
static bool JpegEncode(const RetainPtr<CFX_DIBBase>& pSource,
uint8_t** dest_buf,
size_t* dest_size);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
};
#endif // CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index 79bc2c1..d6450fc 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -99,9 +99,9 @@
// static
CFX_DateTime CFX_DateTime::Now() {
FXUT_SYSTEMTIME utLocal;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
::GetLocalTime((LPSYSTEMTIME)&utLocal);
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else
timeval curTime;
gettimeofday(&curTime, nullptr);
@@ -115,7 +115,7 @@
utLocal.wMinute = st.tm_min;
utLocal.wSecond = st.tm_sec;
utLocal.wMillisecond = curTime.tv_usec / 1000;
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
return CFX_DateTime(utLocal.wYear, static_cast<uint8_t>(utLocal.wMonth),
static_cast<uint8_t>(utLocal.wDay),
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index 855ce8a..7bba0d8 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -6,9 +6,9 @@
#include "core/fxcrt/cfx_seekablestreamproxy.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#include <io.h>
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
#include <algorithm>
#include <limits>
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
index 11d07e2..2969315 100644
--- a/core/fxcrt/fx_coordinates.cpp
+++ b/core/fxcrt/fx_coordinates.cpp
@@ -8,6 +8,7 @@
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -31,7 +32,7 @@
}
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
static_assert(sizeof(FX_RECT) == sizeof(RECT), "FX_RECT vs. RECT mismatch");
static_assert(offsetof(FX_RECT, left) == offsetof(RECT, left),
"FX_RECT vs. RECT mismatch");
diff --git a/core/fxcrt/fx_random.cpp b/core/fxcrt/fx_random.cpp
index 56f84d59..ce796d9 100644
--- a/core/fxcrt/fx_random.cpp
+++ b/core/fxcrt/fx_random.cpp
@@ -6,6 +6,7 @@
#include "core/fxcrt/fx_random.h"
+#include "build/build_config.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -16,12 +17,12 @@
#define MT_Upper_Mask 0x80000000
#define MT_Lower_Mask 0x7fffffff
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#include <wincrypt.h>
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else
#include <sys/time.h>
#include <unistd.h>
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
namespace {
@@ -33,7 +34,7 @@
bool g_bHaveGlobalSeed = false;
uint32_t g_nGlobalSeed = 0;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
bool GenerateSeedFromCryptoRandom(uint32_t* pSeed) {
HCRYPTPROV hCP = 0;
if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) ||
@@ -50,30 +51,30 @@
char c;
uintptr_t p = reinterpret_cast<uintptr_t>(&c);
uint32_t seed = ~static_cast<uint32_t>(p >> 3);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
SYSTEMTIME st;
GetSystemTime(&st);
seed ^= static_cast<uint32_t>(st.wSecond) * 1000000;
seed ^= static_cast<uint32_t>(st.wMilliseconds) * 1000;
seed ^= GetCurrentProcessId();
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else
struct timeval tv;
gettimeofday(&tv, 0);
seed ^= static_cast<uint32_t>(tv.tv_sec) * 1000000;
seed ^= static_cast<uint32_t>(tv.tv_usec);
seed ^= static_cast<uint32_t>(getpid());
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
return seed;
}
void* ContextFromNextGlobalSeed() {
if (!g_bHaveGlobalSeed) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
if (!GenerateSeedFromCryptoRandom(&g_nGlobalSeed))
g_nGlobalSeed = GenerateSeedFromEnvironment();
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else
g_nGlobalSeed = GenerateSeedFromEnvironment();
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
g_bHaveGlobalSeed = true;
}
return FX_Random_MT_Start(++g_nGlobalSeed);
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index c02bbce..dd3c1fb 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -11,11 +11,12 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fileaccess_iface.h"
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/ptr_util.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#include <direct.h>
struct FX_FolderHandle {
@@ -33,7 +34,7 @@
ByteString m_Path;
DIR* m_Dir;
};
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
namespace {
@@ -123,7 +124,7 @@
FX_FolderHandle* FX_OpenFolder(const char* path) {
auto handle = pdfium::MakeUnique<FX_FolderHandle>();
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
handle->m_Handle =
FindFirstFileExA((ByteString(path) + "/*.*").c_str(), FindExInfoStandard,
&handle->m_FindData, FindExSearchNameMatch, nullptr, 0);
@@ -148,7 +149,7 @@
if (!handle)
return false;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
if (handle->m_bEnd)
return false;
@@ -177,7 +178,7 @@
if (!handle)
return;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
FindClose(handle->m_Handle);
#else
closedir(handle->m_Dir);
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index da77735..ef24d36 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -1082,7 +1082,7 @@
TEST(WideString, ToDefANSI) {
EXPECT_EQ("", WideString().ToDefANSI());
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
const char* kResult =
"x"
"?"
@@ -1134,7 +1134,7 @@
TEST(WideString, FromDefANSI) {
EXPECT_EQ(L"", WideString::FromDefANSI(ByteStringView()));
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
const wchar_t* kResult =
L"x"
L"\u20ac"
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index eb43004..d64299f 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -29,7 +29,7 @@
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/ports/SkFontMgr_empty.h"
#endif
@@ -322,17 +322,17 @@
m_pTypeface = SkTypeface::MakeFromStream(
pdfium::MakeUnique<SkMemoryStream>(span.data(), span.size()));
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
if (!m_pTypeface) {
sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty());
pdfium::span<const uint8_t> span = pFont->GetFontSpan();
m_pTypeface = customMgr->makeFromStream(
pdfium::MakeUnique<SkMemoryStream>(span.data(), span.size()));
}
-#endif
+#endif // defined(OS_WIN)
return m_pTypeface.get();
}
-#endif
+#endif // defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
#if !defined(OS_MACOSX)
void CFX_FaceCache::InitPlatform() {}
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 3dfbedb..23fa016 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -9,6 +9,7 @@
#include <limits>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_stream.h"
#include "core/fxge/cfx_fontmapper.h"
@@ -158,7 +159,7 @@
}
ByteString fullpath = path;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
fullpath += "\\";
#else
fullpath += "/";
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index 63b757e..742c016 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -9,9 +9,10 @@
#include <tuple>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
static_assert(sizeof(FX_COLORREF) == sizeof(COLORREF),
"FX_COLORREF vs. COLORREF mismatch");
#endif
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index 7acef50..d03da65 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -480,7 +480,7 @@
static const char kMd5ModifiedHighlight[] =
"aec26075011349dec9bace891856b5f2";
static const char kMd5ModifiedSquare[] = "057f57a32be95975775e5ec513fdcb56";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
static const char kMd5Original[] = "0e27376094f11490f74c65f3dc3a42c5";
static const char kMd5ModifiedHighlight[] =
"66f3caef3a7d488a4fa1ad37fc06310e";
@@ -688,7 +688,7 @@
static const char kMd5ModifiedPath[] = "9059723a045e17478753d2f0eb33bc03";
static const char kMd5TwoPaths[] = "7eed0cfba780f1d4dd8068f717d3a6bf";
static const char kMd5NewAnnot[] = "1de8212d43b7066a6df042095c2aca61";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
static const char kMd5Original[] = "6f3cc2dd37479ce7cc072bfb0c63c275";
static const char kMd5ModifiedPath[] = "c0c2eb2aba73ad15b3240e342fbe0d72";
static const char kMd5TwoPaths[] = "2306bf04915fe001b5f4726843d184c8";
@@ -889,7 +889,7 @@
static const char kMd5Original[] = "c35408717759562d1f8bf33d317483d2";
static const char kMd5NewImage[] = "ff012f5697436dfcaec25b32d1333596";
static const char kMd5ModifiedImage[] = "86cf8cb2755a7a2046a543e66d9c1e61";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
static const char kMd5Original[] = "6f3cc2dd37479ce7cc072bfb0c63c275";
static const char kMd5NewImage[] = "d19c6fcfd9a170802fcfb9adfa13557e";
static const char kMd5ModifiedImage[] = "1273cf2363570a50d1aa0c95b1318197";
@@ -974,7 +974,7 @@
static const char kMd5Original[] = "c35408717759562d1f8bf33d317483d2";
static const char kMd5NewText[] = "60031c1b0330cf1e1575f7d46687d429";
static const char kMd5ModifiedText[] = "79f5cfb0b07caaf936f65f6a7a57ce77";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
static const char kMd5Original[] = "6f3cc2dd37479ce7cc072bfb0c63c275";
static const char kMd5NewText[] = "87d55e09f9096de7e6552f5ae79afd3b";
static const char kMd5ModifiedText[] = "26e94fbd3af4b1e65479327507600114";
@@ -1112,7 +1112,7 @@
#if defined(OS_MACOSX)
static const char kMd5[] = "4d64e61c9c0f8c60ab3cc3234bb73b1c";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
static const char kMd5[] = "9ee141f698c3fcb56c050dffd6c82624";
#else
static const char kMd5[] = "c96ee1f316d7f5a1b154de9f9d467f01";
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 4fdde68..66e8962 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -449,7 +449,7 @@
ASSERT_EQ(2, FPDFPage_CountObjects(page));
#if defined(OS_MACOSX)
const char kChangedMD5[] = "94c1e7a5af7dd9d77dc2223b1091acb7";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kChangedMD5[] = "3137fdb27962671f5c3963a5e965eff5";
#else
const char kChangedMD5[] = "a0c4ea6620772991f66bf7130379b08a";
@@ -488,7 +488,7 @@
{
#if defined(OS_MACOSX)
const char kOriginalMD5[] = "b90475ca64d1348c3bf5e2b77ad9187a";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kOriginalMD5[] = "795b7ce1626931aa06af0fa23b7d80bb";
#else
const char kOriginalMD5[] = "2baa4c0e1758deba1b9c908e1fbd04ed";
@@ -507,7 +507,7 @@
{
#if defined(OS_MACOSX)
const char kRemovedMD5[] = "af760c4702467cb1492a57fb8215efaa";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kRemovedMD5[] = "aae6c5334721f90ec30d3d59f4ef7deb";
#else
const char kRemovedMD5[] = "b76df015fe88009c3c342395df96abf1";
@@ -644,7 +644,7 @@
{
#if defined(OS_MACOSX)
const char kOriginalMD5[] = "5a5eb63cb21cc15084fea1f14284b8df";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kOriginalMD5[] = "587c507a40f613f9c530b2ce2d58d655";
#else
const char kOriginalMD5[] = "2edc6e70d54889aa0c0b7bdf3e168f86";
@@ -690,7 +690,7 @@
#if defined(OS_MACOSX)
const char kNonPrimesMD5[] = "57e76dc7375d896704f0fd6d6d1b9e65";
const char kNonPrimesAfterSaveMD5[] = "6304512d0150bbd5578e8e22d3121103";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kNonPrimesMD5[] = "4d906b57fba36c70c600cf50d60f508c";
const char kNonPrimesAfterSaveMD5[] = "4d906b57fba36c70c600cf50d60f508c";
#else
@@ -966,7 +966,7 @@
ASSERT_EQ(2, FPDFPage_CountObjects(page));
#if defined(OS_MACOSX)
const char kHelloRemovedMD5[] = "e07a62d412728fc4d6e3ff42f2dd0e11";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kHelloRemovedMD5[] = "a97d4c72c969ba373c2dce675d277e65";
#else
const char kHelloRemovedMD5[] = "95b92950647a2190e1230911e7a1a0e9";
@@ -1013,7 +1013,7 @@
ASSERT_EQ(2, FPDFPage_CountObjects(page));
#if defined(OS_MACOSX)
const char kGreetingsRemovedMD5[] = "b90475ca64d1348c3bf5e2b77ad9187a";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kGreetingsRemovedMD5[] = "795b7ce1626931aa06af0fa23b7d80bb";
#else
const char kGreetingsRemovedMD5[] = "2baa4c0e1758deba1b9c908e1fbd04ed";
@@ -1129,7 +1129,7 @@
#if defined(OS_MACOSX)
const char kStream1RemovedMD5[] = "d2e21fbd5a6de563f619feeeb6163331";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kStream1RemovedMD5[] = "b4140f203523e38793283a5943d8075b";
#else
const char kStream1RemovedMD5[] = "e86a3efc160ede6cfcb1f59bcacf1105";
@@ -1261,7 +1261,7 @@
#if defined(OS_MACOSX)
const char kFirstRemovedMD5[] = "af760c4702467cb1492a57fb8215efaa";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kFirstRemovedMD5[] = "aae6c5334721f90ec30d3d59f4ef7deb";
#else
const char kFirstRemovedMD5[] = "b76df015fe88009c3c342395df96abf1";
@@ -1329,7 +1329,7 @@
#if defined(OS_MACOSX)
const char kLastRemovedMD5[] = "f8fbd14a048b9e2ea8e5f059f22a910e";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char kLastRemovedMD5[] = "93db13099042bafefb3c22a165bad684";
#else
const char kLastRemovedMD5[] = "93dcc09055f87a2792c8e3065af99a1b";
@@ -1643,7 +1643,7 @@
ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
#if defined(OS_MACOSX)
const char md5[] = "f9e6fa74230f234286bfcada9f7606d8";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "74dd9c393b8b2578d2b7feb032b7daad";
#else
const char md5[] = "aa71b09b93b55f467f1290e5111babee";
@@ -1788,7 +1788,7 @@
ScopedFPDFBitmap page_bitmap = RenderPage(page);
#if defined(OS_MACOSX)
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "08d1ff3e5a42801bee6077fd366bef00";
#else
const char md5[] = "eacaa24573b8ce997b3882595f096f00";
@@ -1813,7 +1813,7 @@
ScopedFPDFBitmap page_bitmap = RenderPage(page);
#if defined(OS_MACOSX)
const char md5[] = "a5c4ace4c6f27644094813fe1441a21c";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "3755dd35abd4c605755369401ee85b2d";
#else
const char md5[] = "76fcc7d08aa15445efd2e2ceb7c6cc3b";
@@ -1837,7 +1837,7 @@
ScopedFPDFBitmap page_bitmap = RenderPage(page);
#if defined(OS_MACOSX)
const char md5[] = "40b3ef04f915ff4c4208948001763544";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "aba523a8110d01ed9bd7b7781ff74045";
#else
const char md5[] = "b8a21668f1dab625af7c072e07fcefc4";
@@ -2006,7 +2006,7 @@
ScopedFPDFBitmap page_bitmap = RenderPage(page.get());
#if defined(OS_MACOSX)
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "08d1ff3e5a42801bee6077fd366bef00";
#else
const char md5[] = "eacaa24573b8ce997b3882595f096f00";
@@ -2352,7 +2352,7 @@
ScopedFPDFBitmap page_bitmap = RenderPage(page);
#if defined(OS_MACOSX)
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "d60ba39f9698e32360d99e727dd93165";
#else
const char md5[] = "70592859010ffbf532a2237b8118bcc4";
@@ -2370,7 +2370,7 @@
ScopedFPDFBitmap page_bitmap2 = RenderPage(page);
#if defined(OS_MACOSX)
const char md5_2[] = "8eded4193ff1f0f77b8b600a825e97ea";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5_2[] = "2199b579c49ab5f80c246a586a80ee90";
#else
const char md5_2[] = "c1d10cce1761c4a998a16b2562030568";
@@ -2666,7 +2666,7 @@
// Render and check the bitmap is the expected one.
#if defined(OS_MACOSX)
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5[] = "d60ba39f9698e32360d99e727dd93165";
#else
const char md5[] = "70592859010ffbf532a2237b8118bcc4";
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index cefdc7c..d5f6fba 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -794,7 +794,7 @@
const char md5_1[] = "5f11dbe575fe197a37c3fb422559f8ff";
const char md5_2[] = "35b1a4b679eafc749a0b6fda750c0e8d";
const char md5_3[] = "65c64a7c355388f719a752aa1e23f6fe";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#elif defined(OS_WIN)
const char md5_1[] = "d3204faa62b607f0bd3893c9c22cabcb";
const char md5_2[] = "29d1c3fd226ca6a69597f75937690320";
const char md5_3[] = "5e678a55912cb568fd677bf34abb8727";
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 9b1e84b..8c49acf 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -10,6 +10,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/cpdf_modulemgr.h"
#include "core/fpdfapi/cpdf_pagerendercontext.h"
#include "core/fpdfapi/page/cpdf_page.h"
@@ -49,7 +50,7 @@
#include "fxbarcode/BC_Library.h"
#endif // PDF_ENABLE_XFA
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#include "core/fxge/cfx_windowsrenderdevice.h"
#include "public/fpdf_edit.h"
@@ -68,7 +69,7 @@
static_assert(WindowsPrintMode::kModePostScript3PassThrough ==
FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH,
"WindowsPrintMode::kModePostScript3PassThrough value mismatch");
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
namespace {
diff --git a/fxjs/fx_date_helpers.cpp b/fxjs/fx_date_helpers.cpp
index d728965..fbef23e 100644
--- a/fxjs/fx_date_helpers.cpp
+++ b/fxjs/fx_date_helpers.cpp
@@ -10,6 +10,7 @@
#include <cmath>
+#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_system.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
@@ -35,12 +36,12 @@
time_t t = 0;
FXSYS_time(&t);
FXSYS_localtime(&t);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
// In gcc 'timezone' is a global variable declared in time.h. In VC++, that
// variable was removed in VC++ 2015, with _get_timezone replacing it.
long timezone = 0;
_get_timezone(&timezone);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
return (double)(-(timezone * 1000));
}
diff --git a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
index 45a2b60..e06e04c 100644
--- a/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter_unittest.cpp
@@ -10,6 +10,7 @@
#include <memory>
+#include "build/build_config.h"
#include "core/fpdfapi/cpdf_modulemgr.h"
#include "testing/fx_string_testhelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -31,7 +32,7 @@
}
void SetTZ(const char* tz) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
_putenv_s("TZ", tz);
_tzset();
#else
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 0d0b7f5..c950999 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -10,6 +10,7 @@
#include <memory>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/cfx_memorystream.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_font.h"
@@ -44,7 +45,7 @@
} // namespace
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
namespace {
@@ -248,7 +249,7 @@
return &m_FontFaces.back();
}
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else // defined(OS_WIN)
namespace {
@@ -790,7 +791,7 @@
} while (index < num_faces);
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
uint16_t wCodePage,
@@ -808,7 +809,7 @@
return nullptr;
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
const FX_FONTDESCRIPTOR* pFD =
FindFont(pszFontFamily, dwFontStyles, true, wCodePage, 999, 0);
if (!pFD)
@@ -820,7 +821,7 @@
RetainPtr<CFGAS_GEFont> pFont =
CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this);
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else // defined(OS_WIN)
std::vector<CFX_FontDescriptorInfo>* sortedFontInfos =
m_Hash2CandidateList[dwHash].get();
if (!sortedFontInfos) {
@@ -836,7 +837,7 @@
CFX_FontDescriptor* pDesc = (*sortedFontInfos)[0].pFont;
RetainPtr<CFGAS_GEFont> pFont =
LoadFontInternal(pDesc->m_wsFaceName, pDesc->m_nFaceIndex);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
if (!pFont)
return nullptr;
@@ -878,7 +879,7 @@
RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
ByteString bsHash = ByteString::Format("%d, %d", wCodePage, dwFontStyles);
bsHash += FX_UTF8Encode(WideStringView(pszFontFamily));
uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false);
@@ -901,9 +902,9 @@
pFont->SetLogicalFontStyle(dwFontStyles);
pFontArray->push_back(pFont);
return pFont;
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else // defined(OS_WIN)
return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
}
void CFGAS_FontMgr::RemoveFont(const RetainPtr<CFGAS_GEFont>& pEFont) {
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index 389f96a..5461cf2 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -13,6 +13,7 @@
#include <set>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/observable.h"
#include "core/fxcrt/retain_ptr.h"
@@ -25,7 +26,7 @@
class CFX_FontSourceEnum_File;
class IFX_SeekableReadStream;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
struct FX_FONTMATCHPARAMS {
const wchar_t* pwsFamily;
uint32_t dwFontStyles;
@@ -62,7 +63,7 @@
wcscmp(left.wsFontFace, right.wsFontFace) == 0;
}
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else // defined(OS_WIN)
class CFX_FontDescriptor {
public:
@@ -93,7 +94,7 @@
}
};
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
class CFGAS_FontMgr final : public Observable<CFGAS_FontMgr> {
public:
@@ -121,7 +122,7 @@
uint16_t wCodePage,
uint16_t wBitField);
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
bool matchParagraphStyle,
@@ -129,7 +130,7 @@
uint32_t dwUSB,
wchar_t wUnicode);
-#else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#else // defined(OS_WIN)
bool EnumFontsFromFontMapper();
bool EnumFontsFromFiles();
void RegisterFace(FXFT_Face pFace, const WideString* pFaceName);
@@ -142,12 +143,12 @@
wchar_t wcUnicode);
RetainPtr<CFGAS_GEFont> LoadFontInternal(const WideString& wsFaceName,
int32_t iFaceIndex);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts;
std::set<wchar_t> m_FailedUnicodesSet;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
std::deque<FX_FONTDESCRIPTOR> m_FontFaces;
#else
std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
@@ -156,7 +157,7 @@
m_Hash2CandidateList;
std::map<RetainPtr<CFGAS_GEFont>, RetainPtr<IFX_SeekableReadStream>>
m_IFXFont2FileRead;
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
};
#endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index fb5944d..e5b0ed3 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -9,6 +9,7 @@
#include <memory>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_substfont.h"
@@ -58,7 +59,7 @@
CFGAS_GEFont::~CFGAS_GEFont() = default;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
@@ -82,7 +83,7 @@
false);
return m_pFont->GetFace() && InitFont();
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_WIN)
bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) {
if (m_pFont || !pExternalFont)
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index fac6de9..76b02a9 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/maybe_owned.h"
@@ -57,12 +58,12 @@
explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr);
~CFGAS_GEFont() override;
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
bool LoadFontInternal(const wchar_t* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
bool LoadFontInternal(const uint8_t* pBuffer, int32_t length);
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif
bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
bool LoadFontInternal(CFX_Font* pExternalFont);
bool InitFont();
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.h b/xfa/fgas/font/cfx_fontsourceenum_file.h
index 07eab2f..9e93a97 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.h
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.h
@@ -9,12 +9,13 @@
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_stream.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/retain_ptr.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
#error "Not used on Windows"
#endif
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index 1c8d911..cc6c922 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -189,7 +189,7 @@
{0xFFA0, 0xFFEF, 68, 0xFFFF},
};
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
const FGAS_FontInfo g_XFAFontsMap[] = {
{0x01d5d33e, "SimSun", "Arial", 0, 936},
{0x01e4f102, "YouYuan", "Arial", 1, 936},
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 9a98edf..0d54a20 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -83,14 +83,14 @@
}
void CFWL_NoteDriver::Run() {
-#if _FX_OS_ == _FX_OS_LINUX_ || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_WIN)
for (;;) {
CFWL_NoteLoop* pTopLoop = GetTopLoop();
if (!pTopLoop || !pTopLoop->ContinueModal())
break;
UnqueueMessageAndProcess(pTopLoop);
}
-#endif // _FX_OS_ == _FX_OS_LINUX_ || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#endif // _FX_OS_ == _FX_OS_LINUX_ || defined(OS_WIN)
}
void CFWL_NoteDriver::NotifyTargetHide(CFWL_Widget* pNoteTarget) {
diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
index ff5ecce..0469563 100644
--- a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
+++ b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
@@ -8,10 +8,12 @@
#include <time.h>
+#include "build/build_config.h"
+
static bool g_bProviderTimeZoneSet = false;
CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
if (!g_bProviderTimeZoneSet) {
g_bProviderTimeZoneSet = true;
_tzset();