From: <sag...@us...> - 2013-08-11 00:18:35
|
Revision: 2598 http://sourceforge.net/p/modplug/code/2598 Author: saga-games Date: 2013-08-11 00:18:18 +0000 (Sun, 11 Aug 2013) Log Message: ----------- [Ref] More small changes to get rid of warnings in 64-bit compile Modified Paths: -------------- trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/CreditStatic.h trunk/OpenMPT/mptrack/Ctrl_com.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/DefaultVstEditor.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/SampleEditorDialogs.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/VstPresets.cpp trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/ITTools.cpp trunk/OpenMPT/soundlib/ITTools.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/SampleIO.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/WAVTools.cpp trunk/OpenMPT/soundlib/modsmp_ctrl.cpp trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/common/serialization_utils.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -172,7 +172,7 @@ void WriteItemString(std::ostream& oStrm, const char* const pStr, const size_t nSize) //-------------------------------------------------------------------------------- { - uint32 id = std::min<size_t>(nSize, (uint32_max >> 4)) << 4; + uint32 id = (uint32)std::min<size_t>(nSize, (uint32_max >> 4)) << 4; id |= 12; // 12 == 1100b Binarywrite<uint32>(oStrm, id); id >>= 4; @@ -206,7 +206,7 @@ for(size_t i = 0; i < str.size(); i++) iStrm.read(&str[i], 1); - id = (id >> 4) - str.size(); + id = (id >> 4) - (uint32)str.size(); if(id > 0) iStrm.ignore(id); } @@ -585,7 +585,7 @@ const Offtype nRawEntrySize = m_pOstrm->tellp() - posBeforeWrite; if (nRawEntrySize > std::numeric_limits<DataSize>::max()) - { AddWriteNote(SNW_INSUFFICIENT_DATASIZETYPE); return; } + { AddWriteNote(SNW_INSUFFICIENT_DATASIZETYPE); return; } if(GetFlag(RwfRMapHasSize) && nRawEntrySize > (std::numeric_limits<DataSize>::max() >> 2)) { AddWriteNote(SNW_DATASIZETYPE_OVERFLOW); return; } Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -104,7 +104,7 @@ { if(!CheckInstrument(m_nInstrument)) m_nInstrument = GetBestInstrumentCandidate(); - modDoc->ProcessMIDI(midiData, m_nInstrument, &m_VstPlugin, kCtxVSTGUI); + modDoc->ProcessMIDI((uint32)midiData, m_nInstrument, &m_VstPlugin, kCtxVSTGUI); return 1; } return 0; @@ -308,7 +308,7 @@ CInputHandler *ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //Translate message manually - UINT nChar = pMsg->wParam; + UINT nChar = (UINT)pMsg->wParam; UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -171,7 +171,7 @@ int CAutoSaver::GetHistoryDepth() -//_------------------------------ +//------------------------------- { return m_nBackupHistory; } Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -361,12 +361,12 @@ ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW); szFullText[0] = 0; - UINT nID = pNMHDR->idFrom; + UINT_PTR nID = pNMHDR->idFrom; if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)) { // idFrom is actually the HWND of the tool - nID = (UINT)::GetDlgCtrlID((HWND)nID); + nID = (UINT_PTR)::GetDlgCtrlID((HWND)nID); } if ((nID >= 1000) && (nID < 10000) && (m_hWndCtrl) && (::SendMessage(m_hWndCtrl, WM_MOD_GETTOOLTIPTEXT, nID, (LPARAM)szFullText))) Modified: trunk/OpenMPT/mptrack/CreditStatic.h =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/CreditStatic.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -65,7 +65,7 @@ UINT m_Gradient; BOOL m_bTransparent; int n_MaxWidth; - UINT TimerOn; + UINT_PTR TimerOn; // Construction public: CCreditStatic(); Modified: trunk/OpenMPT/mptrack/Ctrl_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_com.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_com.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -195,8 +195,8 @@ } strcat(p, s); } - UINT len = strlen(p); - while ((len > 0) && ((p[len-1] == ' ') || (p[len-1] == SongMessage::InternalLineEnding))) + size_t len = strlen(p); + while ((len > 0) && ((p[len-1] == ' ') || (p[len - 1] == SongMessage::InternalLineEnding))) { len--; p[len] = 0; Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1819,11 +1819,10 @@ CHAR s[64]; s[0] = 0; m_EditFileName.GetWindowText(s, sizeof(s)); - for (UINT i=strlen(s); i<=12; i++) s[i] = 0; ModInstrument *pIns = m_sndFile.Instruments[m_nInstrument]; if ((pIns) && (strncmp(s, pIns->filename, 12))) { - memcpy(pIns->filename, s, 12); + mpt::String::Copy(pIns->filename, s); SetInstrumentModified(true); } } @@ -2608,7 +2607,7 @@ { if(pIns->pTuning == &CSoundFile::GetBuiltInTunings().GetTuning(i)) { - m_ComboTuning.SetCurSel(i+1); + m_ComboTuning.SetCurSel((int)(i + 1)); return; } } @@ -2617,7 +2616,7 @@ { if(pIns->pTuning == &CSoundFile::GetLocalTunings().GetTuning(i)) { - m_ComboTuning.SetCurSel(i+CSoundFile::GetBuiltInTunings().GetNumTunings()+1); + m_ComboTuning.SetCurSel((int)(i + CSoundFile::GetBuiltInTunings().GetNumTunings() + 1)); return; } } @@ -2626,7 +2625,7 @@ { if(pIns->pTuning == &m_sndFile.GetTuneSpecificTunings().GetTuning(i)) { - m_ComboTuning.SetCurSel(i+CSoundFile::GetBuiltInTunings().GetNumTunings() + CSoundFile::GetLocalTunings().GetNumTunings()+1); + m_ComboTuning.SetCurSel((int)(i + CSoundFile::GetBuiltInTunings().GetNumTunings() + CSoundFile::GetLocalTunings().GetNumTunings() + 1)); return; } } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -379,7 +379,7 @@ return m_OrderList.GetCurrentPattern(); case CTRLMSG_PATTERNCHANGED: - UpdateView((lParam << HINT_SHIFT_PAT) | HINT_PATNAMES, NULL); + UpdateView((DWORD)(lParam << HINT_SHIFT_PAT) | HINT_PATNAMES, NULL); break; case CTRLMSG_PAT_PREVINSTRUMENT: @@ -1228,7 +1228,7 @@ //--------------------------------------------------------------------- { TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; - UINT nID =pNMHDR->idFrom; + UINT_PTR nID = pNMHDR->idFrom; if (pTTT->uFlags & TTF_IDISHWND) { // idFrom is actually the HWND of the tool Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -380,7 +380,7 @@ CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //Translate message manually - UINT nChar = pMsg->wParam; + UINT nChar = (UINT)pMsg->wParam; UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1133,62 +1133,62 @@ //------------------------------ { //Default case: Normalize current sample - SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample; + SAMPLEINDEX minSample = m_nSample, maxSample = m_nSample; //If only one sample is selected, parts of it may be amplified - UINT iStart = 0, iEnd = 0; + SmpLength selStart = 0, selEnd = 0; //Shift -> Normalize all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) { if(Reporting::Confirm(GetStrI18N(TEXT("This will normalize all samples independently. Continue?")), GetStrI18N(TEXT("Normalize"))) == cnfNo) return; - iMinSample = 1; - iMaxSample = m_sndFile.m_nSamples; + minSample = 1; + maxSample = m_sndFile.GetNumSamples(); } else { SampleSelectionPoints selection = GetSelectionPoints(); - iStart = selection.nStart; - iEnd = selection.nEnd; + selStart = selection.nStart; + selEnd = selection.nEnd; } BeginWaitCursor(); bool bModified = false; - for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) + for(SAMPLEINDEX iSmp = minSample; iSmp <= maxSample; iSmp++) { if (m_sndFile.GetSample(iSmp).pSample) { bool bOk = false; ModSample &sample = m_sndFile.GetSample(iSmp); - if(iMinSample != iMaxSample) + if(minSample != maxSample) { //if more than one sample is selected, always amplify the whole sample. - iStart = 0; - iEnd = sample.nLength; + selStart = 0; + selEnd = sample.nLength; } else { //one sample: correct the boundaries, if needed - LimitMax(iEnd, sample.nLength); - LimitMax(iStart, iEnd); - if(iStart == iEnd) + LimitMax(selEnd, sample.nLength); + LimitMax(selStart, selEnd); + if(selStart == selEnd) { - iStart = 0; - iEnd = sample.nLength; + selStart = 0; + selEnd = sample.nLength; } } - m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, iStart, iEnd); + m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, selStart, selEnd); - if(sample.uFlags & CHN_STEREO) { iStart *= 2; iEnd *= 2; } + if(sample.uFlags & CHN_STEREO) { selStart *= 2; selEnd *= 2; } if(sample.uFlags & CHN_16BIT) { int16 *p = (int16 *)sample.pSample; int max = 1; - for (UINT i = iStart; i < iEnd; i++) + for (SmpLength i = selStart; i < selEnd; i++) { if (p[i] > max) max = p[i]; if (-p[i] > max) max = -p[i]; @@ -1196,7 +1196,7 @@ if (max < 32767) { max++; - for (UINT j = iStart; j < iEnd; j++) + for (SmpLength j = selStart; j < selEnd; j++) { int l = (((int)p[j]) << 15) / max; p[j] = (int16)l; @@ -1207,7 +1207,7 @@ { int8 *p = (int8 *)sample.pSample; int max = 1; - for (UINT i = iStart; i < iEnd; i++) + for (SmpLength i = selStart; i < selEnd; i++) { if (p[i] > max) max = p[i]; if (-p[i] > max) max = -p[i]; @@ -1215,7 +1215,7 @@ if (max < 127) { max++; - for (UINT j = iStart; j < iEnd; j++) + for (SmpLength j = selStart; j < selEnd; j++) { int l = (((int)p[j]) << 7) / max; p[j] = (int8)l; @@ -1254,13 +1254,13 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, selection.nStart, selection.nEnd); if (sample.uFlags & CHN_STEREO) { selection.nStart *= 2; selection.nEnd *= 2; } - UINT len = selection.nEnd - selection.nStart; + SmpLength len = selection.nEnd - selection.nStart; if ((bFadeIn) && (bFadeOut)) lAmp *= 4; if (sample.uFlags & CHN_16BIT) { signed short *p = ((signed short *)sample.pSample) + selection.nStart; - for (UINT i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { LONG l = (p[i] * lAmp) / 100; if (bFadeIn) l = (LONG)((l * (LONGLONG)i) / len); @@ -1273,7 +1273,7 @@ { signed char *p = ((signed char *)sample.pSample) + selection.nStart; - for (UINT i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { LONG l = (p[i] * lAmp) / 100; if (bFadeIn) l = (LONG)((l * (LONGLONG)i) / len); @@ -1294,51 +1294,51 @@ void CCtrlSamples::OnRemoveDCOffset() //----------------------------------- { - SAMPLEINDEX iMinSample = m_nSample, iMaxSample = m_nSample; + SAMPLEINDEX minSample = m_nSample, maxSample = m_nSample; //Shift -> Process all samples if(CMainFrame::GetInputHandler()->ShiftPressed()) { if(Reporting::Confirm(GetStrI18N(TEXT("This will process all samples independently. Continue?")), GetStrI18N(TEXT("DC Offset Removal"))) == cnfNo) return; - iMinSample = 1; - iMaxSample = m_sndFile.m_nSamples; + minSample = 1; + maxSample = m_sndFile.GetNumSamples(); } BeginWaitCursor(); // for report / SetModified - UINT iModified = 0; + SAMPLEINDEX numModified = 0; float fReportOffset = 0; - for(SAMPLEINDEX iSmp = iMinSample; iSmp <= iMaxSample; iSmp++) + for(SAMPLEINDEX iSmp = minSample; iSmp <= maxSample; iSmp++) { - UINT iStart, iEnd; + SmpLength selStart, selEnd; if(m_sndFile.GetSample(iSmp).pSample == nullptr) continue; - if (iMinSample != iMaxSample) + if (minSample != maxSample) { - iStart = 0; - iEnd = m_sndFile.GetSample(iSmp).nLength; + selStart = 0; + selEnd = m_sndFile.GetSample(iSmp).nLength; } else { SampleSelectionPoints selection = GetSelectionPoints(); - iStart = selection.nStart; - iEnd = selection.nEnd; + selStart = selection.nStart; + selEnd = selection.nEnd; } - m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, iStart, iEnd); + m_modDoc.GetSampleUndo().PrepareUndo(iSmp, sundo_update, selStart, selEnd); - const float fOffset = ctrlSmp::RemoveDCOffset(m_sndFile.GetSample(iSmp), iStart, iEnd, m_sndFile.GetType(), m_sndFile); + const float fOffset = ctrlSmp::RemoveDCOffset(m_sndFile.GetSample(iSmp), selStart, selEnd, m_sndFile.GetType(), m_sndFile); if(fOffset == 0.0f) // No offset removed. continue; fReportOffset += fOffset; - iModified++; + numModified++; m_modDoc.UpdateAllViews(NULL, (iSmp << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); } @@ -1348,16 +1348,16 @@ // fill the statusbar with some nice information CString dcInfo; - if(iModified) + if(numModified) { m_modDoc.SetModified(); - if(iModified == 1) + if(numModified == 1) { dcInfo.Format(GetStrI18N(TEXT("Removed DC offset (%.1f%%)")), fReportOffset * 100); } else { - dcInfo.Format(GetStrI18N(TEXT("Removed DC offset from %d samples (avg %0.1f%%)")), iModified, fReportOffset / iModified * 100); + dcInfo.Format(GetStrI18N(TEXT("Removed DC offset from %d samples (avg %0.1f%%)")), numModified, fReportOffset / numModified * 100); } } else @@ -1411,7 +1411,7 @@ void CCtrlSamples::OnUpsample() //----------------------------- { - DWORD dwStart, dwEnd, dwNewLen; + SmpLength dwStart, dwEnd, dwNewLen; UINT smplsize, newsmplsize; PVOID pOriginal, pNewSample; @@ -1443,13 +1443,13 @@ const UINT nCh = sample.GetNumChannels(); for (UINT iCh=0; iCh<nCh; iCh++) { - int len = dwEnd - dwStart; + SmpLength len = dwEnd - dwStart; int maxndx = sample.nLength; if (sample.uFlags & CHN_16BIT) { signed short *psrc = ((signed short *)pOriginal)+iCh; signed short *pdest = ((signed short *)pNewSample)+dwStart*nCh+iCh; - for (int i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { int accum = 0x80; for (int j=0; j<16; j++) @@ -1470,7 +1470,7 @@ { signed char *psrc = ((signed char *)pOriginal)+iCh; signed short *pdest = ((signed short *)pNewSample)+dwStart*nCh+iCh; - for (int i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { int accum = 0x40; for (int j=0; j<16; j++) @@ -1497,7 +1497,7 @@ { if (dwStart > 0) { - for (UINT i=0; i<dwStart*nCh; i++) + for (SmpLength i=0; i<dwStart*nCh; i++) { ((signed short *)pNewSample)[i] = (signed short)(((signed char *)pOriginal)[i] << 8); } @@ -1505,7 +1505,7 @@ if (dwEnd < sample.nLength) { signed short *pdest = ((signed short *)pNewSample) + (dwEnd-dwStart)*nCh; - for (UINT i=dwEnd*nCh; i<sample.nLength*nCh; i++) + for (SmpLength i=dwEnd*nCh; i<sample.nLength*nCh; i++) { pdest[i] = (signed short)(((signed char *)pOriginal)[i] << 8); } @@ -1903,8 +1903,8 @@ // Show wait mouse cursor BeginWaitCursor(); - UINT pos = 0; - UINT len = 0; //To contain length of processing step. + SmpLength pos = 0; + SmpLength len = 0; //To contain length of processing step. // Initialize soundtouch object. { @@ -2080,7 +2080,8 @@ // Process sample buffer using MAX_BUFFER_LENGTH (max) sized chunk steps (in order to allow // the processing of BIG samples...) - while(pos < sample.nLength){ + while(pos < sample.nLength) + { // Current chunk size limit test if(pos + len >= sample.nLength) len = sample.nLength - pos; @@ -2263,7 +2264,7 @@ ModSample &sample = m_sndFile.GetSample(m_nSample); m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, selection.nStart, selection.nEnd); - int len = selection.nEnd - selection.nStart; + SmpLength len = selection.nEnd - selection.nStart; if (sample.uFlags & CHN_STEREO) { int smplsize = (sample.uFlags & CHN_16BIT) ? 4 : 2; @@ -2276,7 +2277,7 @@ int dest = (selection.nEnd < sample.nLength) ? p[len-1] : 0; int base = (selection.nStart) ? p[0] : 0; int delta = dest - base; - for (int i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { int n = base + (int)(((LONGLONG)delta * (LONGLONG)i) / (len-1)); p[i] = (signed short)n; @@ -2287,7 +2288,7 @@ int dest = (selection.nEnd < sample.nLength) ? p[len-1] : 0; int base = (selection.nStart) ? p[0] : 0; int delta = dest - base; - for (int i=0; i<len; i++) + for (SmpLength i=0; i<len; i++) { int n = base + (delta * i) / (len-1); p[i] = (signed char)n; @@ -2326,13 +2327,10 @@ void CCtrlSamples::OnNameChanged() //-------------------------------- { - CHAR s[64]; + char s[MAX_SAMPLENAME] = { '\0' }; if(IsLocked() || !m_nSample) return; - s[0] = 0; m_EditName.GetWindowText(s, sizeof(s)); - for (UINT i=strlen(s); i<32; i++) s[i] = 0; - s[31] = 0; if (strncmp(s, m_sndFile.m_szNames[m_nSample], MAX_SAMPLENAME)) { mpt::String::Copy(m_sndFile.m_szNames[m_nSample], s); @@ -2346,12 +2344,10 @@ void CCtrlSamples::OnFileNameChanged() //------------------------------------ { - CHAR s[MAX_SAMPLEFILENAME]; + char s[MAX_SAMPLEFILENAME] = { '\0' }; if(IsLocked()) return; - s[0] = 0; m_EditFileName.GetWindowText(s, sizeof(s)); - mpt::String::SetNullTerminator(s); if (strncmp(s, m_sndFile.GetSample(m_nSample).filename, MAX_SAMPLEFILENAME)) { @@ -2785,7 +2781,7 @@ // Find Next LoopStart Point if (pos > 0) { - for (UINT i=sample.nLoopStart+1; i+16<sample.nLoopEnd; i++) + for (SmpLength i=sample.nLoopStart+1; i+16<sample.nLoopEnd; i++) { p += pinc; bOk = (sample.uFlags & CHN_PINGPONGLOOP) ? MPT_BidiStartCheck(p[0], p[pinc], p[pinc*2]) : MPT_LoopCheck(find0, find1, p[0], p[pinc]); @@ -2798,7 +2794,7 @@ } else // Find Prev LoopStart Point { - for (UINT i=sample.nLoopStart; i; ) + for (SmpLength i=sample.nLoopStart; i; ) { i--; p -= pinc; @@ -2831,7 +2827,7 @@ // Find Next LoopEnd Point if (pos > 0) { - for (UINT i=sample.nLoopEnd+1; i<=sample.nLength; i++, p+=pinc) + for (SmpLength i=sample.nLoopEnd+1; i<=sample.nLength; i++, p+=pinc) { bOk = (sample.uFlags & CHN_PINGPONGLOOP) ? MPT_BidiEndCheck(p[0], p[pinc], p[pinc*2]) : MPT_LoopCheck(find0, find1, p[0], p[pinc]); if (bOk) @@ -2843,7 +2839,7 @@ } else // Find Prev LoopEnd Point { - for (UINT i=sample.nLoopEnd; i>sample.nLoopStart+16; ) + for (SmpLength i=sample.nLoopEnd; i>sample.nLoopStart+16; ) { i--; p -= pinc; @@ -2876,7 +2872,7 @@ // Find Next Sustain LoopStart Point if (pos > 0) { - for (UINT i=sample.nSustainStart+1; i+16<sample.nSustainEnd; i++) + for (SmpLength i=sample.nSustainStart+1; i+16<sample.nSustainEnd; i++) { p += pinc; bOk = (sample.uFlags & CHN_PINGPONGSUSTAIN) ? MPT_BidiStartCheck(p[0], p[pinc], p[pinc*2]) : MPT_LoopCheck(find0, find1, p[0], p[pinc]); @@ -2889,7 +2885,7 @@ } else // Find Prev Sustain LoopStart Point { - for (UINT i=sample.nSustainStart; i; ) + for (SmpLength i=sample.nSustainStart; i; ) { i--; p -= pinc; @@ -2921,7 +2917,7 @@ // Find Next LoopEnd Point if (pos > 0) { - for (UINT i=sample.nSustainEnd+1; i+1<sample.nLength; i++, p+=pinc) + for (SmpLength i=sample.nSustainEnd+1; i+1<sample.nLength; i++, p+=pinc) { bOk = (sample.uFlags & CHN_PINGPONGSUSTAIN) ? MPT_BidiEndCheck(p[0], p[pinc], p[pinc*2]) : MPT_LoopCheck(find0, find1, p[0], p[pinc]); if (bOk) @@ -2933,7 +2929,7 @@ } else // Find Prev LoopEnd Point { - for (UINT i=sample.nSustainEnd; i>sample.nSustainStart+16; ) + for (SmpLength i=sample.nSustainEnd; i>sample.nSustainStart+16; ) { i--; p -= pinc; @@ -2960,7 +2956,7 @@ { if (m_sndFile.m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { - UINT d = sample.nC5Speed; + uint32 d = sample.nC5Speed; if (d < 1) d = 8363; if(d < m_nFinetuneStep) d = m_nFinetuneStep; d += (pos * m_nFinetuneStep); @@ -3015,7 +3011,7 @@ CInputHandler* ih = (CMainFrame::GetMainFrame())->GetInputHandler(); //Translate message manually - UINT nChar = pMsg->wParam; + UINT nChar = (UINT)pMsg->wParam; UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); @@ -3076,8 +3072,8 @@ // Set the currently selected part of the sample. // To reset the selection, use nStart = nEnd = 0. -void CCtrlSamples::SetSelectionPoints(UINT nStart, UINT nEnd) -//----------------------------------------------------------- +void CCtrlSamples::SetSelectionPoints(SmpLength nStart, SmpLength nEnd) +//--------------------------------------------------------------------- { const ModSample &sample = m_sndFile.GetSample(m_nSample); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -58,7 +58,7 @@ void ApplyAmplify(LONG nAmp, bool bFadeIn = false, bool bFadeOut = false); SampleSelectionPoints GetSelectionPoints(); - void SetSelectionPoints(UINT nStart, UINT nEnd); + void SetSelectionPoints(SmpLength nStart, SmpLength nEnd); void PropagateAutoVibratoChanges() const; Modified: trunk/OpenMPT/mptrack/DefaultVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/DefaultVstEditor.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -204,7 +204,7 @@ rect.DeflateRect(edSpacing, edSpacing); rect.bottom = edTotalHeight; - for(size_t i = 0; i < NUM_PLUGINEDITOR_PARAMETERS; i++) + for(int i = 0; i < NUM_PLUGINEDITOR_PARAMETERS; i++) { try { Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1036,7 +1036,8 @@ ModChannel *pChn = &m_SndFile.Chn[nChn]; // reset channel properties; in theory the chan is completely unused anyway. - pChn->nPos = pChn->nPosLo = pChn->nLength = 0; + pChn->nPos = pChn->nPosLo = 0; + pChn->nLength = 0; pChn->dwFlags &= CHN_SAMPLEFLAGS; pChn->dwFlags.reset(CHN_MUTE); pChn->nGlobalVol = 64; @@ -1065,7 +1066,8 @@ pChn->pSample = sample.pSample; pChn->nFineTune = sample.nFineTune; pChn->nC5Speed = sample.nC5Speed; - pChn->nPos = pChn->nPosLo = pChn->nLength = 0; + pChn->nPos = pChn->nPosLo = 0; + pChn->nLength = 0; pChn->nLoopStart = sample.nLoopStart; pChn->nLoopEnd = sample.nLoopEnd; pChn->dwFlags = static_cast<ChannelFlags>(sample.uFlags) & (CHN_SAMPLEFLAGS & ~CHN_MUTE); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -288,7 +288,7 @@ std::vector<SAMPLEINDEX> newIndex(oldNumSamples + 1, 0); // One of the new indexes for the old sample std::vector<std::string> sampleNames(oldNumSamples + 1); - for(size_t i = 0; i < newOrder.size(); i++) + for(SAMPLEINDEX i = 0; i < newNumSamples; i++) { const SAMPLEINDEX origSlot = newOrder[i]; if(origSlot > 0 && origSlot <= oldNumSamples) @@ -397,7 +397,7 @@ std::vector<ModInstrument> instrumentHeaders(oldNumInstruments + 1); std::vector<INSTRUMENTINDEX> newIndex(oldNumInstruments + 1, 0); // One of the new indexes for the old instrument - for(size_t i = 0; i < newNumInstruments; i++) + for(INSTRUMENTINDEX i = 0; i < newNumInstruments; i++) { const INSTRUMENTINDEX origSlot = newOrder[i]; if(origSlot > 0 && origSlot <= oldNumInstruments) @@ -550,7 +550,7 @@ for (PLUGINDEX nPlug = 0; nPlug < maxPlug; nPlug++) { - SNDMIXPLUGIN* pPlug = &m_SndFile.m_MixPlugins[nPlug]; + SNDMIXPLUGIN* pPlug = &m_SndFile.m_MixPlugins[nPlug]; if (keepMask[nPlug] || !pPlug) { continue; Modified: trunk/OpenMPT/mptrack/SampleEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/SampleEditorDialogs.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -144,7 +144,7 @@ CSpinButtonCtrl m_SpinSamples; public: - CSampleXFadeDlg(CWnd *parent, UINT nSamples, UINT nMaxSamples) : CDialog(IDD_SAMPLE_XFADE, parent) { m_nSamples = nSamples; m_nMaxSamples = nMaxSamples; }; + CSampleXFadeDlg(CWnd *parent, SmpLength nSamples, UINT nMaxSamples) : CDialog(IDD_SAMPLE_XFADE, parent), m_nSamples(nSamples), m_nMaxSamples(nMaxSamples) { }; protected: virtual void DoDataExchange(CDataExchange* pDX); Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -151,7 +151,7 @@ void CViewSample::UpdateScrollSize(const UINT nZoomOld) -//---------------------------------- +//----------------------------------------------------- { CModDoc *pModDoc = GetDocument(); @@ -161,7 +161,7 @@ CPoint pt; CSoundFile *pSndFile = pModDoc->GetSoundFile(); SIZE sizePage, sizeLine; - DWORD dwLen = 0; + SmpLength dwLen = 0; if ((m_nSample > 0) && (m_nSample <= pSndFile->GetNumSamples())) { @@ -348,7 +348,7 @@ if ((pModDoc) && (m_nSample <= pModDoc->GetNumSamples())) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - UINT nLen = pSndFile->GetSample(m_nSample).nLength; + SmpLength nLen = pSndFile->GetSample(m_nSample).nLength; if (!nLen) return 0; if (m_nZoom) { @@ -371,7 +371,7 @@ if ((pModDoc) && (m_nSample <= pModDoc->GetNumSamples())) { CSoundFile *pSndFile = pModDoc->GetSoundFile(); - UINT nLen = pSndFile->GetSample(m_nSample).nLength; + SmpLength nLen = pSndFile->GetSample(m_nSample).nLength; if (!nLen) return 0; if (m_nZoom) { Modified: trunk/OpenMPT/mptrack/VstPresets.cpp =================================================================== --- trunk/OpenMPT/mptrack/VstPresets.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/mptrack/VstPresets.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -146,7 +146,7 @@ if(writeChunk) { char *chunk = nullptr; - uint32 chunkSize = plugin.Dispatch(effGetChunk, 0, 0, &chunk, 0); + uint32 chunkSize = mpt::saturate_cast<uint32>(plugin.Dispatch(effGetChunk, 0, 0, &chunk, 0)); if(chunkSize && chunk) { WriteBE(chunkSize, f); @@ -204,7 +204,7 @@ if(writeChunk) { char *chunk = nullptr; - uint32 chunkSize = plugin.Dispatch(effGetChunk, 1, 0, &chunk, 0); + uint32 chunkSize = mpt::saturate_cast<uint32>(plugin.Dispatch(effGetChunk, 1, 0, &chunk, 0)); if(chunkSize && chunk) { WriteBE(chunkSize, f); Modified: trunk/OpenMPT/soundlib/Dlsbank.cpp =================================================================== --- trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/Dlsbank.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1724,7 +1724,7 @@ if (pDlsIns->szName[0]) { sprintf(&s[strlen(s)], " (%s", pDlsIns->szName); - int n = strlen(s); + size_t n = strlen(s); while ((n) && (s[n-1] == ' ')) { n--; Modified: trunk/OpenMPT/soundlib/ITTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITTools.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/ITTools.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -204,7 +204,7 @@ // Convert OpenMPT's internal instrument representation to an ITInstrument. -size_t ITInstrument::ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile) +uint32 ITInstrument::ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile) //--------------------------------------------------------------------------------------------------------- { MemsetZero(*this); @@ -255,7 +255,7 @@ // Sample Map nos = 0; std::vector<bool> smpCount(sndFile.GetNumSamples(), false); - for(size_t i = 0; i < 120; i++) + for(int i = 0; i < 120; i++) { keyboard[i * 2] = (mptIns.NoteMap[i] >= NOTE_MIN && mptIns.NoteMap[i] <= NOTE_MAX) ? (mptIns.NoteMap[i] - NOTE_MIN) : static_cast<uint8>(i); @@ -286,7 +286,7 @@ // Convert an ITInstrument to OpenMPT's internal instrument representation. Returns size of the instrument data that has been read. -size_t ITInstrument::ConvertToMPT(ModInstrument &mptIns, MODTYPE modFormat) const +uint32 ITInstrument::ConvertToMPT(ModInstrument &mptIns, MODTYPE modFormat) const //------------------------------------------------------------------------------- { if(id != ITInstrument::magic) @@ -351,7 +351,7 @@ mptIns.PitchEnv.dwFlags.set(ENV_FILTER, (pitchenv.flags & ITEnvelope::envFilter) != 0); // Sample Map - for(size_t i = 0; i < 120; i++) + for(int i = 0; i < 120; i++) { uint8 note = keyboard[i * 2]; SAMPLEINDEX ins = keyboard[i * 2 + 1]; @@ -381,10 +381,10 @@ // Convert OpenMPT's internal instrument representation to an ITInstrumentEx. Returns amount of bytes that need to be written to file. -size_t ITInstrumentEx::ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile) +uint32 ITInstrumentEx::ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile) //----------------------------------------------------------------------------------------------------------- { - size_t instSize = iti.ConvertToIT(mptIns, compatExport, sndFile); + uint32 instSize = iti.ConvertToIT(mptIns, compatExport, sndFile); if(compatExport) { @@ -395,7 +395,7 @@ bool usedExtension = false; iti.nos = 0; std::vector<bool> smpCount(sndFile.GetNumSamples(), false); - for(size_t i = 0; i < 120; i++) + for(int i = 0; i < 120; i++) { const SAMPLEINDEX smp = mptIns.Keyboard[i]; keyboardhi[i] = 0; @@ -430,10 +430,10 @@ // Convert an ITInstrumentEx to OpenMPT's internal instrument representation. Returns size of the instrument data that has been read. -size_t ITInstrumentEx::ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const +uint32 ITInstrumentEx::ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const //-------------------------------------------------------------------------------- { - size_t insSize = iti.ConvertToMPT(mptIns, fromType); + uint32 insSize = iti.ConvertToMPT(mptIns, fromType); // Is this actually an extended instrument? if(insSize == 0 || memcmp(iti.dummy, "MPTX", 4)) @@ -442,7 +442,7 @@ } // Olivier's MPT Instrument Extension - for(size_t i = 0; i < 120; i++) + for(int i = 0; i < 120; i++) { mptIns.Keyboard[i] |= ((SAMPLEINDEX)keyboardhi[i] << 8); } @@ -542,7 +542,7 @@ // Convert an ITSample to OpenMPT's internal sample representation. -size_t ITSample::ConvertToMPT(ModSample &mptSmp) const +uint32 ITSample::ConvertToMPT(ModSample &mptSmp) const //---------------------------------------------------- { if(id != ITSample::magic) Modified: trunk/OpenMPT/soundlib/ITTools.h =================================================================== --- trunk/OpenMPT/soundlib/ITTools.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/ITTools.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -206,9 +206,9 @@ void ConvertEndianness(); // Convert OpenMPT's internal instrument representation to an ITInstrument. Returns amount of bytes that need to be written. - size_t ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile); + uint32 ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile); // Convert an ITInstrument to OpenMPT's internal instrument representation. Returns size of the instrument data that has been read. - size_t ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const; + uint32 ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const; }; STATIC_ASSERT(sizeof(ITInstrument) == 554); @@ -229,9 +229,9 @@ void ConvertEndianness(); // Convert OpenMPT's internal instrument representation to an ITInstrumentEx. Returns amount of bytes that need to be written. - size_t ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile); + uint32 ConvertToIT(const ModInstrument &mptIns, bool compatExport, const CSoundFile &sndFile); // Convert an ITInstrumentEx to OpenMPT's internal instrument representation. Returns size of the instrument data that has been read. - size_t ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const; + uint32 ConvertToMPT(ModInstrument &mptIns, MODTYPE fromType) const; }; STATIC_ASSERT(sizeof(ITInstrumentEx) == sizeof(ITInstrument) + 120); @@ -294,7 +294,7 @@ // Convert OpenMPT's internal sample representation to an ITSample. void ConvertToIT(const ModSample &mptSmp, MODTYPE fromType, bool compress, bool compressIT215); // Convert an ITSample to OpenMPT's internal sample representation. - size_t ConvertToMPT(ModSample &mptSmp) const; + uint32 ConvertToMPT(ModSample &mptSmp) const; // Retrieve the internal sample format flags for this instrument. SampleIO GetSampleFormat(uint16 cwtv = 0x214) const; }; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1045,8 +1045,8 @@ #ifndef MODPLUG_NO_FILESAVE // Save edit history. Pass a null pointer for *f to retrieve the number of bytes that would be written. -DWORD SaveITEditHistory(const CSoundFile *pSndFile, FILE *f) -//---------------------------------------------------------- +uint32 SaveITEditHistory(const CSoundFile *pSndFile, FILE *f) +//----------------------------------------------------------- { #ifdef MODPLUG_TRACKER CModDoc *pModDoc = pSndFile->GetpModDoc(); @@ -1056,8 +1056,8 @@ UNREFERENCED_PARAMETER(pSndFile); #endif // MODPLUG_TRACKER - uint16 fnum = (uint16)MIN(num, uint16_max); // Number of entries that are actually going to be written - const size_t bytes_written = 2 + fnum * 8; // Number of bytes that are actually going to be written + uint16 fnum = std::min<uint16>(num, uint16_max); // Number of entries that are actually going to be written + const uint32 bytes_written = 2 + fnum * 8; // Number of bytes that are actually going to be written if(f == nullptr) return bytes_written; @@ -1333,7 +1333,7 @@ for(UINT nins = 1; nins <= itHeader.insnum; nins++) { ITInstrumentEx iti; - size_t instSize; + uint32 instSize; if(Instruments[nins]) { Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -1591,7 +1591,7 @@ iti.ConvertEndianness(); fwrite(&iti, 1, instSize, f); - filePos += smptable.size() * sizeof(ITSample); + filePos += mpt::saturate_cast<uint32>(smptable.size() * sizeof(ITSample)); // Writing sample headers + data std::vector<SampleIO> sampleFlags; @@ -1609,7 +1609,7 @@ // Write sample off_t curPos = ftell(f); fseek(f, filePos, SEEK_SET); - filePos += itss.GetSampleFormat(0x0214).WriteSample(f, Samples[*iter]); + filePos += mpt::saturate_cast<uint32>(itss.GetSampleFormat(0x0214).WriteSample(f, Samples[*iter])); fseek(f, curPos, SEEK_SET); } Modified: trunk/OpenMPT/soundlib/SampleIO.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleIO.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/SampleIO.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -490,7 +490,7 @@ uint32 sourceSize = file.ReadUint32LE(); int8 packCharacter = file.ReadUint8(); - LimitMax(sourceSize, file.BytesLeft()); + LimitMax(sourceSize, mpt::saturate_cast<uint32>(file.BytesLeft())); bytesRead = 9 + sourceSize; AMSUnpack(reinterpret_cast<const int8 *>(sourceBuf) + 9, sourceSize, sample.pSample, sample.GetSampleSizeInBytes(), packCharacter); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -961,8 +961,8 @@ // Memory Allocation // Allocate sample memory. On sucess, a pointer to the silenced sample buffer is returned. On failure, nullptr is returned. -void *CSoundFile::AllocateSample(UINT nbytes) -//------------------------------------------- +void *CSoundFile::AllocateSample(size_t nbytes) +//--------------------------------------------- { if(nbytes > SIZE_MAX - 0x29u) return nullptr; @@ -1261,9 +1261,10 @@ { m_SongFlags.reset(SONG_FADINGSONG | SONG_ENDREACHED); m_nBufferCount = 0; - for (UINT i=0; i<MAX_CHANNELS; i++) + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) { - Chn[i].nROfs = Chn[i].nLOfs = Chn[i].nLength = 0; + Chn[i].nROfs = Chn[i].nLOfs = 0; + Chn[i].nLength = 0; } } @@ -1640,7 +1641,8 @@ { if(Chn[i].pSample == sample.pSample) { - Chn[i].nPos = Chn[i].nLength = 0; + Chn[i].nPos = 0; + Chn[i].nLength = 0; Chn[i].pSample = Chn[i].pCurrentSample = nullptr; } } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -774,7 +774,7 @@ // System-Dependant functions public: - static void *AllocateSample(UINT nbytes); + static void *AllocateSample(size_t nbytes); static void FreeSample(void *p); ModInstrument *AllocateInstrument(INSTRUMENTINDEX instr, SAMPLEINDEX assignedSample = 0); Modified: trunk/OpenMPT/soundlib/WAVTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/WAVTools.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/WAVTools.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -231,14 +231,14 @@ { identifier = 0; loopType = bidi ? loopBidi : loopForward; - loopStart = start; + loopStart = mpt::saturate_cast<uint32>(start); // Loop ends are *inclusive* in the RIFF standard, while they're *exclusive* in OpenMPT. if(end > start) { - loopEnd = end - 1; + loopEnd = mpt::saturate_cast<uint32>(end - 1); } else { - loopEnd = start; + loopEnd = loopStart; } fraction = 0; playCount = 0; Modified: trunk/OpenMPT/soundlib/modsmp_ctrl.cpp =================================================================== --- trunk/OpenMPT/soundlib/modsmp_ctrl.cpp 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/modsmp_ctrl.cpp 2013-08-11 00:18:18 UTC (rev 2598) @@ -147,7 +147,7 @@ //---------------------------------------- { ModSample* const pSmp = &smp; - const UINT len = pSmp->nLength; + const SmpLength len = pSmp->nLength; T *p = static_cast<T *>(pSmp->pSample); if (pSmp->uFlags & CHN_STEREO) { Modified: trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-08-10 23:26:47 UTC (rev 2597) +++ trunk/OpenMPT/soundlib/plugins/PluginEventQueue.h 2013-08-11 00:18:18 UTC (rev 2598) @@ -102,7 +102,7 @@ VstInt32 Finalise() { Util::lock_guard<Util::mutex> lock(criticalSection); - numEvents = std::min(eventQueue.size(), N); + numEvents = std::min<VstInt32>(eventQueue.size(), N); for(VstInt32 i = 0; i < numEvents; i++) { events[i] = reinterpret_cast<VstEvent *>(&eventQueue[i]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |