diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-03-09 17:46:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-09 17:46:50 +0000 |
commit | 69da36c5f841e8c6e5ded6c704d9ef58c57d532a (patch) | |
tree | 42f50adb5d062f3971f8c6a4f899e737f5462c6c /core/fxcrt/fx_extension.h | |
parent | 3baef5c6daf58cec2df193714b5727802d0bd42e (diff) | |
download | pdfium-69da36c5f841e8c6e5ded6c704d9ef58c57d532a.tar.xz |
Explicitly mark helper methods that only operate on ASCII ranges
A number of our character helper methods take in wide character types,
but only do tests/operations on the ASCII range of characters. As a
very quick first pass I am renaming all of the foot-gun methods to
explictly call out this behaviour, while I do a bigger
cleanup/refactor.
BUG=pdfium:1035
Change-Id: Ia035dfa1cb6812fa6d45155c4565475032c4c165
Reviewed-on: https://pdfium-review.googlesource.com/28330
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_extension.h')
-rw-r--r-- | core/fxcrt/fx_extension.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h index e02d58d0df..491d4b29b7 100644 --- a/core/fxcrt/fx_extension.h +++ b/core/fxcrt/fx_extension.h @@ -25,31 +25,31 @@ float FXSYS_wcstof(const wchar_t* pwsStr, wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count); int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count); -inline bool FXSYS_islower(int32_t ch) { +inline bool FXSYS_isASCIIlower(int32_t ch) { return ch >= 'a' && ch <= 'z'; } -inline bool FXSYS_isupper(int32_t ch) { +inline bool FXSYS_isASCIIupper(int32_t ch) { return ch >= 'A' && ch <= 'Z'; } -inline int32_t FXSYS_tolower(int32_t ch) { +inline int32_t FXSYS_toASCIIlower(int32_t ch) { return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); } -inline int32_t FXSYS_toupper(int32_t ch) { +inline int32_t FXSYS_toASCIIupper(int32_t ch) { return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -inline bool FXSYS_iswalpha(wchar_t wch) { - return FXSYS_isupper(wch) || FXSYS_islower(wch); +inline bool FXSYS_iswASCIIalpha(wchar_t wch) { + return FXSYS_isASCIIupper(wch) || FXSYS_isASCIIlower(wch); } -inline bool FXSYS_iswalnum(wchar_t wch) { - return FXSYS_iswalpha(wch) || std::iswdigit(wch); +inline bool FXSYS_iswASCIIalnum(wchar_t wch) { + return FXSYS_iswASCIIalpha(wch) || std::iswdigit(wch); } -inline bool FXSYS_iswspace(wchar_t c) { +inline bool FXSYS_iswASCIIspace(wchar_t c) { return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); } |