Replace uses of std::iswdigit() with FXSYS_IsDecimalDigit().

Change-Id: Ide6f5c2f17468bfa953df0961303980fbc6e8956
Reviewed-on: https://pdfium-review.googlesource.com/c/46770
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index 19ae58a..e40da81 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -11,6 +11,7 @@
 #include <vector>
 
 #include "core/fpdftext/cpdf_textpage.h"
+#include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
 #include "third_party/base/stl_util.h"
@@ -336,11 +337,12 @@
     char_right = csPageText[startPos + char_count];
   if ((char_left > 'A' && char_left < 'a') ||
       (char_left > 'a' && char_left < 'z') ||
-      (char_left > 0xfb00 && char_left < 0xfb06) || std::iswdigit(char_left) ||
+      (char_left > 0xfb00 && char_left < 0xfb06) ||
+      FXSYS_IsDecimalDigit(char_left) ||
       (char_right > 'A' && char_right < 'a') ||
       (char_right > 'a' && char_right < 'z') ||
       (char_right > 0xfb00 && char_right < 0xfb06) ||
-      std::iswdigit(char_right)) {
+      FXSYS_IsDecimalDigit(char_right)) {
     return false;
   }
   if (!(('A' > char_left || char_left > 'Z') &&
@@ -350,10 +352,14 @@
     return false;
   }
   if (char_count > 0) {
-    if (std::iswdigit(char_left) && std::iswdigit(csPageText[startPos]))
+    if (FXSYS_IsDecimalDigit(char_left) &&
+        FXSYS_IsDecimalDigit(csPageText[startPos])) {
       return false;
-    if (std::iswdigit(char_right) && std::iswdigit(csPageText[endPos]))
+    }
+    if (FXSYS_IsDecimalDigit(char_right) &&
+        FXSYS_IsDecimalDigit(csPageText[endPos])) {
       return false;
+    }
   }
   return true;
 }
diff --git a/core/fxcrt/cfx_decimal.cpp b/core/fxcrt/cfx_decimal.cpp
index 45980db..65fed4e 100644
--- a/core/fxcrt/cfx_decimal.cpp
+++ b/core/fxcrt/cfx_decimal.cpp
@@ -312,7 +312,7 @@
     str++;
   }
 
-  while (str != strBound && (std::iswdigit(*str) || *str == '.') &&
+  while (str != strBound && (FXSYS_IsDecimalDigit(*str) || *str == '.') &&
          scale < FXMATH_DECIMAL_SCALELIMIT) {
     if (*str == '.') {
       if (!pointmet)
diff --git a/core/fxcrt/css/cfx_cssvaluelistparser.cpp b/core/fxcrt/css/cfx_cssvaluelistparser.cpp
index d38dad7..447ba9f 100644
--- a/core/fxcrt/css/cfx_cssvaluelistparser.cpp
+++ b/core/fxcrt/css/cfx_cssvaluelistparser.cpp
@@ -33,7 +33,8 @@
     *iLength = SkipTo(' ', false, false);
     if (*iLength == 4 || *iLength == 7)
       *eType = CFX_CSSPrimitiveType::RGB;
-  } else if (std::iswdigit(wch) || wch == '.' || wch == '-' || wch == '+') {
+  } else if (FXSYS_IsDecimalDigit(wch) || wch == '.' || wch == '-' ||
+             wch == '+') {
     while (m_pCur < m_pEnd && (*m_pCur > ' ' && *m_pCur != m_Separator))
       ++m_pCur;
 
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index cad6598..a764307 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -49,7 +49,7 @@
   float fValue = 0.0f;
   while (iUsedLen < iLength) {
     wchar_t wch = pwsStr[iUsedLen];
-    if (!std::iswdigit(wch))
+    if (!FXSYS_IsDecimalDigit(wch))
       break;
 
     fValue = fValue * 10.0f + (wch - L'0');
@@ -60,7 +60,7 @@
     float fPrecise = 0.1f;
     while (++iUsedLen < iLength) {
       wchar_t wch = pwsStr[iUsedLen];
-      if (!std::iswdigit(wch))
+      if (!FXSYS_IsDecimalDigit(wch))
         break;
 
       fValue += (wch - L'0') * fPrecise;
@@ -82,7 +82,7 @@
     int32_t exp_value = 0;
     while (iUsedLen < iLength) {
       wchar_t wch = pwsStr[iUsedLen];
-      if (!std::iswdigit(wch))
+      if (!FXSYS_IsDecimalDigit(wch))
         break;
 
       exp_value = exp_value * 10.0f + (wch - L'0');
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index 49f82a6..7dc0d21 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -77,7 +77,7 @@
     }
     if (nWidth == 0) {
       nWidth = FXSYS_wtoi(pStr);
-      while (std::iswdigit(*pStr))
+      while (FXSYS_IsDecimalDigit(*pStr))
         ++pStr;
     }
     if (nWidth < 0 || nWidth > 128 * 1024)
@@ -90,7 +90,7 @@
         pStr++;
       } else {
         nPrecision = FXSYS_wtoi(pStr);
-        while (std::iswdigit(*pStr))
+        while (FXSYS_IsDecimalDigit(*pStr))
           ++pStr;
       }
     }
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 297908a..f958868 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -57,7 +57,8 @@
 CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() {}
 
 bool CBC_OnedEAN13Writer::CheckContentValidity(const WideStringView& contents) {
-  return std::all_of(contents.begin(), contents.end(), std::iswdigit);
+  return std::all_of(contents.begin(), contents.end(),
+                     [](wchar_t c) { return FXSYS_IsDecimalDigit(c); });
 }
 
 WideString CBC_OnedEAN13Writer::FilterContents(const WideStringView& contents) {
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 741a3e7..51876af 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -63,7 +63,8 @@
 }
 
 bool CBC_OnedEAN8Writer::CheckContentValidity(const WideStringView& contents) {
-  return std::all_of(contents.begin(), contents.end(), std::iswdigit);
+  return std::all_of(contents.begin(), contents.end(),
+                     [](wchar_t c) { return FXSYS_IsDecimalDigit(c); });
 }
 
 WideString CBC_OnedEAN8Writer::FilterContents(const WideStringView& contents) {
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index c74d575..464dd0a 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -476,7 +476,7 @@
 }
 
 bool IsPartOfNumberW(wchar_t ch) {
-  return std::iswdigit(ch) || ch == L'-' || ch == L'.';
+  return FXSYS_IsDecimalDigit(ch) || ch == L'-' || ch == L'.';
 }
 
 ByteString GUIDString(bool bSeparator) {
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index a8209e2..125f2bb 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -277,7 +277,7 @@
       if (c != L'+' && c != L'-')
         return false;
       bKXJS = true;
-    } else if (!std::iswdigit(c)) {
+    } else if (!FXSYS_IsDecimalDigit(c)) {
       return false;
     }
     p++;
@@ -289,7 +289,7 @@
 bool CJS_PublicMethods::MaskSatisfied(wchar_t c_Change, wchar_t c_Mask) {
   switch (c_Mask) {
     case L'9':
-      return !!std::iswdigit(c_Change);
+      return !!FXSYS_IsDecimalDigit(c_Change);
     case L'A':
       return isascii(c_Change) && isalpha(c_Change);
     case L'O':
@@ -360,7 +360,7 @@
       break;
 
     wchar_t c = value[i];
-    if (std::iswdigit(c)) {
+    if (FXSYS_IsDecimalDigit(c)) {
       number[nIndex++] = FX_ParseStringInteger(value, i, &nSkip, 4);
       i += nSkip;
     } else {
@@ -760,7 +760,7 @@
       continue;
     }
 
-    if (!std::iswdigit(wstrChange[i])) {
+    if (!FXSYS_IsDecimalDigit(wstrChange[i])) {
       pEvent->Rc() = false;
       return CJS_Result::Success();
     }
@@ -1419,7 +1419,7 @@
   v8::Local<v8::Array> nums = pRuntime->NewArray();
   int nIndex = 0;
   for (const auto& wc : str) {
-    if (std::iswdigit(wc)) {
+    if (FXSYS_IsDecimalDigit(wc)) {
       sPart += wc;
     } else if (sPart.GetLength() > 0) {
       pRuntime->PutArrayElement(nums, nIndex,
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index b30c535..e3948f7 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -336,7 +336,7 @@
       } break;
       case '9': {
         if (iSourceIdx < wsSource.GetLength()) {
-          if (std::iswdigit(wsSource[iSourceIdx])) {
+          if (FXSYS_IsDecimalDigit(wsSource[iSourceIdx])) {
             wsResult += wsSource[iSourceIdx];
             ++iFormatIdx;
           }
@@ -421,7 +421,7 @@
       case WIDTH:
         if (c == L'*')
           return -1;
-        if (std::iswdigit(c)) {
+        if (FXSYS_IsDecimalDigit(c)) {
           // Stay in same state.
         } else if (c == L'.') {
           state = PRECISION;
@@ -433,7 +433,7 @@
       case PRECISION:
         if (c == L'*')
           return -1;
-        if (std::iswdigit(c)) {
+        if (FXSYS_IsDecimalDigit(c)) {
           // Stay in same state.
           ++precision_digits;
         } else {
diff --git a/fxjs/fx_date_helpers.cpp b/fxjs/fx_date_helpers.cpp
index 847e8c3..3988b51 100644
--- a/fxjs/fx_date_helpers.cpp
+++ b/fxjs/fx_date_helpers.cpp
@@ -275,7 +275,7 @@
       break;
 
     wchar_t c = str[i];
-    if (!std::iswdigit(c))
+    if (!FXSYS_IsDecimalDigit(c))
       break;
 
     nRet = nRet * 10 + FXSYS_DecimalCharToInt(c);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index b3fc920..adc0d7f 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -254,13 +254,17 @@
 
   wsDate = wsDateTime.Left(nSplitIndex.value());
   if (!wsDate.IsEmpty()) {
-    if (!std::any_of(wsDate.begin(), wsDate.end(), std::iswdigit))
+    if (!std::any_of(wsDate.begin(), wsDate.end(),
+                     [](wchar_t c) { return FXSYS_IsDecimalDigit(c); })) {
       return false;
+    }
   }
   wsTime = wsDateTime.Right(wsDateTime.GetLength() - nSplitIndex.value() - 1);
   if (!wsTime.IsEmpty()) {
-    if (!std::any_of(wsTime.begin(), wsTime.end(), std::iswdigit))
+    if (!std::any_of(wsTime.begin(), wsTime.end(),
+                     [](wchar_t c) { return FXSYS_IsDecimalDigit(c); })) {
       return false;
+    }
   }
   return true;
 }