Пример #1
0
static void DMem_VerifyHeader(MemoryBlockHeader * header) {
    DASSERTMSG( DMem_ClientCheckPtr(header, sizeof(MemoryBlockHeader)), "Invalid header" );
    DASSERTMSG( DMem_VerifyGuardArea(header->guard), "Header corruption, possible underwrite" );
    DASSERTMSG( header->linenumber > 0 && header->linenumber < MAX_LINENUM, "Header corruption, bad line number" );
    DASSERTMSG( header->size <= DMemGlobalState.biggestBlock, "Header corruption, block size is too large");
    DASSERTMSG( header->order <= DMemGlobalState.totalAllocs, "Header corruption, block order out of range");
}
Пример #2
0
static MemoryBlockHeader * DMem_VerifyBlock(void * memptr) {
    MemoryBlockHeader * header;
    MemoryBlockTail *   tail;

    /* check if the pointer is valid */
    DASSERTMSG( DMem_ClientCheckPtr(memptr, 1), "Invalid pointer");

    /* check if the block header is valid */
    header = (MemoryBlockHeader *)((byte_t *)memptr - sizeof(MemoryBlockHeader));
    DMem_VerifyHeader(header);
    /* check that the memory itself is valid */
    DASSERTMSG( DMem_ClientCheckPtr(memptr, DMEM_MIN(MAX_CHECK_BYTES,header->size)), "Block memory invalid" );
    /* check that the pointer to the alloc list is valid */
    DASSERTMSG( DMem_ClientCheckPtr(header->listEnter, sizeof(MemoryListLink)), "Header corruption, alloc list pointer invalid" );
    /* check the tail of the block for overruns */
    tail = (MemoryBlockTail *) ( (byte_t *)memptr + header->size );
    DMem_VerifyTail(tail);

    return header;
}
Пример #3
0
void JNICALL JAWTDrawingSurface::FreeDSI
    (JAWT_DrawingSurfaceInfo* dsi)
{
    TRY_NO_VERIFY;

    DASSERTMSG(dsi != NULL, "Drawing Surface Info is NULL\n");

    JAWTDrawingSurfaceInfo* jdsi = static_cast<JAWTDrawingSurfaceInfo*>(dsi);

    ::ReleaseDC(jdsi->hwnd, jdsi->hdc);

    CATCH_BAD_ALLOC;
}
Пример #4
0
void operator delete(void *ptr, const char*, int) {
    DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!");
}
Пример #5
0
static void DMem_VerifyTail(MemoryBlockTail * tail) {
    DASSERTMSG( DMem_ClientCheckPtr(tail, sizeof(MemoryBlockTail)), "Tail corruption, invalid pointer");
    DASSERTMSG( DMem_VerifyGuardArea(tail->guard), "Tail corruption, possible overwrite" );
}