[Scummvm-cvs-logs] SF.net SVN: scummvm:[35637] scummvm/trunk/sound/shorten.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Dec 31 16:09:33 CET 2008


Revision: 35637
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35637&view=rev
Author:   thebluegr
Date:     2008-12-31 15:09:32 +0000 (Wed, 31 Dec 2008)

Log Message:
-----------
Added possible FIXMEs

Modified Paths:
--------------
    scummvm/trunk/sound/shorten.cpp

Modified: scummvm/trunk/sound/shorten.cpp
===================================================================
--- scummvm/trunk/sound/shorten.cpp	2008-12-31 15:07:30 UTC (rev 35636)
+++ scummvm/trunk/sound/shorten.cpp	2008-12-31 15:09:32 UTC (rev 35637)
@@ -327,6 +327,9 @@
 						channelOffset = (channelOffset >> (bitShift - 1)) >> 1;
 				}
 
+				// FIXME: The original code in this bit tries to modify memory outside of the array (negative indices)
+				// in cases kCmdDiff1, kCmdDiff2 and kCmdDiff3
+				// I've removed those invalid writes, since they happen all the time (even when curChannel is 0)
 				switch (cmd) {
 					case kCmdZero:
 						for (i = 0; i < blockSize; i++)
@@ -373,6 +376,9 @@
 						for (i = 0; i < blockSize; i++) {
 							int32 sum = lpcqOffset;
 							for (j = 0; j < lpcNum; j++) {
+								// FIXME: The original code did an invalid memory access here
+								// (if i and j are 0, the array index requested is -1)
+								// I've removed those invalid writes, since they happen all the time (even when curChannel is 0)
 								if (i - j - 1 < 0)	// ignore invalid table/memory access
 									continue;
 								sum += lpc[j] * buffer[curChannel][i - j - 1];
@@ -429,6 +435,7 @@
 						for (i = 0; i < blockSize; i++) {
 							for (j = 0; j < channels; j++) {
 								int16 val = (int16)(MIN<int32>(buffer[j][i], limit) & 0xFFFF);
+								// values are written in LE
 								*pBuf++ = (byte) (val & 0xFF);
 								*pBuf++ = (byte) ((val >> 8) & 0xFF);
 							}


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