summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/bytestring.cpp4
-rw-r--r--core/fxcrt/fx_extension.cpp8
-rw-r--r--core/fxcrt/fx_extension.h16
-rw-r--r--core/fxcrt/fx_system.cpp16
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp4
5 files changed, 24 insertions, 24 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);
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 7413a69884..d44d7d56d2 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -97,7 +97,7 @@ uint32_t FPF_GetHashCode_StringA(const char* pStr, int32_t iLength) {
const char* pStrEnd = pStr + iLength;
uint32_t uHashCode = 0;
while (pStr < pStrEnd)
- uHashCode = 31 * uHashCode + FXSYS_toASCIIlower(*pStr++);
+ uHashCode = 31 * uHashCode + tolower(*pStr++);
return uHashCode;
}
@@ -167,7 +167,7 @@ uint32_t FPF_SKIANormalizeFontName(const ByteStringView& bsfamily) {
char ch = pBuffer[i];
if (ch == ' ' || ch == '-' || ch == ',')
continue;
- dwHash = 31 * dwHash + FXSYS_toASCIIlower(ch);
+ dwHash = 31 * dwHash + tolower(ch);
}
return dwHash;
}