Fix -Wimplicit-int-float-conversions.

Bug: chromium:989932
Change-Id: I19fb37fa5d3ba5aca666c9854bd2aea303117df2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82616
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_psengine_unittest.cpp b/core/fpdfapi/page/cpdf_psengine_unittest.cpp
index e5f3d3b..1ba4a40 100644
--- a/core/fpdfapi/page/cpdf_psengine_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_psengine_unittest.cpp
@@ -202,7 +202,7 @@
   // Truncate does not behave according to the PostScript Language Reference for
   // values beyond the range of integers. This seems to match Acrobat's
   // behavior. See https://crbug.com/pdfium/1314.
-  float max_int = std::numeric_limits<int>::max();
+  float max_int = static_cast<float>(std::numeric_limits<int>::max());
   EXPECT_FLOAT_EQ(-max_int,
                   DoOperator1(&engine, max_int * -1.5f, PSOP_TRUNCATE));
 }
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 90f5deb..8e5093f 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -370,7 +370,12 @@
 
 config("fx_libopenjpeg_warnings") {
   visibility = [ ":*" ]
-  if (is_win && !is_clang && target_cpu == "x86") {
+  if (is_clang) {
+    cflags = [
+      # Various files convert MAX_INT to double and similar without casting.
+      "-Wno-implicit-int-float-conversion",
+    ]
+  } else if (is_win && target_cpu == "x86") {
     cflags = [
       # Signed/unsigned comparisons.
       "/wd4018",