From 234b65d201c2fb9fc1a83dda819b3292875fe02b Mon Sep 17 00:00:00 2001 From: Konstanty Date: Mon, 31 Jan 2022 09:31:53 +1000 Subject: [PATCH] Revert "Revert making for loop variable permanent." This reverts commit 500711c281ce35d90504684f87ce5c1384cb95bb. --- src/load_it.cpp | 7 ++++--- src/sndfile.cpp | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/load_it.cpp b/src/load_it.cpp index 38a7c983..45fa8e45 100644 --- a/src/load_it.cpp +++ b/src/load_it.cpp @@ -159,6 +159,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength) DWORD patpos[MAX_PATTERNS]; BYTE chnmask[64];//, channels_used[64] MODCOMMAND lastvalue[64]; + UINT j; if ((!lpStream) || (dwMemLength < sizeof(ITFILEHEADER))) return FALSE; ITFILEHEADER pifh = *(ITFILEHEADER *)lpStream; @@ -231,7 +232,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength) if (inspossize > MAX_INSTRUMENTS) inspossize = MAX_INSTRUMENTS; inspossize <<= 2; memcpy(inspos, lpStream+dwMemPos, inspossize); - for (UINT j=0; j < (inspossize>>2); j++) { + for (j=0; j < (inspossize>>2); j++) { inspos[j] = bswapLE32(inspos[j]); } dwMemPos += pifh.insnum * 4; @@ -241,7 +242,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength) if (smppossize > MAX_SAMPLES) smppossize = MAX_SAMPLES; smppossize <<= 2; memcpy(smppos, lpStream+dwMemPos, smppossize); - for (UINT j=0; j < (smppossize>>2); j++) { + for (j=0; j < (smppossize>>2); j++) { smppos[j] = bswapLE32(smppos[j]); } dwMemPos += pifh.smpnum * 4; @@ -251,7 +252,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength) if (patpossize > MAX_PATTERNS) patpossize = MAX_PATTERNS; patpossize <<= 2; memcpy(patpos, lpStream+dwMemPos, patpossize); - for (UINT j=0; j < (patpossize>>2); j++) { + for (j=0; j < (patpossize>>2); j++) { patpos[j] = bswapLE32(patpos[j]); } dwMemPos += pifh.patnum * 4; diff --git a/src/sndfile.cpp b/src/sndfile.cpp index 95383d55..24550de5 100644 --- a/src/sndfile.cpp +++ b/src/sndfile.cpp @@ -1392,17 +1392,18 @@ UINT CSoundFile::ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR lpMemFile, // PTM 8bit delta to 16-bit sample case RS_PTM8DTO16: { + UINT j; len = pIns->nLength * 2; if (len > dwMemLength) break; int8_t *pSample = (int8_t *)pIns->pSample; int8_t delta8 = 0; - for (UINT j=0; jpSample; - for (UINT j=0; j