COMMON: Allow \0 to be appended to Strings

This has been discussed on the mailing list. While there wasn't much
input, the consensus was that it should be allowed for consistency with
std::string.

While most engines don't do this, it is possible that some engines will
break because of it. (A few have already been fixed.) But it will also
repear the currently broken ADL engine. For now, the warning() message
will remain so that it can be investigated on a case-by-case basis.
This commit is contained in:
Torbjörn Andersson 2021-07-13 10:27:59 +02:00
parent dea49f7a0a
commit 976d6564bc

View File

@ -726,9 +726,8 @@ TEMPLATE void BASESTRING::trim() {
TEMPLATE void BASESTRING::assignAppend(value_type c) {
if (c == 0) {
#ifndef SCUMMVM_UTIL
warning("Adding \\0 to String is currently not well defined");
warning("Adding \\0 to String. This is permitted, but can have unwanted consequences. (This warning will be removed later.)");
#endif
return;
}
ensureCapacity(_size + 1, true);