您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GS_ASSERT函数代码示例

51自学网 2021-06-01 20:57:22
  C++
这篇教程C++ GS_ASSERT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ GS_ASSERT函数的具体用法?C++ GS_ASSERT怎么用?C++ GS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GS_ASSERT函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GS_ASSERT

// for GS_ARENA, count must be 4, 8, 16 or 20void *__gs_mempool_alloc(unsigned int arena_id, unsigned int count){  gs_arena_t *arena = &gs_mempool[arena_id];  gs_memblock_t *memblk = arena->lastblock;  if (memblk == NULL) {#ifdef TARG_IA64    // On IA64, the sizeof(gspin_t) is 32    GS_ASSERT(sizeof(gspin_t) == 32, "struct gspin size has changed.");#else    GS_ASSERT(sizeof(gspin_t) == 20, "struct gspin size has changed.");#endif    memblk = gs_new_memblock(0);    arena->firstblock = arena->lastblock = memblk;    arena->current_index = 0;  }  else if ((arena->current_index + count - 1) >=           ((memblk->block_id + 1) << GS_BLOCK_IDX_SHIFT_AMT)) {    memblk = gs_new_memblock(memblk->block_id + 1);    arena->lastblock->next = memblk;    arena->lastblock = memblk;    if (count > 1) // this is needed to gaurantee locations to be contiguous      arena->current_index = memblk->block_id * GS_MEMBLOCK_SIZE;  }  gs_void_t *p = &memblk->mem[arena->current_index & GS_OFST_IN_BLK_MASK];  arena->current_index += count;  return p;}
开发者ID:seguljac,项目名称:higpu,代码行数:28,


示例2: gsUdpEngineGetPeerOutBufferFreeSpace

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UDP Layer must be initialized// theIp and thePort cannot be 0 (Zero)// Based on an IP and port, the function will return the amount of free space // of a peer's buffer.int gsUdpEngineGetPeerOutBufferFreeSpace(unsigned int theIp, unsigned short thePort){	GSUdpEngineObject *aUdp = gsUdpEngineGetEngine();	GSUdpRemotePeer aRemotePeer, *aRemotePeerFound;	int index;	GS_ASSERT(aUdp->mInitialized);	GS_ASSERT(theIp);	GS_ASSERT(thePort);	if (!aUdp->mInitialized)	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug,			"[Udp Engine] Engine not initialized/n");		return 0;	}	aRemotePeer.mAddr = theIp;	aRemotePeer.mPort = thePort;	index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0);	if (index != NOT_FOUND)	{		aRemotePeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index);		return gt2GetOutgoingBufferFreeSpace(aRemotePeerFound->mConnection);	}	return 0;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:31,


示例3: gsUdpEngineGetPeerState

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UDP Layer must be initialized// Used obtain the peer's state // theIp and thePort cannot be 0 (Zero)GSUdpErrorCode gsUdpEngineGetPeerState(unsigned int theIp, unsigned short thePort, GSUdpPeerState *thePeerState){	GSUdpEngineObject *aUdp = gsUdpEngineGetEngine();	GSUdpRemotePeer aPeer, *aPeerFound;	int index;	GS_ASSERT(aUdp->mInitialized);	GS_ASSERT(theIp);	GS_ASSERT(thePort);	GS_ASSERT(thePeerState != NULL);	if (!aUdp->mInitialized)	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_State, GSIDebugLevel_Debug, 			"[Udp Engine] Engine not initialized/n");		*thePeerState = GS_UDP_PEER_CLOSED;		return GS_UDP_NOT_INITIALIZED;	}	aPeer.mAddr = theIp;	aPeer.mPort = thePort;	index = ArraySearch(aUdp->mRemotePeers, &aPeer, gsUdpRemotePeerCompare, 0, 0);	if (index == NOT_FOUND)	{		*thePeerState = GS_UDP_PEER_CLOSED;		return GS_UDP_NO_ERROR;	}		aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index);	*thePeerState = (GSUdpPeerState)gt2GetConnectionState(aPeerFound->mConnection);	return GS_UDP_NO_ERROR;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:36,


示例4: wsLoginCertReadXML

gsi_bool wsLoginCertReadXML(GSLoginCertificate * cert, GSXmlStreamReader reader){	char hexstr[GS_CRYPT_RSA_BYTE_SIZE*2 +1]; // temp storage for key hex strings	int hexlen;	GS_ASSERT(cert != NULL);	GS_ASSERT(reader != NULL);	if (gsi_is_false(gsXmlReadChildAsInt      (reader, "length",     (int*)&cert->mLength))      ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "version",    (int*)&cert->mVersion))     ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "partnercode",(int*)&cert->mPartnerCode)) ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "namespaceid",(int*)&cert->mNamespaceId)) ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "userid",     (int*)&cert->mUserId))      ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "profileid",  (int*)&cert->mProfileId))   ||		gsi_is_false(gsXmlReadChildAsInt      (reader, "expiretime", (int*)&cert->mExpireTime))  ||		gsi_is_false(gsXmlReadChildAsTStringNT (reader, "profilenick", cert->mProfileNick, WS_LOGIN_NICK_LEN))       ||		gsi_is_false(gsXmlReadChildAsTStringNT (reader, "uniquenick",  cert->mUniqueNick,  WS_LOGIN_UNIQUENICK_LEN)) ||		gsi_is_false(gsXmlReadChildAsTStringNT (reader, "cdkeyhash",   cert->mCdKeyHash,   WS_LOGIN_KEYHASH_LEN))    ||		gsi_is_false(gsXmlReadChildAsStringNT (reader, "peerkeymodulus", hexstr, GS_CRYPT_RSA_BYTE_SIZE*2 +1)) ||		gsi_is_false(gsLargeIntSetFromHexString(&cert->mPeerPublicKey.modulus, hexstr)) ||		gsi_is_false(gsXmlReadChildAsStringNT (reader, "peerkeyexponent", hexstr, GS_CRYPT_RSA_BYTE_SIZE*2 +1)) ||		gsi_is_false(gsLargeIntSetFromHexString(&cert->mPeerPublicKey.exponent, hexstr)) ||		gsi_is_false(gsXmlReadChildAsHexBinary(reader, "serverdata", cert->mServerData, WS_LOGIN_SERVERDATA_LEN, &hexlen)) ||		gsi_is_false(gsXmlReadChildAsHexBinary(reader, "signature", cert->mSignature, WS_LOGIN_SIGNATURE_LEN, &hexlen))		)	{		return gsi_false;	}	return gsi_true;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:34,


示例5: gsUdpEngineRemoveMsgHandler

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UDP Layer must be initialized// When a message handler is done or shutting down, the message handler should remove// itself from the UDP Layer// The header cannot be emptyGSUdpErrorCode gsUdpEngineRemoveMsgHandler(char theHeader[GS_UDP_MSG_HEADER_LEN]){	GSUdpEngineObject *aUdp = gsUdpEngineGetEngine();	GSUdpMsgHandler aHandler;	int index;		GS_ASSERT(aUdp->mInitialized);	GS_ASSERT(theHeader);	if (!aUdp->mInitialized)	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug,			"[Udp Engine] Engine not initialized/n");		return GS_UDP_NETWORK_ERROR;	}	if (!theHeader || !theHeader[0])	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug,			"[Udp Engine] invalid or empty header/n");		return GS_UDP_PARAMETER_ERROR;	}		memcpy(aHandler.mHeader, theHeader, GS_UDP_MSG_HEADER_LEN);	index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare2, 0, 0);	if (index != NOT_FOUND)	{		ArrayDeleteAt(aUdp->mMsgHandlers, index);	}	return GS_UDP_NO_ERROR;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:37,


示例6: add_definition

    bool add_definition(const char* original, const char* replacement)    {        int cmp = strcmp(original, replacement);        GS_ASSERT(original[0] != '/0');        GS_ASSERT(replacement[0] != '/0');        GS_ASSERT(this->size < this->max);        GS_ASSERT(cmp != 0);        if (original[0] == '/0') return false;        if (replacement[0] == '/0') return false;        if (this->size >= this->max) return false;        if (cmp == 0) return false;        // make sure the original name is not duplicated        for (size_t i=0; i<this->size; i++)        {            size_t index = this->get_index(i);            int cmp = strcmp(original, &this->originals[index]);            GS_ASSERT(cmp != 0);            if (cmp == 0) return false;        }        size_t index = this->get_index(this->size);        strncpy(&this->originals[index], original, this->name_max);        this->originals[index + this->name_max] = '/0';        strncpy(&this->replacements[index], replacement, this->name_max);        this->replacements[index + this->name_max] = '/0';        this->size++;        return true;    }
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:32,


示例7: wsLoginCertWriteXML

gsi_bool wsLoginCertWriteXML(const GSLoginCertificate * cert, const char * aNamespace, GSXmlStreamWriter writer){	GS_ASSERT(cert != NULL);	GS_ASSERT(writer != NULL);	if (gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "length",      cert->mLength))       ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "version",     cert->mVersion))      ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "partnercode", cert->mPartnerCode))  ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "namespaceid", cert->mNamespaceId))  ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "userid",      cert->mUserId))       ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "profileid",   cert->mProfileId))    ||		gsi_is_false(gsXmlWriteIntElement(writer, aNamespace, "expiretime",  cert->mExpireTime))   ||		gsi_is_false(gsXmlWriteAsciiStringElement(writer, aNamespace, "profilenick", cert->mProfileNick))||		gsi_is_false(gsXmlWriteAsciiStringElement(writer, aNamespace, "uniquenick",  cert->mUniqueNick)) ||		gsi_is_false(gsXmlWriteAsciiStringElement(writer, aNamespace, "cdkeyhash",   cert->mCdKeyHash))  ||		gsi_is_false(gsXmlWriteLargeIntElement(writer, aNamespace, "peerkeymodulus", &cert->mPeerPublicKey.modulus)) || 		gsi_is_false(gsXmlWriteLargeIntElement(writer, aNamespace, "peerkeyexponent", &cert->mPeerPublicKey.exponent)) ||			gsi_is_false(gsXmlWriteHexBinaryElement(writer, aNamespace, "serverdata", cert->mServerData, WS_LOGIN_SERVERDATA_LEN)) ||		gsi_is_false(gsXmlWriteHexBinaryElement(writer, aNamespace, "signature", cert->mSignature, WS_LOGIN_SIGNATURE_LEN))		)	{		//gsLargeIntReverseBytes(&cert->mPeerPublicKey.modulus);		//gsLargeIntReverseBytes(&cert->mPeerPublicKey.exponent);		return gsi_false;	}			//gsLargeIntReverseBytes(&cert->mPeerPublicKey.modulus);	//gsLargeIntReverseBytes(&cert->mPeerPublicKey.exponent);	return gsi_true;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:30,


示例8: sciInterfaceCreate

SCResult sciInterfaceCreate(SCInterface** theInterfaceOut){#ifdef GSI_SC_STATIC_MEM	static SCInterface gStaticInterface;#endif	GS_ASSERT(theInterfaceOut != NULL);	// Check to see if the availability check has been performed and if it has	// set the service URL prepended with the gamename	if (__GSIACResult == GSIACAvailable)	{		if (scServiceURL[0] == '/0')			snprintf(scServiceURL, SC_SERVICE_MAX_URL_LEN, SC_SERVICE_URL_FORMAT, __GSIACGamename);	}	else		return SCResult_NO_AVAILABILITY_CHECK;	#ifdef GSI_SC_STATIC_MEM	*theInterfaceOut = &gStaticInterface;#else	*theInterfaceOut = (SCInterface*)gsimalloc(sizeof(SCInterface));	if (*theInterfaceOut == NULL)	{		return SCResult_OUT_OF_MEMORY;	}#endif	GS_ASSERT(*theInterfaceOut != NULL);	memset(*theInterfaceOut, 0, sizeof(SCInterface));	return SCResult_NO_ERROR;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:32,


示例9: parse_block

size_t parse_block(bool (*process_token) (const char*, const char*, Data*), const char* terminator, const char* str, Data* data){    data->reset();    data->valid = false;    const size_t LONGEST_LINE = 0x7F;    static char buf[LONGEST_LINE+1] = {'/0'};    size_t i = 0;    while (1)    {        char c = '/0';        size_t n = 0;        while ((c = str[i++]) != '/0' && c != '/n' && n < LONGEST_LINE)            buf[n++] = c;        buf[n] = '/0';        GS_ASSERT(c == '/n');        if (c != '/n') return i;        if (strcmp(buf, terminator) == 0) break;        GS_ASSERT(n > TAG_LENGTH + TAG_DELIMITER_LENGTH);        if (n <= TAG_LENGTH + TAG_DELIMITER_LENGTH) return i;        GS_ASSERT(buf[TAG_LENGTH] == TAG_DELIMITER[0]);        if (buf[TAG_LENGTH] != TAG_DELIMITER[0]) return i;        buf[TAG_LENGTH] = '/0';        const char* key = &buf[0];        const char* token = &buf[TAG_LENGTH+1];        if (!process_token(key, token, data)) return i;    }    data->valid = true;    return i;}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:32,


示例10: ArrayGrow

/* ArrayGrow * Reallocates the array to a new size, incresed by growby */static void ArrayGrow(DArray array){	GS_ASSERT(array->elemsize)	// sanity check -mj Oct 31st	array->capacity +=  array->growby;	array->list = gsirealloc(array->list, (size_t) array->capacity * array->elemsize);	GS_ASSERT(array->list);}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:10,


示例11: printf

void map_chunk_uncompressed_StoC::handle(char* buff, size_t byte_num){    //printf("map_chunk: alias= %d for %d %d /n", chunk_alias, chunk_index%MAP_CHUNK_XDIM, chunk_index /MAP_CHUNK_XDIM);    //printf("byte_size= %d /n", byte_size);#if MAP_NET_DEBUG    printf("map chunk is %d bytes /n", byte_size);#endif    GS_ASSERT(client_chunk_alias_list[chunk_alias] == -1);    client_chunk_alias_list[chunk_alias] = chunk_index;    int cx = chunk_index % MAP_CHUNK_XDIM;    int cy = chunk_index / MAP_CHUNK_XDIM;    GS_ASSERT(main_map->chunk[chunk_index] == NULL);    main_map->load_chunk(cx, cy);    class MapChunk* m = main_map->chunk[chunk_index];/*    This is evil, dont do this*/    memcpy((char *) m->e, buff, byte_num);    m->refresh_height_cache(); //refesh height cache after memcpy    main_map->chunk_received(cx,cy);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:26,


示例12: gpiGetPeerByAddr

// NOTE: use this function only when in a UDP layer callbackGPIPeer * gpiGetPeerByAddr(const GPConnection *connection,                           unsigned int ip,                           unsigned short port){	GPIConnection * iconnection = (GPIConnection*)*connection;	GPIPeer * pcurr;	GS_ASSERT(ip);	GS_ASSERT(port);	if (!ip && !port)		return NULL;	// Go through the list of peers.	////////////////////////////////	for(pcurr = iconnection->peerList ; pcurr != NULL ; pcurr  = pcurr->pnext)	{		// Check for a match.		/////////////////////		if(pcurr->ip == ip && pcurr->port == port)		{			// Got it.			//////////			return pcurr;		}	}	return NULL;}
开发者ID:DevSlashNull,项目名称:GameSpy,代码行数:28,


示例13: gpiPeerAddOp

// gpiPeerAddOp notes:// Assumes non-null inputs!// The queue should be empty when the first element is added.// Any new element added will be added to the end of the queue.void gpiPeerAddOp(GPIPeer *peer, GPIPeerOp *operation){	GS_ASSERT(peer);	GS_ASSERT(operation);	if (!peer || !operation)	{		gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError, "Peer operation not added");		return;	}	// Three cases can occur:	// The list is empty - set all pointers to the new node	// The list has only one element - set the first element's next to the new 	//     and set the last element to the new	// The list has more than one element - add the new element to the end of 	//     the queue	if (peer->peerOpQueue.opList == NULL)	{		peer->peerOpQueue.first = operation;		peer->peerOpQueue.last = operation;		peer->peerOpQueue.opList = operation;			}	else if (peer->peerOpQueue.first == peer->peerOpQueue.last)	{		peer->peerOpQueue.first->next = operation;		peer->peerOpQueue.last = operation;	}	else	{		peer->peerOpQueue.last->next = operation;		peer->peerOpQueue.last = operation;			}	gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer Operation Added");}
开发者ID:DevSlashNull,项目名称:GameSpy,代码行数:39,


示例14: OnRomClose

GS_VOID CPokeMiniEmulatorDlg::OnRomOpen(){    OnRomClose();    {        CFileDialog fileDialog(TRUE, _T("*.min"), NULL, OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_EXPLORER, _T("pokemon mini rom(*.min)|*.min"));        if (IDOK == fileDialog.DoModal())        {            CString fileName = fileDialog.GetPathName();            FILE *pFile = _wfopen(fileName, L"rb");            fseek(pFile, 0, SEEK_END);            m_romSize = ftell(pFile);            m_pRomData = GS_MALLOCZ_OBJ_N(GS_BYTE, m_romSize);            fseek(pFile, 0, SEEK_SET);            fread(m_pRomData, 1, m_romSize, pFile);            fclose(pFile);            m_pSaveData = GS_MALLOCZ_OBJ_N(GS_BYTE, m_pSystem->SaveSize());        }    }    if (m_pSystem->Initialize(m_pRomData, m_romSize, m_pSaveData))    {        HRESULT hr = S_OK;        hr = m_pDirectSoundBuffer->SetCurrentPosition(0);        GS_ASSERT(SUCCEEDED(hr));        hr = m_pDirectSoundBuffer->Play(0, 0, DSBPLAY_LOOPING);        GS_ASSERT(SUCCEEDED(hr));        m_state = EMU_RUN;        m_emuThread = CreateThread(NULL, 0, EmuThread, this, 0, &m_emuThreadID);    }}
开发者ID:DragonNeos,项目名称:pokemon-mini-emulator,代码行数:33,


示例15: gsUdpEngineRejectPeer

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UDP Layer must be initialized// theIp and thePort cannot be 0 (Zero)// Rejects a Peer's request for communication // Should only be used by AppGSUdpErrorCode gsUdpEngineRejectPeer(unsigned int theIp, unsigned short thePort){	GSUdpRemotePeer aRemotePeer;		GSUdpEngineObject *aUdp = gsUdpEngineGetEngine();	int index;	GS_ASSERT(aUdp->mInitialized);	GS_ASSERT(theIp);	GS_ASSERT(thePort);	if (!aUdp->mInitialized)	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug,			"[Udp Engine] Engine not initialized/n");		return GS_UDP_NETWORK_ERROR;	}	if (theIp == 0 || thePort == 0)	{		gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug,			"[Udp Engine] Invalid parameter(s), check ip, port/n");		return GS_UDP_PARAMETER_ERROR;	}	// Find the connection to reject in our array of peers	aRemotePeer.mAddr = theIp;	aRemotePeer.mPort = thePort;	index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0);	if (index != NOT_FOUND)	{		GSUdpRemotePeer *aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index);		gt2Reject(aPeerFound->mConnection, NULL, 0);		ArrayDeleteAt(aUdp->mRemotePeers, index);	}	return GS_UDP_NO_ERROR;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:40,


示例16: SetElement

/* SetElement * Sets the element at pos to the contents of elem */static void SetElement(DArray array, const void *elem, int pos){	GS_ASSERT(array)			// safety check -mj Oct 31st	GS_ASSERT(elem)		GS_ASSERT(array->elemsize)		memcpy(ArrayNth(array,pos), elem, (size_t)array->elemsize);}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,


示例17: init_equipment_texture

static void init_equipment_texture(){    GLuint min_filter = GL_LINEAR;    GLuint mag_filter = GL_NEAREST;    int ret = create_texture_from_file(MEDIA_PATH "sprites/container/equipment48.png", &EquipmentTexture, min_filter, mag_filter);    GS_ASSERT(ret == 0);    GS_ASSERT(EquipmentTexture != 0);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:8,


示例18: init_crusher_texture

static void init_crusher_texture(){    GLuint min_filter = GL_LINEAR;    GLuint mag_filter = GL_NEAREST;    int ret = create_texture_from_file(MEDIA_PATH "sprites/container/crusher48.png", &CrusherTexture, min_filter, mag_filter);    GS_ASSERT(ret == 0);    GS_ASSERT(CrusherTexture != 0);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:8,


示例19: init_storage_block_texture

static void init_storage_block_texture(){    GLuint min_filter = GL_LINEAR;    GLuint mag_filter = GL_NEAREST;    int ret = create_texture_from_file(MEDIA_PATH "sprites/container/storage_block48.png", &StorageBlockTexture, min_filter, mag_filter);    GS_ASSERT(ret == 0);    GS_ASSERT(StorageBlockTexture != 0);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:8,


示例20: save_active_names

bool save_active_names(const Property* properties, size_t count, size_t name_len, const char* filename){    bool worked = false;    const char tmp[] = ".tmp";    char* tmp_filename = (char*)malloc((strlen(filename) + sizeof(tmp)) * sizeof(char));    sprintf(tmp_filename, "%s%s", filename, tmp);    const char bak[] = ".bak";    char* bak_filename = (char*)malloc((strlen(filename) + sizeof(bak)) * sizeof(char));    sprintf(bak_filename, "%s%s", filename, bak);    char* buf = (char*)malloc((name_len+2) * sizeof(char));    FILE* f = fopen(tmp_filename, "w");    GS_ASSERT(f != NULL);    if (f == NULL)        goto error;    for (size_t i=0; i<count; i++)    {        if (!properties[i].loaded) continue;        size_t len = strlen(properties[i].name);        GS_ASSERT(len > 0 && len <= name_len);        if (len <= 0 || len > name_len)            goto error;        strncpy(buf, properties[i].name, len);        buf[len] = '/n';        buf[len+1] = '/0';        size_t wrote = fwrite(buf, sizeof(char), len+1, f);        GS_ASSERT(wrote == len + 1);        if (wrote != len + 1)            goto error;    }    worked = true;    error:  // ERROR LABEL    if (f != NULL)    {        worked = (fclose(f) == 0);        GS_ASSERT(worked);    }    if (worked)    {        worked = save_tmp_file(filename, tmp_filename, bak_filename);        GS_ASSERT(worked);    }    free(tmp_filename);    free(bak_filename);    free(buf);    return worked;}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:57,


示例21: set_cube_palette_texture

void set_cube_palette_texture(CubeType id, int side, int tex_id){    GS_ASSERT_ABORT(cube_texture_palette_debug[cube_texture_palette_index] == 1);    cube_texture_palette[6*cube_texture_palette_index + side] = tex_id;    GS_ASSERT(cube_texture_palette_index <= cube_texture_palette_lookup[id] + cube_texture_palette_lookup_max[id]);    GS_ASSERT(cube_texture_palette_index >= cube_texture_palette_lookup[id]);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:9,


示例22: set_periodic

 void set_periodic(int duration, int period) {     GS_ASSERT(this->duration == -1 && this->period == -1);     GS_ASSERT(duration >= 0 && period >= 0);     GS_ASSERT(duration >= period);     this->duration = duration;     this->period = period;     this->event_type = MODIFIER_EVENT_PERIODIC; }
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:9,


示例23: GS_ASSERT

void VoxelRenderListManager::unregister_voxel_volume(class VoxelVolume* vv){    GS_ASSERT(this->max > 0);    GS_ASSERT(this->lists != NULL);    // unregister from correct list    int id = vv->voxel_render_list_id;    if (id < 0 || id >= this->max) return;    this->lists[id].unregister_voxel_volume(vv);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:10,


示例24: gpiPeerAddMessage

GPResultgpiPeerAddMessage(  GPConnection * connection,  GPIPeer * peer,  int type,  const char * message){	GPIMessage gpiMessage;	int len;	GS_ASSERT(peer != NULL);	GS_ASSERT(message != NULL);		if (peer == NULL)		return GP_NETWORK_ERROR;	if (message == NULL)		return GP_NETWORK_ERROR;	// Get the length.	//////////////////	len = (int)strlen(message);	// Clear the message.	/////////////////////	memset(&gpiMessage, 0, sizeof(GPIMessage));	// Copy the type.	/////////////////	gpiMessage.type = type;	// Copy the header to the buffer.	/////////////////////////////////	CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "//m//"));	CHECK_RESULT(gpiAppendIntToBuffer(connection, &gpiMessage.buffer, type));	CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "//len//"));	CHECK_RESULT(gpiAppendIntToBuffer(connection, &gpiMessage.buffer, len));	CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "//msg///n"));	// Copy the message to the buffer.	//////////////////////////////////	gpiMessage.start = gpiMessage.buffer.len;	CHECK_RESULT(gpiAppendStringToBufferLen(connection, &gpiMessage.buffer, message, len));	CHECK_RESULT(gpiAppendCharToBuffer(connection, &gpiMessage.buffer, '/0'));	// Add it to the list.	//////////////////////	ArrayAppend(peer->messages, &gpiMessage);	// Reset the timeout.	/////////////////////	peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT);	return GP_NO_ERROR;}
开发者ID:DevSlashNull,项目名称:GameSpy,代码行数:55,


示例25: GS_ASSERT

GHTTPBool ghttpPostAddXml(	GHTTPPost post,	GSXmlStreamWriter soap){	GS_ASSERT(post != NULL);	GS_ASSERT(soap != NULL);	return ghiPostAddXml(post, soap);}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:11,


示例26: save

    bool save(const char* filename)    {        bool worked = false;        const char line_ending[] = "/n";        const char tmp[] = ".tmp";        char* tmp_filename = (char*)malloc((strlen(filename) + sizeof(tmp)) * sizeof(char));        sprintf(tmp_filename, "%s%s", filename, tmp);        const char bak[] = ".bak";        char* bak_filename = (char*)malloc((strlen(filename) + sizeof(bak)) * sizeof(char));        sprintf(bak_filename, "%s%s", filename, bak);        FILE* f = fopen(tmp_filename, "w");        GS_ASSERT(f != NULL);        if (f == NULL)            goto error;        for (size_t i=0; i<this->size; i++)        {            size_t index = this->get_index(i);            size_t len = strlen(&this->originals[index]);            size_t wrote = fwrite(&this->originals[index], sizeof(char), len, f);            GS_ASSERT(wrote == len);            if (wrote != len)                goto error;            wrote = fwrite(line_ending, sizeof(char), sizeof(line_ending)-1, f);            GS_ASSERT(wrote == sizeof(line_ending)-1);            if (wrote != sizeof(line_ending)-1)                goto error;        }        worked = true;        error:  // ERROR LABEL        if (f != NULL)        {            worked = (fclose(f) == 0);            GS_ASSERT(worked);        }        if (worked)        {            worked = save_tmp_file(filename, tmp_filename, bak_filename);            GS_ASSERT(worked);        }        free(tmp_filename);        free(bak_filename);        return worked;    }
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:54,


示例27: sciInterfaceSetConnectionId

void sciInterfaceSetConnectionId(SCInterface * theInterface, const char * theConnectionId){	GS_ASSERT(theInterface != NULL);	if (theConnectionId == NULL)		theInterface->mConnectionId[0] = '/0';	else	{		GS_ASSERT(strlen(theConnectionId) < sizeof(theInterface->mConnectionId));		strcpy((char *)theInterface->mConnectionId, theConnectionId);	}}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,


示例28: while

void VoxelRenderList::update_vertex_buffer_object(){    VoxelVolume* vv = NULL;    struct VBOmeta* _vbo = &vbo_wrapper[0];    int v_num = 0;    int volumes_updated = 0;    for (int i=0; i < VOXEL_RENDER_LIST_SIZE; i++)    {        if (this->render_list[i] == NULL) continue;        vv = this->render_list[i];        if (vv->needs_vbo_update)        {            vv->needs_vbo_update = false;            volumes_updated++;            vv->update_vertex_list();        }        v_num += vv->vvl.vnum;    }    _vbo->vnum = v_num;    if (v_num == 0) return;    if (!this->needs_update && volumes_updated == 0) return; //return if nothing to update    this->needs_update = false;    if (v_num >= _vbo->max_size)    {        while (v_num >= _vbo->max_size) _vbo->max_size *= 2; //double max size until its large enough and realloc        _vbo->vertex_list = (VoxelVertex*)realloc(_vbo->vertex_list, _vbo->max_size*sizeof(VoxelVertex));    }    int index = 0;    // continue counting indices, but realigning changed data    for (int i=0; i < VOXEL_RENDER_LIST_SIZE; i++)    {        if (this->render_list[i] == NULL) continue;        vv = this->render_list[i];        GS_ASSERT(vv->vvl.vnum != 0);        GS_ASSERT(vv->vvl.vertex_list != 0)        memcpy(&_vbo->vertex_list[index], vv->vvl.vertex_list, vv->vvl.vnum*sizeof(VoxelVertex));        vv->vvl.voff = index;        index += vv->vvl.vnum;    }    GS_ASSERT(index == v_num);    if (_vbo->id == 0)  glGenBuffers(1, &_vbo->id);    glBindBuffer(GL_ARRAY_BUFFER, _vbo->id);    glBufferData(GL_ARRAY_BUFFER, index*sizeof(VoxelVertex), NULL, GL_STATIC_DRAW);    glBufferData(GL_ARRAY_BUFFER, index*sizeof(VoxelVertex), _vbo->vertex_list, GL_STATIC_DRAW);}
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:53,


示例29: sciReportAddFloatValue

SCResult SC_CALL sciReportAddFloatValue(SCIReport * theReport,									    gsi_u16     theKeyId,									    float       theValue){	SCIReportHeader * aHeader = (SCIReportHeader*)theReport->mBuffer.mData;	int writtenLen = 0;	gsi_i16 theKeyType = SCIKeyType_FLOAT;	// calculate length of data to be written	writtenLen += sizeof(gsi_u16) + sizeof(gsi_u16); // 2 byte key ID, 2 byte key type;	writtenLen += sizeof(float);					 // stored in stream as a 4 byte char array	// Check room in buffer	GS_ASSERT((theReport->mBuffer.mPos + writtenLen) < theReport->mBuffer.mCapacity);	// Update count and length markers	if (theReport->mReportState == SCIReportState_GLOBALDATA)	{		aHeader->mGameKeyCount++;		aHeader->mGameSectionLength += writtenLen;	}	else if (theReport->mReportState == SCIReportState_PLAYERDATA)	{		GS_ASSERT(theReport->mCurEntityStartPos != -1);		aHeader->mPlayerKeyCount++;		aHeader->mPlayerSectionLength += writtenLen;				theReport->mCurEntityKeyCount++;		sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mCurEntityStartPos], (gsi_i16)theReport->mCurEntityKeyCount);	}	else if (theReport->mReportState == SCIReportState_TEAMDATA)	{		aHeader->mTeamKeyCount++;		aHeader->mTeamSectionLength += writtenLen;		theReport->mCurEntityKeyCount++;		sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mCurEntityStartPos], (gsi_i16)theReport->mCurEntityKeyCount);	}	// Needs real error handling code or an assertion on a non-constant expression	//else 	//	GS_ASSERT(0); // invalid state for writing key/value pairs!	// Write the data	sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mBuffer.mPos], (gsi_i16)theKeyId);	theReport->mBuffer.mPos += sizeof(gsi_u16);	sciSerializeInt16((gsi_u8 *)&theReport->mBuffer.mData[theReport->mBuffer.mPos], theKeyType);	theReport->mBuffer.mPos += sizeof(gsi_u16);	sciSerializeFloat((gsi_u8 *)&theReport->mBuffer.mData[theReport->mBuffer.mPos], theValue);	theReport->mBuffer.mPos += sizeof(float);	return SCResult_NO_ERROR;}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:52,


示例30: ServerBrowserSortA

void ServerBrowserSortA(ServerBrowser sb, SBBool ascending, const char *sortkey, SBCompareMode comparemode){	SortInfo info;	info.comparemode = comparemode;#ifdef GSI_UNICODE	GS_ASSERT(sortkey != NULL && _tcslen((const unsigned short *)sortkey) <= SORTKEY_LENGTH);	_tcscpy(info.sortkey, (const unsigned short *)sortkey);#else	GS_ASSERT(sortkey != NULL && _tcslen(sortkey) <= SORTKEY_LENGTH);	_tcscpy(info.sortkey, sortkey);#endif	SBServerListSort(&sb->list, ascending, info);}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:13,



注:本文中的GS_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GS_L函数代码示例
C++ GSVector4函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。