Fixed evil longstanding bug in String::toLowercase & toUppercase: Before modifying the string content, make sure we do not share it with any other string). This should help (hopefully fix) bug #1470892

svn-id: r21931
This commit is contained in:
Max Horn 2006-04-16 09:12:27 +00:00
parent 58bfa30c7b
commit 1f07432927

View file

@ -216,6 +216,7 @@ void String::toLowercase() {
if (_str == 0 || _len == 0)
return;
ensureCapacity(_len, true);
for (int i = 0; i < _len; ++i)
_str[i] = tolower(_str[i]);
}
@ -224,6 +225,7 @@ void String::toUppercase() {
if (_str == 0 || _len == 0)
return;
ensureCapacity(_len, true);
for (int i = 0; i < _len; ++i)
_str[i] = toupper(_str[i]);
}