Remove a custom implementation of wcstod().

Change-Id: Ib9c28fb78bd166b46fcea9652582b1243bac80e2
Reviewed-on: https://pdfium-review.googlesource.com/c/46550
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 9b2a69e..d74010d 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_localevalue.h"
 
+#include <cwchar>
 #include <utility>
 #include <vector>
 
@@ -210,66 +211,7 @@
     return 0;
   }
 
-  size_t cc = 0;
-  pdfium::span<const wchar_t> str = m_wsValue.AsSpan();
-  while (cc < str.size() && FXSYS_iswspace(str[cc]))
-    cc++;
-
-  if (cc >= str.size())
-    return 0;
-
-  bool bNegative = false;
-  if (str[cc] == '+') {
-    cc++;
-  } else if (str[cc] == '-') {
-    bNegative = true;
-    cc++;
-  }
-
-  int64_t nIntegral = 0;
-  size_t nIntegralLen = 0;
-  while (cc < str.size()) {
-    if (str[cc] == '.' || !FXSYS_IsDecimalDigit(str[cc]) || nIntegralLen > 17)
-      break;
-
-    nIntegral = nIntegral * 10 + str[cc++] - '0';
-    nIntegralLen++;
-  }
-  nIntegral = bNegative ? -nIntegral : nIntegral;
-
-  int32_t scale = 0;
-  int32_t nExponent = 0;
-  double fraction = 0.0;
-  if (cc < str.size() && str[cc] == '.') {
-    cc++;
-    while (cc < str.size() && FXSYS_IsDecimalDigit(str[cc])) {
-      fraction += XFA_GetFractionalScale(scale) * (str[cc++] - '0');
-      if (++scale == XFA_GetMaxFractionalScale())
-        break;
-    }
-  }
-  if (cc < str.size() && (str[cc] == 'E' || str[cc] == 'e')) {
-    cc++;
-    bool bExpSign = false;
-    if (cc < str.size()) {
-      if (str[cc] == '+') {
-        cc++;
-      } else if (str[cc] == '-') {
-        bExpSign = true;
-        cc++;
-      }
-    }
-    while (cc < str.size() && FXSYS_IsDecimalDigit(str[cc]))
-      nExponent = nExponent * 10 + str[cc++] - '0';
-
-    nExponent = bExpSign ? -nExponent : nExponent;
-  }
-
-  double dValue = nIntegral + (bNegative ? -fraction : fraction);
-  if (nExponent != 0)
-    dValue *= FXSYS_pow(10, static_cast<float>(nExponent));
-
-  return dValue;
+  return wcstod(m_wsValue.c_str(), nullptr);
 }
 
 CFX_DateTime CXFA_LocaleValue::GetDate() const {
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 69a7fef..4e1f1ed 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -32,23 +32,6 @@
 
 constexpr const char kFormNS[] = "http://www.xfa.org/schema/xfa-form/";
 
-const double fraction_scales[] = {0.1,
-                                  0.01,
-                                  0.001,
-                                  0.0001,
-                                  0.00001,
-                                  0.000001,
-                                  0.0000001,
-                                  0.00000001,
-                                  0.000000001,
-                                  0.0000000001,
-                                  0.00000000001,
-                                  0.000000000001,
-                                  0.0000000000001,
-                                  0.00000000000001,
-                                  0.000000000000001,
-                                  0.0000000000000001};
-
 WideString ExportEncodeAttribute(const WideString& str) {
   CFX_WideTextBuf textBuf;
   int32_t iLen = str.GetLength();
@@ -404,14 +387,6 @@
 
 }  // namespace
 
-double XFA_GetFractionalScale(uint32_t idx) {
-  return fraction_scales[idx];
-}
-
-int XFA_GetMaxFractionalScale() {
-  return FX_ArraySize(fraction_scales);
-}
-
 CXFA_LocaleValue XFA_GetLocaleValue(CXFA_Node* pNode) {
   CXFA_Value* pNodeValue =
       pNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false);
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 129dbec..dff7d3d 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -15,9 +15,6 @@
 class CXFA_LocaleValue;
 class CXFA_Node;
 
-double XFA_GetFractionalScale(uint32_t idx);
-int XFA_GetMaxFractionalScale();
-
 bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode,
                                                 const WideString& wsQualifier,
                                                 WideString* wsNamespaceURI);