本文整理汇总了C++中CASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CASSERT函数的具体用法?C++ CASSERT怎么用?C++ CASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteMission
void DeleteMission(CampaignOptions *co)
{
CASSERT(
co->MissionIndex < (int)co->Setting.Missions.size,
"invalid mission index");
MissionTerminate(CampaignGetCurrentMission(co));
CArrayDelete(&co->Setting.Missions, co->MissionIndex);
if (co->MissionIndex >= (int)co->Setting.Missions.size)
{
co->MissionIndex = MAX(0, (int)co->Setting.Missions.size - 1);
}
}
示例2: CBitmapSurface_Composite
static CStatus
CBitmapSurface_Composite(CSurface *_this,
CUInt32 x,
CUInt32 y,
CUInt32 width,
CUInt32 height,
pixman_image_t *src,
pixman_image_t *mask,
pixman_operator_t op)
{
/* declarations */
CBitmap *image;
/* assertions */
CASSERT((_this != 0));
CASSERT((src != 0));
CASSERT((mask != 0));
/* get the image */
image = ((CBitmapSurface *)_this)->image;
/* perform the composite synchronously */
CMutex_Lock(image->lock);
{
/* ensure the image data isn't locked */
if(image->locked)
{
CMutex_Unlock(image->lock);
return CStatus_InvalidOperation_ImageLocked;
}
/* perform the composite */
pixman_composite
(op, src, mask, image->image, 0, 0, 0, 0, x, y, width, height);
}
CMutex_Unlock(image->lock);
/* return successfully */
return CStatus_OK;
}
示例3: NetInputPoll
void NetInputPoll(NetInput *n)
{
if (n->channel.sock == NULL)
{
return;
}
switch (n->channel.state)
{
case CHANNEL_STATE_CLOSED:
CASSERT(false, "Unexpected channel state closed");
return;
case CHANNEL_STATE_DISCONNECTED:
if (!TryRecvSynAndSendSynAck(n))
{
return;
}
n->channel.state = CHANNEL_STATE_WAIT_HANDSHAKE;
// fallthrough
case CHANNEL_STATE_WAIT_HANDSHAKE:
// listen for ACK
if (!NetInputRecvNonBlocking(&n->channel, TryParseAck, &n->channel))
{
return;
}
n->channel.state = CHANNEL_STATE_CONNECTED;
// fallthrough
case CHANNEL_STATE_CONNECTED:
RecvCmd(n);
break;
default:
CASSERT(false, "Unknown channel state");
break;
}
}
示例4: CPath_EnsureCapacity
/*\
|*| Ensure the capacity of point and type lists of this path.
|*|
|*| _this - this path
|*| count - the total minimum capacity required
|*|
|*| Returns status code.
\*/
static CStatus
CPath_EnsureCapacity(CPath *_this,
CUInt32 minimum)
{
/* assertions */
CASSERT((_this != 0));
/* ensure capacity */
_EnsurePathCapacity(_this, minimum);
/* return successfully */
return CStatus_OK;
}
示例5: LogModuleSetLevel
void LogModuleSetLevel(const LogModule m, const LogLevel l)
{
switch (m)
{
case LM_MAIN: llMain = l; break;
case LM_NET: llNet = l; break;
case LM_INPUT: llInput = l; break;
case LM_ACTOR: llActor = l; break;
default:
CASSERT(false, "Unknown log module");
break;
}
}
示例6: WKV_destructor
WPRIVATE void * WKV_destructor (void * _self)
{
struct WKV * const self = _self;
/* preconditions */
CASSERT (self);
if (VALUE)
destroy (VALUE), VALUE = NIL;
return (self);
}
示例7: CBrush_OnChange
/* Handle a change signal. */
CINTERNAL void
CBrush_OnChange(CBrush *_this)
{
/* assertions */
CASSERT((_this != 0));
/* destroy the current pattern, as needed */
if(_this->pattern.image != 0)
{
pixman_image_destroy(_this->pattern.image);
_this->pattern.image = 0;
}
}
示例8: CASSERT
/* cook up a Binary key */
void SymmetricKeyInfoProvider::CssmKeyToBinary(
CssmKey *paramKey, // ignored
CSSM_KEYATTR_FLAGS &attrFlags, // IN/OUT
BinaryKey **binKey)
{
CASSERT(mKey.keyClass() == CSSM_KEYCLASS_SESSION_KEY);
SymmetricBinaryKey *symBinKey = new SymmetricBinaryKey(
mKey.KeyHeader.LogicalKeySizeInBits);
copyCssmData(mKey,
symBinKey->mKeyData,
symBinKey->mAllocator);
*binKey = symBinKey;
}
示例9: CPath_Fill
/* Fill this path to trapezoids. */
CINTERNAL CStatus
CPath_Fill(CPath *_this,
CTrapezoids *trapezoids)
{
/* declarations */
CFillMode fillMode;
/* assertions */
CASSERT((_this != 0));
CASSERT((trapezoids != 0));
/* get the fill mode */
fillMode = (_this->winding ? CFillMode_Winding : CFillMode_Alternate);
/* fill the path */
CStatus_Check
(CTrapezoids_Fill
(trapezoids, _this->points, _this->types, _this->count, fillMode));
/* return successfully */
return CStatus_OK;
}
示例10: CBrush_GetPattern
/* Get a pattern for this brush. */
CINTERNAL CStatus
CBrush_GetPattern(CBrush *_this,
CPattern *pattern)
{
/* assertions */
CASSERT((_this != 0));
CASSERT((pattern != 0));
/* create a pattern, as needed */
if(_this->pattern.image == 0)
{
CStatus_Check
(_this->_class->CreatePattern
(_this, &(_this->pattern)));
}
/* get the pattern */
*pattern = _this->pattern;
/* return successfully */
return CStatus_OK;
}
示例11: LogModuleGetLevel
LogLevel LogModuleGetLevel(const LogModule m)
{
switch (m)
{
case LM_MAIN: return llMain;
case LM_NET: return llNet;
case LM_INPUT: return llInput;
case LM_ACTOR: return llActor;
default:
CASSERT(false, "Unknown log module");
return LL_ERROR;
}
}
示例12: wordAppend
void wordAppend(char *str, word_ptr w_grp)
{
word_ptr wptr, wtmp;
CASSERT(str != NULL && w_grp != NULL, "wordAppend: NULL argument(s)\n");
wptr = w_grp->next_anagram; /* the first actual word in this group */
CASSERT(wptr != NULL, "no word in a group!\n");
wtmp = newnode();
wtmp->str = strdup(str);
CASSERT(wtmp->str, "Out of memory!\n");
wtmp->next = NULL;
wtmp->prev_anagram = NULL;
wtmp->next_anagram = wptr;
wptr->prev_anagram = wtmp;
w_grp->next_anagram = wtmp;
}
示例13: DeathmatchFinalScoresDraw
static void DeathmatchFinalScoresDraw(void *data)
{
UNUSED(data);
// This will only draw once
const int w = gGraphicsDevice.cachedConfig.Res.x;
const int h = gGraphicsDevice.cachedConfig.Res.y;
GraphicsBlitBkg(&gGraphicsDevice);
// Work out the highest kills
int maxKills = 0;
for (int i = 0; i < (int)gPlayerDatas.size; i++)
{
const PlayerData *p = CArrayGet(&gPlayerDatas, i);
if (p->kills > maxKills)
{
maxKills = p->kills;
}
}
// Draw players and their names spread evenly around the screen.
CASSERT(
gPlayerDatas.size >= 2 && gPlayerDatas.size <= 4,
"Unimplemented number of players for deathmatch");
#define LAST_MAN_TEXT "Last man standing!"
for (int i = 0; i < (int)gPlayerDatas.size; i++)
{
const Vec2i pos = Vec2iNew(
w / 4 + (i & 1) * w / 2,
gPlayerDatas.size == 2 ? h / 2 : h / 4 + (i / 2) * h / 2);
const PlayerData *p = CArrayGet(&gPlayerDatas, i);
DisplayCharacterAndName(pos, &p->Char, p->name);
// Kills
char s[16];
sprintf(s, "Kills: %d", p->kills);
FontStrMask(
s, Vec2iNew(pos.x - FontStrW(s) / 2, pos.y + 20),
p->kills == maxKills ? colorGreen : colorWhite);
// Last man standing?
if (p->Lives > 0)
{
FontStrMask(
LAST_MAN_TEXT,
Vec2iNew(pos.x - FontStrW(LAST_MAN_TEXT) / 2, pos.y + 30),
colorGreen);
}
}
}
示例14: CASSERT
void
AsyncLoop::executeSocketAction( SocketHandle socket, SocketActionMask actionMask ) // nofail
{
CASSERT( SA_POLL_IN == CURL_CSELECT_IN );
CASSERT( SA_POLL_OUT == CURL_CSELECT_OUT );
CASSERT( SA_POLL_ERR == CURL_CSELECT_ERR );
CASSERT( sizeof( curl_socket_t ) == sizeof( SocketHandle ) );
try
{
int stillRunning = 0;
CURLMcode multiCurlCode =
curl_multi_socket_action( m_multiCurl, ( curl_socket_t ) socket, actionMask, &stillRunning );
raiseIfError( multiCurlCode );
}
catch( ... )
{
// We cannot fail this method, handle the error and continue.
handleBackgroundError();
}
}
示例15: CHatchBrush_Clone
/* Clone this hatch brush. */
static CStatus
CHatchBrush_Clone(CBrush *_this,
CBrush **_clone)
{
/* declarations */
CHatchBrush *brush;
CHatchBrush **clone;
/* assertions */
CASSERT((_this != 0));
CASSERT((_clone != 0));
/* get this as a hatch brush */
brush = (CHatchBrush *)_this;
/* get the clone as a hatch brush */
clone = (CHatchBrush **)_clone;
/* create the clone */
return
CHatchBrush_Create
(clone, brush->style, brush->foreground, brush->background);
}