mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 00:34:27 +00:00
Cleanup: char-pointer variant of strtolower
This commit is contained in:
parent
b49bd86a46
commit
4ca23a19b6
@ -471,28 +471,6 @@ size_t Utf8StringLength(const std::string &str)
|
||||
return Utf8StringLength(str.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a given ASCII string to lowercase.
|
||||
* NOTE: only support ASCII characters, no UTF8 fancy. As currently
|
||||
* the function is only used to lowercase data-filenames if they are
|
||||
* not found, this is sufficient. If more, or general functionality is
|
||||
* needed, look to r7271 where it was removed because it was broken when
|
||||
* using certain locales: eg in Turkish the uppercase 'I' was converted to
|
||||
* '?', so just revert to the old functionality
|
||||
* @param str string to convert
|
||||
* @return String has changed.
|
||||
*/
|
||||
bool strtolower(char *str)
|
||||
{
|
||||
bool changed = false;
|
||||
for (; *str != '\0'; str++) {
|
||||
char new_str = tolower(*str);
|
||||
changed |= new_str != *str;
|
||||
*str = new_str;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool strtolower(std::string &str, std::string::size_type offs)
|
||||
{
|
||||
bool changed = false;
|
||||
|
@ -43,7 +43,6 @@ void StrMakeValidInPlace(char *str, StringValidationSettings settings = SVS_REPL
|
||||
|
||||
void str_fix_scc_encoded(char *str, const char *last) NOACCESS(2);
|
||||
void str_strip_colours(char *str);
|
||||
bool strtolower(char *str);
|
||||
bool strtolower(std::string &str, std::string::size_type offs = 0);
|
||||
|
||||
[[nodiscard]] bool StrValid(const char *str, const char *last) NOACCESS(2);
|
||||
|
Loading…
Reference in New Issue
Block a user