[Scummvm-cvs-logs] SF.net SVN: scummvm: [29752] scummvm/trunk/engines/scumm/sound.cpp

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sat Dec 8 00:39:19 CET 2007


Revision: 29752
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29752&view=rev
Author:   cyx
Date:     2007-12-07 15:39:19 -0800 (Fri, 07 Dec 2007)

Log Message:
-----------
don't use str functions with binary data, should fix bug #1845760

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/sound.cpp

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2007-12-07 20:53:06 UTC (rev 29751)
+++ scummvm/trunk/engines/scumm/sound.cpp	2007-12-07 23:39:19 UTC (rev 29752)
@@ -1223,13 +1223,15 @@
 		tmpsize = _fileHandle->readUint32BE();
 
 		// SDAT contains name of file we want
-		_fileHandle->read(buffer, tmpsize - 8);
-		// files seem to be 11 chars (8.3) unused space is replaced by spaces
-		*(strstr(buffer, " ")) = '\0';
+		_fileHandle->read(buffer, MIN(128, tmpsize - 8));
+		// files seem to be 11 chars (8.3)
+		char *p = (char *)memchr(buffer, '.', 12);
+		if (!p) p = &buffer[8];
+		strcpy(p, ".dmu");
+		debugC(DEBUG_SOUND, "FMUS file %s", buffer);
 
-		debugC(DEBUG_SOUND, "FMUS file %s", buffer);
-		if (dmuFile.open(buffer) == false) {
-			error("Can't open music file %s*", buffer);
+		if (!dmuFile.open(buffer)) {
+			error("Can't open music file %s", buffer);
 			_res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET;
 			return 0;
 		}


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