C++ (Cpp) Assert Examples

C++ (Cpp) Assert - 30 examples found. These are the top rated real world C++ (Cpp) examples of Assert extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
DECLVBGL(int) vboxCrCtlConConnect(HVBOXCRCTL hCtl, uint32_t *pu32ClientID)
{
    VBoxGuestHGCMConnectInfo info;
    int rc;

    if (!hCtl || !pu32ClientID)
        return VERR_INVALID_PARAMETER;

    memset(&info, 0, sizeof (info));
    info.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
    RTStrCopy(info.Loc.u.host.achName, sizeof (info.Loc.u.host.achName), "VBoxSharedCrOpenGL");
    rc = vbglDriverIOCtl (&hCtl->driver, VBOXGUEST_IOCTL_HGCM_CONNECT, &info, sizeof (info));
    if (RT_SUCCESS(rc))
    {
        rc = info.result;
        if (RT_SUCCESS(rc))
        {
            Assert(info.u32ClientID);
            *pu32ClientID = info.u32ClientID;
            return rc;
        }
    }

    Assert(RT_FAILURE(rc));
    *pu32ClientID = 0;
    return rc;
}
Example #2
0
static void
ginRedoInsertData(Buffer buffer, bool isLeaf, BlockNumber rightblkno, void *rdata)
{
    Page		page = BufferGetPage(buffer);

    if (isLeaf)
    {
        ginxlogRecompressDataLeaf *data = (ginxlogRecompressDataLeaf *) rdata;

        Assert(GinPageIsLeaf(page));

        ginRedoRecompress(page, data);
    }
    else
    {
        ginxlogInsertDataInternal *data = (ginxlogInsertDataInternal *) rdata;
        PostingItem *oldpitem;

        Assert(!GinPageIsLeaf(page));

        /* update link to right page after split */
        oldpitem = GinDataPageGetPostingItem(page, data->offset);
        PostingItemSetBlockNumber(oldpitem, rightblkno);

        GinDataPageAddPostingItem(page, &data->newitem, data->offset);
    }
}
Example #3
0
Var SIMDFloat64x2Lib::EntryClamp(RecyclableObject* function, CallInfo callInfo, ...)
{
    PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);

    ARGUMENTS(args, callInfo);
    ScriptContext* scriptContext = function->GetScriptContext();

    AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'");
    Assert(!(callInfo.Flags & CallFlags_New));

    // we expect at least 3 explicit args with Float64x2 type
    if (args.Info.Count >= 4 &&
            JavascriptSIMDFloat64x2::Is(args[1]) &&
            JavascriptSIMDFloat64x2::Is(args[2]) &&
            JavascriptSIMDFloat64x2::Is(args[3]))
    {
        JavascriptSIMDFloat64x2 *t     = JavascriptSIMDFloat64x2::FromVar(args[1]);
        JavascriptSIMDFloat64x2 *lower = JavascriptSIMDFloat64x2::FromVar(args[2]);
        JavascriptSIMDFloat64x2 *upper = JavascriptSIMDFloat64x2::FromVar(args[3]);
        Assert(t && lower && upper);

        SIMDValue tValue, lowerValue, upperValue, resultValue;

        tValue = t->GetValue();
        lowerValue = lower->GetValue();
        upperValue = upper->GetValue();

        resultValue = SIMDFloat64x2Operation::OpClamp(tValue, lowerValue, upperValue);

        return JavascriptSIMDFloat64x2::New(&resultValue, scriptContext);
    }

    JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdFloat64x2TypeMismatch, L"clamp");
}
/** Must be called from under this object's write lock. */
void MediumAttachment::i_updateEjected()
{
    Assert(isWriteLockOnCurrentThread());
    Assert(!m->pMachine->i_isSnapshotMachine());

    m->fIsEjected = true;
}
void EffectSharpShield::unaffect(Creature* pCreature)
throw(Error)
{
    __BEGIN_TRY

    //cout << "EffectSharpShield" << "unaffect BEGIN" << endl;

    Assert(pCreature != NULL);
    Assert(pCreature->isSlayer());

    // 플래그를 끈다.
    pCreature->removeFlag(Effect::EFFECT_CLASS_SHARP_SHIELD_1);

    Zone* pZone = pCreature->getZone();
    Assert(pZone != NULL);

    // 이펙트를 삭제하라고 알려준다.
    GCRemoveEffect gcRemoveEffect;
    gcRemoveEffect.setObjectID(pCreature->getObjectID());
    gcRemoveEffect.addEffectList(m_ClientEffectClass);
    pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcRemoveEffect);

    //cout << "EffectSharpShield" << "unaffect END" << endl;

    __END_CATCH
}
//-----------------------------------------------------------------------------
// Allocate, deallocate texture
//-----------------------------------------------------------------------------
TextureHandle_t	CTextureAllocator::AllocateTexture( int w, int h )
{
    // Implementational detail for now
    Assert( w == h );

    // Clamp texture size
    if (w < MIN_TEXTURE_SIZE)
        w = MIN_TEXTURE_SIZE;
    else if (w > MAX_TEXTURE_SIZE)
        w = MAX_TEXTURE_SIZE;

    TextureHandle_t handle = m_Textures.AddToTail();
    m_Textures[handle].m_Fragment = INVALID_FRAGMENT_HANDLE;
    m_Textures[handle].m_Size = w;

    // Find the power of two
    int power = 0;
    int size = 1;
    while(size < w)
    {
        size <<= 1;
        ++power;
    }
    Assert( size == w );

    m_Textures[handle].m_Power = power;

    return handle;
}