Fix FXSYS_IsDecimalDigit() and FXSYS_DecimalCharToInt().

On Windows, they do not always behave correctly.
See https://pdfium-review.googlesource.com/46713/ for example:

error: Value of: FXSYS_IsDecimalDigit(static_cast<wchar_t>(0xb2))
  Actual: true
  Expected: false

BUG=chromium:912693

Change-Id: Ic5d5a878eb44e3b6882d799147d019e75c8d3c04
Reviewed-on: https://pdfium-review.googlesource.com/c/46751
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h
index ef79196..621737e 100644
--- a/core/fxcrt/fx_extension.h
+++ b/core/fxcrt/fx_extension.h
@@ -95,7 +95,7 @@
 }
 
 inline bool FXSYS_IsDecimalDigit(wchar_t c) {
-  return !!std::iswdigit(c);
+  return !((c & 0xFFFFFF80) || !std::iswdigit(c));
 }
 
 inline int FXSYS_DecimalCharToInt(char c) {
@@ -103,7 +103,7 @@
 }
 
 inline int FXSYS_DecimalCharToInt(wchar_t c) {
-  return std::iswdigit(c) ? c - L'0' : 0;
+  return FXSYS_IsDecimalDigit(c) ? c - L'0' : 0;
 }
 
 void FXSYS_IntToTwoHexChars(uint8_t c, char* buf);
diff --git a/core/fxcrt/fx_extension_unittest.cpp b/core/fxcrt/fx_extension_unittest.cpp
index fdf51a0..6b62856 100644
--- a/core/fxcrt/fx_extension_unittest.cpp
+++ b/core/fxcrt/fx_extension_unittest.cpp
@@ -20,6 +20,8 @@
   EXPECT_EQ(0, FXSYS_DecimalCharToInt('a'));
   EXPECT_EQ(7, FXSYS_DecimalCharToInt(L'7'));
   EXPECT_EQ(0, FXSYS_DecimalCharToInt(L'a'));
+  EXPECT_EQ(0, FXSYS_DecimalCharToInt(static_cast<char>(-78)));
+  EXPECT_EQ(0, FXSYS_DecimalCharToInt(static_cast<wchar_t>(0xb2)));
 }
 
 TEST(fxcrt, FXSYS_IsDecimalDigit) {
@@ -27,6 +29,8 @@
   EXPECT_TRUE(FXSYS_IsDecimalDigit(L'7'));
   EXPECT_FALSE(FXSYS_IsDecimalDigit('a'));
   EXPECT_FALSE(FXSYS_IsDecimalDigit(L'a'));
+  EXPECT_FALSE(FXSYS_IsDecimalDigit(static_cast<char>(-78)));
+  EXPECT_FALSE(FXSYS_IsDecimalDigit(static_cast<wchar_t>(0xb2)));
 }
 
 TEST(fxcrt, FXSYS_IntToTwoHexChars) {