[Scummvm-cvs-logs] SF.net SVN: scummvm:[44557] scummvm/trunk/engines/sword1/music.cpp

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Sat Oct 3 21:29:15 CEST 2009


Revision: 44557
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44557&view=rev
Author:   dhewg
Date:     2009-10-03 19:29:14 +0000 (Sat, 03 Oct 2009)

Log Message:
-----------
If make*Stream failed, the file needs to be closed to prevent an assert on a consecutive open().

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/music.cpp

Modified: scummvm/trunk/engines/sword1/music.cpp
===================================================================
--- scummvm/trunk/engines/sword1/music.cpp	2009-10-03 19:27:10 UTC (rev 44556)
+++ scummvm/trunk/engines/sword1/music.cpp	2009-10-03 19:29:14 UTC (rev 44557)
@@ -213,27 +213,40 @@
 #ifdef USE_FLAC
 	if (!_audioSource) {
 		sprintf(fileName, "%s.flac", fileBase);
-		if (_file.open(fileName))
+		if (_file.open(fileName)) {
 			_audioSource = Audio::makeFlacStream(&_file, false, 0, 0, loop ? 0 : 1);
+			if (!_audioSource)
+				_file.close();
+		}
 	}
+
 	if (!_audioSource) {
 		sprintf(fileName, "%s.fla", fileBase);
-		if (_file.open(fileName))
+		if (_file.open(fileName)) {
 			_audioSource = Audio::makeFlacStream(&_file, false, 0, 0, loop ? 0 : 1);
+			if (!_audioSource)
+				_file.close();
+		}
 	}
 #endif
 #ifdef USE_VORBIS
 	if (!_audioSource) {
 		sprintf(fileName, "%s.ogg", fileBase);
-		if (_file.open(fileName))
+		if (_file.open(fileName)) {
 			_audioSource = Audio::makeVorbisStream(&_file, false, 0, 0, loop ? 0 : 1);
+			if (!_audioSource)
+				_file.close();
+		}
 	}
 #endif
 #ifdef USE_MAD
 	if (!_audioSource) {
 		sprintf(fileName, "%s.mp3", fileBase);
-		if (_file.open(fileName))
+		if (_file.open(fileName)) {
 			_audioSource = Audio::makeMP3Stream(&_file, false, 0, 0, loop ? 0 : 1);
+			if (!_audioSource)
+				_file.close();
+		}
 	}
 #endif
 	if (!_audioSource) {


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