[Scummvm-cvs-logs] SF.net SVN: scummvm:[47720] scummvm/trunk/sound/decoders/raw.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Jan 30 16:37:22 CET 2010


Revision: 47720
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47720&view=rev
Author:   lordhoto
Date:     2010-01-30 15:37:20 +0000 (Sat, 30 Jan 2010)

Log Message:
-----------
Add some asserts to the RawAudioStream code.

Modified Paths:
--------------
    scummvm/trunk/sound/decoders/raw.cpp

Modified: scummvm/trunk/sound/decoders/raw.cpp
===================================================================
--- scummvm/trunk/sound/decoders/raw.cpp	2010-01-30 15:30:53 UTC (rev 47719)
+++ scummvm/trunk/sound/decoders/raw.cpp	2010-01-30 15:37:20 UTC (rev 47720)
@@ -94,8 +94,11 @@
 
 		// Add up length of all blocks in order to caluclate total play time
 		int32 len = 0;
-		for (RawStreamBlockList::const_iterator i = _blocks.begin(); i != _blocks.end(); ++i)
+		for (RawStreamBlockList::const_iterator i = _blocks.begin(); i != _blocks.end(); ++i) {
+			assert(i->len % (stereo ? 2 : 1) == 0);
 			len += i->len;
+		}
+
 		_playtime = Timestamp(0, len / (is16Bit ? 2 : 1) / (stereo ? 2 : 1), rate);
 	}
 
@@ -269,8 +272,11 @@
 	RawAudioStreamBlock block;
 	block.pos = 0;
 
+	const bool isStereo   = (flags & Audio::FLAG_STEREO) != 0;
 	const bool is16Bit    = (flags & Audio::FLAG_16BITS) != 0;
 
+	assert(stream->size() % ((is16Bit ? 2 : 1) * (isStereo ? 2 : 1)) == 0);
+
 	block.len = stream->size() / (is16Bit ? 2 : 1);
 	blocks.push_back(block);
 


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