From: <sag...@us...> - 2010-03-08 14:26:12
|
Revision: 519 http://modplug.svn.sourceforge.net/modplug/?rev=519&view=rev Author: saga-games Date: 2010-03-08 14:26:04 +0000 (Mon, 08 Mar 2010) Log Message: ----------- [Fix] Sample Undo: If no custom value was set, the default value was set ridiculously high (tx Paul Legovitch) [Fix] Sample Undo: Fixed another possible problem when undoing actions with very little memory left. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Undo.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-07 16:25:09 UTC (rev 518) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-03-08 14:26:04 UTC (rev 519) @@ -203,7 +203,7 @@ | PATTERN_SHOWPREVIOUS | PATTERN_CONTSCROLL | PATTERN_SYNCMUTE | PATTERN_AUTODELAY | PATTERN_NOTEFADE; DWORD CMainFrame::m_nRowSpacing = 16; DWORD CMainFrame::m_nRowSpacing2 = 4; -UINT CMainFrame::m_nSampleUndoMaxBuffer = 100 << 20; +UINT CMainFrame::m_nSampleUndoMaxBuffer = 0; // Real sample buffer undo size will be set later. // GDI HICON CMainFrame::m_hIcon = NULL; @@ -446,7 +446,7 @@ CSoundFile::s_DefaultPlugVolumeHandling = static_cast<uint8>(GetPrivateProfileInt("Misc", "DefaultPlugVolumeHandling", PLUGIN_VOLUMEHANDLING_IGNORE, iniFile)); if(CSoundFile::s_DefaultPlugVolumeHandling > 2) CSoundFile::s_DefaultPlugVolumeHandling = PLUGIN_VOLUMEHANDLING_IGNORE; - m_nSampleUndoMaxBuffer = GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer, iniFile); + m_nSampleUndoMaxBuffer = GetPrivateProfileLong("Sample Editor" , "UndoBufferSize", m_nSampleUndoMaxBuffer >> 20, iniFile); m_nSampleUndoMaxBuffer = max(1, m_nSampleUndoMaxBuffer) << 20; TCHAR szPath[_MAX_PATH] = ""; Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2010-03-07 16:25:09 UTC (rev 518) +++ trunk/OpenMPT/mptrack/Undo.cpp 2010-03-08 14:26:04 UTC (rev 519) @@ -343,7 +343,7 @@ case sundo_delete: // insert deleted data pNewSample = pSndFile->AllocateSample(pUndo->OldSample.GetSampleSizeInBytes() + 4 * nBytesPerSample); - if(pNewSample == nullptr && pUndo->OldSample.nLength > 0) return false; + if(pNewSample == nullptr) return false; memcpy(pNewSample, pCurrentSample, pUndo->nChangeStart * nBytesPerSample); memcpy(pNewSample + pUndo->nChangeStart * nBytesPerSample, pUndo->SamplePtr, nChangeLen * nBytesPerSample); memcpy(pNewSample + pUndo->nChangeEnd * nBytesPerSample, pCurrentSample + pUndo->nChangeStart * nBytesPerSample, (pUndo->OldSample.nLength - pUndo->nChangeEnd) * nBytesPerSample); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |