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);