From: <sag...@us...> - 2013-08-11 21:28:10
|
Revision: 2601 http://sourceforge.net/p/modplug/code/2601 Author: saga-games Date: 2013-08-11 21:27:57 +0000 (Sun, 11 Aug 2013) Log Message: ----------- [Imp] Sample Editor: Don't limit size of loaded sample file to the size of physical memory. [Ref] Get rid of newly introduced warning in IT history code. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-08-11 17:58:59 UTC (rev 2600) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2013-08-11 21:27:57 UTC (rev 2601) @@ -735,9 +735,6 @@ //------------------------------------------------ { CMappedFile f; - CHAR szName[_MAX_FNAME], szExt[_MAX_EXT]; - LPBYTE lpFile; - DWORD len; bool bOk = false; BeginWaitCursor(); @@ -746,9 +743,8 @@ EndWaitCursor(); return false; } - len = f.GetLength(); - if (len > CTrackApp::gMemStatus.dwTotalPhys) len = CTrackApp::gMemStatus.dwTotalPhys; - lpFile = f.Lock(len); + const size_t len = f.GetLength(); + const void *lpFile = f.Lock(len); if (!lpFile) goto OpenError; { @@ -825,30 +821,18 @@ TrackerSettings::Instance().SetWorkingDirectory(lpszFileName, DIR_SAMPLES, true); if (!sample.filename[0]) { - CHAR szFullFilename[_MAX_PATH]; + CHAR szName[_MAX_PATH], szExt[_MAX_EXT]; _splitpath(lpszFileName, 0, 0, szName, szExt); - memset(szFullFilename, 0, 32); - strcpy(szFullFilename, szName); - if (m_sndFile.GetType() & (MOD_TYPE_MOD | MOD_TYPE_XM)) - { - // MOD/XM - strcat(szFullFilename, szExt); - szFullFilename[31] = 0; - memcpy(m_sndFile.m_szNames[m_nSample], szFullFilename, MAX_SAMPLENAME); - } else - { - // S3M/IT - szFullFilename[31] = 0; - if (!m_sndFile.m_szNames[m_nSample][0]) mpt::String::Copy(m_sndFile.m_szNames[m_nSample], szFullFilename); - if (strlen(szFullFilename) < 9) strcat(szFullFilename, szExt); - } - mpt::String::Copy(sample.filename, szFullFilename); + if(!m_sndFile.m_szNames[m_nSample][0]) mpt::String::Copy(m_sndFile.m_szNames[m_nSample], szName); + + if (strlen(szName) < 9) strcat(szName, szExt); + mpt::String::Copy(sample.filename, szName); } - if ((m_sndFile.GetType() & MOD_TYPE_XM) && (!(sample.uFlags & CHN_PANNING))) + if ((m_sndFile.GetType() & MOD_TYPE_XM) && !sample.uFlags[CHN_PANNING]) { sample.nPan = 128; - sample.uFlags |= CHN_PANNING; + sample.uFlags.set(CHN_PANNING); } m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); m_modDoc.SetModified(); @@ -1520,7 +1504,7 @@ if (sample.nSustainEnd >= dwEnd) sample.nSustainEnd += (dwEnd-dwStart); else if (sample.nSustainEnd > dwStart) sample.nSustainEnd += (sample.nSustainEnd - dwStart); - sample.uFlags |= CHN_16BIT; + sample.uFlags.set(CHN_16BIT); ctrlSmp::ReplaceSample(sample, (LPSTR)pNewSample, dwNewLen, m_sndFile); if(!selection.selectionActive) { Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-08-11 17:58:59 UTC (rev 2600) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-08-11 21:27:57 UTC (rev 2601) @@ -1056,8 +1056,8 @@ UNREFERENCED_PARAMETER(pSndFile); #endif // MODPLUG_TRACKER - 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 + uint16 fnum = (uint16)MIN(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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |