本文整理匯總了C++中D_MAGIC_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ D_MAGIC_ASSERT函數的具體用法?C++ D_MAGIC_ASSERT怎麽用?C++ D_MAGIC_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了D_MAGIC_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Packet_Write
static int
Packet_Write( Packet *packet,
int type,
int msg_id,
int channel,
const void *msg_data,
int msg_size,
const void *extra_data,
int extra_size,
bool from_user )
{
size_t total = sizeof(FusionReadMessage) + msg_size + extra_size;
size_t aligned = (total + 3) & ~3;
FusionReadMessage *header = (FusionReadMessage *)( packet->buf + packet->size );
FUSION_DEBUG( "%s( %p, msg_id %d, channel %d, size %d, extra %d, total %zu )\n",
__FUNCTION__, packet, msg_id, channel, msg_size, extra_size, total );
D_MAGIC_ASSERT( packet, Packet );
FUSION_ASSERT( packet->size + aligned <= FUSION_MAX_PACKET_SIZE );
header->msg_type = type;
header->msg_id = msg_id;
header->msg_channel = channel;
header->msg_size = msg_size + extra_size;
if (from_user) {
if (copy_from_user( header + 1, msg_data, msg_size ))
return -EFAULT;
}
else
memcpy( header + 1, msg_data, msg_size );
if (extra_data && extra_size) {
if (copy_from_user( (char*)(header + 1) + msg_size, extra_data, extra_size ))
return -EFAULT;
}
while (total < aligned)
packet->buf[packet->size + total++] = 0;
packet->size += aligned;
return 0;
}
示例2: sharedDeallocateBuffer
static DFBResult
sharedDeallocateBuffer( CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
CoreSurfaceBuffer *buffer,
CoreSurfaceAllocation *allocation,
void *alloc_data )
{
SharedPoolData *data = pool_data;
SharedAllocationData *alloc = alloc_data;
D_MAGIC_ASSERT( pool, CoreSurfacePool );
SHFREE( data->shmpool, alloc->addr );
return DFB_OK;
}
示例3: x11InitPool
static DFBResult
x11InitPool( CoreDFB *core,
CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
void *system_data,
CoreSurfacePoolDescription *ret_desc )
{
DFBResult ret;
x11PoolLocalData *local = pool_local;
DFBX11 *x11 = system_data;
D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_ASSERT( ret_desc != NULL );
local->x11 = x11;
ret_desc->caps = CSPCAPS_NONE;
ret_desc->types = CSTF_LAYER | CSTF_WINDOW | CSTF_SHARED | CSTF_EXTERNAL;
ret_desc->priority = CSPP_ULTIMATE;
/* For showing our X11 window */
ret_desc->access[CSAID_LAYER0] = CSAF_READ;
ret_desc->access[CSAID_LAYER1] = CSAF_READ;
ret_desc->access[CSAID_LAYER2] = CSAF_READ;
snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "X11 Windows" );
ret = direct_hash_create( 7, &local->hash );
if (ret) {
D_DERROR( ret, "X11/Surfaces: Could not create local hash table!\n" );
return ret;
}
pthread_mutex_init( &local->lock, NULL );
int event_base_return, error_base_return;
XLockDisplay( x11->display );
XCompositeQueryExtension( x11->display, &event_base_return, &error_base_return );
x11->Sync( x11 );
XUnlockDisplay( x11->display );
return DFB_OK;
}
示例4: D_DEBUG_AT
void
VoodooInstance::Release()
{
D_DEBUG_AT( Voodoo_Instance, "VoodooInstance::%s( %p )\n", __func__, this );
D_MAGIC_ASSERT( this, VoodooInstance );
D_ASSERT( refs > 0 );
if (!--refs) {
D_DEBUG_AT( Voodoo_Instance, " -> zero refs, deleting instance...\n" );
#ifndef WIN32 //FIXME: why does delete this crash with MSVC?
delete this;
#endif
}
}
示例5: unique_decoration_notify
DFBResult
unique_decoration_notify( UniqueDecoration *decoration,
UniqueDecorationNotificationFlags flags )
{
UniqueDecorationNotification notification;
D_MAGIC_ASSERT( decoration, UniqueDecoration );
D_ASSERT( flags != UDNF_NONE );
D_ASSERT( ! (flags & ~UDNF_ALL) );
notification.flags = flags;
notification.decoration = decoration;
return unique_decoration_dispatch( decoration, ¬ification, unique_decoration_globals );
}
示例6: dfb_clipboard_core_join
static DFBResult
dfb_clipboard_core_join( CoreDFB *core,
DFBClipboardCore *data,
DFBClipboardCoreShared *shared )
{
D_DEBUG_AT( Core_Clipboard, "dfb_clipboard_core_join( %p, %p, %p )\n", core, data, shared );
D_ASSERT( data != NULL );
D_MAGIC_ASSERT( shared, DFBClipboardCoreShared );
data->core = core;
data->shared = shared;
D_MAGIC_SET( data, DFBClipboardCore );
return DFB_OK;
}
示例7: dfb_surface_set_field
DFBResult
dfb_surface_set_field( CoreSurface *surface,
int field )
{
D_MAGIC_ASSERT( surface, CoreSurface );
if (fusion_skirmish_prevail( &surface->lock ))
return DFB_FUSION;
surface->field = field;
dfb_surface_notify( surface, CSNF_FIELD );
fusion_skirmish_dismiss( &surface->lock );
return DFB_OK;
}
示例8: fusion_vector_destroy
void
fusion_vector_destroy( FusionVector *vector )
{
D_MAGIC_ASSERT( vector, FusionVector );
D_ASSERT( vector->count == 0 || vector->elements != NULL );
if (vector->elements) {
if (vector->pool)
SHFREE( vector->pool, vector->elements );
else
D_FREE( vector->elements );
vector->elements = NULL;
}
D_MAGIC_CLEAR( vector );
}
示例9: x11LeavePool
static DFBResult
x11LeavePool( CoreSurfacePool *pool,
void *pool_data,
void *pool_local )
{
x11PoolLocalData *local = pool_local;
D_DEBUG_AT( X11_Surfaces, "%s()\n", __FUNCTION__ );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
pthread_mutex_destroy( &local->lock );
direct_hash_destroy( local->hash );
return DFB_OK;
}
示例10: dfb_surface_unlock_buffer
DFBResult
dfb_surface_unlock_buffer( CoreSurface *surface,
CoreSurfaceBufferLock *lock )
{
DFBResult ret;
D_MAGIC_ASSERT( surface, CoreSurface );
if (fusion_skirmish_prevail( &surface->lock ))
return DFB_FUSION;
ret = dfb_surface_buffer_unlock( lock );
fusion_skirmish_dismiss( &surface->lock );
return ret;
}
示例11: dfb_state_set_source_2
DFBResult
dfb_state_set_source_2( CardState *state,
CoreSurface *source,
u32 flip_count )
{
D_MAGIC_ASSERT( state, CardState );
dfb_state_lock( state );
if (state->source != source || state->source_flip_count != flip_count || !state->source_flip_count_used) {
bool ref = true;//!fusion_config->secure_fusion || dfb_core_is_master( core_dfb );
if (source && ref && dfb_surface_ref( source )) {
D_WARN( "could not ref() source" );
dfb_state_unlock( state );
return DFB_DEAD;
}
if (state->source) {
D_ASSERT( D_FLAGS_IS_SET( state->flags, CSF_SOURCE ) );
if (ref)
dfb_surface_unref( state->source );
}
state->source = source;
state->modified |= SMF_SOURCE;
state->source_flip_count = flip_count;
state->source_flip_count_used = true;
if (source) {
direct_serial_copy( &state->src_serial, &source->serial );
D_FLAGS_SET( state->flags, CSF_SOURCE );
}
else
D_FLAGS_CLEAR( state->flags, CSF_SOURCE );
}
dfb_state_unlock( state );
return DFB_OK;
}
示例12: voodoo_manager_destroy
DirectResult
voodoo_manager_destroy( VoodooManager *manager )
{
D_MAGIC_ASSERT( manager, VoodooManager );
D_DEBUG( "Voodoo/Manager: Destroying manager at %p!\n", manager );
if (!manager->quit)
voodoo_manager_quit( manager );
/* Wait for manager threads exiting. */
direct_thread_join( manager->input.thread );
direct_thread_destroy( manager->input.thread );
direct_thread_join( manager->dispatcher );
direct_thread_destroy( manager->dispatcher );
direct_thread_join( manager->output.thread );
direct_thread_destroy( manager->output.thread );
/* Destroy conditions. */
pthread_cond_destroy( &manager->input.wait );
pthread_cond_destroy( &manager->response.wait );
pthread_cond_destroy( &manager->output.wait );
/* Destroy locks. */
pthread_mutex_destroy( &manager->instances.lock );
pthread_mutex_destroy( &manager->input.lock );
pthread_mutex_destroy( &manager->response.lock );
pthread_mutex_destroy( &manager->output.lock );
/* Release all remaining interfaces. */
direct_hash_iterate( manager->instances.local, instance_iterator, (void*) false );
direct_hash_iterate( manager->instances.local, instance_iterator, (void*) true );
direct_hash_destroy( manager->instances.local );
direct_hash_destroy( manager->instances.remote );
D_MAGIC_CLEAR( manager );
/* Deallocate manager structure. */
D_FREE( manager );
return DR_OK;
}
示例13: direct_thread_cancel
void
direct_thread_cancel( DirectThread *thread )
{
D_MAGIC_ASSERT( thread, DirectThread );
D_ASSERT( thread->handle.thread != -1 );
D_ASSERT( !pthread_equal( thread->handle.thread, pthread_self() ) );
D_ASSUME( !thread->canceled );
D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );
thread->canceled = true;
#ifndef DIRECT_BUILD_NO_PTHREAD_CANCEL
pthread_cancel( thread->handle.thread );
#else
D_UNIMPLEMENTED();
#endif
}
示例14: wm_request_focus
static DFBResult
wm_request_focus( CoreWindow *window,
void *wm_data,
void *window_data )
{
WindowData *data = window_data;
D_ASSERT( window != NULL );
D_ASSERT( wm_data != NULL );
D_ASSERT( window_data != NULL );
D_MAGIC_ASSERT( data, WindowData );
if (!data->window)
return DFB_DESTROYED;
return unique_window_request_focus( data->window );
}
示例15: wm_flush_keys
static DFBResult
wm_flush_keys( CoreWindowStack *stack,
void *wm_data,
void *stack_data )
{
StackData *data = stack_data;
D_ASSERT( stack != NULL );
D_ASSERT( wm_data != NULL );
D_ASSERT( stack_data != NULL );
D_MAGIC_ASSERT( data, StackData );
if (!data->context)
return DFB_DESTROYED;
return unique_context_flush_keys( data->context );
}