[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.61,1.62

Oliver Kiehl olki at users.sourceforge.net
Mon Jan 19 09:45:00 CET 2004


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv28738

Modified Files:
	sound.cpp 
Log Message:
fix mp3 and vorbis specific bug in which sound files could have been read
as zero-byte files in the case that two following offsets pointed to the
same file.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- sound.cpp	11 Jan 2004 15:42:11 -0000	1.61
+++ sound.cpp	19 Jan 2004 17:44:04 -0000	1.62
@@ -203,7 +203,11 @@
 
 	_file->seek(_offsets[sound], SEEK_SET);
 
-	uint32 size = _offsets[sound+1] - _offsets[sound];
+	int i = 1;
+	while (_offsets[sound + i] == _offsets[sound])
+			i++;
+
+	uint32 size = _offsets[sound + i] - _offsets[sound];
 
 	_mixer->playMP3(handle, _file, size);
 }
@@ -223,7 +227,11 @@
 
 	_file->seek(_offsets[sound], SEEK_SET);
 
-	uint32 size = _offsets[sound+1] - _offsets[sound];
+	int i = 1;
+	while (_offsets[sound + i] == _offsets[sound])
+			i++;
+
+	uint32 size = _offsets[sound + i] - _offsets[sound];
 
 	_mixer->playVorbis(handle, _file, size);
 }





More information about the Scummvm-git-logs mailing list