本文整理汇总了C++中FAIL_M函数的典型用法代码示例。如果您正苦于以下问题:C++ FAIL_M函数的具体用法?C++ FAIL_M怎么用?C++ FAIL_M使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FAIL_M函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ap
// szNameArray is of size iMax; pNameCache is of size iMax+2.
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr<RString> *pNameCache )
{
if( unlikely(pNameCache[0].get() == NULL) )
{
for( int i = 0; i < iMax; ++i )
{
auto_ptr<RString> ap( new RString( szNameArray[i] ) );
pNameCache[i] = ap;
}
auto_ptr<RString> ap( new RString );
pNameCache[iMax+1] = ap;
}
// iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted
// to a string.
// Maybe we should assert on _Invalid? It seems better to make
// the caller check that they're supplying a valid enum value instead of
// returning an inconspicuous garbage value (empty string). -Chris
if (iVal < 0)
FAIL_M(ssprintf("Value %i cannot be negative for enums! Enum hint: %s", iVal, szNameArray[0]));
if (iVal == iMax)
FAIL_M(ssprintf("Value %i cannot be a string with value %i! Enum hint: %s", iVal, iMax, szNameArray[0]));
if (iVal > iMax+1)
FAIL_M(ssprintf("Value %i is past the invalid value %i! Enum hint: %s", iVal, iMax, szNameArray[0]));
return *pNameCache[iVal];
}
示例2: CloseDevice
void CloseDevice()
{
MMRESULT mRes=0;
if(m_hWaveIn)
{
UnPrepareBuffers();
mRes=waveInClose(m_hWaveIn);
}
if(m_hOPFile)
{
mRes=mmioAscend(m_hOPFile, &m_stckOut, 0);
if(mRes!=MMSYSERR_NOERROR)
{
FAIL_M("bad");
}
mRes=mmioAscend(m_hOPFile, &m_stckOutRIFF, 0);
if(mRes!=MMSYSERR_NOERROR)
{
FAIL_M("bad");
}
mmioClose(m_hOPFile,0);
m_hOPFile=NULL;
}
m_hWaveIn=NULL;
}
示例3: FAIL_M
bool RageSoundDriver_OSS::GetData()
{
/* Look for a free buffer. */
audio_buf_info ab;
if( ioctl(fd, SNDCTL_DSP_GETOSPACE, &ab) == -1 )
FAIL_M( ssprintf("ioctl(SNDCTL_DSP_GETOSPACE): %s", strerror(errno)) );
if( !ab.fragments )
return false;
const int chunksize = ab.fragsize;
static int16_t *buf = NULL;
if(!buf)
buf = new int16_t[chunksize / sizeof(int16_t)];
this->Mix( buf, chunksize/bytes_per_frame, last_cursor_pos, GetPosition() );
int wrote = write( fd, buf, chunksize );
if( wrote != chunksize )
FAIL_M( ssprintf("write didn't: %i (%s)", wrote, wrote == -1? strerror(errno): "") );
/* Increment last_cursor_pos. */
last_cursor_pos += chunksize / bytes_per_frame;
return true;
}
示例4: PathForFolderType
static void PathForFolderType( char dir[PATH_MAX], OSType folderType )
{
FSRef fs;
if( FSFindFolder(kUserDomain, folderType, kDontCreateFolder, &fs) )
FAIL_M( ssprintf("FSFindFolder(%lu) failed.", folderType) );
if( FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
FAIL_M( "FSRefMakePath() failed." );
}
示例5: FAIL_M
void InputHandler::ButtonPressed( DeviceInput di, bool Down )
{
if( di.ts.IsZero() )
{
di.ts = m_LastUpdate.Half();
++m_iInputsSinceUpdate;
}
INPUTFILTER->ButtonPressed( di, Down );
if( m_iInputsSinceUpdate >= 50 )
{
/*
* We havn't received an update in a long time, so warn about it. We expect to receive
* input events before the first UpdateTimer call only on the first update. Leave
* m_iInputsSinceUpdate where it is, so we only warn once. Only updates that didn't provide
* a timestamp are counted; if the driver provides its own timestamps, UpdateTimer is
* optional.
*
* This can also happen if a device sends a lot of inputs at once; for example, a keyboard
* driver that sends every key in one frame. If that's really needed (wasteful), increase
* the threshold.
*/
LOG->Warn( "InputHandler::ButtonPressed: Driver sent 50 updates without calling UpdateTimer" );
FAIL_M("x");
}
}
示例6: switch
void Course::SetCourseType( CourseType ct )
{
if( GetCourseType() == ct )
return;
m_bRepeat = false;
m_iLives = -1;
if( !m_vEntries.empty() )
m_vEntries[0].fGainSeconds = 0;
switch( ct )
{
default:
FAIL_M(ssprintf("Invalid course type: %i", ct));
case COURSE_TYPE_NONSTOP:
break;
case COURSE_TYPE_ONI:
m_iLives = 4;
break;
case COURSE_TYPE_ENDLESS:
m_bRepeat = true;
break;
case COURSE_TYPE_SURVIVAL:
if( !m_vEntries.empty() )
m_vEntries[0].fGainSeconds = 120;
break;
}
}
示例7: ASSERT
void ModelManager::UnloadModel( RageModelGeometry *m )
{
m->m_iRefCount--;
ASSERT( m->m_iRefCount >= 0 );
if( m->m_iRefCount )
return; /* Can't unload models that are still referenced. */
for( auto i = m_mapFileToGeometry.begin(); i != m_mapFileToGeometry.end(); ++i )
{
if( i->second == m )
{
if( m_Prefs.m_bDelayedUnload )
{
// leave this geometry loaded
return;
}
else
{
m_mapFileToGeometry.erase( i ); // remove map entry
Rage::safe_delete( m ); // free the texture
return;
}
}
}
FAIL_M("Tried to delete a texture that wasn't loaded");
}
示例8: FAIL_M
void Alsa9Buf::SetSampleRate(int hz)
{
samplerate = hz;
samplerate_set_explicitly = true;
if( !SetHWParams() )
{
/*
* If this fails, we're no longer set up; if we call SW param calls,
* ALSA will assert out on us (instead of gracefully returning an error).
*
* If we fail here, it means we set up the initial stream, but can't
* configure it to the sample rate we want. This happened on a CS46xx
* with an old ALSA version, at least: snd_pcm_hw_params failed
* with ENOMEM. It set up only 10 44.1khz streams; it may have been
* trying to increase one to 48khz and, for some reason, that needed
* more card memory. (I've tried to work around that by setting up
* streams as 48khz to begin with, so we set it up as the maximum
* to begin with.)
*/
FAIL_M( ssprintf("SetHWParams(%i) failed", hz) );
}
SetSWParams();
}
示例9: FixLilEndian
static void FixLilEndian()
{
#if defined(ENDIAN_LITTLE)
static bool Initialized = false;
if( Initialized )
return;
Initialized = true;
for( int i = 0; i < AVPixelFormats[i].bpp; ++i )
{
AVPixelFormat_t &pf = AVPixelFormats[i];
if( !pf.bByteSwapOnLittleEndian )
continue;
for( int mask = 0; mask < 4; ++mask)
{
int m = pf.masks[mask];
switch( pf.bpp )
{
case 24: m = Swap24(m); break;
case 32: m = Swap32(m); break;
default:
FAIL_M(ssprintf("Unsupported BPP value: %i", pf.bpp));
}
pf.masks[mask] = m;
}
}
#endif
}
示例10: switch
void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats )
{
LifeMeter::Load( pPlayerState, pPlayerStageStats );
PlayerNumber pn = pPlayerState->m_PlayerNumber;
DrainType dtype = pPlayerState->m_PlayerOptions.GetStage().m_DrainType;
switch( dtype )
{
case DrainType_Normal:
m_fLifePercentage = INITIAL_VALUE;
break;
/* These types only go down, so they always start at full. */
case DrainType_NoRecover:
case DrainType_SuddenDeath:
m_fLifePercentage = 1.0f; break;
default:
FAIL_M(ssprintf("Invalid DrainType: %i", dtype));
}
// Change life difficulty to really easy if merciful beginner on
m_bMercifulBeginnerInEffect =
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
GAMESTATE->IsPlayerEnabled( pPlayerState ) &&
GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == Difficulty_Beginner &&
PREFSMAN->m_bMercifulBeginner;
AfterLifeChanged();
}
示例11: switch
void LifeMeterTime::ChangeLife( TapNoteScore tns )
{
if( GetLifeSeconds() <= 0 )
return;
float fMeterChange = 0;
switch( tns )
{
default:
FAIL_M(ssprintf("Invalid TapNoteScore: %i", tns));
case TNS_W1: fMeterChange = g_fTimeMeterSecondsChange[SE_W1]; break;
case TNS_W2: fMeterChange = g_fTimeMeterSecondsChange[SE_W2]; break;
case TNS_W3: fMeterChange = g_fTimeMeterSecondsChange[SE_W3]; break;
case TNS_W4: fMeterChange = g_fTimeMeterSecondsChange[SE_W4]; break;
case TNS_W5: fMeterChange = g_fTimeMeterSecondsChange[SE_W5]; break;
case TNS_Miss: fMeterChange = g_fTimeMeterSecondsChange[SE_Miss]; break;
case TNS_HitMine: fMeterChange = g_fTimeMeterSecondsChange[SE_HitMine]; break;
case TNS_CheckpointHit: fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointHit]; break;
case TNS_CheckpointMiss:fMeterChange = g_fTimeMeterSecondsChange[SE_CheckpointMiss]; break;
}
float fOldLife = m_fLifeTotalLostSeconds;
m_fLifeTotalLostSeconds -= fMeterChange;
SendLifeChangedMessage( fOldLife, tns, HoldNoteScore_Invalid );
}
示例12: switch
int ScoreKeeperMAX2::TapNoteScoreToGradePoints( TapNoteScore tns, bool bBeginner )
{
if( !GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS )
tns = TNS_PERFECT;
/* This is used for Oni percentage displays. Grading values are currently in
* StageStats::GetGrade. */
int iWeight = 0;
switch( tns )
{
case TNS_NONE: iWeight = 0;
case TNS_AVOIDED_MINE: iWeight = 0;
case TNS_HIT_MINE: iWeight = PREFSMAN->m_iGradeWeightHitMine; break;
case TNS_MISS: iWeight = PREFSMAN->m_iGradeWeightMiss; break;
case TNS_BOO: iWeight = PREFSMAN->m_iGradeWeightBoo; break;
case TNS_GOOD: iWeight = PREFSMAN->m_iGradeWeightGood; break;
case TNS_GREAT: iWeight = PREFSMAN->m_iGradeWeightGreat; break;
case TNS_PERFECT: iWeight = PREFSMAN->m_iGradeWeightPerfect; break;
case TNS_MARVELOUS: iWeight = PREFSMAN->m_iGradeWeightMarvelous;break;
default: FAIL_M( ssprintf("%i", tns) );
}
if( bBeginner && PREFSMAN->m_bMercifulBeginner )
iWeight = max( 0, iWeight );
return iWeight;
}
示例13: URLRageFile_open
int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags )
{
if( strncmp( filename, "rage://", 7 ) )
{
LOG->Warn("URLRageFile_open: Unexpected path \"%s\"", filename );
return -EIO;
}
filename += 7;
int mode = 0;
switch( flags )
{
case URL_RDONLY: mode = RageFile::READ; break;
case URL_WRONLY: mode = RageFile::WRITE | RageFile::STREAMED; break;
case URL_RDWR: FAIL_M( "O_RDWR unsupported" );
}
RageFile *f = new RageFile;
if( !f->Open(filename, mode) )
{
LOG->Trace("Error opening \"%s\": %s", filename, f->GetError().c_str() );
delete f;
return -EIO;
}
h->is_streamed = false;
h->priv_data = f;
return 0;
}
示例14: ASSERT_M
GameInput Style::StyleInputToGameInput( int iCol, PlayerNumber pn ) const
{
ASSERT_M( pn < NUM_PLAYERS && iCol < MAX_COLS_PER_PLAYER,
ssprintf("P%i C%i", pn, iCol) );
bool bUsingOneSide = m_StyleType != StyleType_OnePlayerTwoSides && m_StyleType != StyleType_TwoPlayersSharedSides;
FOREACH_ENUM( GameController, gc)
{
if( bUsingOneSide && gc != (int) pn )
continue;
int iButtonsPerController = INPUTMAPPER->GetInputScheme()->m_iButtonsPerController;
for( GameButton gb=GAME_BUTTON_NEXT; gb < iButtonsPerController; gb=(GameButton)(gb+1) )
{
int iThisInputCol = m_iInputColumn[gc][gb-GAME_BUTTON_NEXT];
if( iThisInputCol == END_MAPPING )
break;
if( iThisInputCol == iCol )
return GameInput( gc, gb );
}
}
FAIL_M( ssprintf("Invalid column number %i for player %i in the style %s", iCol, pn, GAMESTATE->GetCurrentStyle()->m_szName) );
};
示例15: CFBundleGetMainBundle
Dialog::Result DialogDriver_MacOSX::AbortRetryIgnore( RString sMessage, RString sID )
{
CFBundleRef bundle = CFBundleGetMainBundle();
CFStringRef sIgnore = LSTRING( bundle, "Ignore" );
CFStringRef sRetry = LSTRING( bundle, "Retry" );
CFStringRef sAbort = LSTRING( bundle, "Abort" );
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sIgnore, sRetry, sAbort );
CFRelease( sIgnore );
CFRelease( sRetry );
CFRelease( sAbort );
switch( result )
{
case kCFUserNotificationDefaultResponse:
Dialog::IgnoreMessage( sID );
return Dialog::ignore;
case kCFUserNotificationAlternateResponse:
return Dialog::retry;
case kCFUserNotificationOtherResponse:
case kCFUserNotificationCancelResponse:
return Dialog::abort;
default:
FAIL_M( ssprintf("Invalid response: %d.", int(result)) );
}
}