• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ERROR_MSG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ERROR_MSG

//-------------------------------------------------------------------------------------
int NavMeshHandle::findStraightPath(int layer, const Position3D& start, const Position3D& end, std::vector<Position3D>& paths)
{
	std::map<int, NavmeshLayer>::iterator iter = navmeshLayer.find(layer);
	if(iter == navmeshLayer.end())
	{
		ERROR_MSG(fmt::format("NavMeshHandle::findStraightPath: not found layer({})\n",  layer));
		return NAV_ERROR;
	}

	dtNavMeshQuery* navmeshQuery = iter->second.pNavmeshQuery;
	// dtNavMesh* 

	float spos[3];
	spos[0] = start.x;
	spos[1] = start.y;
	spos[2] = start.z;

	float epos[3];
	epos[0] = end.x;
	epos[1] = end.y;
	epos[2] = end.z;

	dtQueryFilter filter;
	filter.setIncludeFlags(0xffff);
	filter.setExcludeFlags(0);

	const float extents[3] = {2.f, 4.f, 2.f};

	dtPolyRef startRef = INVALID_NAVMESH_POLYREF;
	dtPolyRef endRef = INVALID_NAVMESH_POLYREF;

	float startNearestPt[3];
	float endNearestPt[3];
	navmeshQuery->findNearestPoly(spos, extents, &filter, &startRef, startNearestPt);
	navmeshQuery->findNearestPoly(epos, extents, &filter, &endRef, endNearestPt);

	if (!startRef || !endRef)
	{
		ERROR_MSG(fmt::format("NavMeshHandle::findStraightPath({2}): Could not find any nearby poly's ({0}, {1})\n", startRef, endRef, resPath));
		return NAV_ERROR_NEARESTPOLY;
	}

	dtPolyRef polys[MAX_POLYS];
	int npolys;
	float straightPath[MAX_POLYS * 3];
	unsigned char straightPathFlags[MAX_POLYS];
	dtPolyRef straightPathPolys[MAX_POLYS];
	int nstraightPath;
	int pos = 0;

	navmeshQuery->findPath(startRef, endRef, startNearestPt, endNearestPt, &filter, polys, &npolys, MAX_POLYS);
	nstraightPath = 0;

	if (npolys)
	{
		float epos1[3];
		dtVcopy(epos1, endNearestPt);
				
		if (polys[npolys-1] != endRef)
			navmeshQuery->closestPointOnPoly(polys[npolys-1], endNearestPt, epos1);
				
		navmeshQuery->findStraightPath(startNearestPt, endNearestPt, polys, npolys, straightPath, straightPathFlags, straightPathPolys, &nstraightPath, MAX_POLYS);

		Position3D currpos;
		for(int i = 0; i < nstraightPath * 3; )
		{
			currpos.x = straightPath[i++];
			currpos.y = straightPath[i++];
			currpos.z = straightPath[i++];
			paths.push_back(currpos);
			pos++; 
			
			//DEBUG_MSG(fmt::format("NavMeshHandle::findStraightPath: {}->{}, {}, {}\n", pos, currpos.x, currpos.y, currpos.z));
		}
	}

	return pos;
}
开发者ID:281627166,项目名称:kbengine,代码行数:79,代码来源:navigation_mesh_handle.cpp


示例2: render_export_obj

int render_export_obj(char **buffer)
{
	IF_FAILED0(init && buffer);
	
	int element_buffer_size = 0, vertex_buffer_size = 0, normal_buffer_size = 0;
	GLuint vertex_vbo, index_vbo, normal_vbo;
	GLint last_array_buffer, last_element_array_buffer;
	
	glBindVertexArray(0);
	
	glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);	
	glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
	
	glGenBuffers(1, &vertex_vbo);
	glGenBuffers(1, &index_vbo);
	glGenBuffers(1, &normal_vbo);
	
	if(!marching_cubes_create_vbos(volume, 
								   volume_size, 
								   grid_size, 
								   isolevel, vertex_vbo, index_vbo, normal_vbo,
								   volume_func, NULL)) {
		
		ERROR_MSG("Marching Cubes: nothing to generate");
		
		glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
		
		return 0;
	}
	
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_vbo);
	glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &element_buffer_size);
	glBindBuffer(GL_ARRAY_BUFFER, vertex_vbo);
	glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &vertex_buffer_size);
	glBindBuffer(GL_ARRAY_BUFFER, normal_vbo);
	glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &normal_buffer_size);
	
	if(element_buffer_size <= 0 || vertex_buffer_size <= 0 || normal_buffer_size <= 0) {
		
		glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
		
		return 0;
	}
	
	float *vertex_data = (float*) malloc(vertex_buffer_size);
	float *normal_data = (float*) malloc(normal_buffer_size);
	unsigned int *element_data = (unsigned int*) malloc(element_buffer_size);
	
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_vbo);
	glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, element_buffer_size, element_data);
	glBindBuffer(GL_ARRAY_BUFFER, vertex_vbo);
	glGetBufferSubData(GL_ARRAY_BUFFER, 0, vertex_buffer_size, vertex_data);
	glBindBuffer(GL_ARRAY_BUFFER, normal_vbo);
	glGetBufferSubData(GL_ARRAY_BUFFER, 0, normal_buffer_size, normal_data);
	
	// выделяем как можно больше памяти, чтобы вместились все данные
	*buffer = (char*) malloc(sizeof(char) * (element_buffer_size + vertex_buffer_size + normal_buffer_size)*8);
	*buffer[0] = '\0';
	
	strcat(*buffer, "# Generated via VRender\n");
	
	char *temp = (char*) malloc(sizeof(char) * 64);
	sprintf(temp, "# isolevel: %.3f\n", isolevel);
	strcat(*buffer, temp);
	sprintf(temp, "# volume size: x %i y %i z %i\n", volume_size.x, volume_size.y, volume_size.z);
	strcat(*buffer, temp);
	sprintf(temp, "# grid size: x %i y %i z %i\n", grid_size.x, grid_size.y, grid_size.z);
	strcat(*buffer, temp);
	
	unsigned buffer_begin = strlen(*buffer);
	unsigned num_chars = 0;
	char *ptr = *buffer;
	
	ptr += buffer_begin;
	
	
	num_chars = sprintf(temp, "\n# Vertices\n");
	strcat(ptr, temp);
	ptr += num_chars;
	
	for(unsigned i = 0; i < (vertex_buffer_size / sizeof(float)); i += 3) {
		num_chars = sprintf(temp, "v %f %f %f\n", vertex_data[i], vertex_data[i+1], vertex_data[i+2]);
		strcat(ptr, temp);
		ptr += num_chars;
	}
	
	num_chars = sprintf(temp, "\n# Normals\n");
	strcat(ptr, temp);
	ptr += num_chars;
	
	for(unsigned i = 0; i < (normal_buffer_size / sizeof(float)); i += 3) {	
		num_chars = sprintf(temp, "vn %f %f %f\n", normal_data[i], normal_data[i+1], normal_data[i+2]);
		strcat(ptr, temp);
		ptr += num_chars;
	}
	
	num_chars = sprintf(temp, "\n# Faces\n");
	strcat(ptr, temp);
//.........这里部分代码省略.........
开发者ID:RealSfera,项目名称:VRender,代码行数:101,代码来源:render.c


示例3: meterd_createdb_counters

meterd_rv meterd_createdb_counters(int force_overwrite)
{
	counter_spec*	counters	= NULL;
	char*		db_name		= NULL;
	char*		gas_id		= NULL;
	char*		gas_description	= NULL;
	meterd_rv	rv		= MRV_OK;
	void*		db_handle	= NULL;

	/* Check if the database type is configured */
	if ((rv = meterd_conf_get_string("database", "total_consumed", &db_name, NULL)) != MRV_OK)
	{
		ERROR_MSG("Failed to retrieve configuration option database.counters");

		return rv;
	}

	if (db_name == NULL)
	{
		INFO_MSG("No database for consumption and production counters specified, skipping");

		return MRV_OK;
	}

	/* Retrieve the consumption counters */
	if ((rv = meterd_conf_get_counter_specs("database", "consumption", COUNTER_TYPE_CONSUMED, &counters)) != MRV_OK)
	{
		ERROR_MSG("Failed to retrieve consumption counter configuration");

		return rv;
	}

	/* Retrieve the production counters */
	if ((rv = meterd_conf_get_counter_specs("database", "production", COUNTER_TYPE_PRODUCED, &counters)) != MRV_OK)
	{
		ERROR_MSG("Failed to retrieve production counter configuration");

		return rv;
	}

	/* Check if there is a gas counter configured */
	if (((rv = meterd_conf_get_string("database.gascounter", "id", &gas_id, NULL)) != MRV_OK) ||
	    ((rv = meterd_conf_get_string("database.gascounter", "description", &gas_description, NULL)) != MRV_OK))
	{
		ERROR_MSG("Failed to retrieve gas counter configuration");

		free(db_name);
		free(gas_id);
		free(gas_description);
		meterd_conf_free_counter_specs(counters);

		return rv;
	}

	/* Add the gas counter if specified */
	if (gas_id != NULL)
	{
		counter_spec* new_counter = NULL;

		if (gas_description == NULL)
		{
			gas_description = strdup("Gas");
		}

		new_counter = (counter_spec*) malloc(sizeof(counter_spec));

		if (new_counter == NULL)
		{
			free(db_name);
			free(gas_id);
			free(gas_description);
			meterd_conf_free_counter_specs(counters);

			return MRV_MEMORY;
		}

		new_counter->id 		= gas_id;
		new_counter->description	= gas_description;
		new_counter->table_name		= meterd_conf_create_table_name(gas_id, COUNTER_TYPE_CONSUMED);
		new_counter->type		= COUNTER_TYPE_CONSUMED;

		LL_APPEND(counters, new_counter);
	}

	/* Create and open the database */
	if ((rv = meterd_db_create(db_name, force_overwrite, &db_handle)) != MRV_OK)
	{
		ERROR_MSG("Failed to create database %s for counters", db_name);

		free(db_name);
		meterd_conf_free_counter_specs(counters);

		return rv;
	}

	INFO_MSG("Created database %s for counters", db_name);

	/* Create data tables */
	if ((rv = meterd_db_create_tables(db_handle, counters)) != MRV_OK)
	{
//.........这里部分代码省略.........
开发者ID:rijswijk,项目名称:meterd,代码行数:101,代码来源:meterd_createdb.c


示例4: PyUnicode_FromString

//-------------------------------------------------------------------------------------
bool PythonApp::installPyModules()
{
	// 安装入口模块
	PyObject *entryScriptFileName = NULL;
	if(componentType() == BASEAPP_TYPE)
	{
		ENGINE_COMPONENT_INFO& info = g_kbeSrvConfig.getBaseApp();
		entryScriptFileName = PyUnicode_FromString(info.entryScriptFile);
	}
	else if(componentType() == CELLAPP_TYPE)
	{
		ENGINE_COMPONENT_INFO& info = g_kbeSrvConfig.getCellApp();
		entryScriptFileName = PyUnicode_FromString(info.entryScriptFile);
	}
	else if(componentType() == INTERFACES_TYPE)
	{
		ENGINE_COMPONENT_INFO& info = g_kbeSrvConfig.getInterfaces();
		entryScriptFileName = PyUnicode_FromString(info.entryScriptFile);
	}
	else if (componentType() == LOGINAPP_TYPE)
	{
		ENGINE_COMPONENT_INFO& info = g_kbeSrvConfig.getLoginApp();
		entryScriptFileName = PyUnicode_FromString(info.entryScriptFile);
	}
	else if (componentType() == DBMGR_TYPE)
	{
		ENGINE_COMPONENT_INFO& info = g_kbeSrvConfig.getDBMgr();
		entryScriptFileName = PyUnicode_FromString(info.entryScriptFile);
	}
	else
	{
		ERROR_MSG("PythonApp::installPyModules: entryScriptFileName is NULL!\n");
	}

	// 注册创建entity的方法到py
	// 向脚本注册app发布状态
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	publish,			__py_getAppPublish,						METH_VARARGS,	0);

	// 注册设置脚本输出类型
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	scriptLogType,		__py_setScriptLogType,					METH_VARARGS,	0);
	
	// 获得资源全路径
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	getResFullPath,		__py_getResFullPath,					METH_VARARGS,	0);

	// 是否存在某个资源
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	hasRes,				__py_hasRes,							METH_VARARGS,	0);

	// 打开一个文件
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	open,				__py_kbeOpen,							METH_VARARGS,	0);

	// 列出目录下所有文件
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	listPathRes,		__py_listPathRes,						METH_VARARGS,	0);

	// 匹配相对路径获得全路径
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	matchPath,			__py_matchPath,							METH_VARARGS,	0);

	// debug追踪kbe封装的py对象计数
	APPEND_SCRIPT_MODULE_METHOD(getScript().getModule(),	debugTracing,		script::PyGC::__py_debugTracing,		METH_VARARGS,	0);

	if(PyModule_AddIntConstant(this->getScript().getModule(), "LOG_TYPE_NORMAL", log4cxx::ScriptLevel::SCRIPT_INT))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.LOG_TYPE_NORMAL.\n");
	}

	if(PyModule_AddIntConstant(this->getScript().getModule(), "LOG_TYPE_INFO", log4cxx::ScriptLevel::SCRIPT_INFO))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.LOG_TYPE_INFO.\n");
	}

	if(PyModule_AddIntConstant(this->getScript().getModule(), "LOG_TYPE_ERR", log4cxx::ScriptLevel::SCRIPT_ERR))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.LOG_TYPE_ERR.\n");
	}

	if(PyModule_AddIntConstant(this->getScript().getModule(), "LOG_TYPE_DBG", log4cxx::ScriptLevel::SCRIPT_DBG))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.LOG_TYPE_DBG.\n");
	}

	if(PyModule_AddIntConstant(this->getScript().getModule(), "LOG_TYPE_WAR", log4cxx::ScriptLevel::SCRIPT_WAR))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.LOG_TYPE_WAR.\n");
	}

	if(PyModule_AddIntConstant(this->getScript().getModule(), "NEXT_ONLY", KBE_NEXT_ONLY))
	{
		ERROR_MSG( "PythonApp::installPyModules: Unable to set KBEngine.NEXT_ONLY.\n");
	}
	
	onInstallPyModules();

	if (entryScriptFileName != NULL)
	{
		entryScript_ = PyImport_Import(entryScriptFileName);
		SCRIPT_ERROR_CHECK();
		S_RELEASE(entryScriptFileName);

		if(entryScript_.get() == NULL)
		{
//.........这里部分代码省略.........
开发者ID:nichunen,项目名称:kbengine,代码行数:101,代码来源:python_app.cpp


示例5: ERROR_MSG

//-------------------------------------------------------------------------------------		
bool Components::updateComponentInfos(const Components::ComponentInfos* info)
{
	// 不对其他machine做处理
	if(info->componentType == MACHINE_TYPE)
	{
		return true;
	}

	Network::EndPoint epListen;
	epListen.socket(SOCK_STREAM);
	if (!epListen.good())
	{
		ERROR_MSG("Components::updateComponentInfos: couldn't create a socket\n");
		return true;
	}
	
	epListen.setnonblocking(true);

	while(true)
	{
		fd_set	frds, fwds;
		struct timeval tv = { 0, 300000 }; // 100ms

		FD_ZERO( &frds );
		FD_ZERO( &fwds );
		FD_SET((int)epListen, &frds);
		FD_SET((int)epListen, &fwds);

		if(epListen.connect(info->pIntAddr->port, info->pIntAddr->ip) == -1)
		{
			int selgot = select(epListen+1, &frds, &fwds, NULL, &tv);
			if(selgot > 0)
			{
				break;
			}

			WARNING_MSG(fmt::format("Components::updateComponentInfos: couldn't connect to:{}\n", 
				info->pIntAddr->c_str()));

			return false;
		}
	}
	
	epListen.setnodelay(true);

	Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();

	// 由于COMMON_NETWORK_MESSAGE不包含client, 如果是bots, 我们需要单独处理
	if(info->componentType != BOTS_TYPE)
	{
		COMMON_NETWORK_MESSAGE(info->componentType, (*pBundle), lookApp);
	}
	else
	{
		(*pBundle).newMessage(BotsInterface::lookApp);
	}

	epListen.send(pBundle->pCurrPacket()->data(), pBundle->pCurrPacket()->wpos());
	Network::Bundle::ObjPool().reclaimObject(pBundle);

	fd_set	fds;
	struct timeval tv = { 0, 300000 }; // 100ms

	FD_ZERO( &fds );
	FD_SET((int)epListen, &fds);

	int selgot = select(epListen+1, &fds, NULL, NULL, &tv);
	if(selgot == 0)
	{
		// 超时, 可能对方繁忙
		return true;	
	}
	else if(selgot == -1)
	{
		return true;
	}
	else
	{
		COMPONENT_TYPE ctype;
		COMPONENT_ID cid;
		int8 istate = 0;
		ArraySize entitySize = 0, cellSize = 0;
		int32 clientsSize = 0, proxicesSize = 0;
		uint32 telnet_port = 0;

		Network::TCPPacket packet;
		packet.resize(255);
		int recvsize = sizeof(ctype) + sizeof(cid) + sizeof(istate);

		if(info->componentType == CELLAPP_TYPE)
		{
			recvsize += sizeof(entitySize) + sizeof(cellSize) + sizeof(telnet_port);
		}

		if(info->componentType == BASEAPP_TYPE)
		{
			recvsize += sizeof(entitySize) + sizeof(clientsSize) + sizeof(proxicesSize) + sizeof(telnet_port);
		}

//.........这里部分代码省略.........
开发者ID:JustDo1989,项目名称:kbengine,代码行数:101,代码来源:components.cpp


示例6: var_apGeneralInfo


//.........这里部分代码省略.........
	 *var_len = strlen(string);
       return (u_char*) string;   

//heyanhua add for setPingIPaddr ---2010-4-23
    case SETPINGIPADDR:
		memset(ipaddr,0,32);
		*write_method = write_setPingIPaddr;
		 prop_count=load_prop(SEP_EQUAL,SNMP_AGENT_CONF,properties);
         get_prop("PING_ADDR",ipaddr,properties,prop_count);
         free_prop(properties,prop_count) ;	 
		 printf("setPingIPaddr:%s\n",ipaddr);
          retu_addr=inet_addr(ipaddr);
	  *var_len = 4;      
	  return ( UCHAR * )&retu_addr;
		

//heyanhua add for ping testing ---2010-4-22
	case SYSPINGTESTING:
		{
			FILE *fp;
			char cmd[128];
			memset(cmd, 0, 128);
			memset(string1,0,2048);
			memset(string2,0,2048);

			prop_count=load_prop(SEP_EQUAL,SNMP_AGENT_CONF,properties);
         get_prop("PING_ADDR",para,properties,prop_count);
         free_prop(properties,prop_count) ;	   
		 printf("The PING_ADDR is :%s\n",para);
        //  retu_addr=inet_addr(para);
			sprintf(cmd,"%s %s","/bin/ping -c 4",para);

				fp=popen(cmd,"r");
				if(fp)
				{
					while(NULL!=fgets(string1,sizeof(string1),fp))
					strcat(string2,string1);
					printf("heyanhua test! string1:%s\n",string1);
					pclose(fp);
				}
			*var_len=strlen(string2);
			printf("heyanhua test 1:string2:%s\n",string2);
			return (u_char *)string2;
		}
	
	case HARDWAREVERSION:  //heyanhua add 2010-4-30
		{
			FILE *fp;
			fp=popen("/usr/sbin/showsysinfo |awk -F : '/Hardware/ {print $2}'","r");
			if(fp)
				{
					memset(string,0,256);
					fgets(string,sizeof(string),fp);
					pclose(fp);
				}
			*var_len=strlen(string);
			return (u_char *)string;
		}
	case SETPINGIPV6ADDR:
		memset(string,0,256);
			*write_method=write_setPingIPv6addr;
			prop_count=load_prop(SEP_EQUAL,SNMP_AGENT_CONF,properties);
         get_prop("PING_IPv6_ADDR",string,properties,prop_count);
         free_prop(properties,prop_count) ;	 
		 printf("setPingIPaddr:%s\n",string);
	  *var_len = strlen(string);      
	  return ( UCHAR * )string;

	  case SYSPINGIPV6TESTING:
	  	{
			FILE *fp;
			char cmd[128];
			memset(cmd, 0, 128);
			memset(string1,0,2048);
			memset(string2,0,2048);

			prop_count=load_prop(SEP_EQUAL,SNMP_AGENT_CONF,properties);
         get_prop("PING_IPv6_ADDR",para,properties,prop_count);
         free_prop(properties,prop_count) ;	   
		 printf("The PING_IPv6_ADDR is :%s\n",para);
			sprintf(cmd,"%s %s","/bin/ping6 -c 4",para);

				fp=popen(cmd,"r");
				if(fp)
				{
					while(NULL!=fgets(string1,sizeof(string1),fp))
					strcat(string2,string1);
					printf("heyanhua test! string1:%s\n",string1);
					pclose(fp);
				}
			*var_len=strlen(string2);
			printf("heyanhua test 1:string2:%s\n",string2);
			return (u_char *)string2;
		}

    default:
      ERROR_MSG("");
    }
    return NULL;
}
开发者ID:tcdog001,项目名称:apv5sdk-v15,代码行数:101,代码来源:apGeneralInfo.c


示例7: AUTO_SCOPED_PROFILE

//-------------------------------------------------------------------------------------
bool Loginapp::_createAccount(Network::Channel* pChannel, std::string& accountName, 
								 std::string& password, std::string& datas, ACCOUNT_TYPE type)
{
	AUTO_SCOPED_PROFILE("createAccount");

	ACCOUNT_TYPE oldType = type;

	if(!g_kbeSrvConfig.getDBMgr().account_registration_enable)
	{
		WARNING_MSG(fmt::format("Loginapp::_createAccount({}): not available!\n", accountName));

		std::string retdatas = "";
		Network::Bundle* pBundle = Network::Bundle::createPoolObject();
		(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
		SERVER_ERROR_CODE retcode = SERVER_ERR_ACCOUNT_REGISTER_NOT_AVAILABLE;
		(*pBundle) << retcode;
		(*pBundle).appendBlob(retdatas);
		pChannel->send(pBundle);
		return false;
	}

	accountName = KBEngine::strutil::kbe_trim(accountName);
	password = KBEngine::strutil::kbe_trim(password);

	if(accountName.size() > ACCOUNT_NAME_MAX_LENGTH)
	{
		ERROR_MSG(fmt::format("Loginapp::_createAccount: accountName too big, size={}, limit={}.\n",
			accountName.size(), ACCOUNT_NAME_MAX_LENGTH));

		return false;
	}

	if(password.size() > ACCOUNT_PASSWD_MAX_LENGTH)
	{
		ERROR_MSG(fmt::format("Loginapp::_createAccount: password too big, size={}, limit={}.\n",
			password.size(), ACCOUNT_PASSWD_MAX_LENGTH));

		return false;
	}

	if(datas.size() > ACCOUNT_DATA_MAX_LENGTH)
	{
		ERROR_MSG(fmt::format("Loginapp::_createAccount: bindatas too big, size={}, limit={}.\n",
			datas.size(), ACCOUNT_DATA_MAX_LENGTH));

		return false;
	}
	
	std::string retdatas = "";
	if(shuttingdown_ != SHUTDOWN_STATE_STOP)
	{
		WARNING_MSG(fmt::format("Loginapp::_createAccount: shutting down, create {} failed!\n", accountName));

		Network::Bundle* pBundle = Network::Bundle::createPoolObject();
		(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
		SERVER_ERROR_CODE retcode = SERVER_ERR_IN_SHUTTINGDOWN;
		(*pBundle) << retcode;
		(*pBundle).appendBlob(retdatas);
		pChannel->send(pBundle);
		return false;
	}

	PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.find(const_cast<std::string&>(accountName));
	if(ptinfos != NULL)
	{
		WARNING_MSG(fmt::format("Loginapp::_createAccount: pendingCreateMgr has {}, request create failed!\n", 
			accountName));

		Network::Bundle* pBundle = Network::Bundle::createPoolObject();
		(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
		SERVER_ERROR_CODE retcode = SERVER_ERR_BUSY;
		(*pBundle) << retcode;
		(*pBundle).appendBlob(retdatas);
		pChannel->send(pBundle);
		return false;
	}
	
	{
		// 把请求交由脚本处理
		SERVER_ERROR_CODE retcode = SERVER_SUCCESS;
		SCOPED_PROFILE(SCRIPTCALL_PROFILE);

		PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(), 
											const_cast<char*>("onRequestCreateAccount"), 
											const_cast<char*>("ssy#"), 
											accountName.c_str(),
											password.c_str(),
											datas.c_str(), datas.length());

		if(pyResult != NULL)
		{
			if(PySequence_Check(pyResult) && PySequence_Size(pyResult) == 4)
			{
				char* sname;
				char* spassword;
			    char *extraDatas;
			    Py_ssize_t extraDatas_size = 0;
				
				if(PyArg_ParseTuple(pyResult, "H|s|s|y#",  &retcode, &sname, &spassword, &extraDatas, &extraDatas_size) == -1)
//.........这里部分代码省略.........
开发者ID:1564143452,项目名称:kbengine,代码行数:101,代码来源:loginapp.cpp


示例8: var_tcpConnTable


//.........这里部分代码省略.........
        *op++ = *cp++;
        *op++ = *cp++;
        *op++ = *cp++;
        *op++ = *cp++;
        
        newname[19] = ntohs(inp->inp_fport);

        if (exact){
            if (snmp_oid_compare(newname, 20, name, *length) == 0){
                memcpy( (char *)lowest,(char *)newname, 20 * sizeof(oid));
                low_inp = inp;
                break;  /* no need to search further */
            }
        } else {
            if ((snmp_oid_compare(newname, 20, name, *length) > 0) &&
                (!low_inp || (snmp_oid_compare(newname, 20, lowest, 20) < 0))){
                /*
                 * if new one is greater than input and closer to input than
                 * previous lowest, save this one as the "next" one.
                 */
                memcpy( (char *)lowest,(char *)newname, 20 * sizeof(oid));
                low_inp = inp;
            }
        }
    }

    if ( ! low_inp )
        return NULL;

    tp = intotcpcb( low_inp );
    if ( ! tp )
        return NULL; // Shouldn't happen

    memcpy( (char *)name,(char *)lowest, 20 * sizeof(oid));
    *length = 20;
    *var_len = sizeof( long_ret );
    *write_method = 0;
    
    switch(vp->magic) {
    case TCPCONNSTATE:
        // NOTSUPPORTED: *write_method = write_tcpConnState;
        switch ( tp->t_state ) {
        case TCPS_CLOSED	: // 0	/* closed */
            long_ret = 1; break;
        case TCPS_LISTEN	: // 1	/* listening for connection */
            long_ret = 2; break;
        case TCPS_SYN_SENT	: // 2	/* active, have sent syn */
            long_ret = 3; break;
        case TCPS_SYN_RECEIVED	: // 3	/* have sent and received syn */
            long_ret = 4; break;
        case TCPS_ESTABLISHED	: // 4	/* established */
            long_ret = 5; break;
        case TCPS_CLOSE_WAIT	: // 5	/* rcvd fin, waiting for close */
            long_ret = 8; break;
        case TCPS_FIN_WAIT_1	: // 6	/* have closed, sent fin */
            long_ret = 6; break;
        case TCPS_CLOSING	: // 7	/* closed xchd FIN; await ACK */
            long_ret = 10; break;
        case TCPS_LAST_ACK	: // 8	/* had fin and close; await FIN ACK */
            long_ret = 9; break;
        case TCPS_FIN_WAIT_2	: // 9	/* have closed, fin is acked */
            long_ret = 7; break;
        case TCPS_TIME_WAIT	: // 10	/* in 2*msl quiet wait after close */
            long_ret = 11; break;
        default:
            long_ret = 1;
        }
        return (unsigned char *) &long_ret;

    case TCPCONNLOCALADDRESS:
        cp = (u_char *)&low_inp->inp_laddr.s_addr;
        string[0] = *cp++;
        string[1] = *cp++;
        string[2] = *cp++;
        string[3] = *cp++;
        *var_len = 4;
        return (unsigned char *) string;

    case TCPCONNLOCALPORT:
        long_ret = (long)ntohs(low_inp->inp_lport);
        return (unsigned char *) &long_ret;

    case TCPCONNREMADDRESS:
        cp = (u_char *)&low_inp->inp_faddr.s_addr;
        string[0] = *cp++;
        string[1] = *cp++;
        string[2] = *cp++;
        string[3] = *cp++;
        *var_len = 4;
        return (unsigned char *) string;

    case TCPCONNREMPORT:
        long_ret = (long)ntohs(low_inp->inp_fport);
        return (unsigned char *) &long_ret;

    default:
        ERROR_MSG("");
    }
    return NULL;
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:101,代码来源:tcp.c


示例9: soclEnqueueNDRangeKernel_task

void soclEnqueueNDRangeKernel_task(void *descr[], void *args) {
	command_ndrange_kernel cmd = (command_ndrange_kernel)args;

   cl_command_queue cq;
   int wid;
   cl_int err;

  cl_event ev = command_event_get(cmd);
  ev->prof_start = _socl_nanotime();
  gc_entity_release(ev);

   wid = starpu_worker_get_id();
   starpu_opencl_get_queue(wid, &cq);

   DEBUG_MSG("[worker %d] [kernel %d] Executing kernel...\n", wid, cmd->kernel->id);

   int range = starpu_worker_get_range();

   /* Set arguments */
   {
	   unsigned int i;
	   int buf = 0;
	   for (i=0; i<cmd->num_args; i++) {
		   switch (cmd->arg_types[i]) {
			   case Null:
				   err = clSetKernelArg(cmd->kernel->cl_kernels[range], i, cmd->arg_sizes[i], NULL);
				   break;
			   case Buffer: {
						cl_mem mem;  
						mem = (cl_mem)STARPU_VARIABLE_GET_PTR(descr[buf]);
						err = clSetKernelArg(cmd->kernel->cl_kernels[range], i, cmd->arg_sizes[i], &mem);
						buf++;
					}
					break;
			   case Immediate:
					err = clSetKernelArg(cmd->kernel->cl_kernels[range], i, cmd->arg_sizes[i], cmd->args[i]);
					break;
		   }
		   if (err != CL_SUCCESS) {
			   DEBUG_CL("clSetKernelArg", err);
			   DEBUG_ERROR("Aborting\n");
		   }
	   }
   }

   /* Calling Kernel */
   cl_event event;
   err = clEnqueueNDRangeKernel(cq, cmd->kernel->cl_kernels[range], cmd->work_dim, cmd->global_work_offset, cmd->global_work_size, cmd->local_work_size, 0, NULL, &event);

   if (err != CL_SUCCESS) {
	   ERROR_MSG("Worker[%d] Unable to Enqueue kernel (error %d)\n", wid, err);
	   DEBUG_CL("clEnqueueNDRangeKernel", err);
	   DEBUG_MSG("Workdim %d, global_work_offset %p, global_work_size %p, local_work_size %p\n",
			   cmd->work_dim, cmd->global_work_offset, cmd->global_work_size, cmd->local_work_size);
	   DEBUG_MSG("Global work size: %ld %ld %ld\n", cmd->global_work_size[0],
			   (cmd->work_dim > 1 ? cmd->global_work_size[1] : 1), (cmd->work_dim > 2 ? cmd->global_work_size[2] : 1)); 
	   if (cmd->local_work_size != NULL)
		   DEBUG_MSG("Local work size: %ld %ld %ld\n", cmd->local_work_size[0],
				   (cmd->work_dim > 1 ? cmd->local_work_size[1] : 1), (cmd->work_dim > 2 ? cmd->local_work_size[2] : 1)); 
   }
   else {
      /* Waiting for kernel to terminate */
      clWaitForEvents(1, &event);
      clReleaseEvent(event);
   }
}
开发者ID:excess-project,项目名称:starpu-ex-1.2.0rc5,代码行数:66,代码来源:cl_enqueuendrangekernel.c


示例10: var_tcp


//.........这里部分代码省略.........
                size_t  *length, 
                int     exact, 
                size_t  *var_len, 
                WriteMethod **write_method)
{
    static long long_ret;

    if (header_generic(vp,name,length,exact,var_len,write_method)
        == MATCH_FAILED )
        return NULL;

    switch(vp->magic) {

    case TCPRTOALGORITHM:
        long_ret = 1; // meaning "other"
        return (unsigned char *) &long_ret;

    case TCPRTOMIN:
        long_ret = TCPTV_MIN / PR_SLOWHZ * 1000;;
        return (unsigned char *) &long_ret;

    case TCPRTOMAX:
        long_ret = TCPTV_REXMTMAX / PR_SLOWHZ * 1000;;
        return (unsigned char *) &long_ret;

    case TCPMAXCONN:
        long_ret = -1; // It is dynamic.
        return (unsigned char *) &long_ret;

    case TCPACTIVEOPENS:
        long_ret = tcpstat.tcps_connattempt;
        return (unsigned char *) &long_ret;

    case TCPPASSIVEOPENS:
        long_ret = tcpstat.tcps_accepts;
        return (unsigned char *) &long_ret;

    case TCPATTEMPTFAILS:
        long_ret = tcpstat.tcps_conndrops;
        return (unsigned char *) &long_ret;

    case TCPESTABRESETS:
        long_ret = tcpstat.tcps_drops;
        return (unsigned char *) &long_ret;

    case TCPCURRESTAB: {
        struct inpcb *inp;
        long_ret = 0;
        for (
#ifdef CYGPKG_NET_OPENBSD_STACK
	     inp = tcbtable.inpt_queue.cqh_first;
             inp != (struct inpcb *)&tcbtable.inpt_queue;
             inp = inp->inp_queue.cqe_next
#endif
#ifdef CYGPKG_NET_FREEBSD_STACK
	     inp = tcb.lh_first;
             inp;
             inp = inp->inp_list.le_next
#endif
	     ) {
            struct tcpcb *tp = intotcpcb( inp );
            if ( tp && (TCPS_ESTABLISHED == tp->t_state ||
                        TCPS_CLOSE_WAIT  == tp->t_state) )
                long_ret++;
        }
        return (unsigned char *) &long_ret;
    }

    case TCPINSEGS:
        long_ret = tcpstat.tcps_rcvtotal;
        return (unsigned char *) &long_ret;

    case TCPOUTSEGS:
        long_ret = tcpstat.tcps_sndtotal - tcpstat.tcps_sndrexmitpack;
        if ( long_ret < 0 )
            long_ret = 0;
        return (unsigned char *) &long_ret;

    case TCPRETRANSSEGS:
        long_ret = tcpstat.tcps_sndrexmitpack;
        return (unsigned char *) &long_ret;

    case TCPINERRS:
        long_ret = tcpstat.tcps_rcvbadsum
            + tcpstat.tcps_rcvbadoff
            + tcpstat.tcps_rcvshort
            + tcpstat.tcps_rcvmemdrop; // Is that last one an input error?
        return (unsigned char *) &long_ret;

    case TCPOUTRSTS:
        long_ret = tcpstat.tcps_sndctrl - tcpstat.tcps_closed;
        if ( long_ret < 0 )
            long_ret = 0;
        return (unsigned char *) &long_ret;

    default:
      ERROR_MSG("");
  }
  return NULL;
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:101,代码来源:tcp.c


示例11: DEBUG_MSG

//-------------------------------------------------------------------------------------
void Entity::teleportFromBaseapp(Mercury::Channel* pChannel, COMPONENT_ID cellAppID, ENTITY_ID targetEntityID, COMPONENT_ID sourceBaseAppID)
{
	DEBUG_MSG(boost::format("%1%::teleportFromBaseapp: %2%, targetEntityID=%3%, cell=%4%, sourceBaseAppID=%5%.\n") % 
		this->getScriptName() % this->getID() % targetEntityID % cellAppID % sourceBaseAppID);
	
	SPACE_ID lastSpaceID = this->getSpaceID();

	// 如果不在一个cell上
	if(cellAppID != g_componentID)
	{
		Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(cellAppID);
		if(cinfos == NULL || cinfos->pChannel == NULL)
		{
			ERROR_MSG(boost::format("%1%::teleportFromBaseapp: %2%, teleport is error, not found cellapp, targetEntityID, cellAppID=%3%.\n") %
				this->getScriptName() % this->getID() % targetEntityID % cellAppID);

			_sendBaseTeleportResult(this->getID(), sourceBaseAppID, 0, lastSpaceID);
			return;
		}
	}
	else
	{
		Entity* entity = Cellapp::getSingleton().findEntity(targetEntityID);
		if(entity == NULL || entity->isDestroyed())
		{
			ERROR_MSG(boost::format("%1%::teleportFromBaseapp: %2%, can't found targetEntity(%3%).\n") %
				this->getScriptName() % this->getID() % targetEntityID);

			_sendBaseTeleportResult(this->getID(), sourceBaseAppID, 0, lastSpaceID);
			return;
		}
		
		// 找到space
		SPACE_ID spaceID = entity->getSpaceID();

		// 如果是不同space跳转
		if(spaceID != this->getSpaceID())
		{
			Space* space = Spaces::findSpace(spaceID);
			if(space == NULL)
			{
				ERROR_MSG(boost::format("%1%::teleportFromBaseapp: %2%, can't found space(%3%).\n") %
					this->getScriptName() % this->getID() % spaceID);

				_sendBaseTeleportResult(this->getID(), sourceBaseAppID, 0, lastSpaceID);
				return;
			}
			
			Space* currspace = Spaces::findSpace(this->getSpaceID());
			currspace->removeEntity(this);
			space->addEntity(this);
			_sendBaseTeleportResult(this->getID(), sourceBaseAppID, spaceID, lastSpaceID);
		}
		else
		{
			WARNING_MSG(boost::format("%1%::teleportFromBaseapp: %2% targetSpace(%3%) == currSpaceID(%4%).\n") %
				this->getScriptName() % this->getID() % spaceID % this->getSpaceID());

			_sendBaseTeleportResult(this->getID(), sourceBaseAppID, spaceID, lastSpaceID);
		}
	}
}
开发者ID:fengqk,项目名称:kbengine,代码行数:63,代码来源:entity.cpp


示例12: fw_thread_id

int fw_thread_id()
{
	pthread_t current_thread;
	ttglobal tg = gglobal();
	current_thread = pthread_self();

#ifdef _MSC_VER 
	if (!current_thread.p) {
#else
	if (!current_thread) {
#endif
		ERROR_MSG("Critical: pthread_self returned 0\n");
		return 0;
	}

	if (pthread_equal(current_thread, tg->threads.mainThread))
		return FREEWRL_THREAD_MAIN;

	if (pthread_equal(current_thread, tg->threads.DispThrd))
		return FREEWRL_THREAD_DISPLAY;

	if (pthread_equal(current_thread, tg->threads.PCthread))
		return FREEWRL_THREAD_PARSER;

	if (pthread_equal(current_thread, tg->threads.loadThread))
		return FREEWRL_THREAD_TEXTURE;

/*#endif*/
	return -1;
}

#ifdef FREEWRL_THREAD_COLORIZED

int fw_thread_color(int thread_id)
{
	/* id will range from 1 to 5 */
	if ((thread_id > 0) && (thread_id <= FREEWRL_MAX_THREADS)) {
		return threads_colors[ thread_id - 1 ];
	}
	return FREEWRL_DEFAULT_COLOR;
}

#endif /* FREEWRL_THREAD_COLORIZED */

void fwl_thread_dump()
{
	if (gglobal()->internalc.global_trace_threads) {
		/* Synchronize trace/error log... */
		fflush(stdout);
		fflush(stderr);
		TRACE_MSG("FreeWRL CURRENT THREAD: %d\n", fw_thread_id());
	}
}

void trace_enter_thread(const char *str)
{
	int nloops = 0;
	ttglobal tg = gglobal0(); // get the value if we can
	while(tg == NULL){
		usleep(50);
		tg = gglobal0(); //<< new function ttglobal0() just returns NULL if thread not registered yet
		nloops++;
	}
	//printf("trace_enter_thread spent %d loops\n",nloops);

	if (gglobal()->internalc.global_trace_threads) {
		/* Synchronize trace/error log... */
		fflush(stdout);
		fflush(stderr);
		sync();
#ifdef _MSC_VER
		TRACE_MSG("*** ENTERING THREAD: %s, ID=%d self=%p\n", str, fw_thread_id(), (void*) pthread_self().p);
#else
		TRACE_MSG("*** ENTERING THREAD: %s, ID=%d self=%p\n", str, fw_thread_id(), (void*) pthread_self());
#endif
	}
}
开发者ID:cancgroup,项目名称:freewrl,代码行数:77,代码来源:threads.c


示例13: var_serviceTable

/*
 * var_serviceTable():
 *   Handle this table separately from the scalar value case.
 *   The workings of this are basically the same as for var_cyrusMasterMIB above.
 */
unsigned char *
var_serviceTable(struct variable *vp,
    	    oid     *name,
    	    size_t  *length,
    	    int     exact,
    	    size_t  *var_len,
    	    WriteMethod **write_method)
{
    /* variables we may use later */
    static long long_ret;
    static char string[SPRINT_MAX_LEN];
    /* static oid objid[MAX_OID_LEN]; */
    /* static struct counter64 c64; */
    int index;

    /* 
     * This assumes that the table is a 'simple' table.
     *	See the implementation documentation for the meaning of this.
     *	You will need to provide the correct value for the TABLE_SIZE parameter
     *
     * If this table does not meet the requirements for a simple table,
     *	you will need to provide the replacement code yourself.
     *	Mib2c is not smart enough to write this for you.
     *    Again, see the implementation documentation for what is required.
     */
    if (header_simple_table(vp,name,length,exact,var_len,write_method, nservices)
	== MATCH_FAILED )
	return NULL;


    index = name[*length - 1];

    /* 
     * this is where we do the value assignments for the mib results.
     */
    switch(vp->magic) {
    case SERVICEFORKS:
	long_ret = Services[index - 1].nforks;
	return (unsigned char *) &long_ret;
      
    case SERVICEACTIVE:
	long_ret = Services[index - 1].nactive;
	return (unsigned char *) &long_ret;
      
    case SERVICENAME:
        if (Services[index - 1].name != NULL) {
	   strlcpy(string, Services[index - 1].name, sizeof(string));
	   if (Services[index - 1].family == AF_INET6) {
	       strlcat(string, "[v6]", sizeof(string));
	   }
        } else {
           strlcpy(string, "", sizeof(string));
        }
	*var_len = strlen(string);
	return (unsigned char *) string;
      
    case SERVICEID:
	long_ret = index;
	return (unsigned char *) &long_ret;

    case SERVICECONNS:
	long_ret = Services[index - 1].nconnections;
	return (unsigned char *) &long_ret;

    default:
	ERROR_MSG("");
    }
    return NULL;
}
开发者ID:ajwans,项目名称:cyrus-imapd,代码行数:74,代码来源:cyrusMasterMIB.c


示例14: create_buffer

static Bool create_buffer(DrawablePtr pDraw, struct ARMSOCDRI2BufferRec *buf)
{
	ScreenPtr pScreen = pDraw->pScreen;
	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
	struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
	DRI2BufferPtr buffer = DRIBUF(buf);
	PixmapPtr pPixmap = NULL;
	struct armsoc_bo *bo;
	int ret;

	if (buffer->attachment == DRI2BufferFrontLeft) {
		pPixmap = draw2pix(pDraw);
		pPixmap->refcnt++;
	} else {
		pPixmap = createpix(pDraw);
	}

	if (!pPixmap) {
		assert(buffer->attachment != DRI2BufferFrontLeft);
		ERROR_MSG("Failed to create back buffer for window");
		goto fail;
	}

	if (buffer->attachment == DRI2BufferBackLeft && pARMSOC->driNumBufs > 2) {
		buf->pPixmaps = calloc(pARMSOC->driNumBufs-1,
				sizeof(PixmapPtr));
		buf->numPixmaps = pARMSOC->driNumBufs-1;
	} else {
		buf->pPixmaps = malloc(sizeof(PixmapPtr));
		buf->numPixmaps = 1;
	}

	if (!buf->pPixmaps) {
		ERROR_MSG("Failed to allocate PixmapPtr array for DRI2Buffer");
		goto fail;
	}

	buf->pPixmaps[0] = pPixmap;
	assert(buf->currentPixmap == 0);

	bo = ARMSOCPixmapBo(pPixmap);
	if (!bo) {
		ERROR_MSG(
				"Attempting to DRI2 wrap a pixmap with no DRM buffer object backing");
		goto fail;
	}

	DRIBUF(buf)->pitch = exaGetPixmapPitch(pPixmap);
	DRIBUF(buf)->cpp = pPixmap->drawable.bitsPerPixel / 8;
	DRIBUF(buf)->flags = 0;
	buf->refcnt = 1;
	buf->previous_canflip = canflip(pDraw);

	ret = armsoc_bo_get_name(bo, &DRIBUF(buf)->name);
	if (ret) {
		ERROR_MSG("could not get buffer name: %d", ret);
		goto fail;
	}

	if (canflip(pDraw) && buffer->attachment != DRI2BufferFrontLeft) {
		/* Create an fb around this buffer. This will fail and we will
		 * fall back to blitting if the display controller hardware
		 * cannot scan out this buffer (for example, if it doesn't
		 * support the format or there was insufficient scanout memory
		 * at buffer creation time). */
		int ret = armsoc_bo_add_fb(bo);
		if (ret) {
			WARNING_MSG(
					"Falling back to blitting a flippable window");
		}
#if DRI2INFOREC_VERSION >= 6
		else if (FALSE == DRI2SwapLimit(pDraw, pARMSOC->swap_chain_size)) {
			WARNING_MSG(
				"Failed to set DRI2SwapLimit(%x,%d)",
				(unsigned int)pDraw, pARMSOC->swap_chain_size);
		}
#endif /* DRI2INFOREC_VERSION >= 6 */
	}

	DRI2_BUFFER_SET_FB(DRIBUF(buf)->flags, armsoc_bo_get_fb(bo) > 0 ? 1 : 0);
	DRI2_BUFFER_SET_REUSED(DRIBUF(buf)->flags, 0);
	/* Register Pixmap as having a buffer that can be accessed externally,
	 * so needs synchronised access */
	ARMSOCRegisterExternalAccess(pPixmap);

	return TRUE;

fail:
	if (pPixmap != NULL) {
		if (buffer->attachment != DRI2BufferFrontLeft)
			pScreen->DestroyPixmap(pPixmap);
		else
			pPixmap->refcnt--;
	}

	return FALSE;
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__driver__xf86-video-armsoc,代码行数:97,代码来源:armsoc_dri2.c


示例15: XmlPlus

//-------------------------------------------------------------------------------------
bool Config::loadConfig(std::string fileName)
{
	fileName_ = fileName;
	TiXmlNode* rootNode = NULL;
	XmlPlus* xml = new XmlPlus(Resmgr::getSingleton().matchRes(fileName_).c_str());

	if(!xml->isGood())
	{
		ERROR_MSG(boost::format("Config::loadConfig: load %1% is failed!\n") %
			fileName.c_str());

		SAFE_RELEASE(xml);
		return false;
	}
	
	rootNode = xml->getRootNode("packetAlwaysContainLength");
	if(rootNode != NULL){
		Mercury::g_packetAlwaysContainLength = xml->getValInt(rootNode) != 0;
	}

	rootNode = xml->getRootNode("trace_packet");
	if(rootNode != NULL)
	{
		TiXmlNode* childnode = xml->enterNode(rootNode, "debug_type");
		if(childnode)
			Mercury::g_trace_packet = xml->getValInt(childnode);

		if(Mercury::g_trace_packet > 3)
			Mercury::g_trace_packet = 0;

		childnode = xml->enterNode(rootNode, "use_logfile");
		if(childnode)
			Mercury::g_trace_packet_use_logfile = (xml->getValStr(childnode) == "true");

		childnode = xml->enterNode(rootNode, "disables");
		if(childnode)
		{
			do
			{
				if(childnode->FirstChild() != NULL)
				{
					std::string c = childnode->FirstChild()->Value();
					c = strutil::kbe_trim(c);
					if(c.size() > 0)
					{
						Mercury::g_trace_packet_disables.push_back(c);
					}
				}
			}while((childnode = childnode->NextSibling()));
		}
	}

	rootNode = xml->getRootNode("debugEntity");
	if(rootNode != NULL)
	{
		g_debugEntity = xml->getValInt(rootNode) > 0;
	}
	
	rootNode = xml->getRootNode("publish");
	if(rootNode != NULL)
	{
		TiXmlNode* childnode = xml->enterNode(rootNode, "state");
		if(childnode)
		{
			g_appPublish = xml->getValInt(childnode);
		}

		childnode = xml->enterNode(rootNode, "script_version");
		if(childnode)
		{
			KBEVersion::setScriptVersion(xml->getValStr(childnode));
		}
	}

	rootNode = xml->getRootNode("channelCommon");
	if(rootNode != NULL)
	{
		TiXmlNode* childnode = xml->enterNode(rootNode, "timeout");
		if(childnode)
		{
			TiXmlNode* childnode1 = xml->enterNode(childnode, "internal");
			if(childnode1)
			{
				channelInternalTimeout_ = KBE_MAX(1.f, float(xml->getValFloat(childnode1)));
				Mercury::g_channelInternalTimeout = channelInternalTimeout_;
			}

			childnode1 = xml->enterNode(childnode, "external");
			if(childnode)
			{
				channelExternalTimeout_ = KBE_MAX(1.f, float(xml->getValFloat(childnode1)));
				Mercury::g_channelExternalTimeout = channelExternalTimeout_;
			}
		}

		childnode = xml->enterNode(rootNode, "resend");
		if(childnode)
		{
			TiXmlNode* childnode1 = xml->enterNode(childnode, "internal");
//.........这里部分代码省略.........
开发者ID:HeadClot,项目名称:kbengine,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ERROR_PRINT函数代码示例发布时间:2022-05-30
下一篇:
C++ ERROR_MESSAGE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap