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/fx_extension.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/fxcrt/fx_extension.cpp') diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 371f1b5211..7bfcec6d42 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -68,8 +68,8 @@ int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count) { ASSERT(s1 && s2 && count > 0); wchar_t wch1 = 0, wch2 = 0; while (count-- > 0) { - wch1 = static_cast(FXSYS_tolower(*s1++)); - wch2 = static_cast(FXSYS_tolower(*s2++)); + wch1 = static_cast(FXSYS_toASCIIlower(*s1++)); + wch2 = static_cast(FXSYS_toASCIIlower(*s2++)); if (wch1 != wch2) break; } @@ -80,7 +80,7 @@ uint32_t FX_HashCode_GetA(const ByteStringView& str, bool bIgnoreCase) { uint32_t dwHashCode = 0; if (bIgnoreCase) { for (const auto& c : str) - dwHashCode = 31 * dwHashCode + FXSYS_tolower(c); + dwHashCode = 31 * dwHashCode + FXSYS_toASCIIlower(c); } else { for (const auto& c : str) dwHashCode = 31 * dwHashCode + c; @@ -92,7 +92,7 @@ uint32_t FX_HashCode_GetW(const WideStringView& str, bool bIgnoreCase) { uint32_t dwHashCode = 0; if (bIgnoreCase) { for (const auto& c : str) - dwHashCode = 1313 * dwHashCode + FXSYS_tolower(c); + dwHashCode = 1313 * dwHashCode + FXSYS_toASCIIlower(c); } else { for (const auto& c : str) dwHashCode = 1313 * dwHashCode + c; -- cgit v1.2.3