aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2006-04-16 09:12:27 +0000
committerMax Horn2006-04-16 09:12:27 +0000
commit1f07432927838fcc09e39e8f89aad11ea2d90a76 (patch)
treedd18bdcc0b9c301cc88d473552e4c7ec847d2889
parent58bfa30c7baedde26e0b1901c4dce3f0229b866b (diff)
downloadscummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.tar.gz
scummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.tar.bz2
scummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.zip
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
-rw-r--r--common/str.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 05be3b9e6b..47dd6eef8c 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -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]);
}