[Scummvm-cvs-logs] SF.net SVN: scummvm:[40508] scummvm/trunk/engines/cruise

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Tue May 12 22:03:10 CEST 2009


Revision: 40508
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40508&view=rev
Author:   eriktorbjorn
Date:     2009-05-12 20:03:10 +0000 (Tue, 12 May 2009)

Log Message:
-----------
When source and destination are the same, there is no need to strcpy(). In fact
it may even be harmful when source and destination overlap. (This happens when
loading savegames.)

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/background.cpp
    scummvm/trunk/engines/cruise/ctp.cpp
    scummvm/trunk/engines/cruise/dataLoader.cpp

Modified: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp	2009-05-12 19:58:05 UTC (rev 40507)
+++ scummvm/trunk/engines/cruise/background.cpp	2009-05-12 20:03:10 UTC (rev 40508)
@@ -206,7 +206,8 @@
 	}
 
 
-	strcpy(backgroundTable[idx].name, name);
+	if (name != backgroundTable[idx].name)
+		strcpy(backgroundTable[idx].name, name);
 
 	return (0);
 }

Modified: scummvm/trunk/engines/cruise/ctp.cpp
===================================================================
--- scummvm/trunk/engines/cruise/ctp.cpp	2009-05-12 19:58:05 UTC (rev 40507)
+++ scummvm/trunk/engines/cruise/ctp.cpp	2009-05-12 20:03:10 UTC (rev 40508)
@@ -325,7 +325,8 @@
 	}
 	free(ptr);
 
-	strcpy(currentCtpName, ctpName);
+	if (ctpName != currentCtpName)
+		strcpy(currentCtpName, ctpName);
 
 	numberOfWalkboxes = segementSizeTable[6] / 2;	// get the number of walkboxes
 

Modified: scummvm/trunk/engines/cruise/dataLoader.cpp
===================================================================
--- scummvm/trunk/engines/cruise/dataLoader.cpp	2009-05-12 19:58:05 UTC (rev 40507)
+++ scummvm/trunk/engines/cruise/dataLoader.cpp	2009-05-12 20:03:10 UTC (rev 40508)
@@ -499,7 +499,8 @@
 		}
 		}
 
-		strcpy(filesDatabase[fileIndex].subData.name, name);
+		if (name != filesDatabase[fileIndex].subData.name)
+			strcpy(filesDatabase[fileIndex].subData.name, name);
 
 		// create the mask
 		switch (localBuffer.type) {


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