From: <man...@us...> - 2014-03-09 15:45:57
|
Revision: 3853 http://sourceforge.net/p/modplug/code/3853 Author: manxorist Date: 2014-03-09 15:45:50 +0000 (Sun, 09 Mar 2014) Log Message: ----------- [Ref] Kill LPBYTE in soundlib/ . Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Dlsbank.h trunk/OpenMPT/soundlib/Load_dmf.cpp trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/common/typedefs.h 2014-03-09 15:45:50 UTC (rev 3853) @@ -411,7 +411,6 @@ typedef std::uint32_t DWORD; typedef std::int32_t LONG; typedef std::uint32_t UINT; -typedef BYTE * LPBYTE; #endif // !WIN32 Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2014-03-09 15:45:50 UTC (rev 3853) @@ -603,10 +603,10 @@ DWORD dwPos = 12; while (dwPos < plist->len) { - LPIFFCHUNK p = (LPIFFCHUNK)(((LPBYTE)plist) + dwPos); + LPIFFCHUNK p = (LPIFFCHUNK)(((uint8 *)plist) + dwPos); if (!(p->id & 0xFF)) { - p = (LPIFFCHUNK)( ((LPBYTE)p)+1 ); + p = (LPIFFCHUNK)( ((uint8 *)p)+1 ); dwPos++; } if (dwPos + p->len + 8 <= plist->len + 12) @@ -674,7 +674,7 @@ //Log("fulOptions=0x%04X loops=%d\n", p->fulOptions, p->cSampleLoops); if ((p->cSampleLoops) && (p->cbSize + sizeof(WSMPSAMPLELOOP) <= p->len)) { - WSMPSAMPLELOOP *ploop = (WSMPSAMPLELOOP *)(((LPBYTE)p)+8+p->cbSize); + WSMPSAMPLELOOP *ploop = (WSMPSAMPLELOOP *)(((uint8 *)p)+8+p->cbSize); //Log("looptype=%2d loopstart=%5d loopend=%5d\n", ploop->ulLoopType, ploop->ulLoopStart, ploop->ulLoopLength); if (ploop->ulLoopLength > 3) { @@ -704,7 +704,7 @@ pDlsEnv->nDefPan = 128; pDlsEnv->nVolSustainLevel = 128; //Log(" art1 (%3d bytes): cbSize=%d cConnectionBlocks=%d\n", p->len, p->cbSize, p->cConnectionBlocks); - CONNECTIONBLOCK *pblk = (CONNECTIONBLOCK *)( ((LPBYTE)p)+8+p->cbSize ); + CONNECTIONBLOCK *pblk = (CONNECTIONBLOCK *)( ((uint8 *)p)+8+p->cbSize ); for (UINT iblk=0; iblk<p->cConnectionBlocks; iblk++, pblk++) { // [4-bit transform][12-bit dest][8-bit control][8-bit source] = 32-bit ID @@ -1404,7 +1404,7 @@ } -bool CDLSBank::FreeWaveForm(LPBYTE p) +bool CDLSBank::FreeWaveForm(uint8 *p) //----------------------------------- { if (p) free(p); @@ -1412,7 +1412,7 @@ } -bool CDLSBank::ExtractWaveForm(UINT nIns, UINT nRgn, LPBYTE *ppWave, DWORD *pLen) +bool CDLSBank::ExtractWaveForm(UINT nIns, UINT nRgn, uint8 **ppWave, DWORD *pLen) //------------------------------------------------------------------------------- { DLSINSTRUMENT *pDlsIns; @@ -1458,7 +1458,7 @@ if (fseek(f, 8, SEEK_CUR) == 0) { *pLen = m_pSamplesEx[nWaveLink].dwLen; - *ppWave = (LPBYTE)calloc(1, *pLen + 8); + *ppWave = (uint8 *)calloc(1, *pLen + 8); fread((*ppWave), 1, *pLen, f); bOk = true; } @@ -1471,7 +1471,7 @@ if ((chunk.id == IFFID_LIST) && (chunk.listid == IFFID_wave) && (chunk.len > 4)) { *pLen = chunk.len + 8; - *ppWave = (LPBYTE)calloc(1, chunk.len + 8); + *ppWave = (uint8 *)calloc(1, chunk.len + 8); if (*ppWave) { memcpy((*ppWave), &chunk, 12); @@ -1521,7 +1521,7 @@ //--------------------------------------------------------------------------------------------------------- { DLSINSTRUMENT *pDlsIns; - LPBYTE pWaveForm = NULL; + uint8 *pWaveForm = NULL; DWORD dwLen = 0; bool bOk, bWaveForm; Modified: trunk/OpenMPT/soundlib/Dlsbank.h =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.h 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/Dlsbank.h 2014-03-09 15:45:50 UTC (rev 3853) @@ -145,8 +145,8 @@ DLSINSTRUMENT *GetInstrument(UINT iIns) { return (m_pInstruments) ? &m_pInstruments[iIns] : NULL; } DLSINSTRUMENT *FindInstrument(bool bDrum, UINT nBank=0xFF, DWORD dwProgram=0xFF, DWORD dwKey=0xFF, UINT *pInsNo=NULL); UINT GetRegionFromKey(UINT nIns, UINT nKey); - bool FreeWaveForm(LPBYTE p); - bool ExtractWaveForm(UINT nIns, UINT nRgn, LPBYTE *ppWave, DWORD *pLen); + bool FreeWaveForm(uint8 *p); + bool ExtractWaveForm(UINT nIns, UINT nRgn, uint8 **ppWave, DWORD *pLen); bool ExtractSample(CSoundFile &sndFile, SAMPLEINDEX nSample, UINT nIns, UINT nRgn, int transpose=0); bool ExtractInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr, UINT nIns, UINT nDrumRgn); const char *GetRegionName(UINT nIns, UINT nRgn) const; Modified: trunk/OpenMPT/soundlib/Load_dmf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/Load_dmf.cpp 2014-03-09 15:45:50 UTC (rev 3853) @@ -1183,7 +1183,7 @@ } -uintptr_t DMFUnpack(LPBYTE psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen) +uintptr_t DMFUnpack(uint8 *psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen) //----------------------------------------------------------------------------------------- { DMFHTree tree; Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2014-03-09 15:45:50 UTC (rev 3853) @@ -864,7 +864,7 @@ if (!tracks) tracks = m_nChannels; if(Patterns.Insert(iBlk, lines)) continue; ModCommand *p = Patterns[iBlk]; - LPBYTE s = (LPBYTE)(lpStream + dwPos + 2); + const uint8 * s = (const uint8 *)(lpStream + dwPos + 2); UINT maxlen = tracks*lines*3; if (maxlen + dwPos > dwMemLength - 2) break; for (UINT y=0; y<lines; y++) @@ -929,7 +929,7 @@ } } ModCommand *p = Patterns[iBlk]; - LPBYTE s = (LPBYTE)(lpStream + dwPos + 8); + const uint8 * s = (const uint8 *)(lpStream + dwPos + 8); UINT maxlen = tracks*lines*4; if (maxlen + dwPos > dwMemLength - 8) break; for (UINT y=0; y<lines; y++) Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2014-03-09 15:45:50 UTC (rev 3853) @@ -63,16 +63,13 @@ { file.Rewind(); - const BYTE * const lpMemFile = reinterpret_cast<const BYTE*>(file.GetRawData()); - const DWORD dwFileLength = file.GetLength(); - if(!nSample || nSample >= MAX_SAMPLES) return false; if(!ReadWAVSample(nSample, file, mayNormalize) && !ReadXISample(nSample, file) && !ReadITISample(nSample, file) && !ReadAIFFSample(nSample, file, mayNormalize) && !ReadITSSample(nSample, file) - && !ReadPATSample(nSample, const_cast<BYTE*>(lpMemFile), dwFileLength) + && !ReadPATSample(nSample, reinterpret_cast<const uint8*>(file.GetRawData()), file.GetLength()) && !ReadIFFSample(nSample, file) && !ReadS3ISample(nSample, file) && !ReadFLACSample(nSample, file) @@ -94,7 +91,7 @@ { if ((!nInstr) || (nInstr >= MAX_INSTRUMENTS)) return false; file.Rewind(); - if(!ReadPATInstrument(nInstr, (const LPBYTE)file.GetRawData(), file.GetLength()) + if(!ReadPATInstrument(nInstr, reinterpret_cast<const uint8*>(file.GetRawData()), file.GetLength()) && !ReadXIInstrument(nInstr, file) && !ReadITIInstrument(nInstr, file) // Generic read @@ -619,8 +616,8 @@ } -static void PatchToSample(CSoundFile *that, SAMPLEINDEX nSample, LPBYTE lpStream, DWORD dwMemLength) -//-------------------------------------------------------------------------------------------------- +static void PatchToSample(CSoundFile *that, SAMPLEINDEX nSample, const uint8 *lpStream, DWORD dwMemLength) +//-------------------------------------------------------------------------------------------------------- { ModSample &sample = that->GetSample(nSample); DWORD dwMemPos = sizeof(GF1SAMPLEHEADER); @@ -671,8 +668,8 @@ } -bool CSoundFile::ReadPATSample(SAMPLEINDEX nSample, LPBYTE lpStream, DWORD dwMemLength) -//------------------------------------------------------------------------------------- +bool CSoundFile::ReadPATSample(SAMPLEINDEX nSample, const uint8 *lpStream, DWORD dwMemLength) +//------------------------------------------------------------------------------------------- { DWORD dwMemPos = sizeof(GF1PATCHFILEHEADER)+sizeof(GF1INSTRUMENT)+sizeof(GF1LAYER); GF1PATCHFILEHEADER *phdr = (GF1PATCHFILEHEADER *)lpStream; @@ -695,7 +692,7 @@ // PAT Instrument -bool CSoundFile::ReadPATInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpStream, DWORD dwMemLength) +bool CSoundFile::ReadPATInstrument(INSTRUMENTINDEX nInstr, const uint8 *lpStream, DWORD dwMemLength) //-------------------------------------------------------------------------------------------------- { GF1PATCHFILEHEADER *phdr = (GF1PATCHFILEHEADER *)lpStream; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2014-03-09 14:54:24 UTC (rev 3852) +++ trunk/OpenMPT/soundlib/Sndfile.h 2014-03-09 15:45:50 UTC (rev 3853) @@ -61,7 +61,7 @@ // Sample decompression void AMSUnpack(const int8 * const source, size_t sourceSize, void * const dest, const size_t destSize, char packCharacter); uint16 MDLReadBits(uint32 &bitbuf, uint32 &bitnum, const uint8 *(&ibuf), int8 n); -uintptr_t DMFUnpack(LPBYTE psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen); +uintptr_t DMFUnpack(uint8 *psample, const uint8 *ibuf, const uint8 *ibufmax, uint32 maxlen); bool IMAADPCMUnpack16(int16 *target, SmpLength sampleLen, FileReader file, uint16 blockAlign); // Module decompression @@ -852,7 +852,7 @@ // Samples file I/O bool ReadSampleFromFile(SAMPLEINDEX nSample, FileReader &file, bool mayNormalize=false); bool ReadWAVSample(SAMPLEINDEX nSample, FileReader &file, bool mayNormalize=false, FileReader *wsmpChunk = nullptr); - bool ReadPATSample(SAMPLEINDEX nSample, const LPBYTE lpMemFile, DWORD dwFileLength); + bool ReadPATSample(SAMPLEINDEX nSample, const uint8 *lpMemFile, DWORD dwFileLength); bool ReadS3ISample(SAMPLEINDEX nSample, FileReader &file); bool ReadAIFFSample(SAMPLEINDEX nSample, FileReader &file, bool mayNormalize=false); bool ReadXISample(SAMPLEINDEX nSample, FileReader &file); @@ -871,7 +871,7 @@ bool ReadInstrumentFromFile(INSTRUMENTINDEX nInstr, FileReader &file, bool mayNormalize=false); bool ReadXIInstrument(INSTRUMENTINDEX nInstr, FileReader &file); bool ReadITIInstrument(INSTRUMENTINDEX nInstr, FileReader &file); - bool ReadPATInstrument(INSTRUMENTINDEX nInstr, const LPBYTE lpMemFile, DWORD dwFileLength); + bool ReadPATInstrument(INSTRUMENTINDEX nInstr, const uint8 *lpMemFile, DWORD dwFileLength); bool ReadSampleAsInstrument(INSTRUMENTINDEX nInstr, FileReader &file, bool mayNormalize=false); #ifndef MODPLUG_NO_FILESAVE bool SaveXIInstrument(INSTRUMENTINDEX nInstr, const mpt::PathString &filename) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |