Use attributes where possible

This commit is contained in:
Martin Natano
2023-04-19 20:55:30 +02:00
parent a93fc07896
commit 093675cdc3
23 changed files with 142 additions and 133 deletions
+2 -2
View File
@@ -826,7 +826,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
switch( pStyle->m_StyleType )
{
case StyleType_OnePlayerTwoSides:
case StyleType_TwoPlayersSharedSides: // fall through?
case StyleType_TwoPlayersSharedSides:
{
// find the middle, and split based on iColNum
// it's unknown if this will work for routine.
@@ -838,7 +838,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
}
break;
case StyleType_OnePlayerOneSide:
case StyleType_TwoPlayersTwoSides: // fall through
case StyleType_TwoPlayersTwoSides:
{
// the code was the same for both of these cases in StepNXA.
if( pPlayerState->m_PlayerNumber == PLAYER_2 )
+1 -1
View File
@@ -334,7 +334,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
{
default:
LuaHelpers::ReportScriptErrorFmt( "CreateBackground() Unknown file type '%s'", vsResolved[0].c_str() );
// fall through
[[fallthrough]];
case FT_Bitmap:
case FT_Sprite:
case FT_Movie:
+14 -14
View File
@@ -185,7 +185,7 @@ void EditMenu::Load( const RString &sType )
// fill in data structures
GetGroupsToShow( m_sGroups );
// In EditMode_Practice this will be filled in by OnRowValueChanged()
if( EDIT_MODE.GetValue() != EditMode_Practice )
m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
@@ -384,7 +384,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
UpdateArrows();
EditMode mode = EDIT_MODE.GetValue();
switch( row )
{
case ROW_GROUP:
@@ -424,9 +424,9 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
GetSongsToShowForGroup(GetSelectedGroup(), m_pSongs);
}
}
m_iSelection[ROW_SONG] = 0;
// fall through
[[fallthrough]];
case ROW_SONG:
if(GetSelectedSong() == nullptr)
{
@@ -466,15 +466,15 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
{
if(SongUtil::GetStepsByDifficulty( GetSelectedSong(), st, Difficulty_Invalid, false) != nullptr)
m_StepsTypes.push_back(st);
// Try to preserve the user's StepsType selection.
if(st == orgSel)
m_iSelection[ROW_STEPS_TYPE] = m_StepsTypes.size() - 1;
}
}
}
// fall through
[[fallthrough]];
case ROW_STEPS_TYPE:
if(GetSelectedStepsType() == StepsType_Invalid)
{
@@ -569,7 +569,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
}
CLAMP( m_iSelection[ROW_STEPS], 0, m_vpSteps.size()-1 );
}
// fall through
[[fallthrough]];
case ROW_STEPS:
if(GetSelectedSteps() == nullptr && mode == EditMode_Practice)
{
@@ -590,8 +590,8 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
m_StepsDisplay.SetFromStepsTypeAndMeterAndDifficultyAndCourseType( GetSelectedSourceStepsType(), 0, GetSelectedDifficulty(), CourseType_Invalid );
}
}
// fall through
case ROW_SOURCE_STEPS_TYPE:
[[fallthrough]];
case ROW_SOURCE_STEPS_TYPE:
if(mode == EditMode_Practice)
{
m_textLabel[ROW_SOURCE_STEPS_TYPE].SetVisible(false);
@@ -626,7 +626,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
StripLockedStepsAndDifficulty( m_vpSteps );
CLAMP( m_iSelection[ROW_SOURCE_STEPS], 0, m_vpSourceSteps.size()-1 );
}
// fall through
[[fallthrough]];
case ROW_SOURCE_STEPS:
if(mode == EditMode_Practice)
{
@@ -690,7 +690,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
}
m_iSelection[ROW_ACTION] = 0;
}
// fall through
[[fallthrough]];
case ROW_ACTION:
if(GetSelectedAction() == EditMenuAction_Invalid)
{
@@ -709,7 +709,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -719,7 +719,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+4 -4
View File
@@ -1,4 +1,4 @@
/*
/*
http://en.wikipedia.org/wiki/INI_file
- names and values are trimmed on both sides
- semicolons start a comment line
@@ -128,7 +128,7 @@ bool IniFile::WriteFile( const RString &sPath ) const
bool IniFile::WriteFile( RageFileBasic &f ) const
{
FOREACH_CONST_Child( this, pKey )
FOREACH_CONST_Child( this, pKey )
{
if( f.PutLine( ssprintf("[%s]", pKey->GetName().c_str()) ) == -1 )
{
@@ -199,7 +199,7 @@ bool IniFile::RenameKey(const RString &from, const RString &to)
/*
* (c) 2001-2004 Adam Clauss, Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -209,7 +209,7 @@ bool IniFile::RenameKey(const RString &from, const RString &to)
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+1 -1
View File
@@ -608,8 +608,8 @@ XNode *LuaHelpers::GetLuaInformation()
sort( c.m_vMethods.begin(), c.m_vMethods.end() );
break;
}
[[fallthrough]];
}
// fall through
case LUA_TUSERDATA: // table or userdata: class instance
{
if( !luaL_callmeta(L, -1, "__type") )
+2 -2
View File
@@ -1515,8 +1515,8 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu
needsBackwards = false;
}
if (needsBackwards) break;
[[fallthrough]];
}
[[fallthrough]];
case NoteDataUtil::mirror:
{
for( int t=0; t<NumTracks; t++ )
@@ -1935,7 +1935,7 @@ static void HyperShuffleNotes( NoteData &inout, int iStartIndex, int iEndIndex)
// If they aren't off, this code can't be reached.
inout.SetTapNote(track, r, TAP_EMPTY);
// Fallthrough
[[fallthrough]];
case TapNoteType_Empty:
// Empty tap notes don't get directly placed in the shuffle table.
// Instead, if they aren't in a hold, they get added to the list
+1 -1
View File
@@ -402,7 +402,7 @@ void NoteField::DrawBeatBar( const float fBeat, BeatBarType type, int iMeasureIn
{
DEFAULT_FAIL( type );
case measure: // handled above
case beat: // fall through
case beat:
fAlpha = BAR_4TH_ALPHA;
iState = 1;
break;
+32 -32
View File
@@ -281,8 +281,8 @@ float SMLoader::RowToBeat( RString line, const int rowsPerBeat )
}
}
void SMLoader::LoadFromTokens(
RString sStepsType,
void SMLoader::LoadFromTokens(
RString sStepsType,
RString sDescription,
RString sDifficulty,
RString sMeter,
@@ -322,11 +322,11 @@ void SMLoader::LoadFromTokens(
if( out.GetDifficulty() == Difficulty_Hard )
{
// HACK: SMANIAC used to be Difficulty_Hard with a special description.
if( sDescription.CompareNoCase("smaniac") == 0 )
if( sDescription.CompareNoCase("smaniac") == 0 )
out.SetDifficulty( Difficulty_Challenge );
// HACK: CHALLENGE used to be Difficulty_Hard with a special description.
if( sDescription.CompareNoCase("challenge") == 0 )
if( sDescription.CompareNoCase("challenge") == 0 )
out.SetDifficulty( Difficulty_Challenge );
}
@@ -348,7 +348,7 @@ void SMLoader::ProcessBGChanges( Song &out, const RString &sValueName, const RSt
BackgroundLayer iLayer = BACKGROUND_LAYER_1;
if( sscanf(sValueName, "BGCHANGES%d", &*ConvertValue<int>(&iLayer)) == 1 )
enum_add(iLayer, -1); // #BGCHANGES2 = BACKGROUND_LAYER_2
bool bValid = iLayer>=0 && iLayer<NUM_BackgroundLayer;
if( !bValid )
{
@@ -383,18 +383,18 @@ void SMLoader::ProcessAttacks( AttackArray &attacks, MsdFile::value_t params )
{
Attack attack;
float end = -9999;
for( unsigned j=1; j < params.params.size(); ++j )
{
std::vector<RString> sBits;
split( params[j], "=", sBits, false );
// Need an identifer and a value for this to work
if( sBits.size() < 2 )
continue;
Trim( sBits[0] );
if( !sBits[0].CompareNoCase("TIME") )
attack.fStartSecond = strtof( sBits[1], nullptr );
else if( !sBits[0].CompareNoCase("LEN") )
@@ -405,16 +405,16 @@ void SMLoader::ProcessAttacks( AttackArray &attacks, MsdFile::value_t params )
{
Trim(sBits[1]);
attack.sModifiers = sBits[1];
if( end != -9999 )
{
attack.fSecsRemaining = end - attack.fStartSecond;
end = -9999;
}
if( attack.fSecsRemaining < 0.0f )
attack.fSecsRemaining = 0.0f;
attacks.push_back( attack );
}
}
@@ -471,7 +471,7 @@ void SMLoader::ParseStops( std::vector<std::pair<float, float>> &out, const RStr
{
std::vector<RString> arrayFreezeExpressions;
split( line, ",", arrayFreezeExpressions );
for( unsigned f=0; f<arrayFreezeExpressions.size(); f++ )
{
std::vector<RString> arrayFreezeValues;
@@ -947,7 +947,7 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
change.m_def.m_sColor2 = aBGChangeValues[10];
change.m_def.m_sColor2.Replace( '^', ',' );
change.m_def.m_sColor2 = RageColor::NormalizeColorString( change.m_def.m_sColor2 );
// fall through
[[fallthrough]];
case 10:
change.m_def.m_sColor1 = aBGChangeValues[9];
change.m_def.m_sColor1.Replace( '^', ',' );
@@ -980,7 +980,7 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
if( !bLoop )
change.m_def.m_sEffect = SBE_StretchNoLoop;
}
// fall through
[[fallthrough]];
case 5:
// param 7 overrides this.
// Backward compatibility:
@@ -1036,7 +1036,7 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
const MsdFile::value_t &sParams = msd.GetValue(i);
RString sValueName = sParams[0];
sValueName.MakeUpper();
// The only tag we care about is the #NOTES tag.
if( sValueName=="NOTES" || sValueName=="NOTES2" )
{
@@ -1048,7 +1048,7 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
iNumParams );
continue;
}
RString stepsType = sParams[1];
RString description = sParams[2];
RString difficulty = sParams[3];
@@ -1064,7 +1064,7 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
{
difficulty = "Challenge";
}
/* Handle hacks that originated back when StepMania didn't have
* Difficulty_Challenge. TODO: Remove the need for said hacks. */
if( difficulty.CompareNoCase("hard") == 0 )
@@ -1074,10 +1074,10 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
* Account for the rogue charts that do this. */
// HACK: SMANIAC used to be Difficulty_Hard with a special description.
if (description.CompareNoCase("smaniac") == 0 ||
description.CompareNoCase("challenge") == 0)
description.CompareNoCase("challenge") == 0)
difficulty = "Challenge";
}
if(!(out.m_StepsType == GAMEMAN->StringToStepsType( stepsType ) &&
out.GetDescription() == description &&
(out.GetDifficulty() == StringToDifficulty(difficulty) ||
@@ -1085,7 +1085,7 @@ bool SMLoader::LoadNoteDataFromSimfile( const RString &path, Steps &out )
{
continue;
}
RString noteData = sParams[6];
Trim( noteData );
out.SetSMNoteData( noteData );
@@ -1141,12 +1141,12 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
}
Steps* pNewNotes = out.CreateSteps();
LoadFromTokens(
sParams[1],
sParams[2],
sParams[3],
sParams[4],
sParams[5],
LoadFromTokens(
sParams[1],
sParams[2],
sParams[3],
sParams[4],
sParams[5],
sParams[6],
*pNewNotes);
@@ -1252,7 +1252,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath
return true;
Steps* pNewNotes = pSong->CreateSteps();
LoadFromTokens(
LoadFromTokens(
sParams[1], sParams[2], sParams[3], sParams[4], sParams[5], sParams[6],
*pNewNotes);
@@ -1427,7 +1427,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
continue;
// the string itself matches
if (f.EqualsNoCase(sChanges.substr(start, f.size()).c_str()))
if (f.EqualsNoCase(sChanges.substr(start, f.size()).c_str()))
{
size_t nextpos = start + f.size();
@@ -1469,7 +1469,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
{
size_t eqpos = sChanges.find('=', start);
size_t compos = sChanges.find(',', start);
if ((eqpos == RString::npos) && (compos == RString::npos))
{
// neither = nor , were found in the remainder of the string. consume the rest of the string.
@@ -1517,7 +1517,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -1527,7 +1527,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+19 -9
View File
@@ -249,10 +249,20 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
f.Write( "#SELECTABLE:" );
switch(out.m_SelectionDisplay)
{
default: ASSERT_M(0, "An invalid selectable value was found for this song!"); // fall through
case Song::SHOW_ALWAYS: f.Write( "YES" ); break;
//case Song::SHOW_NONSTOP: f.Write( "NONSTOP" ); break;
case Song::SHOW_NEVER: f.Write( "NO" ); break;
default:
ASSERT_M(0, "An invalid selectable value was found for this song!");
[[fallthrough]];
case Song::SHOW_ALWAYS:
f.Write( "YES" );
break;
#if 0
case Song::SHOW_NONSTOP:
f.Write( "NONSTOP" );
break;
#endif
case Song::SHOW_NEVER:
f.Write( "NO" );
break;
}
f.PutLine( ";" );
@@ -449,7 +459,7 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const std::vector<St
}
WriteGlobalTags( f, out );
if( bSavingCache )
{
f.PutLine( ssprintf( "// cache tags:" ) );
@@ -514,8 +524,8 @@ bool NotesWriterSSC::WriteEditFileToMachine( const Song *pSong, Steps *pSteps, R
RString sPath = sDir + GetEditFileName(pSong,pSteps);
// Check to make sure that we're not clobering an existing file before opening.
bool bFileNameChanging =
pSteps->GetSavedToDisk() &&
bool bFileNameChanging =
pSteps->GetSavedToDisk() &&
pSteps->GetFilename() != sPath;
if( bFileNameChanging && DoesFileExist(sPath) )
{
@@ -551,7 +561,7 @@ bool NotesWriterSSC::WriteEditFileToMachine( const Song *pSong, Steps *pSteps, R
/*
* (c) 2011 Jason Felds
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -561,7 +571,7 @@ bool NotesWriterSSC::WriteEditFileToMachine( const Song *pSong, Steps *pSteps, R
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+1 -2
View File
@@ -2175,7 +2175,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
case 0:
// autoplay is on, or this is a computer player
iNumTracksHeld = 1;
// fall through
[[fallthrough]];
default:
{
float fCalsFor100Lbs = SCALE( iNumTracksHeld, 1, 2, 0.023f, 0.077f );
@@ -2286,7 +2286,6 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
break;
}
// Fall through to default.
[[fallthrough]];
default:
if( (pTN->type == TapNoteType_Lift) == bRelease )
+3 -1
View File
@@ -9,7 +9,9 @@
* The original documentation stated this was a class for some reason. */
namespace RageException
{
void SM_NORETURN Throw( const char *fmt, ... ) PRINTF(1,2);
[[noreturn]]
void Throw( const char *fmt, ... ) PRINTF(1,2);
void SetCleanupHandler( void (*pHandler)(const RString &sError) );
}
+5 -5
View File
@@ -72,7 +72,7 @@ void ScreenAttract::Cancel( ScreenMessage smSendWhenDone )
bool ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen )
{
if( input.type != IET_FIRST_PRESS )
if( input.type != IET_FIRST_PRESS )
return false; // don't care
switch( input.MenuI )
@@ -80,7 +80,7 @@ bool ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
case GAME_BUTTON_BACK:
if( !BACK_GOES_TO_START_SCREEN )
break;
// fall through
[[fallthrough]];
case GAME_BUTTON_START:
case GAME_BUTTON_COIN:
// If we're not in a game and there aren't enough credits to start,
@@ -161,7 +161,7 @@ void ScreenAttract::GoToStartScreen( RString sScreenName )
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to the ScreenAttract. */
/** @brief Allow Lua to have access to the ScreenAttract. */
class LunaScreenAttract: public Luna<ScreenAttract>
{
public:
@@ -177,7 +177,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenAttract, ScreenWithMenuElements )
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -187,7 +187,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenAttract, ScreenWithMenuElements )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+1 -2
View File
@@ -3239,8 +3239,7 @@ bool ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
if( GAMESTATE->GetCurrentStyle(GAMESTATE->GetMasterPlayerNumber())->m_StyleType != StyleType_TwoPlayersSharedSides )
break;
// fall through to input handling logic:
[[fallthrough]];
[[fallthrough]];
case PLAYER_1:
{
switch( gbt )
+1 -1
View File
@@ -1434,7 +1434,7 @@ void ScreenGameplay::LoadLights()
return;
}
/* fall through */
// fall through
}
NoteDataUtil::LoadTransformedLights( TapNoteData1, m_CabinetLightsNoteData, GAMEMAN->GetStepsTypeInfo(StepsType_lights_cabinet).iNumTracks );
+1 -1
View File
@@ -1852,7 +1852,7 @@ void ScreenSelectMusic::AfterMusicChange()
// we want to load the sample music, but we don't want to
// actually play it. fall through. -aj
case SampleMusicPreviewMode_Normal:
case SampleMusicPreviewMode_LastSong: // fall through
case SampleMusicPreviewMode_LastSong:
// play the sample music
m_sSampleMusicToPlay = pSong->GetPreviewMusicPath();
if(!m_sSampleMusicToPlay.empty() && ActorUtil::GetFileType(m_sSampleMusicToPlay) != FT_Sound)
+17 -7
View File
@@ -24,7 +24,7 @@ void ScreenSyncOverlay::Init()
m_overlay.Load(THEME->GetPathB(m_sName, "overlay"));
AddChild(m_overlay);
Update( 0 );
}
@@ -134,10 +134,20 @@ bool ScreenSyncOverlay::Input( const InputEventPlus &input )
bool bIncrease = true;
switch( input.DeviceI.button )
{
case KEY_F4: a = RevertSyncChanges; break;
case KEY_F9: bIncrease = false; /* fall through */
case KEY_F10: a = ChangeSongBPM; break;
case KEY_F11: bIncrease = false; /* fall through */
case KEY_F4:
a = RevertSyncChanges;
break;
case KEY_F9:
bIncrease = false;
[[fallthrough]];
case KEY_F10:
a = ChangeSongBPM;
break;
case KEY_F11:
bIncrease = false;
[[fallthrough]];
case KEY_F12:
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) )
@@ -292,7 +302,7 @@ void ScreenSyncOverlay::HideHelp()
/*
* (c) 2001-2005 Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -302,7 +312,7 @@ void ScreenSyncOverlay::HideHelp()
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+7 -9
View File
@@ -72,7 +72,7 @@ static INT_PTR CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
{
case IDOK:
g_bHush = !!IsDlgButtonChecked( hWnd, IDC_HUSH );
// fall through
[[fallthrough]];
case IDCANCEL:
EndDialog( hWnd, 0 );
break;
@@ -146,7 +146,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
case WM_INITDIALOG:
{
DialogUtil::SetHeaderFont( hWnd, IDC_STATIC_HEADER_TEXT );
// Set static text
RString sMessage = g_sErrorString;
sMessage.Replace( "\n", "\r\n" );
@@ -183,8 +183,6 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
break;
case IDC_BUTTON_RESTART:
Win32RestartProgram();
// Possibly make W32RP a SM_NORETURN call?
FAIL_M("Win32RestartProgram failed?");
case IDOK:
EndDialog( hWnd, 0 );
break;
@@ -201,7 +199,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
{
case IDC_STATIC_HEADER_TEXT:
case IDC_STATIC_ICON:
hbr = (HBRUSH)::GetStockObject(WHITE_BRUSH);
hbr = (HBRUSH)::GetStockObject(WHITE_BRUSH);
SetBkMode( hdc, OPAQUE );
SetBkColor( hdc, RGB(255,255,255) );
break;
@@ -244,7 +242,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString I
default:
FAIL_M(ssprintf("Unexpected response to Abort/Retry/Ignore dialog: %i", iRet));
}
}
}
Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID )
{
@@ -261,7 +259,7 @@ Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID )
default:
FAIL_M(ssprintf("Unexpected response to Retry/Cancel dialog: %i", iRet));
}
}
}
Dialog::Result DialogDriver_Win32::YesNo( RString sMessage, RString sID )
{
@@ -283,7 +281,7 @@ Dialog::Result DialogDriver_Win32::YesNo( RString sMessage, RString sID )
/*
* (c) 2003-2004 Glenn Maynard, Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -293,7 +291,7 @@ Dialog::Result DialogDriver_Win32::YesNo( RString sMessage, RString sID )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+15 -14
View File
@@ -69,7 +69,8 @@ static void GetExecutableName( char *buf, int bufsize )
}
#endif
static void SM_NORETURN spawn_child_process( int from_parent )
[[noreturn]]
static void spawn_child_process( int from_parent )
{
/* We need to re-exec ourself, to get a clean process. Close all
* FDs except for 0-2 and to_child, and then assign to_child to 3. */
@@ -107,7 +108,7 @@ static int retried_write( int fd, const void *buf, size_t count )
ret = write( fd, buf, count );
}
while( ret == -1 && errno == EINTR && tries-- );
return ret;
}
@@ -134,7 +135,7 @@ static void parent_process( int to_child, const CrashData *crash )
/* 1. Write the CrashData. */
if( !parent_write(to_child, crash, sizeof(CrashData)) )
return;
/* 2. Write info. */
const char *p = RageLog::GetInfo();
int size = strlen( p )+1;
@@ -150,7 +151,7 @@ static void parent_process( int to_child, const CrashData *crash )
return;
if( !parent_write(to_child, p, size) )
return;
/* 4. Write RecentLogs. */
int cnt = 0;
const char *ps[1024];
@@ -175,7 +176,7 @@ static void parent_process( int to_child, const CrashData *crash )
return;
if( !parent_write(to_child, buf, size) )
return;
/* 6. Write the crashed thread's name. */
p = RageThread::GetCurrentThreadName();
size = strlen( p )+1;
@@ -188,7 +189,7 @@ static void parent_process( int to_child, const CrashData *crash )
/* The parent process is the crashed process. It'll send data to the
* child, who will do stuff with it. The parent then waits for the
* child to quit, and exits.
* child to quit, and exits.
*
* We can do whatever fancy things we want in the child process. However,
* let's not open any windows until we at least try to shut down OpenGL,
@@ -216,7 +217,7 @@ static void RunCrashHandler( const CrashData *crash )
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", nullptr );
_exit( 1 );
}
/* Block SIGPIPE, so we get EPIPE. */
struct sigaction sa;
memset( &sa, 0, sizeof(sa) );
@@ -261,7 +262,7 @@ static void RunCrashHandler( const CrashData *crash )
/* Stop other threads. XXX: This prints a spurious ptrace error if any threads
* are already suspended, which happens in ForceCrashHandlerDeadlock(). */
RageThread::HaltAllThreads();
/* We need to be very careful, since we're under crash conditions. Let's fork
* a process and exec ourself to get a clean environment to work in. */
int fds[2];
@@ -313,19 +314,19 @@ static void BacktraceAllThreads( CrashData& crash )
{
int iCnt = 1;
uint64_t iID;
for( int i = 0; RageThread::EnumThreadIDs(i, iID); ++i )
{
if( iID == GetInvalidThreadId() || iID == RageThread::GetCurrentThreadID() )
continue;
BacktraceContext ctx;
if( GetThreadBacktraceContext( iID, &ctx ) )
GetBacktrace( crash.BacktracePointers[iCnt], BACKTRACE_MAX_SIZE, &ctx );
strncpy( crash.m_ThreadName[iCnt], RageThread::GetThreadNameByID(iID), sizeof(crash.m_ThreadName[0])-1 );
++iCnt;
if( iCnt == CrashData::MAX_BACKTRACE_THREADS )
break;
}
@@ -426,7 +427,7 @@ void CrashHandler::InitializeCrashHandler()
/*
* (c) 2003-2004 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -436,7 +437,7 @@ void CrashHandler::InitializeCrashHandler()
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+6 -5
View File
@@ -467,7 +467,7 @@ static bool PointsToValidCall( ULONG_PTR ptr )
return IsValidCall(buf+7, len);
}
void CrashHandler::do_backtrace( const void **buf, size_t size,
void CrashHandler::do_backtrace( const void **buf, size_t size,
HANDLE hProcess, HANDLE hThread, const CONTEXT *pContext )
{
const void **pLast = buf + size - 1;
@@ -535,7 +535,7 @@ void CrashHandler::do_backtrace( const void **buf, size_t size,
MEMORY_BASIC_INFORMATION meminfo;
VirtualQuery((void *)data, &meminfo, sizeof meminfo);
if (!IsExecutableProtection(meminfo.Protect) || meminfo.State!=MEM_COMMIT)
fValid = false;
@@ -563,7 +563,8 @@ void CrashHandler::do_backtrace( const void **buf, size_t size,
}
// Trigger the crash handler. This works even in the debugger.
static void SM_NORETURN debug_crash()
[[noreturn]]
static void debug_crash()
{
// __try {
#if defined(__MSC_VER)
@@ -652,7 +653,7 @@ void CrashHandler::ForceCrash( const char *reason )
* (c) 1998-2001 Avery Lee
* (c) 2003-2004 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -662,7 +663,7 @@ void CrashHandler::ForceCrash( const char *reason )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+3 -2
View File
@@ -1,6 +1,7 @@
#ifndef RESTART_PROGRAM_H
#define RESTART_PROGRAM_H
[[noreturn]]
void Win32RestartProgram();
#endif
@@ -8,7 +9,7 @@ void Win32RestartProgram();
/*
* (c) 2002-2004 Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -18,7 +19,7 @@ void Win32RestartProgram();
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+3 -3
View File
@@ -25,7 +25,7 @@ using CrashHandler::DebugBreak;
#include "archutils/Unix/CrashHandler.h"
#endif
void SM_NORETURN sm_crash( const char *reason )
void sm_crash( const char *reason )
{
#if ( defined(_WINDOWS) && defined(CRASH_HANDLER) ) || defined(MACOSX) || defined(_XDBG)
/* If we're being debugged, throw a debug break so it'll suspend the process. */
@@ -60,7 +60,7 @@ void SM_NORETURN sm_crash( const char *reason )
/*
* (c) 2004 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -70,7 +70,7 @@ void SM_NORETURN sm_crash( const char *reason )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+2 -15
View File
@@ -61,20 +61,6 @@ namespace Checkpoints
#define CHECKPOINT_M(m) (Checkpoints::SetCheckpoint(__FILE__, __LINE__, m))
/**
* @brief Define a macro to tell the compiler that a function doesn't return.
*
* This just improves compiler warnings. This should be placed near the
* beginning of the function prototype (although it looks better near the end,
* VC only accepts it at the beginning). */
#if defined(_MSC_VER)
#define SM_NORETURN __declspec(noreturn)
#elif defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define SM_NORETURN __attribute__ ((__noreturn__))
#else
#define SM_NORETURN
#endif
/**
* @brief A crash has occurred, and we're not getting out of it easily.
*
@@ -84,7 +70,8 @@ namespace Checkpoints
* @param reason the crash reason as determined by prior function calls.
* @return nothing: there is no escape without quitting the program.
*/
void SM_NORETURN sm_crash( const char *reason = "Internal error" );
[[noreturn]]
void sm_crash( const char *reason = "Internal error" );
/**
* @brief Assertion that sets an optional message and brings up the crash
+1
View File
@@ -2429,6 +2429,7 @@ int CZipArchive::CWildcard::Match(LPCTSTR lpszPattern, LPCTSTR lpszText)
/* must match this character exactly */
[[fallthrough]];
default:
if (*lpszPattern != *lpszText)
return matchPattern;