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

Function SanitizeSingleStringHelper

src/network/network_command.cpp:452–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450/** Validate a single string argument coming from network. */
451template <class T>
452static inline void SanitizeSingleStringHelper([[maybe_unused]] CommandFlags cmd_flags, T &data)
453{
454 if constexpr (std::is_same_v<std::string, T>) {
455 if (!_network_server && cmd_flags.Test(CommandFlag::StrCtrl)) {
456 StrMakeValidInPlace(data, {StringValidationSetting::AllowControlCode, StringValidationSetting::ReplaceWithQuestionMark});
457 } else {
458 StrMakeValidInPlace(data, {StringValidationSetting::ReplaceWithQuestionMark});
459 }
460 }
461}
462
463/** Helper function to perform validation on command data strings. */
464template <class Ttuple, size_t... Tindices>

Callers 1

SanitizeStringsHelperFunction · 0.70

Calls 2

StrMakeValidInPlaceFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected