Split fx_types.h off from fx_system.h.

Headers that require FX_FILESIZE will just require the smaller
fx_types.h rather than the full-up fx_system.h, which drags in a
number of other system library headers.

Change-Id: I5e731d1cf8a979dad92abcc95346a405d076c0b4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82830
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index 30c3a71..58e4c80 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -54,6 +54,7 @@
     "fx_string.h",
     "fx_system.cpp",
     "fx_system.h",
+    "fx_types.h",
     "fx_unicode.cpp",
     "fx_unicode.h",
     "maybe_owned.h",
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index e027bcf..db41234 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -13,6 +13,7 @@
 #include "build/build_config.h"
 #include "core/fxcrt/fileaccess_iface.h"
 #include "core/fxcrt/fx_safe_types.h"
+#include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/unowned_ptr.h"
 
 #if defined(OS_WIN)
@@ -26,7 +27,6 @@
 #else
 #include <dirent.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 struct FX_FolderHandle {
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 44c739f..0720e15 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -15,6 +15,7 @@
 #include <wchar.h>
 
 #include "build/build_config.h"
+#include "core/fxcrt/fx_types.h"
 
 #if defined(_MSC_VER) && _MSC_VER < 1900
 #error Sorry, VC++ 2015 or later is required to compile PDFium.
@@ -37,14 +38,6 @@
 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
 
-// PDFium file sizes match the platform. The value must be signed to support -1
-// error returns.
-#if defined(OS_WIN)
-#define FX_FILESIZE int64_t
-#else
-#define FX_FILESIZE off_t
-#endif  // defined(OS_WIN)
-
 // M_PI not universally present on all platforms.
 #define FX_PI 3.1415926535897932384626433832795f
 #define FX_BEZIER 0.5522847498308f
diff --git a/core/fxcrt/fx_types.h b/core/fxcrt/fx_types.h
new file mode 100644
index 0000000..b62131c
--- /dev/null
+++ b/core/fxcrt/fx_types.h
@@ -0,0 +1,22 @@
+// Copyright 2021 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_FX_TYPES_H_
+#define CORE_FXCRT_FX_TYPES_H_
+
+#include "build/build_config.h"
+
+// PDFium file sizes match the platform. The value must be signed to support -1
+// error returns.
+#if defined(OS_WIN)
+#include <stdint.h>
+#define FX_FILESIZE int64_t
+#else
+#include <sys/types.h>  // For off_t.
+#define FX_FILESIZE off_t
+#endif  // defined(OS_WIN)
+
+#endif  // CORE_FXCRT_FX_TYPES_H_