aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2019-04-30 16:45:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2019-04-30 16:45:57 +0000
commite4cdac596d7baef7d38e828816bbcecbe80bf8cd (patch)
tree57a424bd3c758f60a9ff3ee4d9e60d3655cbe6fd
parentc1aefb717810667d6889990d76798a481acce148 (diff)
downloadpdfium-e4cdac596d7baef7d38e828816bbcecbe80bf8cd.tar.gz
Replace _FX_PLATFORM_APPLE_ with defined(OS_MACOSX).
Use build/build_config.h to standarize on Chromium's platform defines. Replace most _FX_PLATFORM_APPLE_ usage. Also replace _FX_OS_MACOSX_ usage. Change-Id: I49275357bcd6ca608ee1d24a6dcdefa28e419498 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53712 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp3
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp3
-rw-r--r--core/fpdfapi/font/cpdf_font.h3
-rw-r--r--core/fpdfapi/font/cpdf_type1font.cpp35
-rw-r--r--core/fpdfapi/font/cpdf_type1font.h5
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp3
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp3
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.cpp5
-rw-r--r--core/fpdfapi/render/cpdf_devicebuffer.cpp3
-rw-r--r--core/fpdfapi/render/cpdf_dibtransferfunc.cpp15
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
-rw-r--r--core/fpdfdoc/cpdf_filespec.cpp12
-rw-r--r--core/fpdfdoc/cpdf_filespec_unittest.cpp9
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.cpp7
-rw-r--r--core/fxcrt/cfx_datetime.cpp4
-rw-r--r--core/fxcrt/widestring_unittest.cpp3
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp13
-rw-r--r--core/fxge/agg/fx_agg_driver.h9
-rw-r--r--core/fxge/cfx_facecache.cpp5
-rw-r--r--core/fxge/cfx_font.cpp5
-rw-r--r--core/fxge/cfx_font.h9
-rw-r--r--core/fxge/cfx_fontmapper.cpp2
-rw-r--r--core/fxge/skia/fx_skia_device.cpp5
-rw-r--r--fpdfsdk/fpdf_annot_embeddertest.cpp11
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp41
-rw-r--r--fpdfsdk/fpdf_formfill_embeddertest.cpp3
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp5
-rw-r--r--xfa/fgas/font/cfx_fontsourceenum_file.cpp6
-rw-r--r--xfa/fgas/font/fgas_fontutils.cpp2
-rw-r--r--xfa/fgas/layout/cfx_rtfbreak.cpp3
-rw-r--r--xfa/fgas/layout/cfx_txtbreak.cpp3
-rw-r--r--xfa/fwl/cfwl_edit.cpp3
-rw-r--r--xfa/fwl/cfwl_notedriver.cpp3
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp3
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.cpp3
35 files changed, 139 insertions, 112 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 59eb923d5..9c526b126 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -10,6 +10,7 @@
#include <limits>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/cmaps/cmap_int.h"
#include "core/fpdfapi/cpdf_modulemgr.h"
#include "core/fpdfapi/font/cfx_cttgsubtable.h"
@@ -669,7 +670,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (m_Charset == CIDSET_JAPAN1) {
if (unicode == '\\') {
unicode = '/';
-#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
+#if !defined(OS_MACOSX)
} else if (unicode == 0xa5) {
unicode = 0x5c;
#endif
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 6c114eb63..fb1fd8932 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.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/font/cpdf_tounicodemap.h"
@@ -116,7 +117,7 @@ size_t CPDF_Font::CountChar(ByteStringView pString) const {
return pString.GetLength();
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) {
return GlyphFromCharCode(charcode, nullptr);
}
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 4bd6e308f..ff5ec30a1 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -54,7 +55,7 @@ class CPDF_Font {
virtual size_t CountChar(ByteStringView pString) const;
virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
virtual int GlyphFromCharCodeExt(uint32_t charcode);
#endif
virtual WideString UnicodeFromCharCode(uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index fa88c75bb..b78922ddf 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -8,19 +8,20 @@
#include <algorithm>
+#include "build/build_config.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
#include "core/fxge/apple/apple_int.h"
#endif
namespace {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
struct GlyphNameMap {
const char* m_pStrAdobe; // Raw, POD struct.
const char* m_pStrUnicode; // Raw, POD struct.
@@ -40,7 +41,7 @@ const char* GlyphNameRemap(const char* pStrAdobe) {
return nullptr;
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif // defined(OS_MACOSX)
bool FT_UseType1Charmap(FXFT_Face face) {
if (FXFT_Get_Face_CharmapCount(face) == 0) {
@@ -65,7 +66,7 @@ bool FT_UseType1Charmap(FXFT_Face face) {
CPDF_Type1Font::CPDF_Type1Font(CPDF_Document* pDocument,
CPDF_Dictionary* pFontDict)
: CPDF_SimpleFont(pDocument, pFontDict) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
memset(m_ExtGID, 0xff, sizeof(m_ExtGID));
#endif
}
@@ -108,7 +109,7 @@ bool CPDF_Type1Font::Load() {
return LoadCommon();
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) {
if (charcode > 0xff)
return -1;
@@ -122,7 +123,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (!m_Font.GetFace())
return;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
bool bCoreText = true;
CQuartz2D& quartz2d =
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
@@ -146,7 +147,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
uint16_t unicode = prefix[j] * 256 + charcode;
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
if (m_GlyphIndex[charcode]) {
@@ -156,7 +157,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
if (bGotOne) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (!bCoreText)
memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
@@ -176,25 +177,25 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
m_Font.GetFace(), m_Encoding.UnicodeFromCharCode(charcode));
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
if (m_GlyphIndex[charcode] == 0 && strcmp(name, ".notdef") == 0) {
m_Encoding.SetUnicode(charcode, 0x20);
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 0x20);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
}
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (!bCoreText)
memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
return;
}
FT_UseType1Charmap(m_Font.GetFace());
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (bCoreText) {
if (FontStyleIsSymbolic(m_Flags)) {
for (uint32_t charcode = 0; charcode < 256; charcode++) {
@@ -259,7 +260,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
return;
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif // defined(OS_MACOSX)
if (FontStyleIsSymbolic(m_Flags)) {
for (int charcode = 0; charcode < 256; charcode++) {
const char* name =
@@ -286,7 +287,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (!bCoreText)
memcpy(m_ExtGID, m_GlyphIndex, 256);
@@ -315,13 +316,13 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_GlyphIndex[charcode] = 0xffff;
}
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (!bCoreText)
memcpy(m_ExtGID, m_GlyphIndex, 256);
#endif
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
void CPDF_Type1Font::SetExtGID(const char* name, uint32_t charcode) {
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
@@ -338,4 +339,4 @@ void CPDF_Type1Font::CalcExtGID(uint32_t charcode) {
name_glyph[255] = 0;
SetExtGID(name_glyph, charcode);
}
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif // defined(OS_MACOSX)
diff --git a/core/fpdfapi/font/cpdf_type1font.h b/core/fpdfapi/font/cpdf_type1font.h
index 86a9812af..862e41bab 100644
--- a/core/fpdfapi/font/cpdf_type1font.h
+++ b/core/fpdfapi/font/cpdf_type1font.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
#define CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
+#include "build/build_config.h"
#include "core/fpdfapi/font/cpdf_simplefont.h"
#include "core/fxcrt/fx_system.h"
@@ -19,7 +20,7 @@ class CPDF_Type1Font final : public CPDF_SimpleFont {
bool IsType1Font() const override;
const CPDF_Type1Font* AsType1Font() const override;
CPDF_Type1Font* AsType1Font() override;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
int GlyphFromCharCodeExt(uint32_t charcode) override;
#endif
@@ -32,7 +33,7 @@ class CPDF_Type1Font final : public CPDF_SimpleFont {
// CPDF_SimpleFont:
void LoadGlyphMap() override;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
void SetExtGID(const char* name, uint32_t charcode);
void CalcExtGID(uint32_t charcode);
diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
index 00796dce8..2e90c6cd9 100644
--- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
@@ -5,6 +5,7 @@
#include <memory>
#include <string>
+#include "build/build_config.h"
#include "core/fxcrt/fx_system.h"
#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_edit.h"
@@ -66,7 +67,7 @@ TEST_F(CPDFSecurityHandlerEmbedderTest, OwnerPassword) {
TEST_F(CPDFSecurityHandlerEmbedderTest, PasswordAfterGenerateSave) {
#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
const char md5[] = "7048dca58e2ed8f93339008b91e4eb4e";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
const char md5[] = "6951b6c9891dfe0332a5b1983e484400";
#else
const char md5[] = "041c2fb541c8907cc22ce101b686c79e";
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
index 213106446..f4b1f32ca 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
@@ -6,6 +6,7 @@
#include <memory>
#include <string>
+#include "build/build_config.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "public/cpp/fpdf_scopers.h"
#include "testing/embedder_test.h"
@@ -116,7 +117,7 @@ TEST_F(FPDFParserDecodeEmbedderTest, Bug_455199) {
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kExpectedMd5sum[] = "795b7ce1626931aa06af0fa23b7d80bb";
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index 86035319e..44052749d 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -6,6 +6,7 @@
#include "core/fpdfapi/render/cpdf_charposlist.h"
+#include "build/build_config.h"
#include "core/fpdfapi/font/cpdf_cidfont.h"
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -32,7 +33,7 @@ CPDF_CharPosList::CPDF_CharPosList(const std::vector<uint32_t>& charCodes,
charpos.m_Unicode = !unicode.IsEmpty() ? unicode[0] : CharCode;
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
uint32_t GlyphID = charpos.m_GlyphIndex;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode);
GlyphID = charpos.m_ExtGID != static_cast<uint32_t>(-1)
? charpos.m_ExtGID
@@ -48,7 +49,7 @@ CPDF_CharPosList::CPDF_CharPosList(const std::vector<uint32_t>& charCodes,
charpos.m_GlyphIndex = pFont->FallbackGlyphFromCharcode(
charpos.m_FallbackFontPosition, CharCode);
pCurrentFont = pFont->GetFontFallback(charpos.m_FallbackFontPosition);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
charpos.m_ExtGID = charpos.m_GlyphIndex;
#endif
}
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp
index 4029f2efc..091a0c169 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -6,6 +6,7 @@
#include "core/fpdfapi/render/cpdf_devicebuffer.h"
+#include "build/build_config.h"
#include "core/fpdfapi/page/cpdf_pageobject.h"
#include "core/fpdfapi/render/cpdf_rendercontext.h"
#include "core/fpdfapi/render/cpdf_renderoptions.h"
@@ -28,7 +29,7 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext,
m_Rect = rect;
m_pObject = pObj;
m_Matrix.Translate(-rect.left, -rect.top);
-#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
+#if !defined(OS_MACOSX)
int horz_size = pDevice->GetDeviceCaps(FXDC_HORZ_SIZE);
int vert_size = pDevice->GetDeviceCaps(FXDC_VERT_SIZE);
if (horz_size && vert_size && max_dpi) {
diff --git a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
index ee2737889..58dbcf06a 100644
--- a/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
+++ b/core/fpdfapi/render/cpdf_dibtransferfunc.cpp
@@ -8,6 +8,7 @@
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/render/cpdf_transferfunc.h"
#include "third_party/base/compiler_specific.h"
@@ -25,7 +26,7 @@ FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() {
if (m_pSrc->IsAlphaMask())
return FXDIB_8bppMask;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb32;
#else
return (m_pSrc->HasAlpha()) ? FXDIB_Argb : FXDIB_Rgb;
@@ -59,7 +60,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
(*dest_buf)[index++] = g0;
(*dest_buf)[index++] = r0;
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
index++;
#endif
}
@@ -93,7 +94,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
(*dest_buf)[index++] = m_RampR[src_byte];
}
src_buf++;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
index++;
#endif
}
@@ -111,7 +112,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
(*dest_buf)[index++] = m_RampB[*(src_buf++)];
(*dest_buf)[index++] = m_RampG[*(src_buf++)];
(*dest_buf)[index++] = m_RampR[*(src_buf++)];
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
index++;
#endif
}
@@ -128,7 +129,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(
(*dest_buf)[index++] = m_RampR[*(src_buf++)];
if (!bSkip) {
(*dest_buf)[index++] = *src_buf;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
} else {
index++;
#endif
@@ -156,7 +157,7 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
*dest_buf++ = m_RampR[*(src_buf++)];
}
} else {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (!m_pSrc->HasAlpha()) {
for (int i = 0; i < pixels; i++) {
*dest_buf++ = m_RampB[*(src_buf++)];
@@ -173,7 +174,7 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
*dest_buf++ = m_RampR[*(src_buf++)];
*dest_buf++ = *(src_buf++);
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
}
#endif
}
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 8f7dd84b5..b604186cc 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "constants/transparency.h"
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/font/cpdf_type3char.h"
@@ -2524,8 +2525,7 @@ RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
FXDIB_Format format;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \
- defined _SKIA_SUPPORT_PATHS_
+#if defined(OS_MACOSX) || defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
format = bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask;
#else
format = bLuminosity ? FXDIB_Rgb : FXDIB_8bppMask;
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 64a482be8..2d670bbe1 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -8,6 +8,7 @@
#include <vector>
+#include "build/build_config.h"
#include "constants/stream_dict_common.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_name.h"
@@ -19,13 +20,12 @@
namespace {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \
- _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
+#if defined(OS_MACOSX) || _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
WideString ChangeSlashToPlatform(const wchar_t* str) {
WideString result;
while (*str) {
if (*str == '/') {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
result += L':';
#else
result += L'\\';
@@ -50,7 +50,7 @@ WideString ChangeSlashToPDF(const wchar_t* str) {
}
return result;
}
-#endif // _FX_PLATFORM_APPLE_ || _FX_PLATFORM_WINDOWS_
+#endif // defined(OS_MACOSX) || _FX_PLATFORM_WINDOWS_
} // namespace
@@ -69,7 +69,7 @@ WideString CPDF_FileSpec::DecodeFileName(const WideString& filepath) {
if (filepath.GetLength() <= 1)
return WideString();
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (filepath.Left(sizeof("/Mac") - 1) == WideStringView(L"/Mac"))
return ChangeSlashToPlatform(filepath.c_str() + 1);
return ChangeSlashToPlatform(filepath.c_str());
@@ -186,7 +186,7 @@ WideString CPDF_FileSpec::EncodeFileName(const WideString& filepath) {
if (filepath[0] == L'\\')
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
if (filepath.Left(sizeof("Mac") - 1).EqualsASCII("Mac"))
return L'/' + ChangeSlashToPDF(filepath.c_str());
return ChangeSlashToPDF(filepath.c_str());
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 14c3ad6dd..82315f2b1 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -6,6 +6,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
@@ -33,7 +34,7 @@ TEST(cpdf_filespec, EncodeDecodeFileName) {
{L"\\\\pdfdocs\\spec.pdf", L"/pdfdocs/spec.pdf"},
// Network resource name. It is not supported yet.
// {L"pclib/eng:\\pdfdocs\\spec.pdf", L"/pclib/eng/pdfdocs/spec.pdf"},
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
// Absolute path with colon separator.
{L"Mac HD:PDFDocs:spec.pdf", L"/Mac HD/PDFDocs/spec.pdf"},
// Relative path with colon separator.
@@ -63,7 +64,7 @@ TEST(cpdf_filespec, GetFileName) {
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
L"/C/docs/test.pdf",
L"C:\\docs\\test.pdf"
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
L"/Mac HD/docs/test.pdf",
L"Mac HD:docs:test.pdf"
#else
@@ -84,7 +85,7 @@ TEST(cpdf_filespec, GetFileName) {
{L"/E/docs/test.pdf", L"E:\\docs\\test.pdf"},
{L"/F/docs/test.pdf", L"F:\\docs\\test.pdf"},
{L"/G/docs/test.pdf", L"G:\\docs\\test.pdf"},
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
{L"/Mac HD/docs1/test.pdf", L"Mac HD:docs1:test.pdf"},
{L"/Mac HD/docs2/test.pdf", L"Mac HD:docs2:test.pdf"},
{L"/Mac HD/docs3/test.pdf", L"Mac HD:docs3:test.pdf"},
@@ -128,7 +129,7 @@ TEST(cpdf_filespec, SetFileName) {
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
L"C:\\docs\\test.pdf",
L"/C/docs/test.pdf"
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
L"Mac HD:docs:test.pdf",
L"/Mac HD/docs/test.pdf"
#else
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index e27553f2b..30d761653 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcodec/codec/cfx_codec_memory.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/fx_stream.h"
@@ -25,11 +26,11 @@
namespace {
#ifdef PDF_ENABLE_XFA_PNG
-#if _FX_OS_ == _FX_OS_MACOSX_
+#if defined(OS_MACOSX)
const double kPngGamma = 1.7;
-#else // _FX_OS_ == _FX_OS_MACOSX_
+#else
const double kPngGamma = 2.2;
-#endif // _FX_OS_ == _FX_OS_MACOSX_
+#endif // defined(OS_MACOSX)
#endif // PDF_ENABLE_XFA_PNG
void RGB2BGR(uint8_t* buffer, int width = 1) {
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index 286e634ee..79bc2c1f1 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -9,8 +9,8 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_system.h"
-#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_ANDROID) || \
- _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_WASM_
+#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_ANDROID) || defined(OS_MACOSX) || \
+ _FX_OS_ == _FX_OS_WASM_
#include <sys/time.h>
#include <time.h>
#endif
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 08edf4888..da7773599 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -8,6 +8,7 @@
#include <iterator>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_string.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/span.h"
@@ -1549,7 +1550,7 @@ TEST(WideString, FormatString) {
EXPECT_EQ(L"cla", WideString::Format(L"%.3ls", L"clams"));
EXPECT_EQ(L"\u043e\u043f", WideString(L"\u043e\u043f"));
-#if _FX_OS_ != _FX_OS_MACOSX_
+#if !defined(OS_MACOSX)
// See https://bugs.chromium.org/p/pdfium/issues/detail?id=1132
EXPECT_EQ(L"\u043e\u043f", WideString::Format(L"\u043e\u043f"));
EXPECT_EQ(L"\u043e\u043f", WideString::Format(L"%ls", L"\u043e\u043f"));
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index a735d6740..89f3f206d 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <utility>
+#include "build/build_config.h"
#include "core/fxge/cfx_cliprgn.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_graphstatedata.h"
@@ -1120,13 +1121,9 @@ CFX_AggDeviceDriver::CFX_AggDeviceDriver(
const RetainPtr<CFX_DIBitmap>& pBackdropBitmap,
bool bGroupKnockout)
: m_pBitmap(pBitmap),
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- m_pPlatformGraphics(nullptr),
-#endif
- m_FillFlags(0),
m_bRgbByteOrder(bRgbByteOrder),
- m_pBackdropBitmap(pBackdropBitmap),
- m_bGroupKnockout(bGroupKnockout) {
+ m_bGroupKnockout(bGroupKnockout),
+ m_pBackdropBitmap(pBackdropBitmap) {
InitPlatform();
}
@@ -1138,7 +1135,7 @@ uint8_t* CFX_AggDeviceDriver::GetBuffer() const {
return m_pBitmap->GetBuffer();
}
-#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
+#if !defined(OS_MACOSX)
void CFX_AggDeviceDriver::InitPlatform() {}
void CFX_AggDeviceDriver::DestroyPlatform() {}
@@ -1151,7 +1148,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars,
uint32_t color) {
return false;
}
-#endif // _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
+#endif // !defined(OS_MACOSX)
int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const {
switch (caps_id) {
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 80fbf7366..1aecc5022 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "build/build_config.h"
#include "core/fxge/renderdevicedriver_iface.h"
#include "third_party/agg23/agg_clip_liang_barsky.h"
#include "third_party/agg23/agg_path_storage.h"
@@ -112,13 +113,13 @@ class CFX_AggDeviceDriver final : public RenderDeviceDriverIface {
RetainPtr<CFX_DIBitmap> m_pBitmap;
std::unique_ptr<CFX_ClipRgn> m_pClipRgn;
std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- void* m_pPlatformGraphics;
+#if defined(OS_MACOSX)
+ void* m_pPlatformGraphics = nullptr;
#endif
- int m_FillFlags;
+ int m_FillFlags = 0;
const bool m_bRgbByteOrder;
- RetainPtr<CFX_DIBitmap> m_pBackdropBitmap;
const bool m_bGroupKnockout;
+ RetainPtr<CFX_DIBitmap> m_pBackdropBitmap;
};
#endif // CORE_FXGE_AGG_FX_AGG_DRIVER_H_
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index d868bf2a8..869e464d4 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -11,6 +11,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_fontmgr.h"
@@ -262,7 +263,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont,
}
#endif
ByteString FaceGlyphsKey(keygen.key_, keygen.key_len_);
-#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ || defined _SKIA_SUPPORT_ || \
+#if !defined(OS_MACOSX) || defined _SKIA_SUPPORT_ || \
defined _SKIA_SUPPORT_PATHS_
return LookUpGlyphBitmap(pFont, matrix, FaceGlyphsKey, glyph_index,
bFontStyle, dest_width, anti_alias);
@@ -333,7 +334,7 @@ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) {
}
#endif
-#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
+#if !defined(OS_MACOSX)
void CFX_FaceCache::InitPlatform() {}
#endif
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index cd137bd7f..6234b1536 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_stream.h"
#include "core/fxge/cfx_facecache.h"
@@ -220,7 +221,7 @@ const CFX_Font::CharsetFontMap CFX_Font::defaultTTFMap[] = {
{FX_CHARSET_ShiftJIS, "MS Gothic"},
{FX_CHARSET_Hangul, "Batang"},
{FX_CHARSET_MSWin_Cyrillic, "Arial"},
-#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ || _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_ || defined(OS_MACOSX)
{FX_CHARSET_MSWin_EasternEuropean, "Arial"},
#else
{FX_CHARSET_MSWin_EasternEuropean, "Tahoma"},
@@ -336,7 +337,7 @@ CFX_Font::~CFX_Font() {
if (m_Face)
DeleteFace();
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
ReleasePlatformResource();
#endif
}
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 99b2c0e9e..bc9cc854d 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/unowned_ptr.h"
@@ -94,7 +95,7 @@ class CFX_Font {
void AdjustMMParams(int glyph_index, int dest_width, int weight) const;
CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index,
uint32_t dest_width) const;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
void* GetPlatformFont() const { return m_pPlatformFont; }
void SetPlatformFont(void* font) { m_pPlatformFont = font; }
#endif
@@ -128,9 +129,9 @@ class CFX_Font {
CFX_FaceCache* GetFaceCache() const;
void DeleteFace();
void ClearFaceCache();
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
void ReleasePlatformResource();
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif
ByteString GetFamilyNameOrUntitled() const;
@@ -142,7 +143,7 @@ class CFX_Font {
pdfium::span<uint8_t> m_FontData;
bool m_bEmbedded = false;
bool m_bVertical = false;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
void* m_pPlatformFont = nullptr;
#endif
};
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index c4a723765..b3a828ec4 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -598,7 +598,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
}
} else {
if (Charset == FX_CHARSET_Symbol) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || defined(OS_ANDROID)
+#if defined(OS_MACOSX) || defined(OS_ANDROID)
if (SubstName == "Symbol") {
pSubstFont->m_Family = "Chrome Symbol";
pSubstFont->m_Charset = FX_CHARSET_Symbol;
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index d246b6acd..01db19638 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -8,6 +8,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/page/cpdf_expintfunc.h"
#include "core/fpdfapi/page/cpdf_function.h"
#include "core/fpdfapi/page/cpdf_meshstream.h"
@@ -865,7 +866,7 @@ class SkiaState {
m_positions[index + count] = {cp.m_Origin.x * flip,
cp.m_Origin.y * vFlip};
m_glyphs[index + count] = static_cast<uint16_t>(cp.m_GlyphIndex);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (cp.m_ExtGID)
m_glyphs[index + count] = static_cast<uint16_t>(cp.m_ExtGID);
#endif
@@ -1592,7 +1593,7 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
}
}
glyphs[index] = static_cast<uint16_t>(cp.m_GlyphIndex);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
if (cp.m_ExtGID)
glyphs[index] = static_cast<uint16_t>(cp.m_ExtGID);
#endif
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index f64cd3bc2..7acef506f 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "build/build_config.h"
#include "constants/annotation_common.h"
#include "core/fxcrt/fx_system.h"
#include "public/cpp/fpdf_scopers.h"
@@ -474,7 +475,7 @@ TEST_F(FPDFAnnotEmbedderTest, GetAndSetQuadPoints) {
}
TEST_F(FPDFAnnotEmbedderTest, ModifyRectQuadpointsWithAP) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
static const char kMd5Original[] = "63af8432fab95a67cdebb7cd0e514941";
static const char kMd5ModifiedHighlight[] =
"aec26075011349dec9bace891856b5f2";
@@ -682,7 +683,7 @@ TEST_F(FPDFAnnotEmbedderTest, RemoveAnnotation) {
}
TEST_F(FPDFAnnotEmbedderTest, AddAndModifyPath) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
static const char kMd5Original[] = "c35408717759562d1f8bf33d317483d2";
static const char kMd5ModifiedPath[] = "9059723a045e17478753d2f0eb33bc03";
static const char kMd5TwoPaths[] = "7eed0cfba780f1d4dd8068f717d3a6bf";
@@ -884,7 +885,7 @@ TEST_F(FPDFAnnotEmbedderTest, ModifyAnnotationFlags) {
}
TEST_F(FPDFAnnotEmbedderTest, AddAndModifyImage) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
static const char kMd5Original[] = "c35408717759562d1f8bf33d317483d2";
static const char kMd5NewImage[] = "ff012f5697436dfcaec25b32d1333596";
static const char kMd5ModifiedImage[] = "86cf8cb2755a7a2046a543e66d9c1e61";
@@ -969,7 +970,7 @@ TEST_F(FPDFAnnotEmbedderTest, AddAndModifyImage) {
}
TEST_F(FPDFAnnotEmbedderTest, AddAndModifyText) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
static const char kMd5Original[] = "c35408717759562d1f8bf33d317483d2";
static const char kMd5NewText[] = "60031c1b0330cf1e1575f7d46687d429";
static const char kMd5ModifiedText[] = "79f5cfb0b07caaf936f65f6a7a57ce77";
@@ -1109,7 +1110,7 @@ TEST_F(FPDFAnnotEmbedderTest, GetSetStringValue) {
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
UnloadPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
static const char kMd5[] = "4d64e61c9c0f8c60ab3cc3234bb73b1c";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
static const char kMd5[] = "9ee141f698c3fcb56c050dffd6c82624";
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 525e9cc5c..4fdde68e7 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -7,6 +7,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/page/cpdf_formobject.h"
#include "core/fpdfapi/page/cpdf_page.h"
@@ -446,7 +447,7 @@ TEST_F(FPDFEditEmbedderTest, SetText) {
// Verify the "Hello, world!" text is gone and "Changed for SetText test" is
// now displayed.
ASSERT_EQ(2, FPDFPage_CountObjects(page));
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kChangedMD5[] = "94c1e7a5af7dd9d77dc2223b1091acb7";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kChangedMD5[] = "3137fdb27962671f5c3963a5e965eff5";
@@ -485,7 +486,7 @@ TEST_F(FPDFEditEmbedderTest, RemovePageObject) {
// Show what the original file looks like.
{
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kOriginalMD5[] = "b90475ca64d1348c3bf5e2b77ad9187a";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kOriginalMD5[] = "795b7ce1626931aa06af0fa23b7d80bb";
@@ -504,7 +505,7 @@ TEST_F(FPDFEditEmbedderTest, RemovePageObject) {
// Verify the "Hello, world!" text is gone.
{
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kRemovedMD5[] = "af760c4702467cb1492a57fb8215efaa";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kRemovedMD5[] = "aae6c5334721f90ec30d3d59f4ef7deb";
@@ -641,7 +642,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveMarkedObjectsPrime) {
// Show what the original file looks like.
{
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kOriginalMD5[] = "5a5eb63cb21cc15084fea1f14284b8df";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kOriginalMD5[] = "587c507a40f613f9c530b2ce2d58d655";
@@ -686,7 +687,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveMarkedObjectsPrime) {
EXPECT_EQ(11, FPDFPage_CountObjects(page));
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kNonPrimesMD5[] = "57e76dc7375d896704f0fd6d6d1b9e65";
const char kNonPrimesAfterSaveMD5[] = "6304512d0150bbd5578e8e22d3121103";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
@@ -963,7 +964,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveExistingPageObjectSplitStreamsNotLonely) {
// Verify the "Hello, world!" text is gone.
ASSERT_EQ(2, FPDFPage_CountObjects(page));
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kHelloRemovedMD5[] = "e07a62d412728fc4d6e3ff42f2dd0e11";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kHelloRemovedMD5[] = "a97d4c72c969ba373c2dce675d277e65";
@@ -1010,7 +1011,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveExistingPageObjectSplitStreamsLonely) {
// Verify the "Greetings, world!" text is gone.
ASSERT_EQ(2, FPDFPage_CountObjects(page));
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kGreetingsRemovedMD5[] = "b90475ca64d1348c3bf5e2b77ad9187a";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kGreetingsRemovedMD5[] = "795b7ce1626931aa06af0fa23b7d80bb";
@@ -1126,7 +1127,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveAllFromStream) {
EXPECT_EQ(1, cpdf_page_object->GetContentStream()) << i;
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kStream1RemovedMD5[] = "d2e21fbd5a6de563f619feeeb6163331";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kStream1RemovedMD5[] = "b4140f203523e38793283a5943d8075b";
@@ -1258,7 +1259,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveFirstFromSingleStream) {
cpdf_page_object = CPDFPageObjectFromFPDFPageObject(page_object);
ASSERT_EQ(0, cpdf_page_object->GetContentStream());
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kFirstRemovedMD5[] = "af760c4702467cb1492a57fb8215efaa";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kFirstRemovedMD5[] = "aae6c5334721f90ec30d3d59f4ef7deb";
@@ -1326,7 +1327,7 @@ TEST_F(FPDFEditEmbedderTest, RemoveLastFromSingleStream) {
cpdf_page_object = CPDFPageObjectFromFPDFPageObject(page_object);
ASSERT_EQ(0, cpdf_page_object->GetContentStream());
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char kLastRemovedMD5[] = "f8fbd14a048b9e2ea8e5f059f22a910e";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char kLastRemovedMD5[] = "93db13099042bafefb3c22a165bad684";
@@ -1640,7 +1641,7 @@ TEST_F(FPDFEditEmbedderTest, PathOnTopOfText) {
// Render and check the result. Text is slightly different on Mac.
ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "f9e6fa74230f234286bfcada9f7606d8";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "74dd9c393b8b2578d2b7feb032b7daad";
@@ -1785,7 +1786,7 @@ TEST_F(FPDFEditEmbedderTest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
{
ScopedFPDFBitmap page_bitmap = RenderPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "08d1ff3e5a42801bee6077fd366bef00";
@@ -1810,7 +1811,7 @@ TEST_F(FPDFEditEmbedderTest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
{
ScopedFPDFBitmap page_bitmap = RenderPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "a5c4ace4c6f27644094813fe1441a21c";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "3755dd35abd4c605755369401ee85b2d";
@@ -1834,7 +1835,7 @@ TEST_F(FPDFEditEmbedderTest, AddStandardFontText) {
EXPECT_TRUE(FPDFPage_GenerateContent(page));
{
ScopedFPDFBitmap page_bitmap = RenderPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "40b3ef04f915ff4c4208948001763544";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "aba523a8110d01ed9bd7b7781ff74045";
@@ -2003,7 +2004,7 @@ TEST_F(FPDFEditEmbedderTest, AddStandardFontText2) {
FPDFPageObj_Transform(text_object, 1, 0, 0, 1, 20, 20);
FPDFPage_InsertObject(page.get(), text_object);
ScopedFPDFBitmap page_bitmap = RenderPage(page.get());
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "08d1ff3e5a42801bee6077fd366bef00";
@@ -2349,13 +2350,13 @@ TEST_F(FPDFEditEmbedderTest, AddTrueTypeFontText) {
FPDFPageObj_Transform(text_object, 1, 0, 0, 1, 400, 400);
FPDFPage_InsertObject(page, text_object);
ScopedFPDFBitmap page_bitmap = RenderPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "d60ba39f9698e32360d99e727dd93165";
#else
const char md5[] = "70592859010ffbf532a2237b8118bcc4";
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif
CompareBitmap(page_bitmap.get(), 612, 792, md5);
// Add some more text, same font
@@ -2367,13 +2368,13 @@ TEST_F(FPDFEditEmbedderTest, AddTrueTypeFontText) {
FPDFPage_InsertObject(page, text_object2);
}
ScopedFPDFBitmap page_bitmap2 = RenderPage(page);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5_2[] = "8eded4193ff1f0f77b8b600a825e97ea";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5_2[] = "2199b579c49ab5f80c246a586a80ee90";
#else
const char md5_2[] = "c1d10cce1761c4a998a16b2562030568";
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#endif
CompareBitmap(page_bitmap2.get(), 612, 792, md5_2);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
@@ -2663,7 +2664,7 @@ TEST_F(FPDFEditEmbedderTest, AddMarkedText) {
EXPECT_EQ(0, memcmp(block_value, buffer, kBlobLen));
// Render and check the bitmap is the expected one.
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const char md5[] = "d60ba39f9698e32360d99e727dd93165";
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index d40ee0bde..cefdc7c99 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
+#include "build/build_config.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -789,7 +790,7 @@ TEST_F(FPDFFormFillEmbedderTest, BUG_765384) {
#endif // PDF_ENABLE_V8
TEST_F(FPDFFormFillEmbedderTest, FormText) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
const char md5_1[] = "5f11dbe575fe197a37c3fb422559f8ff";
const char md5_2[] = "35b1a4b679eafc749a0b6fda750c0e8d";
const char md5_3[] = "65c64a7c355388f719a752aa1e23f6fe";
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index b4d85b461..9349a1c70 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -26,6 +26,7 @@
#include <memory>
#include <vector>
+#include "build/build_config.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_graphstatedata.h"
@@ -133,7 +134,7 @@ void CBC_OneDimWriter::CalcTextInfo(const ByteString& text,
charPos[0].m_Origin = CFX_PointF(penX + left, penY + top);
charPos[0].m_GlyphIndex = encoding->GlyphFromCharCode(charcodes[0]);
charPos[0].m_FontCharWidth = cFont->GetGlyphWidth(charPos[0].m_GlyphIndex);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
penX += (float)(charPos[0].m_FontCharWidth) * (float)fontSize / 1000.0f;
@@ -141,7 +142,7 @@ void CBC_OneDimWriter::CalcTextInfo(const ByteString& text,
charPos[i].m_Origin = CFX_PointF(penX + left, penY + top);
charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(charcodes[i]);
charPos[i].m_FontCharWidth = cFont->GetGlyphWidth(charPos[i].m_GlyphIndex);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
charPos[i].m_ExtGID = charPos[i].m_GlyphIndex;
#endif
penX += (float)(charPos[i].m_FontCharWidth) * (float)fontSize / 1000.0f;
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.cpp b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
index 386dc59b2..f9eafb344 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.cpp
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
@@ -18,8 +18,10 @@ constexpr const char* g_FontFolders[] = {
#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
"/usr/share/fonts", "/usr/share/X11/fonts/Type1",
"/usr/share/X11/fonts/TTF", "/usr/local/share/fonts",
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- "~/Library/Fonts", "/Library/Fonts", "/System/Library/Fonts",
+#elif defined(OS_MACOSX)
+ "~/Library/Fonts",
+ "/Library/Fonts",
+ "/System/Library/Fonts",
#elif defined(OS_ANDROID)
"/system/fonts",
#endif
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index f95a5ad96..1c8d91180 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -1020,7 +1020,7 @@ const FGAS_FontInfo g_XFAFontsMap[] = {
"Sharp,WenQuanYi Micro Hei",
0, 936},
};
-#elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#elif defined(OS_MACOSX)
const FGAS_FontInfo g_XFAFontsMap[] = {
{0x01d5d33e, "SimSun", "STHeiti,Heiti TC,STFangsong", 0, 936},
{0x01e4f102, "YouYuan", "STHeiti,Heiti TC,STFangsong", 1, 936},
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index 543f6f37c..3ea89cced 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "build/build_config.h"
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/stl_util.h"
@@ -782,7 +783,7 @@ size_t CFX_RTFBreak::GetDisplayPos(const CFX_TextPiece* pPiece,
current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wForm);
if (current_char_pos.m_GlyphIndex == 0xFFFF)
current_char_pos.m_GlyphIndex = pFont->GetGlyphIndex(wch);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
current_char_pos.m_ExtGID = current_char_pos.m_GlyphIndex;
#endif
current_char_pos.m_FontCharWidth = iCharWidth;
diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp
index 537de71d2..456d5b9d2 100644
--- a/xfa/fgas/layout/cfx_txtbreak.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "build/build_config.h"
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/font/cfgas_gefont.h"
@@ -842,7 +843,7 @@ size_t CFX_TxtBreak::GetDisplayPos(const Run* pTxtRun,
}
if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) {
pCharPos->m_GlyphIndex = pFont->GetGlyphIndex(wForm);
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+#if defined(OS_MACOSX)
pCharPos->m_ExtGID = pCharPos->m_GlyphIndex;
#endif
// TODO(npm): change widths in this method to unsigned to avoid implicit
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index f17457b29..3256c89d4 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "build/build_config.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_texteditengine.h"
@@ -36,7 +37,7 @@ namespace {
const int kEditMargin = 3;
-#if (_FX_OS_ == _FX_OS_MACOSX_)
+#if defined(OS_MACOSX)
constexpr int kEditingModifier = FWL_KEYFLAG_Command;
#else
constexpr int kEditingModifier = FWL_KEYFLAG_Ctrl;
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 3b180988b..9a98edf9e 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <utility>
+#include "build/build_config.h"
#include "core/fxcrt/fx_extension.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -193,7 +194,7 @@ bool CFWL_NoteDriver::DoKillFocus(CFWL_Message* pMessage,
bool CFWL_NoteDriver::DoKey(CFWL_Message* pMessage, CFWL_Widget* pMessageForm) {
CFWL_MessageKey* pMsg = static_cast<CFWL_MessageKey*>(pMessage);
-#if (_FX_OS_ != _FX_OS_MACOSX_)
+#if !defined(OS_MACOSX)
if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown &&
pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index bf3b7cbc1..3531bf28b 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -8,6 +8,7 @@
#include <utility>
+#include "build/build_config.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_notedriver.h"
@@ -325,7 +326,7 @@ void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) {
CFWL_NoteDriver* pNoteDriver = pDstWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->ProcessMessage(pMessage->Clone());
-#if (_FX_OS_ == _FX_OS_MACOSX_)
+#if defined(OS_MACOSX)
CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop();
if (pTopLoop)
pNoteDriver->UnqueueMessageAndProcess(pTopLoop);
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 73c48398a..a59b77433 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -6,6 +6,7 @@
#include "xfa/fwl/theme/cfwl_listboxtp.h"
+#include "build/build_config.h"
#include "xfa/fwl/cfwl_listbox.h"
#include "xfa/fwl/cfwl_themebackground.h"
#include "xfa/fwl/cfwl_widget.h"
@@ -61,7 +62,7 @@ void CFWL_ListBoxTP::DrawListBoxItem(CXFA_Graphics* pGraphics,
pGraphics->SaveGraphState();
pGraphics->SetFillColor(CXFA_GEColor(FWLTHEME_COLOR_BKSelected));
CXFA_GEPath path;
-#if (_FX_OS_ == _FX_OS_MACOSX_)
+#if defined(OS_MACOSX)
path.AddRectangle(rtItem.left, rtItem.top, rtItem.width - 1,
rtItem.height - 1);
#else