diff --git a/src/RageThreads.cpp b/src/RageThreads.cpp index 4d502a8a94..e3aeb6b946 100644 --- a/src/RageThreads.cpp +++ b/src/RageThreads.cpp @@ -751,12 +751,11 @@ void RageSemaphore::Post() void RageSemaphore::Wait( bool bFailOnTimeout ) { -retry: - if( m_pSema->Wait() ) - return; - - if( !bFailOnTimeout || RageThread::GetIsShowingDialog() ) - goto retry; + do + { + if( m_pSema->Wait() ) + return; + } while( !bFailOnTimeout || RageThread::GetIsShowingDialog() ); /* We waited too long. We're probably deadlocked, though unlike mutexes, we can't * tell which thread we're stuck on. */ diff --git a/src/ScreenSelectMaster.cpp b/src/ScreenSelectMaster.cpp index ab979cc502..24118fa488 100644 --- a/src/ScreenSelectMaster.cpp +++ b/src/ScreenSelectMaster.cpp @@ -390,20 +390,19 @@ bool ScreenSelectMaster::Move( PlayerNumber pn, MenuDir dir ) int iSwitchToIndex = m_iChoice[pn]; set seen; -try_again: - map::const_iterator iter = m_mapCurrentChoiceToNextChoice[dir].find( iSwitchToIndex ); - if( iter != m_mapCurrentChoiceToNextChoice[dir].end() ) - iSwitchToIndex = iter->second; + do + { + map::const_iterator iter = m_mapCurrentChoiceToNextChoice[dir].find( iSwitchToIndex ); + if( iter != m_mapCurrentChoiceToNextChoice[dir].end() ) + iSwitchToIndex = iter->second; - if( iSwitchToIndex < 0 || iSwitchToIndex >= (int) m_aGameCommands.size() ) // out of choice range - return false; // can't go that way - if( seen.find(iSwitchToIndex) != seen.end() ) - return false; // went full circle and none found - seen.insert( iSwitchToIndex ); - - if( !m_aGameCommands[iSwitchToIndex].IsPlayable() && !DO_SWITCH_ANYWAYS ) - goto try_again; + if( iSwitchToIndex < 0 || iSwitchToIndex >= (int) m_aGameCommands.size() ) // out of choice range + return false; // can't go that way + if( seen.find(iSwitchToIndex) != seen.end() ) + return false; // went full circle and none found + seen.insert( iSwitchToIndex ); + } while( !m_aGameCommands[iSwitchToIndex].IsPlayable() && !DO_SWITCH_ANYWAYS ); return ChangeSelection( pn, dir, iSwitchToIndex ); } diff --git a/src/smpackage/SMPackageInstallDlg.cpp b/src/smpackage/SMPackageInstallDlg.cpp index 062a2a9c23..9161ad9102 100644 --- a/src/smpackage/SMPackageInstallDlg.cpp +++ b/src/smpackage/SMPackageInstallDlg.cpp @@ -332,58 +332,58 @@ void CSMPackageInstallDlg::OnOK() ProgressInit = 1; } -retry_unzip: - - // Extract the files - const RString sFile = vs[i]; - LOG->Trace( "Extracting: "+sFile ); - - RString sError; + Dialog::Result result; + do { - int iErr; - RageFileBasic *pFileFrom = zip.Open( sFile, RageFile::READ, iErr ); - if( pFileFrom == NULL ) + // Extract the files + const RString sFile = vs[i]; + LOG->Trace( "Extracting: "+sFile ); + + RString sError; { - sError = ssprintf( ERROR_OPENING_SOURCE_FILE.GetValue(), sFile.c_str(), ssprintf("%d",iErr).c_str() ); - goto show_error; + int iErr; + RageFileBasic *pFileFrom = zip.Open( sFile, RageFile::READ, iErr ); + if( pFileFrom == NULL ) + { + sError = ssprintf( ERROR_OPENING_SOURCE_FILE.GetValue(), sFile.c_str(), ssprintf("%d",iErr).c_str() ); + goto show_error; + } + + int iError; + RageFileBasic *pFileTo = dir.Open( sFile, RageFile::WRITE, iError ); + if( pFileTo == NULL ) + { + sError = ssprintf( ERROR_OPENING_DESTINATION_FILE.GetValue(), sFile.c_str(), pFileTo->GetError().c_str() ); + goto show_error; + } + + RString sErr; + if( !FileCopy(*pFileFrom, *pFileTo, sErr) ) + { + sError = ssprintf( ERROR_COPYING_FILE.GetValue(), sFile.c_str(), sErr.c_str() ); + goto show_error; + } + + SAFE_DELETE( pFileFrom ); + SAFE_DELETE( pFileTo ); } - int iError; - RageFileBasic *pFileTo = dir.Open( sFile, RageFile::WRITE, iError ); - if( pFileTo == NULL ) - { - sError = ssprintf( ERROR_OPENING_DESTINATION_FILE.GetValue(), sFile.c_str(), pFileTo->GetError().c_str() ); - goto show_error; - } - - RString sErr; - if( !FileCopy(*pFileFrom, *pFileTo, sErr) ) - { - sError = ssprintf( ERROR_COPYING_FILE.GetValue(), sFile.c_str(), sErr.c_str() ); - goto show_error; - } - - SAFE_DELETE( pFileFrom ); - SAFE_DELETE( pFileTo ); - } - - goto done_with_file; + break; show_error: - switch( Dialog::AbortRetryIgnore(sError) ) - { - case Dialog::abort: - exit(1); // better way to exit? - break; - case Dialog::retry: - goto retry_unzip; - break; - case Dialog::ignore: - // do nothing - break; - } - -done_with_file: + Dialog::Result result = Dialog::AbortRetryIgnore(sError); + switch( result ) + { + case Dialog::abort: + exit(1); // better way to exit? + break; + case Dialog::retry: + break; + case Dialog::ignore: + // do nothing + break; + } + } while( result == Dialog::retry ); pProgress1->StepIt(); //increase the progress bar of 1 step } @@ -460,4 +460,4 @@ HBRUSH CSMPackageInstallDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. - */ \ No newline at end of file + */