From 69da36c5f841e8c6e5ded6c704d9ef58c57d532a Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 9 Mar 2018 17:46:50 +0000 Subject: 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 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima Reviewed-by: dsinclair --- core/fxcrt/css/cfx_cssselector.cpp | 4 ++-- core/fxcrt/css/cfx_csssyntaxparser.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core/fxcrt/css') diff --git a/core/fxcrt/css/cfx_cssselector.cpp b/core/fxcrt/css/cfx_cssselector.cpp index 3993dcae5c..76cb846890 100644 --- a/core/fxcrt/css/cfx_cssselector.cpp +++ b/core/fxcrt/css/cfx_cssselector.cpp @@ -17,7 +17,7 @@ int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) { const wchar_t* pStart = psz; while (psz < pEnd) { wchar_t wch = *psz; - if (!FXSYS_iswalnum(wch) && wch != '_' && wch != '-') + if (!FXSYS_iswASCIIalnum(wch) && wch != '_' && wch != '-') break; ++psz; } @@ -67,7 +67,7 @@ std::unique_ptr CFX_CSSSelector::FromString( std::unique_ptr pFirst = nullptr; for (psz = pStart; psz < pEnd;) { wchar_t wch = *psz; - if (FXSYS_iswalpha(wch) || wch == '*') { + if (FXSYS_iswASCIIalpha(wch) || wch == '*') { int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd); auto p = pdfium::MakeUnique(CFX_CSSSelectorType::Element, psz, iNameLen, true); diff --git a/core/fxcrt/css/cfx_csssyntaxparser.cpp b/core/fxcrt/css/cfx_csssyntaxparser.cpp index 30352a5a20..fea951f1ec 100644 --- a/core/fxcrt/css/cfx_csssyntaxparser.cpp +++ b/core/fxcrt/css/cfx_csssyntaxparser.cpp @@ -18,7 +18,7 @@ namespace { bool IsSelectorStart(wchar_t wch) { - return wch == '.' || wch == '#' || wch == '*' || FXSYS_iswalpha(wch); + return wch == '.' || wch == '#' || wch == '*' || FXSYS_iswASCIIalpha(wch); } } // namespace -- cgit v1.2.3