mirror of https://github.com/AxioDL/metaforce.git
hecl/SystemChar: Cast to unsigned char before calling tolower/toupper
Performed for the same reasons outlined within b32f16b519eafacb9de4852855486270f73d5e2e (avoiding undefined behavior).
This commit is contained in:
parent
b63d848846
commit
58e0c7eaa7
|
@ -40,8 +40,14 @@ typedef char SystemChar;
|
|||
static inline size_t StrLen(const SystemChar* str) { return strlen(str); }
|
||||
typedef std::string SystemString;
|
||||
typedef std::string_view SystemStringView;
|
||||
static inline void ToLower(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), tolower); }
|
||||
static inline void ToUpper(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), toupper); }
|
||||
static inline void ToLower(SystemString& str) {
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](SystemChar c) { return std::tolower(static_cast<unsigned char>(c)); });
|
||||
}
|
||||
static inline void ToUpper(SystemString& str) {
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](SystemChar c) { return std::toupper(static_cast<unsigned char>(c)); });
|
||||
}
|
||||
#ifndef _SYS_STR
|
||||
#define _SYS_STR(val) val
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue