@@ -259,7 +259,7 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
259259 // Reading IT Extra Info
260260 if (dwMemPos + 2 < dwMemLength)
261261 {
262- UINT nflt = bswapLE16 (*((WORD *)( lpStream + dwMemPos)) );
262+ UINT nflt = READ_LE16 ( lpStream + dwMemPos);
263263 dwMemPos += 2 ;
264264 if (dwMemPos + nflt * 8 < dwMemLength) dwMemPos += nflt * 8 ;
265265 }
@@ -273,9 +273,9 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
273273 }
274274 }
275275 // Read pattern names: "PNAM"
276- if ((dwMemPos + 8 < dwMemLength) && (bswapLE32 (*((DWORD *)( lpStream+dwMemPos)) ) == 0x4d414e50 ))
276+ if ((dwMemPos + 8 < dwMemLength) && (READ_LE32 ( lpStream+dwMemPos) == 0x4d414e50 ))
277277 {
278- UINT len = bswapLE32 (*((DWORD *)( lpStream+dwMemPos+4 )) );
278+ UINT len = READ_LE32 ( lpStream+dwMemPos+4 );
279279 dwMemPos += 8 ;
280280 if ((dwMemPos + len <= dwMemLength) && (len <= MAX_PATTERNS*MAX_PATTERNNAME) && (len >= MAX_PATTERNNAME))
281281 {
@@ -291,9 +291,9 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
291291 // 4-channels minimum
292292 m_nChannels = 4 ;
293293 // Read channel names: "CNAM"
294- if ((dwMemPos + 8 < dwMemLength) && (bswapLE32 (*((DWORD *)( lpStream+dwMemPos)) ) == 0x4d414e43 ))
294+ if ((dwMemPos + 8 < dwMemLength) && (READ_LE32 ( lpStream+dwMemPos) == 0x4d414e43 ))
295295 {
296- UINT len = bswapLE32 (*((DWORD *)( lpStream+dwMemPos+4 )) );
296+ UINT len = READ_LE32 ( lpStream+dwMemPos+4 );
297297 dwMemPos += 8 ;
298298 if ((dwMemPos + len <= dwMemLength) && (len <= 64 *MAX_CHANNELNAME))
299299 {
@@ -319,8 +319,8 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
319319 {
320320 memset (chnmask, 0 , sizeof (chnmask));
321321 if ((!patpos[patchk]) || ((DWORD)patpos[patchk] >= dwMemLength - 4 )) continue ;
322- UINT len = bswapLE16 (*((WORD *)( lpStream+patpos[patchk])) );
323- UINT rows = bswapLE16 (*((WORD *)( lpStream+patpos[patchk]+2 )) );
322+ UINT len = READ_LE16 ( lpStream+patpos[patchk]);
323+ UINT rows = READ_LE16 ( lpStream+patpos[patchk]+2 );
324324 if ((rows < 4 ) || (rows > 256 )) continue ;
325325 if (8 +len > dwMemLength || patpos[patchk] > dwMemLength - (8 +len)) continue ;
326326 UINT i = 0 ;
@@ -451,8 +451,8 @@ BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
451451 continue ;
452452 }
453453
454- UINT len = bswapLE16 (*((WORD *)( lpStream+patpos[npat])) );
455- UINT rows = bswapLE16 (*((WORD *)( lpStream+patpos[npat]+2 )) );
454+ UINT len = READ_LE16 ( lpStream+patpos[npat]);
455+ UINT rows = READ_LE16 ( lpStream+patpos[npat]+2 );
456456 if ((rows < 4 ) || (rows > 256 )) continue ;
457457 if (8 +len > dwMemLength || patpos[npat] > dwMemLength - (8 +len)) continue ;
458458 PatternSize[npat] = rows;
@@ -1233,7 +1233,7 @@ DWORD ITUnpack8Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dw
12331233 if (!wCount)
12341234 {
12351235 wCount = 0x8000 ;
1236- // wHdr = bswapLE16(*((LPWORD) pSrc) );
1236+ // wHdr = READ_LE16( pSrc);
12371237 pSrc += 2 ;
12381238 bLeft = 9 ;
12391239 bTemp = bTemp2 = 0 ;
@@ -1320,7 +1320,7 @@ DWORD ITUnpack16Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD d
13201320 if (!wCount)
13211321 {
13221322 wCount = 0x4000 ;
1323- // wHdr = bswapLE16(*((LPWORD) pSrc) );
1323+ // wHdr = READ_LE16( pSrc);
13241324 pSrc += 2 ;
13251325 bLeft = 17 ;
13261326 wTemp = wTemp2 = 0 ;
@@ -1482,13 +1482,13 @@ UINT CSoundFile::LoadMixPlugins(const void *pData, UINT nLen)
14821482 DWORD nPluginSize;
14831483 UINT nPlugin;
14841484
1485- nPluginSize = bswapLE32 (*(DWORD *)( p+nPos+4 ) );
1485+ nPluginSize = READ_LE32 ( p+nPos+4 );
14861486 if (nPluginSize > nLen-nPos-8 ) break ;;
1487- if (( bswapLE32 (*(DWORD *)( p+nPos)) ) == 0x58464843 )
1487+ if (READ_LE32 ( p+nPos) == 0x58464843 )
14881488 {
14891489 for (UINT ch=0 ; ch<64 ; ch++) if (ch*4 < nPluginSize)
14901490 {
1491- ChnSettings[ch].nMixPlugin = bswapLE32 (*(DWORD *)( p+nPos+8 +ch*4 ) );
1491+ ChnSettings[ch].nMixPlugin = READ_LE32 ( p+nPos+8 +ch*4 );
14921492 }
14931493 } else
14941494 {
@@ -1500,7 +1500,7 @@ UINT CSoundFile::LoadMixPlugins(const void *pData, UINT nLen)
15001500 nPlugin = (p[nPos+2 ]-' 0' )*10 + (p[nPos+3 ]-' 0' );
15011501 if ((nPlugin < MAX_MIXPLUGINS) && (nPluginSize >= sizeof (SNDMIXPLUGININFO)+4 ))
15021502 {
1503- DWORD dwExtra = bswapLE32 (*(DWORD *)( p+nPos+8 +sizeof (SNDMIXPLUGININFO) ));
1503+ DWORD dwExtra = READ_LE32 ( p+nPos+8 +sizeof (SNDMIXPLUGININFO));
15041504 m_MixPlugins[nPlugin].Info = *(const SNDMIXPLUGININFO *)(p+nPos+8 );
15051505 m_MixPlugins[nPlugin].Info .dwPluginId1 = bswapLE32 (m_MixPlugins[nPlugin].Info .dwPluginId1 );
15061506 m_MixPlugins[nPlugin].Info .dwPluginId2 = bswapLE32 (m_MixPlugins[nPlugin].Info .dwPluginId2 );
0 commit comments