Switch to C headers for cmath.

Consistently use the C version instead the C++ version. Also remove
unused cmath headers.

Change-Id: I41409a160394674472de1bf5f7096975f562ca3f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83951
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index eb51287..63f719a 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -6,9 +6,10 @@
 
 #include "core/fpdfapi/render/cpdf_rendershading.h"
 
+#include <math.h>
+
 #include <algorithm>
 #include <array>
-#include <cmath>
 #include <memory>
 #include <utility>
 #include <vector>
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index eb1700e..acd5928 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -7,7 +7,6 @@
 #include "core/fpdfapi/render/cpdf_renderstatus.h"
 
 #include <algorithm>
-#include <cmath>
 #include <memory>
 #include <numeric>
 #include <set>
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index e82aec8..ed07532 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -6,8 +6,9 @@
 
 #include "core/fxge/win32/cfx_psrenderer.h"
 
+#include <math.h>
+
 #include <algorithm>
-#include <cmath>
 #include <memory>
 #include <sstream>
 #include <utility>
@@ -571,7 +572,7 @@
   float scale =
       std::min(mtObject2Device.GetXUnit(), mtObject2Device.GetYUnit());
   static constexpr float kEpsilon = 0.01f;
-  if (std::fabs(font_size * scale) < kEpsilon)
+  if (fabsf(font_size * scale) < kEpsilon)
     return true;
 
   StartRendering();
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 29b5c65..c9211ec 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -6,7 +6,6 @@
 
 #include "public/fpdfview.h"
 
-#include <cmath>
 #include <memory>
 #include <utility>
 #include <vector>
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 0099cb7..5b6c2c8 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <cmath>
+#include <math.h>
+
 #include <limits>
 #include <memory>
 #include <string>
diff --git a/fxjs/cjs_publicmethods_embeddertest.cpp b/fxjs/cjs_publicmethods_embeddertest.cpp
index 174153a..fd86392 100644
--- a/fxjs/cjs_publicmethods_embeddertest.cpp
+++ b/fxjs/cjs_publicmethods_embeddertest.cpp
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <cmath>
+#include <math.h>
+
 #include <vector>
 
 #include "core/fxcrt/fx_string.h"
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index a202280..7687501 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -7,7 +7,6 @@
 #include "xfa/fxfa/cxfa_ffwidget.h"
 
 #include <algorithm>
-#include <cmath>
 #include <memory>
 #include <utility>
 
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index a2ea10d..8147160 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -6,8 +6,9 @@
 
 #include "xfa/fxfa/parser/cxfa_box.h"
 
+#include <math.h>
+
 #include <algorithm>
-#include <cmath>
 #include <utility>
 
 #include "fxjs/xfa/cjx_object.h"
@@ -222,7 +223,7 @@
   XFA_Element type = GetElementType();
   if (type == XFA_Element::Arc || forceRound) {
     CXFA_Edge* edge = GetEdgeIfExists(0);
-    float fThickness = std::fmax(0.0, edge ? edge->GetThickness() : 0);
+    float fThickness = fmax(0.0, edge ? edge->GetThickness() : 0);
     float fHalf = fThickness / 2;
     XFA_AttributeValue iHand = GetHand();
     if (iHand == XFA_AttributeValue::Left)
diff --git a/xfa/fxfa/parser/cxfa_rectangle.cpp b/xfa/fxfa/parser/cxfa_rectangle.cpp
index 90d9a08..0d211c1 100644
--- a/xfa/fxfa/parser/cxfa_rectangle.cpp
+++ b/xfa/fxfa/parser/cxfa_rectangle.cpp
@@ -6,7 +6,8 @@
 
 #include "xfa/fxfa/parser/cxfa_rectangle.h"
 
-#include <cmath>
+#include <math.h>
+
 #include <utility>
 
 #include "fxjs/xfa/cjx_node.h"
@@ -227,7 +228,7 @@
     return;
 
   for (int32_t i = 1; i < 8; i += 2) {
-    float fThickness = std::fmax(0.0, strokes[i]->GetThickness());
+    float fThickness = fmax(0.0, strokes[i]->GetThickness());
     float fHalf = fThickness / 2;
     XFA_AttributeValue iHand = GetHand();
     switch (i) {