Replace more _FX_PLATFORM_WINDOWS_ usage.
Use build/build_config.h to standarize on Chromium's platform defines.
Replace more instances of _FX_PLATFORM_WINDOWS_ usage.
Change-Id: I8c31ba909974dde84836589d0537678cdadf1b6f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53715
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 91c5301..9ebda33 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -131,7 +131,7 @@
return CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
}
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) {
switch (charset) {
@@ -179,7 +179,7 @@
return 0;
}
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif // !defined(OS_WIN)
void FT_UseCIDCharmap(FXFT_Face face, int coding) {
int encoding;
diff --git a/core/fxcrt/cfx_fileaccess_windows.h b/core/fxcrt/cfx_fileaccess_windows.h
index a430b53..a95466f 100644
--- a/core/fxcrt/cfx_fileaccess_windows.h
+++ b/core/fxcrt/cfx_fileaccess_windows.h
@@ -7,10 +7,11 @@
#ifndef CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
#define CORE_FXCRT_CFX_FILEACCESS_WINDOWS_H_
+#include "build/build_config.h"
#include "core/fxcrt/fileaccess_iface.h"
#include "core/fxcrt/fx_system.h"
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
#error "Included on the wrong platform"
#endif
diff --git a/core/fxcrt/fx_system_unittest.cpp b/core/fxcrt/fx_system_unittest.cpp
index 73f9c75..d32c8e2 100644
--- a/core/fxcrt/fx_system_unittest.cpp
+++ b/core/fxcrt/fx_system_unittest.cpp
@@ -4,6 +4,7 @@
#include <limits>
+#include "build/build_config.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -11,7 +12,7 @@
// Unit test covering cases where PDFium replaces well-known library
// functionality on any given platformn.
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
namespace {
@@ -158,7 +159,7 @@
"111111111111111111111111111111111111111111111111111111111111111");
}
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif // !defined(OS_WIN)
TEST(fxcrt, FXSYS_wcsftime) {
struct tm good_time = {};
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 6234b15..0477747 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -320,7 +320,7 @@
return true;
}
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
void CFX_Font::SetFace(FXFT_Face face) {
ClearFaceCache();
m_Face = face;
@@ -329,7 +329,7 @@
void CFX_Font::SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) {
m_pSubstFont = std::move(subst);
}
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif // !defined(OS_WIN)
#endif // PDF_ENABLE_XFA
CFX_Font::~CFX_Font() {
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index bc9cc85..e708f9b 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -55,10 +55,10 @@
#ifdef PDF_ENABLE_XFA
bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex);
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
void SetFace(FXFT_Face face);
void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst);
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif // !defined(OS_WIN)
#endif // PDF_ENABLE_XFA
const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index,
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 517b541..3015fe8 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_font.h"
@@ -53,7 +54,7 @@
}
}
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
uint32_t dwFontStyle = pFont->GetFontStyles();
CFX_Font FxFont;
auto SubstFxFont = pdfium::MakeUnique<CFX_SubstFont>();
@@ -62,7 +63,7 @@
SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight;
SubstFxFont->m_bItalicCJK = FontStyleIsItalic(dwFontStyle);
FxFont.SetSubstFont(std::move(SubstFxFont));
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif
RetainPtr<CFGAS_GEFont> pCurFont;
TextCharPos* pCurCP = nullptr;
@@ -77,12 +78,12 @@
pFxFont = pCurFont->GetDevFont();
CFX_Font* font;
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
FxFont.SetFace(pFxFont->GetFace());
font = &FxFont;
#else
font = pFxFont;
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif
device->DrawNormalText(iCurCount, pCurCP, font, -fFontSize, pMatrix,
color, FXTEXT_CLEARTYPE);
@@ -99,20 +100,20 @@
if (pCurFont && iCurCount) {
pFxFont = pCurFont->GetDevFont();
CFX_Font* font;
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
FxFont.SetFace(pFxFont->GetFace());
font = &FxFont;
#else
font = pFxFont;
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif
bRet = device->DrawNormalText(iCurCount, pCurCP, font, -fFontSize, pMatrix,
color, FXTEXT_CLEARTYPE);
}
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
FxFont.SetFace(nullptr);
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif
return bRet;
}
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index c950999..b223765 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -24,7 +24,7 @@
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/font/fgas_fontutils.h"
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
#include "xfa/fgas/font/cfx_fontsourceenum_file.h"
#endif
@@ -911,9 +911,9 @@
if (!pEFont)
return;
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
m_IFXFont2FileRead.erase(pEFont);
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif
auto iter = m_Hash2Fonts.begin();
while (iter != m_Hash2Fonts.end()) {
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index e5b0ed3..f57871f 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -239,7 +239,7 @@
WideString wsFamily = GetFamilyName();
RetainPtr<CFGAS_GEFont> pFont =
m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), wsFamily.c_str());
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if !defined(OS_WIN)
if (!pFont)
pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), nullptr);
#endif