[Scummvm-cvs-logs] SF.net SVN: scummvm: [27208] scummvm/branches/branch-0-10-0/engines/cine

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Fri Jun 8 21:30:23 CEST 2007


Revision: 27208
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27208&view=rev
Author:   eriktorbjorn
Date:     2007-06-08 12:30:22 -0700 (Fri, 08 Jun 2007)

Log Message:
-----------
Fixed some Valgrind warnings (overlapping source and destination in strcpy()).

Modified Paths:
--------------
    scummvm/branches/branch-0-10-0/engines/cine/bg.cpp
    scummvm/branches/branch-0-10-0/engines/cine/part.cpp
    scummvm/branches/branch-0-10-0/engines/cine/various.cpp

Modified: scummvm/branches/branch-0-10-0/engines/cine/bg.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/cine/bg.cpp	2007-06-08 19:29:48 UTC (rev 27207)
+++ scummvm/branches/branch-0-10-0/engines/cine/bg.cpp	2007-06-08 19:30:22 UTC (rev 27208)
@@ -42,7 +42,8 @@
 	uint16 header[32];
 	byte *ptr, *dataPtr;
 
-	strcpy(currentCtName, ctName);
+	if (currentCtName != ctName)
+		strcpy(currentCtName, ctName);
 
 	ptr = dataPtr = readBundleFile(findFileInBundle(ctName));
 
@@ -86,7 +87,8 @@
 byte loadBg(const char *bgName) {
 	byte *ptr, *dataPtr;
 
-	strcpy(currentBgName[0], bgName);
+	if (currentBgName[0] != bgName)
+		strcpy(currentBgName[0], bgName);
 
 	byte fileIdx = findFileInBundle(bgName);
 	ptr = dataPtr = readBundleFile(fileIdx);

Modified: scummvm/branches/branch-0-10-0/engines/cine/part.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/cine/part.cpp	2007-06-08 19:29:48 UTC (rev 27207)
+++ scummvm/branches/branch-0-10-0/engines/cine/part.cpp	2007-06-08 19:30:22 UTC (rev 27208)
@@ -52,7 +52,8 @@
 	numElementInPart = g_cine->_partFileHandle.readUint16BE();
 	g_cine->_partFileHandle.readUint16BE(); // entry size
 
-	strcpy(currentPartName, partName);
+	if (currentPartName != partName)
+		strcpy(currentPartName, partName);
 
 	for (i = 0; i < numElementInPart; i++) {
 		g_cine->_partFileHandle.read(partBuffer[i].partName, 14);

Modified: scummvm/branches/branch-0-10-0/engines/cine/various.cpp
===================================================================
--- scummvm/branches/branch-0-10-0/engines/cine/various.cpp	2007-06-08 19:29:48 UTC (rev 27207)
+++ scummvm/branches/branch-0-10-0/engines/cine/various.cpp	2007-06-08 19:30:22 UTC (rev 27208)
@@ -2714,7 +2714,7 @@
 		currentHead = tempHead->next;
 	}
 
-	newElement = (overlayHeadElement *) malloc(sizeof(overlayHeadElement));
+	newElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement));
 
 	newElement->next = tempHead->next;
 	tempHead->next = newElement;


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