Replace remaining _FX_PLATFORM_WINDOWS_ usage outside of fx_system.h.

Use build/build_config.h to standarize on Chromium's platform defines.

Change-Id: I0eb37e9cd6dc2904bc0af809d643720f6415d22a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53716
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/fx_system.cpp b/core/fxcrt/fx_system.cpp
index 673b286..abe833d 100644
--- a/core/fxcrt/fx_system.cpp
+++ b/core/fxcrt/fx_system.cpp
@@ -9,6 +9,7 @@
 #include <cmath>
 #include <limits>
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_extension.h"
 
 namespace {
@@ -109,7 +110,27 @@
   return FXSYS_IntToStr<int64_t, uint64_t, char*>(value, str, radix);
 }
 
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#if defined(OS_WIN)
+
+size_t FXSYS_wcsftime(wchar_t* strDest,
+                      size_t maxsize,
+                      const wchar_t* format,
+                      const struct tm* timeptr) {
+  // Avoid tripping an invalid parameter handler and crashing process.
+  // Note: leap seconds may cause tm_sec == 60.
+  if (timeptr->tm_year < -1900 || timeptr->tm_year > 8099 ||
+      timeptr->tm_mon < 0 || timeptr->tm_mon > 11 || timeptr->tm_mday < 1 ||
+      timeptr->tm_mday > 31 || timeptr->tm_hour < 0 || timeptr->tm_hour > 23 ||
+      timeptr->tm_min < 0 || timeptr->tm_min > 59 || timeptr->tm_sec < 0 ||
+      timeptr->tm_sec > 60 || timeptr->tm_wday < 0 || timeptr->tm_wday > 6 ||
+      timeptr->tm_yday < 0 || timeptr->tm_yday > 365) {
+    strDest[0] = L'\0';
+    return 0;
+  }
+  return wcsftime(strDest, maxsize, format, timeptr);
+}
+
+#else  // defined(OS_WIN)
 
 int FXSYS_GetACP() {
   return 0;
@@ -222,24 +243,4 @@
   return wlen;
 }
 
-#else  // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
-
-size_t FXSYS_wcsftime(wchar_t* strDest,
-                      size_t maxsize,
-                      const wchar_t* format,
-                      const struct tm* timeptr) {
-  // Avoid tripping an invalid parameter handler and crashing process.
-  // Note: leap seconds may cause tm_sec == 60.
-  if (timeptr->tm_year < -1900 || timeptr->tm_year > 8099 ||
-      timeptr->tm_mon < 0 || timeptr->tm_mon > 11 || timeptr->tm_mday < 1 ||
-      timeptr->tm_mday > 31 || timeptr->tm_hour < 0 || timeptr->tm_hour > 23 ||
-      timeptr->tm_min < 0 || timeptr->tm_min > 59 || timeptr->tm_sec < 0 ||
-      timeptr->tm_sec > 60 || timeptr->tm_wday < 0 || timeptr->tm_wday > 6 ||
-      timeptr->tm_yday < 0 || timeptr->tm_yday > 365) {
-    strDest[0] = L'\0';
-    return 0;
-  }
-  return wcsftime(strDest, maxsize, format, timeptr);
-}
-
-#endif  // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
+#endif  // defined(OS_WIN)
diff --git a/third_party/libtiff/0000-build-config.patch b/third_party/libtiff/0000-build-config.patch
index 2989607..4acd37e 100644
--- a/third_party/libtiff/0000-build-config.patch
+++ b/third_party/libtiff/0000-build-config.patch
@@ -68,7 +68,7 @@
 diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h
 --- /dev/null
 +++ b/third_party/libtiff/tiffconf.h
-@@ -0,0 +1,239 @@
+@@ -0,0 +1,240 @@
 +/* libtiff/tiffconf.h.  Generated by configure.  */
 +/*
 +  Configuration defines for installed libtiff.
@@ -78,6 +78,7 @@
 +#ifndef _TIFFCONF_
 +#define _TIFFCONF_
 +
++#include "build/build_config.h"
 +#include "core/fxcrt/fx_system.h"
 +
 +//NOTE: The tiff codec requires an ANSI C compiler environment for building and 
@@ -100,7 +101,7 @@
 +//fx_system.h already include the string.h in ANSIC
 +
 +/* Define to 1 if you have the <search.h> header file. */
-+#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ && _MSC_VER >= 1900
++#if defined(OS_WIN)
 +// search.h is always available in VS 2015 and above, and may be
 +// available in earlier versions.
 +#define HAVE_SEARCH_H 1
diff --git a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h
index e527083..6292cc5 100644
--- a/third_party/libtiff/tiffconf.h
+++ b/third_party/libtiff/tiffconf.h
@@ -7,6 +7,7 @@
 #ifndef _TIFFCONF_
 #define _TIFFCONF_
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_system.h"
 
 //NOTE: The tiff codec requires an ANSI C compiler environment for building and 
@@ -29,7 +30,7 @@
 //fx_system.h already include the string.h in ANSIC
 
 /* Define to 1 if you have the <search.h> header file. */
-#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ && _MSC_VER >= 1900
+#if defined(OS_WIN)
 // search.h is always available in VS 2015 and above, and may be
 // available in earlier versions.
 #define HAVE_SEARCH_H 1
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index f57871f..7698aa7 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -23,16 +23,15 @@
                                                uint32_t dwFontStyles,
                                                uint16_t wCodePage,
                                                CFGAS_FontMgr* pFontMgr) {
-#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_
-  if (!pFontMgr)
-    return nullptr;
-
-  return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
-#else
+#if defined(OS_WIN)
   auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr);
   if (!pFont->LoadFontInternal(pszFontFamily, dwFontStyles, wCodePage))
     return nullptr;
   return pFont;
+#else
+  if (!pFontMgr)
+    return nullptr;
+  return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
 #endif
 }