From: <sag...@us...> - 2010-04-18 20:21:54
|
Revision: 571 http://modplug.svn.sourceforge.net/modplug/?rev=571&view=rev Author: saga-games Date: 2010-04-18 20:21:47 +0000 (Sun, 18 Apr 2010) Log Message: ----------- [Fix] Song Length Estimation: In some special cases (f.e. the order +++, ---, 0), the length estimation was running into an infinite loop. Modified Paths: -------------- trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-18 14:46:44 UTC (rev 570) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2010-04-18 20:21:47 UTC (rev 571) @@ -132,13 +132,13 @@ // Check if pattern is valid nPattern = Order[nCurrentPattern]; - bool positionJumpOnThisRow=false; - bool patternBreakOnThisRow=false; + bool positionJumpOnThisRow = false; + bool patternBreakOnThisRow = false; - while (nPattern >= Patterns.Size()) + while(nPattern >= Patterns.Size()) { - // End of song ? - if ((nPattern == Order.GetInvalidPatIndex()) || (nCurrentPattern >= Order.size())) + // End of song? + if((nPattern == Order.GetInvalidPatIndex()) || (nCurrentPattern >= Order.size())) { if(nCurrentPattern == m_nRestartPos) break; @@ -150,6 +150,8 @@ } nPattern = (nCurrentPattern < Order.size()) ? Order[nCurrentPattern] : Order.GetInvalidPatIndex(); nNextPattern = nCurrentPattern; + if(IsRowVisited(nCurrentPattern, 0, true)) + break; } // Skip non-existing patterns if ((nPattern >= Patterns.Size()) || (!Patterns[nPattern])) @@ -220,9 +222,9 @@ positionJumpOnThisRow=true; nNextPattern = (ORDERINDEX)param; // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx - if (!patternBreakOnThisRow || (GetType() == MOD_TYPE_XM)) { + if(!patternBreakOnThisRow || (GetType() == MOD_TYPE_XM)) nNextRow = 0; - } + if (bAdjust) { pChn->nPatternLoopCount = 0; @@ -1923,7 +1925,8 @@ //occurs also when pattern loop is enabled. } // see http://lpchip.com/modplug/viewtopic.php?t=2769 - FastTracker resets Dxx if Bxx is called _after_ Dxx - if(GetType() == MOD_TYPE_XM) nBreakRow = 0; + if(GetType() == MOD_TYPE_XM) + nBreakRow = 0; break; // Pattern Break @@ -4156,5 +4159,5 @@ if(Patterns.IsValidPat(nPat)) return (size_t)(Patterns[nPat].GetNumRows()); else - return 0; + return 1; // invalid patterns consist of a "fake" row. } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |