Remove fx_system.h from fx_safe_types.h

Reduces the include dependency chain.

-- Illustrate usage in fx_stream.h
-- Place windows-specific include in the one place required.

Change-Id: I0beccde72474214b2f35a6b7380a31c13dcfcc1c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82831
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/jpeg/jpeg_common.h b/core/fxcodec/jpeg/jpeg_common.h
index a56e4e9..33b8a96 100644
--- a/core/fxcodec/jpeg/jpeg_common.h
+++ b/core/fxcodec/jpeg/jpeg_common.h
@@ -12,6 +12,13 @@
 
 #include <stdio.h>
 
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+// windows.h must come before the third_party/libjpeg_turbo includes.
+#include <windows.h>
+#endif
+
 extern "C" {
 
 #undef FAR
diff --git a/core/fxcrt/fx_safe_types.h b/core/fxcrt/fx_safe_types.h
index 6f5b967..02e8787 100644
--- a/core/fxcrt/fx_safe_types.h
+++ b/core/fxcrt/fx_safe_types.h
@@ -5,9 +5,10 @@
 #ifndef CORE_FXCRT_FX_SAFE_TYPES_H_
 #define CORE_FXCRT_FX_SAFE_TYPES_H_
 
-#include <stdlib.h>  // For size_t.
+#include <stddef.h>
+#include <stdint.h>
 
-#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/fx_types.h"
 #include "third_party/base/numerics/safe_math.h"
 
 using FX_SAFE_UINT32 = pdfium::base::CheckedNumeric<uint32_t>;
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index db41234..54ab02c 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -13,7 +13,6 @@
 #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)
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index ef58660..65480f0 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -7,8 +7,11 @@
 #ifndef CORE_FXCRT_FX_STREAM_H_
 #define CORE_FXCRT_FX_STREAM_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include "core/fxcrt/fx_string.h"
-#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/fx_types.h"
 #include "core/fxcrt/retain_ptr.h"
 #include "third_party/base/compiler_specific.h"