From: <sag...@us...> - 2010-03-07 13:37:23
|
Revision: 516 http://modplug.svn.sourceforge.net/modplug/?rev=516&view=rev Author: saga-games Date: 2010-03-07 13:37:12 +0000 (Sun, 07 Mar 2010) Log Message: ----------- [New] Orderlist: "Select All" shortcut also works here now. [Fix] PTM Loader: Fixed an unhandled null pointer exception that occured when loading some unsupported RAR files. [Fix] All loaders: Added another security check to the CSoundFile::Create method because of aforementioned problem. [Fix] Treeview: "Bypass" action for VSTs didn't set the document as modified. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-03-06 12:41:43 UTC (rev 515) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2010-03-07 13:37:12 UTC (rev 516) @@ -401,11 +401,14 @@ case kcOrderlistNavigateFirstSelect: case kcOrderlistNavigateFirst: SetCurSelTo2ndSel(wParam == kcOrderlistNavigateFirstSelect); SetCurSel(0); return wParam; + case kcEditSelectAll: + SetCurSel(0); + // fallthroughs intended. case kcOrderlistNavigateLastSelect: case kcOrderlistNavigateLast: if((m_pModDoc != nullptr) && (m_pModDoc->GetSoundFile() != nullptr)) { - SetCurSelTo2ndSel(wParam == kcOrderlistNavigateLastSelect); + SetCurSelTo2ndSel(wParam == kcOrderlistNavigateLastSelect || wParam == kcEditSelectAll); ORDERINDEX nLast = m_pModDoc->GetSoundFile()->Order.GetLengthTailTrimmed(); if(nLast > 0) nLast--; SetCurSel(nLast); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-06 12:41:43 UTC (rev 515) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2010-03-07 13:37:12 UTC (rev 516) @@ -2768,20 +2768,22 @@ { pModDoc->MuteInstrument((INSTRUMENTINDEX)modItemID, (pModDoc->IsInstrumentMuted((INSTRUMENTINDEX)modItemID)) ? false : true); UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_INSNAMES | HINT_INSTRUMENT); - } - + } else if ((modItemType == MODITEM_EFFECT)) { - CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : NULL; - if (pSndFile) { - PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[modItemID]; - if (pPlugin) { - CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; - if (pVstPlugin) pVstPlugin->Bypass(); - } - } + CSoundFile *pSndFile = pModDoc ? pModDoc->GetSoundFile() : nullptr; + if (pSndFile == nullptr) + return; + PSNDMIXPLUGIN pPlugin = &pSndFile->m_MixPlugins[modItemID]; + if(pPlugin == nullptr) + return; + CVstPlugin *pVstPlugin = (CVstPlugin *)pPlugin->pMixPlugin; + if(pVstPlugin == nullptr) + return; + pVstPlugin->Bypass(); + pModDoc->SetModified(); + //UpdateView(GetDocumentIDFromModDoc(pModDoc), HINT_MIXPLUGINS); } - } } Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp 2010-03-06 12:41:43 UTC (rev 515) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2010-03-07 13:37:12 UTC (rev 516) @@ -65,6 +65,9 @@ bool CSoundFile::ReadPTM(const BYTE *lpStream, DWORD dwMemLength) //--------------------------------------------------------------- { + if(lpStream == nullptr || dwMemLength < sizeof(PTMFILEHEADER)) + return false; + PTMFILEHEADER pfh = *(LPPTMFILEHEADER)lpStream; DWORD dwMemPos; UINT nOrders; @@ -76,12 +79,11 @@ pfh.fileflags = LittleEndianW(pfh.fileflags); pfh.reserved2 = LittleEndianW(pfh.reserved2); pfh.ptmf_id = LittleEndian(pfh.ptmf_id); - for (UINT j=0; j<128; j++) - { - pfh.patseg[j] = LittleEndianW(pfh.patseg[j]); + for (UINT j = 0; j < 128; j++) + { + pfh.patseg[j] = LittleEndianW(pfh.patseg[j]); } - if ((!lpStream) || (dwMemLength < 1024)) return false; if ((pfh.ptmf_id != 0x464d5450) || (!pfh.nchannels) || (pfh.nchannels > 32) || (pfh.norders > 256) || (!pfh.norders) @@ -98,12 +100,12 @@ nOrders = (pfh.norders < MAX_ORDERS) ? pfh.norders : MAX_ORDERS-1; Order.ReadAsByte(pfh.orders, nOrders, nOrders); - for (UINT ipan=0; ipan<m_nChannels; ipan++) + for (CHANNELINDEX ipan = 0; ipan < m_nChannels; ipan++) { ChnSettings[ipan].nVolume = 64; ChnSettings[ipan].nPan = ((pfh.chnpan[ipan] & 0x0F) << 4) + 4; } - for (UINT ismp=0; ismp<m_nSamples; ismp++, dwMemPos += SIZEOF_PTMSAMPLE) + for (SAMPLEINDEX ismp = 0; ismp < m_nSamples; ismp++, dwMemPos += SIZEOF_PTMSAMPLE) { MODSAMPLE *pSmp = &Samples[ismp+1]; PTMSAMPLE *psmp = (PTMSAMPLE *)(lpStream+dwMemPos); Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-06 12:41:43 UTC (rev 515) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2010-03-07 13:37:12 UTC (rev 516) @@ -572,7 +572,7 @@ CZipArchive archive(glpszModExtensions); if (CZipArchive::IsArchive((LPBYTE)lpStream, dwMemLength)) { - if (archive.UnzipArchive((LPBYTE)lpStream, dwMemLength)) + if (archive.UnzipArchive((LPBYTE)lpStream, dwMemLength) && archive.GetOutputFile()) { lpStream = archive.GetOutputFile(); dwMemLength = archive.GetOutputFileLength(); @@ -583,7 +583,7 @@ CRarArchive unrar((LPBYTE)lpStream, dwMemLength, glpszModExtensions); if (unrar.IsArchive()) { - if (unrar.ExtrFile()) + if (unrar.ExtrFile() && unrar.GetOutputFile()) { lpStream = unrar.GetOutputFile(); dwMemLength = unrar.GetOutputFileLength(); @@ -594,7 +594,7 @@ CLhaArchive unlha((LPBYTE)lpStream, dwMemLength, glpszModExtensions); if (unlha.IsArchive()) { - if (unlha.ExtractFile()) + if (unlha.ExtractFile() && unlha.GetOutputFile()) { lpStream = unlha.GetOutputFile(); dwMemLength = unlha.GetOutputFileLength(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |