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/fpdftext | |
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/fpdftext')
-rw-r--r-- | core/fpdftext/cpdf_linkextract.cpp | 4 | ||||
-rw-r--r-- | core/fpdftext/cpdf_textpage.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp index c3cf4fc1ef..f8144a171b 100644 --- a/core/fpdftext/cpdf_linkextract.cpp +++ b/core/fpdftext/cpdf_linkextract.cpp @@ -246,7 +246,7 @@ bool CPDF_LinkExtract::CheckMailLink(WideString* str) { size_t pPos = aPos.value(); // Used to track the position of '@' or '.'. for (size_t i = aPos.value(); i > 0; i--) { wchar_t ch = (*str)[i - 1]; - if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch)) + if (ch == L'_' || ch == L'-' || FXSYS_iswASCIIalnum(ch)) continue; if (ch != L'.' || i == pPos || i == 1) { @@ -282,7 +282,7 @@ bool CPDF_LinkExtract::CheckMailLink(WideString* str) { pPos = 0; // Used to track the position of '.'. for (size_t i = aPos.value() + 1; i < nLen; i++) { wchar_t wch = (*str)[i]; - if (wch == L'-' || FXSYS_iswalnum(wch)) + if (wch == L'-' || FXSYS_iswASCIIalnum(wch)) continue; if (wch != L'.' || i == pPos + 1) { diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index e712549ceb..5019eabaf5 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -1210,7 +1210,7 @@ bool CPDF_TextPage::IsHyphen(wchar_t curChar) const { if ((iter + 1) != curText.rend()) { iter++; - if (FXSYS_iswalpha(*iter) && FXSYS_iswalnum(curChar)) + if (FXSYS_iswASCIIalpha(*iter) && FXSYS_iswASCIIalnum(curChar)) return true; } |