Use StringBuilder for GetString/GetStringWithArgs, as per upstream

Update dependent code as required
This commit is contained in:
Jonathan G Rennison
2024-01-05 21:12:54 +00:00
parent 1b7a5372ec
commit f034714559
61 changed files with 1064 additions and 1228 deletions

View File

@@ -1112,17 +1112,17 @@ void DeterminePaths(const char *exe, bool only_local_path)
/**
* Sanitizes a filename, i.e. removes all illegal characters from it.
* @param filename the "\0" terminated filename
* @param filename the filename
*/
void SanitizeFilename(char *filename)
void SanitizeFilename(std::string &filename)
{
for (; *filename != '\0'; filename++) {
switch (*filename) {
for (auto &c : filename) {
switch (c) {
/* The following characters are not allowed in filenames
* on at least one of the supported operating systems: */
case ':': case '\\': case '*': case '?': case '/':
case '<': case '>': case '|': case '"':
*filename = '_';
c = '_';
break;
}
}