From: <rel...@us...> - 2008-05-10 13:28:05
|
Revision: 211 http://modplug.svn.sourceforge.net/modplug/?rev=211&view=rev Author: relabsoluness Date: 2008-05-10 06:27:55 -0700 (Sat, 10 May 2008) Log Message: ----------- . Fix to crash when loading samples in sample tab; occurs usually with big samples. . Fix to assigning wrong size to orderlist in COrderToPatternTable::OnModTypeChanged. Can(?) cause crashes or other problems at least when saving XM files. Bug was introduced in rev. 199, thus existing in builds .51 and .52. . Fixes to modspecifications Internal: / Some minor modifications e.g. to remove compiler warnings in VC2008. Modified Paths: -------------- trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/CreditStatic.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/OrderToPatternTable.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/soundlib/Load_mid.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_stm.cpp trunk/OpenMPT/soundlib/Load_umx.cpp trunk/OpenMPT/soundlib/Load_xm.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -223,7 +223,7 @@ { // We do not call CModDoc::DoSave as this populates the Recent Files // list with backups... hence we have duplicated code.. :( - bool success=false; + BOOL success=false; CSoundFile* pSndFile = pModDoc->GetSoundFile(); if (pSndFile) { @@ -252,7 +252,7 @@ //Do nothing } } - return success; + return (success == TRUE); } void CAutoSaver::CleanUpBackups(CModDoc *pModDoc) @@ -354,7 +354,7 @@ m_pAutoSaver->SetFilenameTemplate(""); //TODO m_pAutoSaver->SetHistoryDepth(GetDlgItemInt(IDC_AUTOSAVE_HISTORY)); m_pAutoSaver->SetSaveInterval(GetDlgItemInt(IDC_AUTOSAVE_INTERVAL)); - m_pAutoSaver->SetUseOriginalPath(IsDlgButtonChecked(IDC_AUTOSAVE_USEORIGDIR)); + m_pAutoSaver->SetUseOriginalPath(IsDlgButtonChecked(IDC_AUTOSAVE_USEORIGDIR) == BST_CHECKED); GetDlgItemText(IDC_AUTOSAVE_PATH, tempPath); if (!tempPath.IsEmpty() && (tempPath.Right(1)!="\\")) tempPath.Append("\\"); @@ -385,7 +385,7 @@ void CAutoSaverGUI::OnBnClickedAutosaveEnable() { - bool enabled = IsDlgButtonChecked(IDC_AUTOSAVE_ENABLE); + BOOL enabled = IsDlgButtonChecked(IDC_AUTOSAVE_ENABLE); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_INTERVAL), enabled); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_HISTORY), enabled); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_USEORIGDIR), enabled); @@ -399,7 +399,7 @@ void CAutoSaverGUI::OnBnClickedAutosaveUseorigdir() { if (IsDlgButtonChecked(IDC_AUTOSAVE_ENABLE)) { - bool enabled = IsDlgButtonChecked(IDC_AUTOSAVE_USEORIGDIR); + BOOL enabled = IsDlgButtonChecked(IDC_AUTOSAVE_USEORIGDIR); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_PATH), !enabled); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_AUTOSAVE_BROWSE), !enabled); OnSettingsChanged(); Modified: trunk/OpenMPT/mptrack/CreditStatic.cpp =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/mptrack/CreditStatic.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -113,13 +113,13 @@ ASSERT(credits); - if((str = strdup(credits)) == NULL) + if((str = _tcsdup(credits)) == NULL) return; m_ArrCredit.RemoveAll(); ptr1 = str; - while((ptr2 = strchr(ptr1,delimiter)) != NULL) { + while((ptr2 = _tcschr(ptr1,delimiter)) != NULL) { *ptr2 = '\0'; m_ArrCredit.AddTail(ptr1); ptr1 = ptr2+1; Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -53,9 +53,9 @@ { if (lpszPathName) { - CHAR s[_MAX_EXT]; - _splitpath(lpszPathName, NULL, NULL, NULL, s); - if (!stricmp(s, ".dll")) + TCHAR s[_MAX_EXT]; + _tsplitpath(lpszPathName, NULL, NULL, NULL, s); + if (!_tcsicmp(s, _TEXT(".dll"))) { CVstPluginManager *pPluginManager = theApp.GetPluginManager(); if (pPluginManager) @@ -696,7 +696,7 @@ if (m_pszProfileName) { free((void *)m_pszProfileName); } - m_pszProfileName = strdup(m_szConfigFileName); + m_pszProfileName = _tcsdup(m_szConfigFileName); LoadStdProfileSettings(10); // Load standard INI file options (including MRU) @@ -1483,8 +1483,8 @@ -97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6 }; -#define Sinus(x) __SinusTable[x&0xFF] -#define Cosinus(x) __SinusTable[(x+0x40)&0xFF] +#define Sinus(x) __SinusTable[(x)&0xFF] +#define Cosinus(x) __SinusTable[((x)+0x40)&0xFF] #define PI 3.14159265358979323f BOOL CPaletteBitmap::Animate() Modified: trunk/OpenMPT/mptrack/OrderToPatternTable.cpp =================================================================== --- trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/mptrack/OrderToPatternTable.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -94,11 +94,11 @@ { const CModSpecifications specs = m_rSndFile.GetModSpecifications(); - //Resize orderlist if needed. Because old orderlist had 256 elements, not making it + //Resize orderlist if needed. Because old orderlist had MAX_ORDERS(256) elements, not making it //smaller than that even if the modtype doesn't support that many orders. if(specs.ordersMax < GetCount()) { - resize(max(MAX_PATTERNS, specs.ordersMax)); + resize(max(MAX_ORDERS, specs.ordersMax)); for(ORDERINDEX i = GetCount(); i>specs.ordersMax; --i) (*this)[i-1] = GetInvalidPatIndex(); } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -595,7 +595,9 @@ int smplsize, oldsmin, oldsmax; int yrange = cy/2; signed char *psample = (signed char *)pSampleData; - int y0 = 0, xmax, posincr, posfrac, poshi; + //int y0 = 0, xmax, posincr, posfrac, poshi; + int32 y0 = 0, xmax, poshi; + uint64 posincr, posfrac; if (len <= 0) return; smplsize = (uFlags & CHN_16BIT) ? 2 : 1; @@ -612,21 +614,24 @@ { xmax = len>>(m_nZoom-1); if (xmax > cx) xmax = cx; - posincr = 1<<(m_nZoom-1+16); + posincr = (uint64(1) << (m_nZoom-1+16)); } else { xmax = cx; - posincr = _muldiv(len, 0x10000, cx); + //posincr = _muldiv(len, 0x10000, cx); + posincr = uint64(len) * uint64(0x10000) / uint64(cx); } ::MoveToEx(hdc, 0, ymed, NULL); posfrac = 0; poshi = 0; for (int x=0; x<xmax; x++) { - int smin, smax, scanlen; + //int smin, smax, scanlen; + int smin, smax; + int32 scanlen; posfrac += posincr; - scanlen = (posfrac+0xffff) >> 16; + scanlen = static_cast<int32>((posfrac+0xffff) >> 16); if (poshi >= len) poshi = len-1; if (poshi+scanlen > len) scanlen = len-poshi; if (scanlen < 1) scanlen = 1; @@ -692,7 +697,7 @@ ::LineTo(hdc, x, smin); oldsmin = smin; oldsmax = smax; - poshi += (posfrac>>16); + poshi += static_cast<int32>(posfrac>>16); posfrac &= 0xffff; } } @@ -2320,4 +2325,4 @@ } return NULL; -} \ No newline at end of file +} Modified: trunk/OpenMPT/soundlib/Load_mid.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mid.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/Load_mid.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -763,7 +763,7 @@ CHAR s[32]; memcpy(s, ptrk->ptracks, k); s[k] = 0; - if ((!strnicmp(s, "Copyri", 6)) || (!s[0])) break; + if ((!_strnicmp(s, "Copyri", 6)) || (!s[0])) break; if (i == 0x03) { if (!m_szNames[0][0]) strcpy(m_szNames[0], s); Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -348,7 +348,7 @@ LPSTR p = (LPSTR)(lpStream+dwMemPos); UINT flags = 0; if (dwMemPos + 5 >= dwMemLength) break; - if (!strnicmp(p, "ADPCM", 5)) + if (!_strnicmp(p, "ADPCM", 5)) { flags = 3; p += 5; Modified: trunk/OpenMPT/soundlib/Load_stm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_stm.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/Load_stm.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -67,8 +67,8 @@ if ((!lpStream) || (dwMemLength < sizeof(STMHEADER))) return FALSE; if ((phdr->filetype != 2) || (phdr->unused != 0x1A) - || ((strnicmp(phdr->trackername, "!SCREAM!", 8)) - && (strnicmp(phdr->trackername, "BMOD2STM", 8)))) return FALSE; + || ((_strnicmp(phdr->trackername, "!SCREAM!", 8)) + && (_strnicmp(phdr->trackername, "BMOD2STM", 8)))) return FALSE; memcpy(m_szNames[0], phdr->songname, 20); // Read STM header m_nType = MOD_TYPE_STM; Modified: trunk/OpenMPT/soundlib/Load_umx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_umx.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/Load_umx.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -38,7 +38,7 @@ return ReadS3M(lpStream + dwRipOfs, dwMemLength - dwRipOfs); } // XM - if (!strnicmp((LPCSTR)(lpStream+uscan), "Extended Module", 15)) + if (!_strnicmp((LPCSTR)(lpStream+uscan), "Extended Module", 15)) { DWORD dwRipOfs = uscan; return ReadXM(lpStream + dwRipOfs, dwMemLength - dwRipOfs); Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2008-05-10 13:27:55 UTC (rev 211) @@ -680,6 +680,9 @@ header.norder++; if ((Order[i] >= header.patterns) && (Order[i] < MAX_PATTERNS)) header.patterns = Order[i]+1; }*/ + if(Order.GetCount() < MAX_ORDERS) + Order.resize(MAX_ORDERS, Order.GetInvalidPatIndex()); + for (i=MAX_ORDERS-1; i>=0; i--) { // walk backwards over orderlist if ((Order[i]!=0xFF) && (header.norder==0)) { header.norder=i+1; //find last used order Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2008-04-13 21:53:04 UTC (rev 210) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2008-05-10 13:27:55 UTC (rev 211) @@ -4,6 +4,7 @@ //Simple struct to gather various modspecifications in one place. //Feel free to improve. struct CModSpecifications +//======================= { //NOTE: If changing order, update all initializations below. char fileExtension[5]; @@ -108,7 +109,7 @@ 256, //Max pattern rows 20, //Max mod name length 31, //SamplesMax - 256, //instrumentMax + 200, //instrumentMax mixLevels_original, //defaultMixLevels 0 //Max MIDI mapping directives }; @@ -118,16 +119,16 @@ { //TODO: Set correct values. "xm", //File extension - 64, //Pattern max. - 128, //Order max. + 240, //Pattern max. + 256, //Order max. 4, //Channel min - 64, //Channel max + 127, //Channel max 32, //Min tempo 512, //Max tempo 4, //Min pattern rows 1024, //Max pattern rows 20, //Max mod name length - 31, //SamplesMax + 4000, //SamplesMax 256, //instrumentMax mixLevels_117RC3, //defaultMixLevels 200 //Max MIDI mapping directives @@ -146,7 +147,7 @@ 64, //Min pattern rows 64, //Max pattern rows 27, //Max mod name length - 31, //SamplesMax + 99, //SamplesMax 0, //instrumentMax mixLevels_original, //defaultMixLevels 0 //Max MIDI mapping directives @@ -165,7 +166,7 @@ 64, //Min pattern rows 64, //Max pattern rows 27, //Max mod name length - 31, //SamplesMax + 99, //SamplesMax 0, //instrumentMax mixLevels_original, //defaultMixLevels 0 //Max MIDI mapping directives @@ -185,7 +186,7 @@ 256, //Max pattern rows 25, //Max mod name length 256, //SamplesMax - 256, //instrumentMax + 200, //instrumentMax mixLevels_original, //defaultMixLevels 0 //Max MIDI mapping directives }; @@ -212,6 +213,4 @@ - - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |