diff src/modplug/load_amf.cxx @ 2337:107c1fed3d92

Port Schism modplug core.
author "Tony Vroon <chainsaw@gentoo.org>"
date Thu, 24 Jan 2008 12:05:59 +0000
parents 6907fc39b53f
children
line wrap: on
line diff
--- a/src/modplug/load_amf.cxx	Wed Jan 23 19:37:05 2008 +0100
+++ b/src/modplug/load_amf.cxx	Thu Jan 24 12:05:59 2008 +0000
@@ -5,7 +5,7 @@
  * option) any later version.
  *
  * Authors: Olivier Lapicque <olivierl@jps.net>
-*/
+ */
 
 ///////////////////////////////////////////////////
 //
@@ -223,6 +223,7 @@
 			if (!p) break;
 			Patterns[iPat] = p;
 			PatternSize[iPat] = 64;
+			PatternAllocSize[iPat] = 64;
 			const UCHAR *pin = lpStream + dwMemPos;
 			for (UINT i=0; i<8*64; i++)
 			{
@@ -314,9 +315,11 @@
 		{
 			Order[iOrd] = iOrd;
 			PatternSize[iOrd] = 64;
+			PatternAllocSize[iOrd] = 64;
 			if (pfh->version >= 14)
 			{
 				PatternSize[iOrd] = bswapLE16(*(USHORT *)(lpStream+dwMemPos));
+				PatternAllocSize[iOrd] = bswapLE16(*(USHORT *)(lpStream+dwMemPos));
 				dwMemPos += 2;
 			}
 			ptracks[iOrd] = (USHORT *)(lpStream+dwMemPos);
@@ -353,8 +356,7 @@
 		if ((psh->type) && (bswapLE32(psh->offset) < dwMemLength-1))
 		{
 			sampleseekpos[iIns] = bswapLE32(psh->offset);
-			if (bswapLE32(psh->offset) > maxsampleseekpos) 
-				maxsampleseekpos = bswapLE32(psh->offset);
+			if (bswapLE32(psh->offset) > maxsampleseekpos) maxsampleseekpos = bswapLE32(psh->offset);
 			if ((pins->nLoopEnd > pins->nLoopStart + 2)
 			 && (pins->nLoopEnd <= pins->nLength)) pins->uFlags |= CHN_LOOP;
 		}
@@ -373,7 +375,7 @@
 	for (UINT iTrack=0; iTrack<realtrackcnt; iTrack++) if (dwMemPos + 3 <= dwMemLength)
 	{
 		UINT nTrkSize = bswapLE16(*(USHORT *)(lpStream+dwMemPos));
-		nTrkSize += (UINT)lpStream[dwMemPos+2] << 16;
+		nTrkSize += (UINT)lpStream[dwMemPos+2] << 16;
 
 		if (dwMemPos + nTrkSize * 3 + 3 <= dwMemLength)
 		{
@@ -418,3 +420,5 @@
 	}
 	return TRUE;
 }
+
+