MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / StrMakeValidInPlace

Function StrMakeValidInPlace

src/string.cpp:157–163  ·  view source on GitHub ↗

* Scans the string for invalid characters and replaces them with a * question mark '?' (if not ignored). * @param str The string to validate. * @param settings The settings for the string validation. * @note The string must be properly NUL terminated. */

Source from the content-addressed store, hash-verified

155 * @note The string must be properly NUL terminated.
156 */
157void StrMakeValidInPlace(char *str, StringValidationSettings settings)
158{
159 InPlaceReplacement inplace(std::span(str, strlen(str)));
160 StrMakeValid(inplace.builder, inplace.consumer, settings);
161 /* Add NUL terminator, if we ended up with less bytes than before */
162 if (inplace.builder.AnyBytesUnused()) inplace.builder.PutChar('\0');
163}
164
165/**
166 * Scans the string for invalid characters and replaces them with a

Callers 9

MakeValueValidMethod · 0.85
StrMakeValidFunction · 0.85
operator()Method · 0.85
mainFunction · 0.85
mainFunction · 0.85
GlobalVarChangeInfoFunction · 0.85
SlStdStringFunction · 0.85

Calls 9

spanClass · 0.85
AnyBytesUnusedMethod · 0.80
PutCharMethod · 0.80
StrMakeValidFunction · 0.70
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
GetBytesWrittenMethod · 0.45

Tested by

no test coverage detected