[Scummvm-cvs-logs] SF.net SVN: scummvm:[41337] scummvm/trunk/common/str.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Jun 7 15:14:34 CEST 2009


Revision: 41337
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41337&view=rev
Author:   fingolfin
Date:     2009-06-07 13:14:34 +0000 (Sun, 07 Jun 2009)

Log Message:
-----------
Fixed appending a (substring of a) string to itself

Modified Paths:
--------------
    scummvm/trunk/common/str.cpp

Modified: scummvm/trunk/common/str.cpp
===================================================================
--- scummvm/trunk/common/str.cpp	2009-06-07 13:07:16 UTC (rev 41336)
+++ scummvm/trunk/common/str.cpp	2009-06-07 13:14:34 UTC (rev 41337)
@@ -264,6 +264,9 @@
 }
 
 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 String &str) {
+	if (&str == this)
+		return operator+=(Common::String(str));
+
 	int len = str._size;
 	if (len > 0) {
 		ensureCapacity(_size + len, true);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list