这篇教程C++ ASSERT_RETURN函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ASSERT_RETURN函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_RETURN函数的具体用法?C++ ASSERT_RETURN怎么用?C++ ASSERT_RETURN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ASSERT_RETURN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERT_RETURNBOOL CFileVersionInfo::QueryStringValue( IN LPCTSTR lpszItem, OUT LPTSTR lpszValue, IN INT nBuf ) const{ if( m_bValid == FALSE || lpszItem == NULL ) ASSERT_RETURN( FALSE ); if( lpszValue != NULL && nBuf <= 0 ) ASSERT_RETURN( FALSE ); ::ZeroMemory( lpszValue, nBuf * sizeof( TCHAR ) ); TCHAR szSFI[ MAX_PATH ] = { 0 }; ::wsprintf( szSFI, _T( "//StringFileInfo//%04X%04X//%s" ), GetCurLID(), GetCurCP(), lpszItem ); BOOL bRes = FALSE; UINT uLen = 0; LPTSTR lpszBuf = NULL; if( ::VerQueryValue( m_lpbyVIB, (LPTSTR)szSFI, (LPVOID*)&lpszBuf, &uLen ) ) { if( lpszValue != NULL && nBuf > 0 ) bRes = (BOOL)( ::lstrcpyn( lpszValue, lpszBuf, nBuf ) != NULL ); else bRes = TRUE; } return ( bRes );}
开发者ID:3rdexp,项目名称:jezzitest,代码行数:30,
示例2: kdbus_test_sync_replyint kdbus_test_sync_reply(struct kdbus_test_env *env){ pthread_t thread; int ret; conn_a = kdbus_hello(env->buspath, 0, NULL, 0); conn_b = kdbus_hello(env->buspath, 0, NULL, 0); ASSERT_RETURN(conn_a && conn_b); pthread_create(&thread, NULL, run_thread, NULL); ret = kdbus_msg_send(conn_b, NULL, cookie, KDBUS_MSG_FLAGS_EXPECT_REPLY | KDBUS_MSG_FLAGS_SYNC_REPLY, 5000000000ULL, 0, conn_a->id); pthread_join(thread, NULL); ASSERT_RETURN(ret == 0); kdbus_printf("-- closing bus connections/n"); kdbus_conn_free(conn_a); kdbus_conn_free(conn_b); return TEST_OK;}
开发者ID:amigadave,项目名称:kdbus,代码行数:25,
示例3: ASSERT_RETURN bool KBagManager::AddOneCell( const SC_BagAddResponse* pBAR ) { ASSERT_RETURN(pBAR, false); int nBagID = pBAR->byteBagID; KBag* pBag = FindBag(nBagID); ASSERT_RETURN(pBag, false); KItem item; item.Clear(); KMsgInputStream si(pBAR->GetItemBuffer(), pBAR->nItemBufferSize); if(!item.Unserilize(si)) { return false; } if(!pBag->AddOneCell(pBAR->nPos, item)) { return false; } pBag->NumChange(item.GetID(), item.GetStackNumber()); // 通知界面 int nBoxID = BagId2BoxID(nBagID); ASSERT_RETURN(-1 != nBoxID, false); KItemBlock* pIB = KItemBlock::Alloc(); pIB->SetPos(nBoxID, pBAR->nPos); KBlockBoxManager::Instance()->PutBlock(nBoxID, pBAR->nPos, pIB); if (nBagID == enum_item_BagNormal) { KDynamicWorld::getSingleton().SendWorldMsg(LOGIC_WORLD_NORMAL_BAG_ITEM_CHANGE, item.GetID(), 0); } return true; }
开发者ID:joyfish,项目名称:zgc,代码行数:35,
示例4: BoxID2BagID bool KBagManager::IsValidCell( int nBoxId, int nPos ) const { int nBagId = BoxID2BagID(nBoxId); ASSERT_RETURN(nBagId >= enum_item_Bag_Start, false); const KBag* pBag = FindBag(nBagId); ASSERT_RETURN(pBag, false); return pBag->IsPosValid(nPos); }
开发者ID:joyfish,项目名称:zgc,代码行数:8,
示例5: kdbus_test_fd_passingint kdbus_test_fd_passing(struct kdbus_test_env *env){ struct kdbus_conn *conn_src, *conn_dst; const char *str = "stackenblocken"; const struct kdbus_item *item; struct kdbus_msg *msg; unsigned int i; int fds[2]; int ret; /* create two connections */ conn_src = kdbus_hello(env->buspath, 0, NULL, 0); conn_dst = kdbus_hello(env->buspath, 0, NULL, 0); ASSERT_RETURN(conn_src && conn_dst); /* * Try to ass the handle of a connection as message payload. * This must fail. */ ret = send_fd(conn_src, conn_dst->id, conn_src->fd); ASSERT_RETURN(ret == -ELOOP); ret = send_fd(conn_src, conn_dst->id, conn_dst->fd); ASSERT_RETURN(ret == -ELOOP); ret = pipe(fds); ASSERT_RETURN(ret == 0); i = write(fds[1], str, strlen(str)); ASSERT_RETURN(i == strlen(str)); ret = send_fd(conn_src, conn_dst->id, fds[0]); ASSERT_RETURN(ret == 0); ret = kdbus_msg_recv(conn_dst, &msg); ASSERT_RETURN(ret == 0); KDBUS_ITEM_FOREACH(item, msg, items) { if (item->type == KDBUS_ITEM_FDS) { char tmp[14]; int nfds = (item->size - KDBUS_ITEM_HEADER_SIZE) / sizeof(int); ASSERT_RETURN(nfds == 1); i = read(item->fds[0], tmp, sizeof(tmp)); ASSERT_RETURN(i == sizeof(tmp)); ASSERT_RETURN(memcmp(tmp, str, sizeof(tmp)) == 0); close(item->fds[0]); break; } } return TEST_OK;}
开发者ID:squiddle,项目名称:kdbus,代码行数:56,
示例6: PERF_COUNTER bool KL2Map_Base::_InsertJointToBlock(const _Node_Lite * pNode) { PERF_COUNTER(KL2Map_Base__InsertJointToBlock); ASSERT_RETURN(pNode, false); int_r bx(-1), by(-1); GetJointBlockPos(pNode->x, pNode->y, bx, by); ASSERT_RETURN(bx >= 0, false); ASSERT_RETURN(by >= 0, false); return m_L2MapByBlock[bx][by].insert_unique(pNode) > -1; }
开发者ID:zhuxiaokun,项目名称:workshop,代码行数:10,
示例7: unpriv_test_custom_epstatic int unpriv_test_custom_ep(const char *buspath){ int ret, ep_fd1, ep_fd2; char *ep1, *ep2, *tmp1, *tmp2; tmp1 = strdup(buspath); tmp2 = strdup(buspath); ASSERT_RETURN(tmp1 && tmp2); ret = asprintf(&ep1, "%s/%u-%s", dirname(tmp1), getuid(), "apps1"); ASSERT_RETURN(ret >= 0); ret = asprintf(&ep2, "%s/%u-%s", dirname(tmp2), getuid(), "apps2"); ASSERT_RETURN(ret >= 0); free(tmp1); free(tmp2); /* endpoint only accessible to current uid */ ep_fd1 = create_endpoint(buspath, getuid(), "apps1", 0); ASSERT_RETURN(ep_fd1 >= 0); /* endpoint world accessible */ ep_fd2 = create_endpoint(buspath, getuid(), "apps2", KDBUS_MAKE_ACCESS_WORLD); ASSERT_RETURN(ep_fd2 >= 0); ret = RUN_UNPRIVILEGED(UNPRIV_UID, UNPRIV_UID, ({ int ep_fd; struct kdbus_conn *ep_conn; /* * Make sure that we are not able to create custom * endpoints */ ep_fd = create_endpoint(buspath, getuid(), "unpriv_costum_ep", 0); ASSERT_EXIT(ep_fd == -EPERM); /* * Endpoint "apps1" only accessible to same users, * that own the endpoint. Access denied by VFS */ ep_conn = kdbus_hello(ep1, 0, NULL, 0); ASSERT_EXIT(!ep_conn && errno == EACCES); /* Endpoint "apps2" world accessible */ ep_conn = kdbus_hello(ep2, 0, NULL, 0); ASSERT_EXIT(ep_conn); kdbus_conn_free(ep_conn); _exit(EXIT_SUCCESS); }),
开发者ID:balrog-kun,项目名称:kdbus,代码行数:54,
示例8: kdbus_match_kdbus_pidsstatic int kdbus_match_kdbus_pids(struct kdbus_msg *msg, const struct kdbus_pids *expected_pids){ struct kdbus_item *item; item = kdbus_get_item(msg, KDBUS_ITEM_PIDS); ASSERT_RETURN(item); ASSERT_RETURN(memcmp(&item->pids, expected_pids, sizeof(struct kdbus_pids)) == 0); return 0;}
开发者ID:D-os,项目名称:kdbus,代码行数:13,
示例9: switchstd::vector<std::wstring> NppInterface::GetOpenFilenames(ViewTarget viewTarget) const { int enumVal = -1; switch (viewTarget) { case ViewTarget::primary: enumVal = PRIMARY_VIEW; break; case ViewTarget::secondary: enumVal = SECOND_VIEW; break; case ViewTarget::both: enumVal = ALL_OPEN_FILES; break; } ASSERT_RETURN(enumVal >= 0, {}); int count = SendMsgToNpp(NPPM_GETNBOPENFILES, 0, enumVal); wchar_t** paths; paths = new wchar_t *[count]; for (int i = 0; i < count; ++i) paths[i] = new wchar_t[MAX_PATH]; int msg = -1; switch (viewTarget) { case ViewTarget::primary: msg = NPPM_GETOPENFILENAMESPRIMARY; break; case ViewTarget::secondary: msg = NPPM_GETOPENFILENAMESSECOND; break; case ViewTarget::both: msg = NPPM_GETOPENFILENAMES; break; } ASSERT_RETURN(msg >= 0, {}); { auto ret = SendMsgToNpp(msg, reinterpret_cast<WPARAM>(paths), count); ASSERT_RETURN(ret == count, {}); } std::vector<std::wstring> res; for (int i = 0; i < count; ++i) { res.push_back(paths[i]); delete[] paths[i]; } delete[] paths; return res;}
开发者ID:marviktintor,项目名称:GoToFile,代码行数:49,
示例10: FindBag const KCreateInfo_ItemBase* KBagManager::GetOneItemCreateInfoBase( int nBagID, DWORD dwItemID ) { const KBag* pBag = FindBag(nBagID); ASSERT_RETURN(pBag, NULL); int nPos = pBag->GetFirstPos(dwItemID); ASSERT_RETURN(nPos >= 0, NULL); const KCellBag* pCell = pBag->FindCell(nPos); ASSERT_RETURN(pCell, NULL); const KItem& item = pCell->GetItem(); ASSERT_I(item.GetID() == dwItemID); return GetItemCreateInfo(dwItemID); }
开发者ID:joyfish,项目名称:zgc,代码行数:15,
示例11: ASSERT_RETURN bool KStoreProduct::AddProductPrice(int nMoneyType, int nTParam1, int nTParam2) { ASSERT_RETURN(nMoneyType > enumPT_none && nMoneyType < enumPT_count, false); KStoreProductPrice price; price.nMoneyType = nMoneyType; price.nTParam1 = nTParam1; price.nTParam2 = nTParam2; int i = 0; for(i=0;i<sizeof(m_Prices)/sizeof(m_Prices[0]);i++) { if(enumPT_none == m_Prices[i].nMoneyType) break; if(m_Prices[i].nMoneyType == nMoneyType) return false; } if(i < PRICE_TYPE_MAX) { m_Prices[i].nMoneyType = nMoneyType; m_Prices[i].nTParam1 = nTParam1; m_Prices[i].nTParam2 = nTParam2; return true; } return false; }
开发者ID:joyfish,项目名称:zgc,代码行数:25,
示例12: ASSERT_RETURNvoid CGraphicWindowChildFrame::moveForward(){ ASSERT_RETURN( forwardTabCount() > 0 ); int newTab = m_forwardTabList[forwardTabCount()]; m_forwardTabList.remove(forwardTabCount()); SetTab( newTab );}
开发者ID:JeffLutzenberger,项目名称:fea-graphics-engine-example,代码行数:7,
示例13: FindCell int KBagManager::GetCount(int nBagID, int nPos) const { const KCellBag* pCell = FindCell(nBagID, nPos); ASSERT_RETURN(pCell, 0); return pCell->GetItemStackNumber(); }
开发者ID:joyfish,项目名称:zgc,代码行数:7,
示例14: enlil_iptc_job_prependEnlil_IPTC_Job *enlil_iptc_job_prepend(Enlil_Photo *photo, Enlil_IPTC_Done_Cb cb, void *data){ ASSERT_RETURN(photo != NULL); Eina_List *l; Enlil_IPTC_Job *job; EINA_LIST_FOREACH(l_jobs, l, job) if(job->photo == photo) break; if(!job) { job = calloc(1, sizeof(Enlil_IPTC_Job)); job->photo = photo; job->cb = cb; job->data = data; } else l_jobs = eina_list_remove(l_jobs, job); l_jobs = eina_list_prepend(l_jobs, job); _job_next(); return job;}
开发者ID:Limsik,项目名称:e17,代码行数:29,
示例15: initPoolMemoryPool* initPool(size_t size, size_t increment){ MemoryPool *pool; MemoryBlock *block; void *buffer; ASSERT_RETURN(size >= sizeof(MemoryPool)+sizeof(MemoryBlock), NULL); buffer=malloc(size+sizeof(*pool)+sizeof(*block)); if (!buffer) return NULL; // Initialize first memory block block = (MemoryBlock*) ((size_t)buffer+sizeof(*pool)); block->next = NULL; block->start=(void*)((size_t)block+sizeof(*block)); block->pos=ALIGN_PTR(block->start, POOL_ALIGNMENT); block->end=block->start+size; // Initialize pool pool = (MemoryPool*) buffer; pool->lastAlloc = 0; pool->capacity = size; pool->increment = (increment) ? increment : (size_t)sysconf(_SC_PAGESIZE); pool->base=block; pool->cur=block; PRINT("Pool created, used size=%ld, capacity=%ld, increment size=%ld", (((size_t)(pool->cur->start)) - (size_t)pool), pool->capacity, pool->increment); return pool;}
开发者ID:jagu-sayan,项目名称:SayanLib,代码行数:31,
示例16: enlil_tag_photos_count_getintenlil_tag_photos_count_get(const Enlil_Tag *tag){ ASSERT_RETURN(tag != NULL); return eina_list_count(tag->photos);}
开发者ID:Limsik,项目名称:e17,代码行数:7,
示例17: ASSERT_RETURNbool SocketAddress::setIntern(Exception& ex,const string& hostAndPort,bool resolveHost) { ASSERT_RETURN(!hostAndPort.empty(),false); string host, port; auto it = hostAndPort.begin(); auto& end = hostAndPort.end(); if (*it == '[') { ++it; while (it != end && *it != ']') host += *it++; if (it == end) { ex.set(Exception::NETADDRESS,"Malformed IPv6 address ", hostAndPort); return false; } ++it; } else { while (it != end && *it != ':') host += *it++; } if (it != end && *it == ':') { ++it; while (it != end) port += *it++; } else { ex.set(Exception::NETADDRESS, "Missing port number in ", hostAndPort); return false; } return setIntern(ex,host, resolveService(ex,port),resolveHost);}
开发者ID:jaejungkim,项目名称:MonaServer,代码行数:30,
示例18: pthread_attr_setinheritschedint pthread_attr_setinheritsched(pthread_attr_t *attr, int h){ ASSERT_RETURN(!attr,EINVAL); attr->schedinherited = h; return 0;}
开发者ID:marcoscunha,项目名称:reverse,代码行数:7,
示例19: kdbus_fork_test/* * Return: TEST_OK, TEST_ERR or TEST_SKIP * we return TEST_OK only if the children return with the expected * 'expected_status' that is specified as an argument. */static int kdbus_fork_test(const char *bus, const char *name, struct kdbus_conn **conn_db, int expected_status){ pid_t pid; int ret = 0; int status = 0; pid = fork(); ASSERT_RETURN_VAL(pid >= 0, pid); if (pid == 0) { ret = prctl(PR_SET_PDEATHSIG, SIGKILL); ASSERT_EXIT(ret == 0); ret = drop_privileges(65534, 65534); ASSERT_EXIT(ret == 0); ret = kdbus_recv_in_threads(bus, name, conn_db); _exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE); } ret = waitpid(pid, &status, 0); ASSERT_RETURN(ret >= 0); return (status == EXIT_SUCCESS) ? TEST_OK : TEST_ERR;}
开发者ID:adhideguchi,项目名称:kdbus,代码行数:31,
示例20: ASSERT_RETURNvoid CGraphicsRigidDiaphragmLoad::translate( const CRigidDiaphragmLoad* pRDL, float length ){ double dLoc[3]; const CNode* pN = pRDL->location(); ASSERT_RETURN( pN ); dLoc[0] = m_loc[0] = pN->x(); dLoc[1] = m_loc[1] = pN->y(); dLoc[2] = m_loc[2] = pN->z(); glMatrixMode( GL_MODELVIEW ); //glPushMatrix(); glTranslatef( (float)m_loc.x, (float)m_loc.y, (float)m_loc.z ); if( !zero( pRDL->magnitude( DX ) ) ){ //draw x dir arrow } else if( !zero( pRDL->magnitude( DY ) ) ){ //draw y dir arrow glRotatef( 90.f, 0.f, 0.f, 1.f ); } else if( !zero( pRDL->magnitude( DZ ) ) ){ //draw z dir arrow glRotatef( -90.f, 0.f, 1.f, 0.f ); } glTranslatef( length, 0.f, 0.f ); //glGetDoublev( GL_MODELVIEW_MATRIX, m_mv ); //glPopMatrix(); return;}
开发者ID:JeffLutzenberger,项目名称:fea-graphics-engine-example,代码行数:31,
注:本文中的ASSERT_RETURN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ASSERT_STATUS函数代码示例 C++ ASSERT_PASS函数代码示例 |