summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index b543ab868..39fc8479c 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -255,6 +255,18 @@ void str_validate(char *str, const char *last, StringValidationSettings settings
}
/**
+ * Scans the string for valid characters and if it finds invalid ones,
+ * replaces them with a question mark '?'.
+ * @param str the string to validate
+ */
+void ValidateString(const char *str)
+{
+ /* We know it is '\0' terminated. */
+ str_validate(const_cast<char *>(str), str + strlen(str) + 1);
+}
+
+
+/**
* Checks whether the given string is valid, i.e. contains only
* valid (printable) characters and is properly terminated.
* @param str The string to validate.