summaryrefslogtreecommitdiff
path: root/core/include/fxcrt
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2015-12-17 18:16:23 -0800
committerWei Li <weili@chromium.org>2015-12-17 18:16:23 -0800
commit60eac0f7cebd682e93eb5d8a0950f31856099081 (patch)
treef797cf457d0a4b8eb916373ee3afcb7d9ca73abe /core/include/fxcrt
parentc5d934dff4c2fa254b445dbf06899bb181df1c12 (diff)
downloadpdfium-60eac0f7cebd682e93eb5d8a0950f31856099081.tar.xz
Merge to XFA: Correctly extracting email addresses
An email address contains user name part and host name part. User name allows dash or underscore, but not leading/ending/double period. Host name doesn't allow leading/ending/double period either. BUG=489107 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1530763005 . (cherry picked from commit cc70b7b55c9edcd0ff038f59080699060fbbede1) Review URL: https://codereview.chromium.org/1532303002 .
Diffstat (limited to 'core/include/fxcrt')
-rw-r--r--core/include/fxcrt/fx_ext.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h
index 6cba8eeb91..3f4f668190 100644
--- a/core/include/fxcrt/fx_ext.h
+++ b/core/include/fxcrt/fx_ext.h
@@ -36,6 +36,15 @@ inline int32_t FXSYS_tolower(int32_t ch) {
inline int32_t FXSYS_toupper(int32_t ch) {
return ch < 'a' || ch > 'z' ? ch : (ch - 0x20);
}
+inline FX_BOOL FXSYS_iswalpha(wchar_t wch) {
+ return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z');
+}
+inline FX_BOOL FXSYS_iswdigit(wchar_t wch) {
+ return wch >= L'0' && wch <= L'9';
+}
+inline FX_BOOL FXSYS_iswalnum(wchar_t wch) {
+ return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch);
+}
inline int FXSYS_toHexDigit(const FX_CHAR c) {
if (!std::isxdigit(c))