本文整理汇总了C++中dbg_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ dbg_assert函数的具体用法?C++ dbg_assert怎么用?C++ dbg_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbg_assert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cntr_array_add_back
static void cntr_array_add_back (cntr ca, void* object) {
cntr_array* pca = (cntr_array*)ca;
dbg_assert(pca->capacity >= pca->size);
if (pca->capacity == pca->size) __expand_capacity(pca);
pca->data[pca->size++] = object;
}
开发者ID:march1896,项目名称:pegas,代码行数:8,代码来源:cntr_array.c
示例2: citer_local_get_ref
static void* citer_local_get_ref(citer itr) {
citer_cont* cur = (citer_cont*)itr;
void** ele = (void**)cur->connection;
dbg_assert(ele);
return *ele;
}
开发者ID:march1896,项目名称:pegas,代码行数:8,代码来源:cntr_array.c
示例3: ch_generate_ddsg
static void
ch_generate_ddsg(FILE *in, FILE *ref, FILE *idx, FILE *ddsg)
{
GHashTable *hash=coord_hash_new();
struct item_bin *ib;
int nodes=0,edges=0;
while ((ib=read_item(in))) {
int ccount=ib->clen/2;
struct coord *c=(struct coord *)(ib+1);
if (road_speed(ib->type)) {
add_node_to_hash(idx, hash, &c[0], &nodes);
add_node_to_hash(idx, hash, &c[ccount-1], &nodes);
edges++;
}
}
edge_hash=g_hash_table_new_full(edge_hash_hash, edge_hash_equal, edge_hash_slice_free, item_id_slice_free);
fseek(in, 0, SEEK_SET);
fprintf(ddsg,"d\n");
fprintf(ddsg,"%d %d\n", nodes, edges);
while ((ib=read_item(in))) {
int i,ccount=ib->clen/2;
struct coord *c=(struct coord *)(ib+1);
int n1,n2,speed=road_speed(ib->type);
struct item_id road_id;
double l;
fread(&road_id, sizeof(road_id), 1, ref);
if (speed) {
struct edge_hash_item *hi=g_slice_new(struct edge_hash_item);
struct item_id *id=g_slice_new(struct item_id);
*id=road_id;
dbg_assert((n1=GPOINTER_TO_INT(g_hash_table_lookup(hash, &c[0]))) != 0);
dbg_assert((n2=GPOINTER_TO_INT(g_hash_table_lookup(hash, &c[ccount-1]))) != 0);
l=0;
for (i = 0 ; i < ccount-1 ; i++) {
l+=sqrt(sq(c[i+1].x-c[i].x)+sq(c[i+1].y-c[i].y));
}
fprintf(ddsg,"%d %d %d 0\n", n1-1, n2-1, (int)(l*36/speed));
hi->first=n1-1;
hi->last=n2-1;
g_hash_table_insert(edge_hash, hi, id);
}
}
g_hash_table_destroy(hash);
}
开发者ID:PDXostc,项目名称:navit,代码行数:45,代码来源:ch.c
示例4: dbg_assert
void CGraphics_Threaded::QuadsBegin()
{
dbg_assert(m_Drawing == 0, "called Graphics()->QuadsBegin twice");
m_Drawing = DRAWING_QUADS;
QuadsSetSubset(0,0,1,1,-1);
QuadsSetRotation(0);
SetColor(1,1,1,1);
}
开发者ID:TsFreddie,项目名称:teeworlds,代码行数:9,代码来源:graphics_threaded.cpp
示例5: coord_rect_overlap
int
coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2)
{
dbg_assert(r1->lu.x <= r1->rl.x);
dbg_assert(r1->lu.y >= r1->rl.y);
dbg_assert(r2->lu.x <= r2->rl.x);
dbg_assert(r2->lu.y >= r2->rl.y);
dbg(1,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y);
if (r1->lu.x > r2->rl.x)
return 0;
if (r1->rl.x < r2->lu.x)
return 0;
if (r1->lu.y < r2->rl.y)
return 0;
if (r1->rl.y > r2->lu.y)
return 0;
return 1;
}
开发者ID:justinzane,项目名称:navit,代码行数:18,代码来源:coord.c
示例6: _bind_self
static void _bind_self(worker_t *worker) {
dbg_assert(worker);
if (self && self != worker) {
dbg_error("HPX does not permit worker structure switching.\n");
}
self = worker;
self->thread = pthread_self();
}
开发者ID:dkogler,项目名称:hpx5-measurement-tests,代码行数:9,代码来源:scheduler.c
示例7: dbg_assert
void CGraphics_OpenGL::QuadsBegin()
{
dbg_assert(m_Drawing == 0, "called quads_begin twice");
m_Drawing = DRAWING_QUADS;
QuadsSetSubset(0,0,1,1);
QuadsSetRotation(0);
SetColor(1,1,1,1);
}
开发者ID:CoolerMAN,项目名称:tdtw,代码行数:9,代码来源:graphics.cpp
示例8: while
void CEcon::Update()
{
if(!m_Ready)
return;
m_NetConsole.Update();
char aBuf[NET_MAX_PACKETSIZE];
int ClientID;
while(m_NetConsole.Recv(aBuf, (int)(sizeof(aBuf))-1, &ClientID))
{
dbg_assert(m_aClients[ClientID].m_State != CClient::STATE_EMPTY, "got message from empty slot");
if(m_aClients[ClientID].m_State == CClient::STATE_CONNECTED)
{
if(str_comp(aBuf, g_Config.m_EcPassword) == 0)
{
m_aClients[ClientID].m_State = CClient::STATE_AUTHED;
m_NetConsole.Send(ClientID, "Authentication successful. External console access granted.");
str_format(aBuf, sizeof(aBuf), "cid=%d authed", ClientID);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "econ", aBuf);
}
else
{
m_aClients[ClientID].m_AuthTries++;
char aMsg[128];
str_format(aMsg, sizeof(aMsg), "Wrong password %d/%d.", m_aClients[ClientID].m_AuthTries, MAX_AUTH_TRIES);
m_NetConsole.Send(ClientID, aMsg);
if(m_aClients[ClientID].m_AuthTries >= MAX_AUTH_TRIES)
{
if(!g_Config.m_EcBantime)
m_NetConsole.Drop(ClientID, CLIENTDROPTYPE_KICK, "Too many authentication tries");
else
m_NetConsole.NetBan()->BanAddr(m_NetConsole.ClientAddr(ClientID), g_Config.m_EcBantime*60, "Too many authentication tries");
}
}
}
else if(m_aClients[ClientID].m_State == CClient::STATE_AUTHED)
{
char aFormatted[256];
str_format(aFormatted, sizeof(aFormatted), "cid=%d cmd='%s'", ClientID, aBuf);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aFormatted);
m_UserClientID = ClientID;
Console()->ExecuteLine(aBuf);
m_UserClientID = -1;
}
}
for(int i = 0; i < NET_MAX_CONSOLE_CLIENTS; ++i)
{
if(m_aClients[i].m_State == CClient::STATE_CONNECTED &&
time_get() > m_aClients[i].m_TimeConnected + g_Config.m_EcAuthTimeout * time_freq())
m_NetConsole.Drop(i, CLIENTDROPTYPE_KICK, "authentication timeout");
}
}
开发者ID:AlphaDEXi,项目名称:teeworlds-infclass,代码行数:56,代码来源:econ.cpp
示例9: data_seeds_init
static void data_seeds_init() {
int i;
int* seeds_random = (int*)malloc(sizeof(int) * g_op_count);
int* seeds_inorder = (int*)malloc(sizeof(int) * g_op_count);
g_seeds_inuse = (int*)malloc(sizeof(int) * g_op_count);
for (i = 0; i < g_op_count; i ++) {
seeds_random[i] = generate_in_range(g_pagesize_min, g_pagesize_max);
seeds_inorder[i] = seeds_random[i];
}
qsort(seeds_inorder, g_op_count, sizeof(int), cmpfunc);
switch (g_page_pattern) {
int index;
case ht_pattern_unique:
index = generate_in_range(0, g_op_count);
for (i = 0; i < g_op_count; i ++) {
g_seeds_inuse[i] = seeds_random[index];
}
break;
case ht_pattern_increasing:
for (i = 0; i < g_op_count; i ++) {
g_seeds_inuse[i] = seeds_inorder[i];
}
break;
case ht_pattern_decreasing:
for (i = 0; i < g_op_count; i ++) {
g_seeds_inuse[i] = seeds_inorder[g_op_count-1-i];
}
break;
case ht_pattern_jag:
/* TODO: jag is not implemented, currently using random */
for (i = 0; i < g_op_count; i ++) {
g_seeds_inuse[i] = seeds_random[i];
}
case ht_pattern_random_restricted:
dbg_assert(g_pagepattern_random_restricted_count < g_op_count);
for (i = 0; i < g_op_count; i ++) {
int index = generate_in_range(0, g_pagepattern_random_restricted_count);
g_seeds_inuse[i] = seeds_inorder[index];
}
case ht_pattern_random:
for (i = 0; i < g_op_count; i ++) {
g_seeds_inuse[i] = seeds_random[i];
}
break;
default:
break;
}
free(seeds_random);
free(seeds_inorder);
}
开发者ID:march1896,项目名称:pegas,代码行数:56,代码来源:heap_util.test.c
示例10: cntr_array_remove_front
static void* cntr_array_remove_front(cntr ca) {
cntr_array* pca = (cntr_array*)ca;
void* obj = pca->data[0];
dbg_assert(pca->size > 0);
pca->size --;
memory_move((char*)(pca->data), (char*)(pca->data + 1), pca->size * sizeof(void*) / sizeof(char));
return obj;
}
开发者ID:march1896,项目名称:pegas,代码行数:10,代码来源:cntr_array.c
示例11: eoc_to_cpu
static void eoc_to_cpu(struct zip_eoc *eoc) {
dbg_assert(eoc != NULL);
eoc->zipesig = le32_to_cpu(eoc->zipesig);
eoc->zipedsk = le16_to_cpu(eoc->zipedsk);
eoc->zipecen = le16_to_cpu(eoc->zipecen);
eoc->zipenum = le16_to_cpu(eoc->zipenum);
eoc->zipecenn = le16_to_cpu(eoc->zipecenn);
eoc->zipecsz = le32_to_cpu(eoc->zipecsz);
eoc->zipeofst = le32_to_cpu(eoc->zipeofst);
eoc->zipecoml = le16_to_cpu(eoc->zipecoml);
}
开发者ID:justinzane,项目名称:navit,代码行数:11,代码来源:binfile.c
示例12: event_sdl_watch_startthread
static void event_sdl_watch_startthread(GPtrArray *watch_list) {
dbg(lvl_debug, "enter\n");
if (sdl_watch_thread)
event_sdl_watch_stopthread();
int ret;
ret = pthread_create(&sdl_watch_thread, NULL,
(void *) event_sdl_watch_thread, (void *) watch_list);
dbg_assert(ret == 0);
}
开发者ID:PDXostc,项目名称:navit,代码行数:11,代码来源:event.c
示例13: cntr_array_add_front
static void cntr_array_add_front (cntr ca, void* object) {
cntr_array* pca = (cntr_array*)ca;
dbg_assert(pca->capacity >= pca->size);
if (pca->capacity == pca->size) __expand_capacity(pca);
memory_move((char*)(pca->data + 1), (char*)(pca->data), pca->size * sizeof(void*) / sizeof(char));
pca->data[0] = object;
pca->size ++;
}
开发者ID:march1896,项目名称:pegas,代码行数:11,代码来源:cntr_array.c
示例14: dbg_msg
int CNetServer::Send(CNetChunk *pChunk)
{
if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
{
if(pChunk->m_DataSize >= NET_MAX_PAYLOAD)
{
dbg_msg("netserver", "packet payload too big. %d. dropping packet", pChunk->m_DataSize);
return -1;
}
// send connectionless packet
CNetBase::SendPacketConnless(m_Socket, &pChunk->m_Address, pChunk->m_pData, pChunk->m_DataSize);
}
else
{
if(pChunk->m_DataSize+NET_MAX_CHUNKHEADERSIZE >= NET_MAX_PAYLOAD)
{
dbg_msg("netclient", "chunk payload too big. %d. dropping chunk", pChunk->m_DataSize);
return -1;
}
int Flags = 0;
dbg_assert(pChunk->m_ClientID >= 0, "errornous client id");
dbg_assert(pChunk->m_ClientID < MaxClients(), "errornous client id");
if(pChunk->m_Flags&NETSENDFLAG_VITAL)
Flags = NET_CHUNKFLAG_VITAL;
if(m_aSlots[pChunk->m_ClientID].m_Connection.QueueChunk(Flags, pChunk->m_DataSize, pChunk->m_pData) == 0)
{
if(pChunk->m_Flags&NETSENDFLAG_FLUSH)
m_aSlots[pChunk->m_ClientID].m_Connection.Flush();
}
else
{
Drop(pChunk->m_ClientID, "Error sending data");
}
}
return 0;
}
开发者ID:4a4ik,项目名称:teeworlds,代码行数:40,代码来源:network_server.cpp
示例15: cntr_array_assign_capacity
static void cntr_array_assign_capacity(cntr ca, int n_size) {
cntr_array* pca = (cntr_array*)ca;
void** n_data = NULL;
dbg_assert(n_size >= pca->size);
pca->capacity = n_size;
n_data = (void**)malloc(sizeof(void*) * pca->capacity);
memory_move((char*)n_data, (char*)pca->data, pca->size * sizeof(void*) / sizeof(char));
free((void*)pca->data);
pca->data = n_data;
}
开发者ID:march1896,项目名称:pegas,代码行数:13,代码来源:cntr_array.c
示例16: _user_lco_init
static int
_user_lco_init(_user_lco_t *u, size_t size, hpx_action_t id,
hpx_action_t op, hpx_action_t predicate, void *init,
size_t init_size) {
dbg_assert(id);
dbg_assert(op);
dbg_assert(predicate);
lco_init(&u->lco, &_user_lco_vtable);
cvar_reset(&u->cvar);
u->size = size;
u->id = id;
u->op = op;
u->predicate = predicate;
u->init = u->data;
u->buffer = (char*)u->data + init_size;
handler_t f = actions[u->id].handler;
_hpx_user_lco_id_t init_fn = (_hpx_user_lco_id_t)f;
init_fn(u->buffer, u->size, init, init_size);
return HPX_SUCCESS;
}
开发者ID:dkogler,项目名称:hpx5-measurement-tests,代码行数:22,代码来源:user_lco.c
示例17: set_bench_search_randomly
static void set_bench_search_randomly() {
int i;
dbg_assert(iset_empty(__set));
log_printline("[number of search: %d]", __num_search);
for (i = 0; i < __data_diff_type; i ++) {
/* insert all data one by one */
iset_insert(__set, s_test_data_addr[i]);
}
/* now the set contains __data_diff_type * 2 of data, each elememt int [0, __data_diff_type)
* appears at least once */
for (i = 0; i < __num_search; i ++) {
intptr_t x = rand() % __data_diff_type;
bool res = iset_contains(__set, s_test_data_addr[x]);
dbg_assert(res == true);
}
iset_clear(__set);
}
开发者ID:march1896,项目名称:pegas,代码行数:22,代码来源:iset.test.c
示例18: __cast
inline unknown* __cast(const unknown* x, unique_id id) {
if (__is_object(x)) {
_object* obj = (_object*)x;
return obj->__cast(obj, id);
}
else if (__is_interface(x)) {
_object* obj = (_object*)__object_from_interface((_interface*)x);
return obj->__cast(obj, id);
}
dbg_assert(false);
return NULL;
}
开发者ID:march1896,项目名称:pegas,代码行数:13,代码来源:oo_model.c
示例19: __is_interface
inline bool __is_interface(const unknown *x) {
const _interface* inf = (const _interface*)x;
dbg_assert((intptr_t)(inf->__offset) <= __MAX_NUM_INTERFACE_PER_OBJECT);
{
const _object* obj = __object_from_interface(inf);
if (__is_object((unknown*)obj)) {
return true;
}
}
return false;
}
开发者ID:march1896,项目名称:pegas,代码行数:13,代码来源:oo_model.c
示例20: item_bin_sort_compare
static int
item_bin_sort_compare(const void *p1, const void *p2)
{
struct item_bin *ib1=*((struct item_bin **)p1),*ib2=*((struct item_bin **)p2);
struct attr_bin *attr1,*attr2;
char *s1,*s2;
int ret;
#if 0
dbg_assert(ib1->clen==2);
dbg_assert(ib2->clen==2);
attr1=(struct attr_bin *)((int *)(ib1+1)+ib1->clen);
attr2=(struct attr_bin *)((int *)(ib2+1)+ib1->clen);
#else
attr1=item_bin_get_attr_bin_last(ib1);
attr2=item_bin_get_attr_bin_last(ib2);
#endif
#if 0
dbg_assert(attr1->type == attr_town_name || attr1->type == attr_town_name_match);
dbg_assert(attr2->type == attr_town_name || attr2->type == attr_town_name_match);
#endif
s1=(char *)(attr1+1);
s2=(char *)(attr2+1);
if (attr1->type == attr_house_number && attr2->type == attr_house_number) {
ret=atoi(s1)-atoi(s2);
if (ret)
return ret;
}
ret=strcmp(s1, s2);
if (!ret) {
int match1=0,match2=0;
match1=(attr1->type == attr_town_name_match || attr1->type == attr_district_name_match);
match2=(attr2->type == attr_town_name_match || attr2->type == attr_district_name_match);
ret=match1-match2;
}
#if 0
fprintf(stderr,"sort_countries_compare p1=%p p2=%p %s %s\n",p1,p2,s1,s2);
#endif
return ret;
}
开发者ID:albertz,项目名称:navit,代码行数:39,代码来源:itembin.c
注:本文中的dbg_assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论