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:
parent
58bfa30c7b
commit
1f07432927
1 changed files with 2 additions and 0 deletions
|
@ -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]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue