diff options
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/bytestring.cpp | 4 | ||||
-rw-r--r-- | core/fxcrt/fx_extension.cpp | 8 | ||||
-rw-r--r-- | core/fxcrt/fx_extension.h | 16 | ||||
-rw-r--r-- | core/fxcrt/fx_system.cpp | 16 |
4 files changed, 22 insertions, 22 deletions
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp index 2a57602692..f5687c591e 100644 --- a/core/fxcrt/bytestring.cpp +++ b/core/fxcrt/bytestring.cpp @@ -344,8 +344,8 @@ bool ByteString::EqualNoCase(const ByteStringView& str) const { const uint8_t* pThat = str.raw_str(); for (size_t i = 0; i < len; i++) { if ((*pThis) != (*pThat)) { - uint8_t bThis = FXSYS_toASCIIlower(*pThis); - uint8_t bThat = FXSYS_toASCIIlower(*pThat); + uint8_t bThis = tolower(*pThis); + uint8_t bThat = tolower(*pThat); if (bThis != bThat) return false; } diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 7bfcec6d42..4448a71a9b 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<wchar_t>(FXSYS_toASCIIlower(*s1++)); - wch2 = static_cast<wchar_t>(FXSYS_toASCIIlower(*s2++)); + wch1 = static_cast<wchar_t>(FXSYS_towlower(*s1++)); + wch2 = static_cast<wchar_t>(FXSYS_towlower(*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_toASCIIlower(c); + dwHashCode = 31 * dwHashCode + tolower(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_toASCIIlower(c); + dwHashCode = 1313 * dwHashCode + FXSYS_towlower(c); } else { for (const auto& c : str) dwHashCode = 1313 * dwHashCode + c; diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h index 8e9d06694f..0f249f89c8 100644 --- a/core/fxcrt/fx_extension.h +++ b/core/fxcrt/fx_extension.h @@ -26,20 +26,20 @@ 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_isASCIIlower(int32_t ch) { - return ch >= 'a' && ch <= 'z'; +inline bool FXSYS_iswlower(int32_t c) { + return u_islower(c); } -inline bool FXSYS_isASCIIupper(int32_t ch) { - return ch >= 'A' && ch <= 'Z'; +inline bool FXSYS_iswupper(int32_t c) { + return u_isupper(c); } -inline int32_t FXSYS_toASCIIlower(int32_t ch) { - return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); +inline int32_t FXSYS_towlower(wchar_t c) { + return u_tolower(c); } -inline int32_t FXSYS_toASCIIupper(int32_t ch) { - return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); +inline int32_t FXSYS_towupper(wchar_t c) { + return u_toupper(c); } inline bool FXSYS_iswalpha(wchar_t c) { diff --git a/core/fxcrt/fx_system.cpp b/core/fxcrt/fx_system.cpp index 532e83b949..27cbd65f3c 100644 --- a/core/fxcrt/fx_system.cpp +++ b/core/fxcrt/fx_system.cpp @@ -118,7 +118,7 @@ char* FXSYS_strlwr(char* str) { } char* s = str; while (*str) { - *str = FXSYS_toASCIIlower(*str); + *str = tolower(*str); str++; } return s; @@ -129,7 +129,7 @@ char* FXSYS_strupr(char* str) { } char* s = str; while (*str) { - *str = FXSYS_toASCIIupper(*str); + *str = toupper(*str); str++; } return s; @@ -140,7 +140,7 @@ wchar_t* FXSYS_wcslwr(wchar_t* str) { } wchar_t* s = str; while (*str) { - *str = FXSYS_toASCIIlower(*str); + *str = FXSYS_towlower(*str); str++; } return s; @@ -151,7 +151,7 @@ wchar_t* FXSYS_wcsupr(wchar_t* str) { } wchar_t* s = str; while (*str) { - *str = FXSYS_toASCIIupper(*str); + *str = FXSYS_towupper(*str); str++; } return s; @@ -161,8 +161,8 @@ int FXSYS_stricmp(const char* dst, const char* src) { int f; int l; do { - f = FXSYS_toASCIIupper(*dst); - l = FXSYS_toASCIIupper(*src); + f = toupper(*dst); + l = toupper(*src); ++dst; ++src; } while (f && f == l); @@ -173,8 +173,8 @@ int FXSYS_wcsicmp(const wchar_t* dst, const wchar_t* src) { wchar_t f; wchar_t l; do { - f = FXSYS_toASCIIupper(*dst); - l = FXSYS_toASCIIupper(*src); + f = FXSYS_towupper(*dst); + l = FXSYS_towupper(*src); ++dst; ++src; } while (f && f == l); |