1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 00:42:45 +01:00

Codechange: Add a std::string overload for StrMakeValidInPlace() and a moving std::string&& overload for StrMakeValid(). (#13962)

This commit is contained in:
frosch
2025-04-07 18:22:47 +02:00
committed by GitHub
parent 981b2a94db
commit 2cdf2bedfa
8 changed files with 38 additions and 9 deletions

View File

@@ -597,8 +597,8 @@ void StringSettingDesc::MakeValueValid(std::string &str) const
/* In case a maximum length is imposed by the setting, the length
* includes the '\0' termination for network transfer purposes.
* Also ensure the string is valid after chopping of some bytes. */
std::string stdstr(str, 0, this->max_length - 1);
str.assign(StrMakeValid(stdstr, SVS_NONE));
str.erase(this->max_length - 1, std::string::npos);
StrMakeValidInPlace(str, SVS_NONE);
}
/**