diff options
author | Max Horn | 2009-06-07 13:14:34 +0000 |
---|---|---|
committer | Max Horn | 2009-06-07 13:14:34 +0000 |
commit | a5ff6cc19d47fbe6acd8c6ad459b609a37ca39ec (patch) | |
tree | fdcd5df1740285c957c87411b981c7f8ea2afbec /common/str.cpp | |
parent | 6d59856fe1c2302a5e163f3b4799c94a721e102d (diff) | |
download | scummvm-rg350-a5ff6cc19d47fbe6acd8c6ad459b609a37ca39ec.tar.gz scummvm-rg350-a5ff6cc19d47fbe6acd8c6ad459b609a37ca39ec.tar.bz2 scummvm-rg350-a5ff6cc19d47fbe6acd8c6ad459b609a37ca39ec.zip |
Fixed appending a (substring of a) string to itself
svn-id: r41337
Diffstat (limited to 'common/str.cpp')
-rw-r--r-- | common/str.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index 75394fcf89..0d24f2edac 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -264,6 +264,9 @@ String& String::operator =(char c) { } String &String::operator +=(const char *str) { + if (_str <= str && str <= _str + _size) + return operator+=(Common::String(str)); + int len = strlen(str); if (len > 0) { ensureCapacity(_size + len, true); @@ -275,6 +278,9 @@ String &String::operator +=(const char *str) { } String &String::operator +=(const String &str) { + if (&str == this) + return operator+=(Common::String(str)); + int len = str._size; if (len > 0) { ensureCapacity(_size + len, true); |