[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.80,1.81

James Brown ender at users.sourceforge.net
Tue Jan 28 20:01:02 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv19677/scumm

Modified Files:
	sound.cpp 
Log Message:
Stop the sound que stuff erroring(). This code was nasty, it LET itself write out of bounds -then- error()'ed. Youch.
There is still a problem, as this warning will come up quite frequently - leading me to believe the que is not being processed 
properly?


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- sound.cpp	26 Jan 2003 14:26:02 -0000	1.80
+++ sound.cpp	29 Jan 2003 04:00:45 -0000	1.81
@@ -692,13 +692,17 @@
 		processSoundQues();
 		return;
 	}
+
+	if ((_soundQuePos + num) > 0x100) {
+		warning("Sound que buffer overflow");
+		return;
+	}
+
 	_soundQue[_soundQuePos++] = num;
 	
-	for (i = 0; i < num; i++)
+	for (i = 0; i < num; i++) {
 		_soundQue[_soundQuePos++] = list[i];
-
-	if (_soundQuePos > 0x100)
-		error("Sound que buffer overflow");
+	}
 }
 
 void Sound::talkSound(uint32 a, uint32 b, int mode, int frame) {





More information about the Scummvm-git-logs mailing list