replace ASSERT(0) with useful fail messages

This commit is contained in:
Devin J. Pohly
2012-12-27 16:59:35 -05:00
parent 376056a0cf
commit bd0e2074ad
71 changed files with 289 additions and 245 deletions
+8 -7
View File
@@ -183,10 +183,8 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
break;
case IDC_BUTTON_RESTART:
Win32RestartProgram();
// not reached
ASSERT( 0 );
EndDialog( hWnd, 0 );
break;
// Possibly make W32RP a NORETURN call?
FAIL_M("Win32RestartProgram failed?");
case IDOK:
EndDialog( hWnd, 0 );
break;
@@ -242,8 +240,9 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString I
{
case IDABORT: return Dialog::abort;
case IDRETRY: return Dialog::retry;
default: ASSERT(0);
case IDIGNORE: return Dialog::ignore;
default:
FAIL_M(ssprintf("Unexpected response to Abort/Retry/Ignore dialog: %i", iRet));
}
}
@@ -258,8 +257,9 @@ Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID )
switch( iRet )
{
case IDRETRY: return Dialog::retry;
default: ASSERT(0);
case IDCANCEL: return Dialog::abort;
default:
FAIL_M(ssprintf("Unexpected response to Retry/Cancel dialog: %i", iRet));
}
}
@@ -274,8 +274,9 @@ Dialog::Result DialogDriver_Win32::YesNo( RString sMessage, RString sID )
switch( iRet )
{
case IDYES: return Dialog::yes;
default: ASSERT(0);
case IDNO: return Dialog::no;
default:
FAIL_M(ssprintf("Unexpected response to Yes/No dialog: %i", iRet));
}
}
@@ -269,7 +269,7 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
switch( device.type )
{
default:
ASSERT(0);
FAIL_M(ssprintf("Unsupported DI device type: %i", device.type));
case device.KEYBOARD:
{
unsigned char keys[256];
+3 -2
View File
@@ -452,10 +452,11 @@ void MovieTexture_DShow::CreateTexture()
return;
PixelFormat pixfmt;
switch( TEXTUREMAN->GetPrefs().m_iMovieColorDepth )
int depth = TEXTUREMAN->GetPrefs().m_iMovieColorDepth;
switch( depth )
{
default:
ASSERT(0);
FAIL_M(ssprintf("Unsupported movie color depth: %i", depth));
case 16:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;
@@ -154,7 +154,8 @@ static void FixLilEndian()
{
case 24: m = Swap24(m); break;
case 32: m = Swap32(m); break;
default: ASSERT(0);
default:
FAIL_M(ssprintf("Unsupported BPP value: %i", pf.bpp));
}
pf.masks[mask] = m;
}
@@ -232,10 +232,11 @@ void MovieTexture_Generic::CreateTexture()
{
/* We weren't given a natively-supported pixel format. Pick a supported
* one. This is a fallback case, and implies a second conversion. */
switch( TEXTUREMAN->GetPrefs().m_iMovieColorDepth )
int depth = TEXTUREMAN->GetPrefs().m_iMovieColorDepth;
switch( depth )
{
default:
ASSERT(0);
FAIL_M(ssprintf("Unsupported movie color depth: %i", depth));
case 16:
if( DISPLAY->SupportsTextureFormat(PixelFormat_RGB5) )
pixfmt = PixelFormat_RGB5;