当前位置: 首页>>代码示例>>C++>>正文


C++ WARNING_MSG函数代码示例

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


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

示例1: ARMSOCDRI2CreateBuffer

/**
 * Create Buffer.
 *
 * Note that 'format' is used from the client side to specify the DRI buffer
 * format, which could differ from the drawable format.  For example, the
 * drawable could be 32b RGB, but the DRI buffer some YUV format (video) or
 * perhaps lower bit depth RGB (GL).  The color conversion is handled when
 * blitting to front buffer, and page-flipping (overlay or flipchain) can
 * only be used if the display supports.
 */
static DRI2BufferPtr
ARMSOCDRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment,
		unsigned int format)
{
	ScreenPtr pScreen = pDraw->pScreen;
	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
	struct ARMSOCDRI2BufferRec *buf = calloc(1, sizeof(*buf));
	struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
	struct armsoc_bo *bo;

	DEBUG_MSG("pDraw=%p, attachment=%d, format=%08x",
			pDraw, attachment, format);

	if (!buf) {
		ERROR_MSG("Couldn't allocate internal buffer structure");
		return NULL;
	}

	buf->refcnt = 1;
	buf->previous_canflip = canflip(pDraw);
	DRIBUF(buf)->attachment = attachment;
	DRIBUF(buf)->cpp = pDraw->bitsPerPixel / 8;
	DRIBUF(buf)->format = format + 1; /* suppress DRI2 buffer reuse */
	DRIBUF(buf)->flags = 0;

	/* If it is a pixmap, just migrate to a GEM buffer */
	if (pDraw->type == DRAWABLE_PIXMAP)
	{
	    if (!(bo = MigratePixmapToGEM(pARMSOC, pDraw))) {
	        ErrorF("ARMSOCDRI2CreateBuffer: MigratePixmapToUMP failed\n");
	        free(buf);
	        return NULL;
	    }
	    DRIBUF(buf)->pitch = armsoc_bo_pitch(bo);
	    DRIBUF(buf)->name = armsoc_bo_name(bo);
            buf->bo = bo;
	    return DRIBUF(buf);
	}

	/* We are not interested in anything other than back buffer requests ... */
	if (attachment != DRI2BufferBackLeft || pDraw->type != DRAWABLE_WINDOW) {
		/* ... and just return some dummy UMP buffer */
		bo = pARMSOC->scanout;
		DRIBUF(buf)->pitch = armsoc_bo_pitch(bo);
		DRIBUF(buf)->name = armsoc_bo_name(bo);
		buf->bo = bo;
		armsoc_bo_reference(bo);
		return DRIBUF(buf);
	}

	bo = armsoc_bo_from_drawable(pDraw);
	if (bo && armsoc_bo_width(bo) == pDraw->width && armsoc_bo_height(bo) == pDraw->height && armsoc_bo_bpp(bo) == pDraw->bitsPerPixel) {
		// Reuse existing
		DRIBUF(buf)->pitch = armsoc_bo_pitch(bo);
		DRIBUF(buf)->name = armsoc_bo_name(bo);
		buf->bo = bo;
		armsoc_bo_reference(bo);
		return DRIBUF(buf);
	}

	bo = armsoc_bo_new_with_dim(pARMSOC->dev,
                                pDraw->width,
                                pDraw->height,
                                pDraw->depth,
                                pDraw->bitsPerPixel,
				canflip(pDraw) ? ARMSOC_BO_SCANOUT : ARMSOC_BO_NON_SCANOUT);
	if (!bo) {
	        ErrorF("ARMSOCDRI2CreateBuffer: BO alloc failed\n");
		free(buf);
		return NULL;
	}

	armsoc_bo_set_drawable(bo, pDraw);
	DRIBUF(buf)->name = armsoc_bo_name(bo);
	DRIBUF(buf)->pitch = armsoc_bo_pitch(bo);
	buf->bo = bo;

	if (canflip(pDraw) && 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");
		}
	}

//.........这里部分代码省略.........
开发者ID:ManMower,项目名称:xf86-video-armsoc,代码行数:101,代码来源:armsoc_dri2.c

示例2: REASON_GENERAL_NETWORK

PacketReceiver::RecvState UDPPacketReceiver::checkSocketErrors(int len, bool expectingPacket)
{
	if (len == 0)
	{
		/*SL_ELOG(fmt::format("PacketReceiver::processPendingEvents: "
			"Throwing REASON_GENERAL_NETWORK (1)- {}\n",
			strerror( errno )));*/

		/*this->dispatcher().errorReporter().reportException(
			REASON_GENERAL_NETWORK );*/

		return RECV_STATE_CONTINUE;
	}

#ifdef _WIN32
	DWORD wsaErr = WSAGetLastError();
#endif //def _WIN32

	if (
#ifdef _WIN32
		wsaErr == WSAEWOULDBLOCK && !expectingPacket
#else
		errno == EAGAIN && !expectingPacket
#endif
		)
	{
		return RECV_STATE_BREAK;
	}

#ifdef unix
	if (errno == EAGAIN ||
		errno == ECONNREFUSED ||
		errno == EHOSTUNREACH)
	{
		Network::Address offender;

		if (pEndpoint_->getClosedPort(offender))
		{
			// If we got a NO_SUCH_PORT error and there is an internal
			// channel to this address, mark it as remote failed.  The logic
			// for dropping external channels that get NO_SUCH_PORT
			// exceptions is built into BaseApp::onClientNoSuchPort().
			if (errno == ECONNREFUSED)
			{
				// 未实现
			}

			this->dispatcher().errorReporter().reportException(
				REASON_NO_SUCH_PORT, offender);

			return RECV_STATE_CONTINUE;
		}
		else
		{
			WARNING_MSG("UDPPacketReceiver::processPendingEvents: "
				"getClosedPort() failed\n");
		}
	}
#else
	if (wsaErr == WSAECONNRESET)
	{
		return RECV_STATE_CONTINUE;
	}
#endif // unix

#ifdef _WIN32
	/*WARNING_MSG(fmt::format("UDPPacketReceiver::processPendingEvents: "
		"Throwing REASON_GENERAL_NETWORK - {}\n",
		wsaErr));*/
#else
	WARNING_MSG(fmt::format("UDPPacketReceiver::processPendingEvents: "
		"Throwing REASON_GENERAL_NETWORK - {}\n",
		kbe_strerror()));
#endif
	/*this->dispatcher().errorReporter().reportException(
		REASON_GENERAL_NETWORK);*/

	return RECV_STATE_CONTINUE;
}
开发者ID:DuanDechao,项目名称:shyloo,代码行数:79,代码来源:sludp_packet_receiver.cpp

示例3: WARNING_MSG

//-------------------------------------------------------------------------------------
bool UDPPacketReceiver::checkSocketErrors(int len, bool expectingPacket)
{
	if (len == 0)
	{
		WARNING_MSG( "PacketReceiver::processPendingEvents: "
			"Throwing REASON_GENERAL_NETWORK (1)- %s\n",
			strerror( errno ) );

		this->dispatcher().errorReporter().reportException(
				REASON_GENERAL_NETWORK );

		return true;
	}
	
#ifdef _WIN32
	DWORD wsaErr = WSAGetLastError();
#endif //def _WIN32

	if (
#ifdef _WIN32
		wsaErr == WSAEWOULDBLOCK && !expectingPacket
#else
		errno == EAGAIN && !expectingPacket
#endif
		)
	{
		return false;
	}

#ifdef unix
	if (errno == EAGAIN ||
		errno == ECONNREFUSED ||
		errno == EHOSTUNREACH)
	{
#if defined(PLAYSTATION3)
		this->dispatcher().errorReporter().reportException(
				REASON_NO_SUCH_PORT);
		return true;
#else
		Mercury::Address offender;

		if (pEndpoint_->getClosedPort(offender))
		{
			// If we got a NO_SUCH_PORT error and there is an internal
			// channel to this address, mark it as remote failed.  The logic
			// for dropping external channels that get NO_SUCH_PORT
			// exceptions is built into BaseApp::onClientNoSuchPort().
			if (errno == ECONNREFUSED)
			{
				// н╢й╣ож
			}

			this->dispatcher().errorReporter().reportException(
					REASON_NO_SUCH_PORT, offender);

			return true;
		}
		else
		{
			WARNING_MSG("UDPPacketReceiver::processPendingEvents: "
				"getClosedPort() failed\n");
		}
#endif
	}
#else
	if (wsaErr == WSAECONNRESET)
	{
		return true;
	}
#endif // unix

#ifdef _WIN32
	WARNING_MSG("UDPPacketReceiver::processPendingEvents: "
				"Throwing REASON_GENERAL_NETWORK - %d\n",
				wsaErr);
#else
	WARNING_MSG("UDPPacketReceiver::processPendingEvents: "
				"Throwing REASON_GENERAL_NETWORK - %s\n",
			kbe_strerror());
#endif
	this->dispatcher().errorReporter().reportException(
			REASON_GENERAL_NETWORK);

	return true;
}
开发者ID:ChowZenki,项目名称:kbengine,代码行数:86,代码来源:udp_packet_receiver.cpp

示例4: switch

//-------------------------------------------------------------------------------------
bool Componentbridge::findInterfaces()
{
	int8 findComponentTypes[] = {UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, 
								UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE};

	switch(componentType_)
	{
	case CELLAPP_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		findComponentTypes[1] = RESOURCEMGR_TYPE;
		findComponentTypes[2] = DBMGR_TYPE;
		findComponentTypes[3] = CELLAPPMGR_TYPE;
		findComponentTypes[4] = BASEAPPMGR_TYPE;
		break;
	case BASEAPP_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		findComponentTypes[1] = RESOURCEMGR_TYPE;
		findComponentTypes[2] = DBMGR_TYPE;
		findComponentTypes[3] = BASEAPPMGR_TYPE;
		findComponentTypes[4] = CELLAPPMGR_TYPE;
		break;
	case BASEAPPMGR_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		findComponentTypes[1] = DBMGR_TYPE;
		findComponentTypes[2] = CELLAPPMGR_TYPE;
		break;
	case CELLAPPMGR_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		findComponentTypes[1] = DBMGR_TYPE;
		findComponentTypes[2] = BASEAPPMGR_TYPE;
		break;
	case LOGINAPP_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		findComponentTypes[1] = DBMGR_TYPE;
		findComponentTypes[2] = BASEAPPMGR_TYPE;
		break;
	case DBMGR_TYPE:
		findComponentTypes[0] = MESSAGELOG_TYPE;
		break;
	default:
		if(componentType_ != MESSAGELOG_TYPE && componentType_ != MACHINE_TYPE)
			findComponentTypes[0] = MESSAGELOG_TYPE;
		break;
	};

	int ifind = 0;
	srand(KBEngine::getSystemTime());
	uint16 nport = KBE_PORT_START + (rand() % 1000);

	while(findComponentTypes[ifind] != UNKNOWN_COMPONENT_TYPE)
	{
		if(dispatcher().isBreakProcessing())
			return false;

		int8 findComponentType = findComponentTypes[ifind];

		INFO_MSG("Componentbridge::process: finding %s...\n",
			COMPONENT_NAME_EX((COMPONENT_TYPE)findComponentType));
		
		Mercury::BundleBroadcast bhandler(networkInterface_, nport);
		if(!bhandler.good())
		{
			KBEngine::sleep(10);
			nport = KBE_PORT_START + (rand() % 1000);
			continue;
		}

		if(bhandler.pCurrPacket() != NULL)
		{
			bhandler.pCurrPacket()->resetPacket();
		}

		bhandler.newMessage(MachineInterface::onFindInterfaceAddr);
		MachineInterface::onFindInterfaceAddrArgs6::staticAddToBundle(bhandler, getUserUID(), getUsername(), 
			componentType_, findComponentType, networkInterface_.intaddr().ip, bhandler.epListen().addr().port);

		if(!bhandler.broadcast())
		{
			ERROR_MSG("Componentbridge::process: broadcast error!\n");
			return false;
		}
	
		MachineInterface::onBroadcastInterfaceArgs8 args;
		if(bhandler.receive(&args, 0, 1000000))
		{
			if(args.componentType == UNKNOWN_COMPONENT_TYPE)
			{
				//INFO_MSG("Componentbridge::process: not found %s, try again...\n",
				//	COMPONENT_NAME_EX(findComponentType));
				
				KBEngine::sleep(1000);
				
				// 如果是这些辅助组件没找到则跳过
				if(findComponentType == MESSAGELOG_TYPE || findComponentType == RESOURCEMGR_TYPE)
				{
					WARNING_MSG("Componentbridge::process: not found %s!\n",
						COMPONENT_NAME_EX((COMPONENT_TYPE)findComponentType));

					findComponentTypes[ifind] = -1; // 跳过标志
//.........这里部分代码省略.........
开发者ID:shinsuo,项目名称:kbengine,代码行数:101,代码来源:componentbridge.cpp

示例5: createFile

static inline int createFile(void) {

#ifdef _DEBUGFLAGS_H_
	{
		static unsigned int registered = 0;
		if (unlikely(0 == registered)) {
			registered = 1; /* dirty work around to avoid deadlock: syslogex->register->syslogex */
			registered = (registerLibraryDebugFlags(&debugFlags) == EXIT_SUCCESS);
		}
	}
#endif /*_DEBUGFLAGS_H_*/

	int error = pthread_mutex_lock(&fileLock);

	if (likely(EXIT_SUCCESS == error)) {
		int internalError = EXIT_SUCCESS;
		int flags = O_WRONLY|O_CREAT|O_TRUNC;

		if (likely((!(LogStat & LOG_FILE_WITHOUT_SYNC)) && (!(LogStat & LOG_FILE_SYNC_ON_ERRORS_ONLY)))) {
			flags |= O_SYNC; /* enable synchronous I/O to avoid data lost in case of crash */
		}

		if (logFile != -1) {
			WARNING_MSG("logFile was NOT NULL");
			if (close(logFile) != 0) {
				internalError = errno;
				ERROR_MSG("close %d error %d (%m)", logFile, internalError);
			}
			logFile = -1;
		}

		if (unlikely(NULL == processName)) {
			setProcessName();
		}
		setFullFileName();

		logFile = open(fullFileName,flags,S_IRUSR|S_IWUSR|S_IRGRP);
		if (likely(logFile != -1)) {
			fileSize = 0;
			if (LOG_FILE_DURATION & LogStat) {
				startTime = time(NULL);
			}
		} else {
			error = errno;
			ERROR_MSG("open %s for creation error %d (%m)", fullFileName, error);
		}

		internalError = pthread_mutex_unlock(&fileLock);
		if (internalError != EXIT_SUCCESS) {
			ERROR_MSG("pthread_mutex_lock fileLock error %d (%s)", internalError, strerror(internalError));
			if (EXIT_SUCCESS == error) {
				error = internalError;
			}
		}

	} else {
		ERROR_MSG("pthread_mutex_lock fileLock error %d (%m)", error);
	}

	return error;
}
开发者ID:Oliviers-OSS,项目名称:dbgflags,代码行数:61,代码来源:fileLogger.c

示例6: networkInterface

//-------------------------------------------------------------------------------------
void ClientApp::handleGameTick()
{
	++g_kbetime;
	threadPool_.onMainThreadTick();
	
	networkInterface().processChannels(KBEngine::Network::MessageHandlers::pMainMessageHandlers);
	tickSend();

	switch(state_)
	{
		case C_STATE_INIT:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_INITLOGINAPP_CHANNEL:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::login())
			{
				WARNING_MSG("ClientApp::handleGameTick: login is failed!\n");
				return;
			}

			break;
		case C_STATE_LOGIN_BASEAPP_CHANNEL:
			{
				state_ = C_STATE_PLAY;

				bool ret = updateChannel(false, "", "", "", 0);
				if(ret)
				{
					// 先握手然后等helloCB之后再进行登录
					Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();
					(*pBundle).newMessage(BaseappInterface::hello);
					(*pBundle) << KBEVersion::versionString();
					(*pBundle) << KBEVersion::scriptVersionString();

					if(Network::g_channelExternalEncryptType == 1)
					{
						pBlowfishFilter_ = new Network::BlowfishFilter();
						(*pBundle).appendBlob(pBlowfishFilter_->key());
						pServerChannel_->pFilter(NULL);
					}
					else
					{
						std::string key = "";
						(*pBundle).appendBlob(key);
					}

					pServerChannel_->pEndPoint()->send(pBundle);
					Network::Bundle::ObjPool().reclaimObject(pBundle);
					// ret = ClientObjectBase::loginBaseapp();
				}
			}
			break;
		case C_STATE_LOGIN_BASEAPP:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::loginBaseapp())
			{
				WARNING_MSG("ClientApp::handleGameTick: loginBaseapp is failed!\n");
				return;
			}

			break;
		case C_STATE_PLAY:
			break;
		default:
			KBE_ASSERT(false);
			break;
	};
}
开发者ID:waluoo,项目名称:kbengine,代码行数:77,代码来源:clientapp.cpp

示例7: THREAD_MUTEX_LOCK

//-------------------------------------------------------------------------------------
void ThreadPool::destroy()
{
	isDestroyed_ = true;

	THREAD_MUTEX_LOCK(threadStateList_mutex_);

	DEBUG_MSG(fmt::format("ThreadPool::destroy(): starting size {0}.\n",
		allThreadList_.size()));
	
	THREAD_MUTEX_UNLOCK(threadStateList_mutex_);

	int itry = 0;
	while(true)
	{
		KBEngine::sleep(300);
		itry++;

		std::string taskaddrs = "";
		THREAD_MUTEX_LOCK(threadStateList_mutex_);

		int count = (int)allThreadList_.size();
		std::list<TPThread*>::iterator itr = allThreadList_.begin();
		for(; itr != allThreadList_.end(); ++itr)
		{
			if((*itr))
			{
				if((*itr)->state() != TPThread::THREAD_STATE_END)
				{
					(*itr)->sendCondSignal();
					taskaddrs += (fmt::format("{0:p},", (void*)(*itr)));
				}
				else
				{
					count--;
				}
			}
		}

		THREAD_MUTEX_UNLOCK(threadStateList_mutex_);
		
		if(count <= 0)
		{
			break;
		}
		else
		{
			WARNING_MSG(fmt::format("ThreadPool::destroy(): waiting for thread({0})[{1}], try={2}\n", 
				count, taskaddrs, itry));
		}
	}

	THREAD_MUTEX_LOCK(threadStateList_mutex_);

	KBEngine::sleep(100);

	std::list<TPThread*>::iterator itr = allThreadList_.begin();
	for(; itr != allThreadList_.end(); ++itr)
	{
		if((*itr))
		{
			delete (*itr);
			(*itr) = NULL;
		}
	}
	
	allThreadList_.clear();
	THREAD_MUTEX_UNLOCK(threadStateList_mutex_);

	THREAD_MUTEX_LOCK(finiTaskList_mutex_);
	
	if(finiTaskList_.size() > 0)
	{
		WARNING_MSG(fmt::format("ThreadPool::~ThreadPool(): Discarding {0} finished tasks.\n",
			finiTaskList_.size()));

		std::list<TPTask*>::iterator finiiter  = finiTaskList_.begin();
		for(; finiiter != finiTaskList_.end(); ++finiiter)
		{
			delete (*finiiter);
		}
	
		finiTaskList_.clear();
		finiTaskList_count_ = 0;
	}

	THREAD_MUTEX_UNLOCK(finiTaskList_mutex_);

	THREAD_MUTEX_LOCK(bufferedTaskList_mutex_);

	if(bufferedTaskList_.size() > 0)
	{
		WARNING_MSG(fmt::format("ThreadPool::~ThreadPool(): Discarding {0} buffered tasks.\n", 
			bufferedTaskList_.size()));

		while(bufferedTaskList_.size() > 0)
		{
			TPTask* tptask = bufferedTaskList_.front();
			bufferedTaskList_.pop();
			delete tptask;
//.........这里部分代码省略.........
开发者ID:ihuangx,项目名称:kbengine,代码行数:101,代码来源:threadpool.cpp

示例8: hashes

//-------------------------------------------------------------------------------------
bool KBEEmailVerificationTableRedis::resetpassword(DBInterface * pdbi, const std::string& name, 
												   const std::string& password, const std::string& code)
{
	/*
	kbe_email_verification:code = hashes(accountName, type, datas, logtime)
	kbe_email_verification:accountName = code
	*/	
	redisReply* pRedisReply = NULL;

	if (!pdbi->query(fmt::format("HMGET kbe_email_verification:{} accountName type, datas logtime", code), false))
	{
		ERROR_MSG(fmt::format("KBEEmailVerificationTableRedis::bindEMail({}): cmd({}) is failed({})!\n", 
				code, pdbi->lastquery(), pdbi->getstrerror()));
	}	

	uint64 logtime = 1;
	int type = -1;
	std::string qname, qemail;
	
	if(pRedisReply)
	{
		if(pRedisReply->type == REDIS_REPLY_ARRAY)
		{
			if(RedisHelper::check_array_results(pRedisReply))
			{			
				qname = pRedisReply->element[0]->str;
				StringConv::str2value(type, pRedisReply->element[1]->str);
				qemail = pRedisReply->element[2]->str;
				StringConv::str2value(logtime, pRedisReply->element[3]->str);
			}
		}
		
		freeReplyObject(pRedisReply); 
	}

	if(logtime > 0 && time(NULL) - logtime > g_kbeSrvConfig.emailResetPasswordInfo_.deadline)
	{
		ERROR_MSG(fmt::format("KBEEmailVerificationTableRedis::resetpassword({}): is expired! {} > {}.\n", 
				code, (time(NULL) - logtime), g_kbeSrvConfig.emailResetPasswordInfo_.deadline));

		return false;
	}

	if(qname.size() == 0 || password.size() == 0)
	{
		ERROR_MSG(fmt::format("KBEEmailVerificationTableRedis::resetpassword({}): name or password is NULL.\n", 
				code));

		return false;
	}

	if(qname != name)
	{
		WARNING_MSG(fmt::format("KBEEmailVerificationTableRedis::resetpassword: code({}) username({} != {}) not match.\n" 
			, code, name, qname));

		return false;
	}

	if((int)KBEEmailVerificationTable::V_TYPE_RESETPASSWORD != type)
	{
		ERROR_MSG(fmt::format("KBEEmailVerificationTableMysql::resetpassword({}): type({}) error!\n", 
				code, type));

		return false;
	}
	
	// 寻找dblog是否有此账号
	KBEAccountTable* pTable = static_cast<KBEAccountTable*>(EntityTables::findByInterfaceName(pdbi->name()).findKBETable("kbe_accountinfos"));
	KBE_ASSERT(pTable);

	if(!pTable->updatePassword(pdbi, qname, KBE_MD5::getDigest(password.data(), password.length())))
	{
		ERROR_MSG(fmt::format("KBEEmailVerificationTableRedis::resetpassword({}): update accountName({}) password error({})!\n", 
				code, qname, pdbi->getstrerror()));

		return false;
	}

	delAccount(pdbi, (int8)V_TYPE_RESETPASSWORD, qname);
	return true;
}
开发者ID:AlbertGithubHome,项目名称:kbengine,代码行数:83,代码来源:kbe_table_redis.cpp

示例9: main

/**
 * Programme principal
 */
int main ( int argc, char *argv[] ) {
    /* exemples d'utilisation des macros du fichier notify.h */
    INFO_MSG("Un message INFO_MSG : Debut du programme %s", argv[0]); /* macro INFO_MSG */
    WARNING_MSG("Un message WARNING_MSG !"); /* macro INFO_MSG */
    DEBUG_MSG("Un message DEBUG_MSG !"); /* macro DEBUG_MSG : uniquement si compil en mode DEBUG_MSG */

    FILE *fp = NULL; /* le flux dans lequel les commandes seront lues : stdin (mode shell) ou un fichier */

    if ( argc > 2 ) {
        usage_ERROR_MSG( argv[0] );
        exit( EXIT_FAILURE );
    }
    if(argc == 2 && strcmp(argv[1], "-h") == 0) {
        usage_ERROR_MSG( argv[0] );
        exit( EXIT_SUCCESS );
    }

    /*par defaut : mode shell interactif */
    fp = stdin;
    if(argc == 2) {
        /* mode fichier de commandes */
        fp = fopen( argv[1], "r" );
        if ( fp == NULL ) {
            perror( "fopen" );
            exit( EXIT_FAILURE );
        }
    }

    /* boucle principale : lit puis execute une cmd en boucle */
    while ( 1 ) {
        char input[MAX_STR];
        if ( acquire_line( fp,  input )  == 0 ) {
            /* Une nouvelle ligne a ete acquise dans le flux fp*/
            int res = parse_and_execute_cmd_string(input); /* execution de la commande */
            switch(res) {
            case CMD_OK_RETURN_VALUE: /* tout s'est bien passé */
                break;
            case CMD_EMPTY_RETURN_VALUE: /* commande vide */
                /* rien a faire ! */
                break;
            case CMD_EXIT_RETURN_VALUE:
                /* sortie propre du programme */
                if ( fp != stdin ) {
                    fclose( fp );
                }
                exit(EXIT_SUCCESS);
                break;
            default:
                /* erreur durant l'execution de la commande */
                /* En mode "fichier" toute erreur implique la fin du programme ! */
                if ( fp != stdin ) {
                    fclose( fp );
                    /*macro ERROR_MSG : message d'erreur puis fin de programme ! */
                    ERROR_MSG("ERREUR DETECTEE. Aborts");
                }
                break;
            }
        }
        if( fp != stdin && feof(fp) ) {
            /* mode fichier, fin de fichier => sortie propre du programme */
            DEBUG_MSG("FIN DE FICHIER");
            fclose( fp );
            exit(EXIT_SUCCESS);
        }
    }
    /* tous les cas de sortie du programme sont gérés plus haut*/
    ERROR_MSG("SHOULD NEVER BE HERE\n");
}
开发者ID:Zeenoth,项目名称:step0,代码行数:71,代码来源:simMips.c

示例10: handleTimers

//-------------------------------------------------------------------------------------
void ClientApp::handleGameTick()
{
	g_kbetime++;
	threadPool_.onMainThreadTick();
	handleTimers();
	
	if(lastAddr.ip != 0)
	{
		getNetworkInterface().deregisterChannel(lastAddr);
		getNetworkInterface().registerChannel(pServerChannel_);
		lastAddr.ip = 0;
	}

	getNetworkInterface().processAllChannelPackets(KBEngine::Mercury::MessageHandlers::pMainMessageHandlers);
	tickSend();

	switch(state_)
	{
		case C_STATE_INIT:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_INITLOGINAPP_CHANNEL:
			state_ = C_STATE_PLAY;
			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::login())
			{
				WARNING_MSG("ClientApp::handleGameTick: login is failed!\n");
				return;
			}

			break;
		case C_STATE_LOGIN_GATEWAY_CHANNEL:
			{
				state_ = C_STATE_PLAY;

				bool exist = false;

				if(pServerChannel_->endpoint())
				{
					lastAddr = pServerChannel_->endpoint()->addr();
					getNetworkInterface().dispatcher().deregisterFileDescriptor(*pServerChannel_->endpoint());
					exist = getNetworkInterface().findChannel(pServerChannel_->endpoint()->addr()) != NULL;
				}

				bool ret = initBaseappChannel() != NULL;
				if(ret)
				{
					if(!exist)
					{
						getNetworkInterface().registerChannel(pServerChannel_);
						pTCPPacketReceiver_ = new Mercury::TCPPacketReceiver(*pServerChannel_->endpoint(), getNetworkInterface());
					}
					else
					{
						pTCPPacketReceiver_->endpoint(pServerChannel_->endpoint());
					}

					getNetworkInterface().dispatcher().registerFileDescriptor(*pServerChannel_->endpoint(), pTCPPacketReceiver_);
					
					// 先握手然后等helloCB之后再进行登录
					Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject();
					(*pBundle).newMessage(BaseappInterface::hello);
					(*pBundle) << KBEVersion::versionString();
					
					if(Mercury::g_channelExternalEncryptType == 1)
					{
						pBlowfishFilter_ = new Mercury::BlowfishFilter();
						(*pBundle).appendBlob(pBlowfishFilter_->key());
						pServerChannel_->pFilter(NULL);
					}
					else
					{
						std::string key = "";
						(*pBundle).appendBlob(key);
					}

					pServerChannel_->pushBundle(pBundle);
					// ret = ClientObjectBase::loginGateWay();
				}
			}
			break;
		case C_STATE_LOGIN_GATEWAY:

			state_ = C_STATE_PLAY;

			if(!ClientObjectBase::loginGateWay())
			{
				WARNING_MSG("ClientApp::handleGameTick: loginGateWay is failed!\n");
				return;
			}

			break;
		case C_STATE_PLAY:
			break;
		default:
//.........这里部分代码省略.........
开发者ID:Myrninvollo,项目名称:kbengine,代码行数:101,代码来源:clientapp.cpp

示例11: init_mem

mem  init_mem( uint32_t nseg ) {

    mem vm = calloc( nseg+3, sizeof( *vm ) );

    if ( NULL == vm ) {
        WARNING_MSG( "Unable to allocate host memory for vmem" );
        return NULL;
    }
    else {
        uint i;

        vm->seg = calloc( nseg+2, sizeof( *(vm->seg) ) );
        if ( NULL == vm->seg ) {
            WARNING_MSG( "Unable to allocate host memory for vmem segment" );
            free( vm );
            return NULL;
        }

        // each segment is initialised to a null value
        // Note that though this is unnecessary since a calloc is used
        // this permits future evolution of the default initialisation values
        for ( i= 0; i< nseg; i++ ) {
            vm->seg[i].name      = NULL;
            vm->seg[i].content   = NULL;
            vm->seg[i].start._64 = 0x0;
            vm->seg[i].size._64  = 0x0;
            vm->seg[i].attr      = 0x0;
        }

        /*
        //Definition de lib
        vm->seg[i].name=calloc(5, sizeof(int));
        strcpy(vm->seg[i].name,"[lib]");
        vm->seg[i].start._32 = 0xFF7FD000;
        vm->seg[i].size._32  = 0x00002000;
        vm->seg[i].content   = calloc(1, vm->seg[i].size._64);
        vm->seg[i].attr      = 0x00002002; //32 bit RW
        i++;
        */

        //Definition de stack
        vm->seg[i].name=calloc(7, sizeof(int));
        strcpy(vm->seg[i].name,"[stack]");
        vm->seg[i].start._64 = 0xFF7FF000;
        vm->seg[i].size._64  = 0x00800000;
        vm->seg[i].content   = calloc(1, vm->seg[i].size._64);
        vm->seg[i].attr      = 0x00002002;
        i++;
        //Definition de vsyscall
        vm->seg[i].name=calloc(10, sizeof(int));
        strcpy(vm->seg[i].name,"[vsyscall]");
        vm->seg[i].start._64 = 0xFFFFF000;
        vm->seg[i].size._64  = 0x00000FFF;
        vm->seg[i].content   = calloc(1, vm->seg[i].size._64);
        vm->seg[i].attr      = 0x00002003;  //32 bits r-x
        i++;


        vm->nseg = nseg+2;
    }

    return vm;
}
开发者ID:Benz0X,项目名称:Emul-MIPS,代码行数:63,代码来源:mem.c

示例12: reloc_segment


//.........这里部分代码省略.........

      int i = 0, j = 0;
      unsigned int V = 0;
      unsigned int S = 0;
      unsigned int A = 0;
      unsigned int T = 0;
      
      for (i=0; i<scnsz/sizeof(*rel); i++) {
          T =0;
          __Elf_Rel_flip_endianness((byte *)(rel+i), 32, endianness);
          unsigned int offset = rel[i].r_offset; // decalage par rapport au debut de section
          int sym = (int) ELF32_R_SYM(rel[i].r_info);
          int type = (unsigned char) ELF32_R_TYPE(rel[i].r_info);
	  int P = seg.vaddr + offset;

          DEBUG_MSG("Entrée de relocation : offset %08x info =%08x sym = %08x type =%08x\n",rel[i].r_offset,rel[i].r_info,sym,type);
          DEBUG_MSG("Symbole en fonction duquel on reloge : symbole %s de type %d\n",symtab->sym[sym].name, type);

          if (symtab->sym[sym].type==STT_SECTION) {
            S = symtab->sym[sym].addr._32;
 
	    if (type == R_ARM_ABS8) {
              uint8_t oct = read_memory_value(P, mem);
              if (oct < 0)
                A = oct | 0xFFFFFF00;
              else
                A = oct;
              V = A + S;
              write_memory_value(P, V, mem);  
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
            }
            
            if (type == R_ARM_ABS32) {
              A = read_word(P, mem) ;
              V = (S + A) | T;
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
              write_word(P, V, mem);
            }

            if (type == R_ARM_THM_CALL) {
            }
                         
          } 
          
          else if (symtab->sym[sym].type==STT_FUNC) {
          
            T = 1;
            S = symtab->sym[sym].addr._32;   

	    if (type == R_ARM_ABS8) {
              A = read_memory_value(P, mem) ;
              V = A + S;
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
              write_memory_value(P, V, mem);  
            }
            
            if (type == R_ARM_ABS32) {
              A = read_word(P, mem) << 1;
              V = (S + A) | T;
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
              write_word(P, V, mem);
            }

            if (type == R_ARM_THM_CALL) {
            }               
          } 

          else if (symtab->sym[sym].type==STT_NOTYPE) {
          
            S = symtab->sym[sym].addr._32;   

	    if (type == R_ARM_ABS8) {
              A = read_memory_value(P, mem);
              V = A + S;
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
              write_memory_value(P, V, mem);  
            }
            
            if (type == R_ARM_ABS32) {
              A = read_word(P, mem);
              V = (S + A) | T;
              printf("A: %d, P: %d, S: %d, T: %d, V:%x\n", A, P, S, T, V);
              write_word(P, V, mem);
            }

            if (type == R_ARM_THM_CALL) {
            }               
          }  
       
          else {
              WARNING_MSG("%d non traité pour l'instant",symtab->sym[sym].type) ;
              continue;
          }
      }
  }
  del_scntab(section_tab);
  free( rel );
  free( reloc_name );
  free( ehdr );
}
开发者ID:gueladjo,项目名称:ARM-Cortex-A-emulator,代码行数:101,代码来源:relocation.c

示例13: error

int InternalDatabaseReader::getQueryResults(CorbaClientAdaptor &adaptor) {
    int error(EXIT_SUCCESS);
    MutexMgr mutexMgr(mutex);
    const unsigned int numberOfColumns(sqlite3_column_count(SQLQueryStatement));
    adaptor.setNumberOfSubItems(numberOfColumns);

    // set Labels'name corresponding to the current query'fields
    for(unsigned int i=0;i<numberOfColumns;i++) {
        const char *label = sqlite3_column_name(SQLQueryStatement,i);
        DEBUG_MSG("label %u = %s",i,label);
        adaptor.setLabel(i,label);
    }

    // retrieve the result of the current query
    unsigned int row(0);
    std::string errorMsg;
    unsigned int nbRetries(0);
    do {
        error = sqlite3_step(SQLQueryStatement);
        DEBUG_VAR(error,"%d");
        switch(error) {
            case SQLITE_DONE:
                DEBUG_MSG("SQLITE_DONE");
                break;
            case SQLITE_ROW: {
                for(unsigned int column=0;column<numberOfColumns;column++) {
                    const int cellDataType = sqlite3_column_type(SQLQueryStatement,column);
                    DEBUG_VAR(cellDataType,"%d");
                    switch(cellDataType) {
                        case SQLITE_INTEGER: {
                            const int value = sqlite3_column_int(SQLQueryStatement,column);
                            DEBUG_VAR(value,"%d");
                            adaptor.setValue(row,column,value);
                        }
                        break;
                        case SQLITE_FLOAT: {
                            const double value = sqlite3_column_double(SQLQueryStatement,column);
                            DEBUG_VAR(value,"%f");
                            adaptor.setValue(row,column,value);
                        }
                        break;
                        case SQLITE_TEXT: {
                            const char *value = (char *)sqlite3_column_text(SQLQueryStatement,column);
                            DEBUG_VAR(value,"%s");
                            adaptor.setValue(row,column,value);
                        }
                        break;
                        case SQLITE_BLOB:
                            NOTICE_MSG("BLOB (not yet supported)");
                            break;
                        case SQLITE_NULL:
                            DEBUG_MSG("NULL");
                            // do Nothing
                            break;
                    } //switch(cellDataType)
                } //for(unsigned int column=0;column<numberOfColumns;column++)
            } //case SQLITE_ROW
            break;
            case SQLITE_BUSY:
                DEBUG_MSG("SQLITE_BUSY");
                nbRetries++;
                WARNING_MSG("error during query execution, database is lock, retrying...(%u)",nbRetries);
                break;
            case SQLITE_ERROR: {
                const char *msg = sqlite3_errmsg(database);
                ERROR_MSG("SQLITE_ERROR %s",msg);
                errorMsg = msg;
            }
            break;
            case SQLITE_MISUSE: {
                const char *msg = sqlite3_errmsg(database);
                ERROR_MSG("SQLITE_MISUSE %s",msg);
                errorMsg = msg;
            }
            break;
            default: {
                const char *msg = sqlite3_errmsg(database);
                ERROR_MSG("SQLite return code %d,  %s",msg);
                errorMsg = msg;
            }
            break;
        } // switch(error)
        ++row;
        DEBUG_MSG("new line (%u)",row);
    } while((SQLITE_ROW == error) || ((SQLITE_BUSY == error) && (nbRetries < NB_MAX_RETRIES)));
    sqlite3_reset(SQLQueryStatement);
    if (error != SQLITE_DONE) {
        throw exception(error,errorMsg);
    }
    return error;
}
开发者ID:Oliviers-OSS,项目名称:IEC-61162,代码行数:91,代码来源:InternalDatabaseReader.cpp

示例14: ERROR_MSG

//-------------------------------------------------------------------------------------
void DebugHelper::sync()
{
    if(bufferedLogPackets_.size() == 0)
        return;

    if(messagelogAddr_.isNone())
    {
        if(bufferedLogPackets_.size() > 128)
        {
            ERROR_MSG("DebugHelper::sync: can't found messagelog. packet size=%u.\n", bufferedLogPackets_.size());
            clearBufferedLog();
        }
        return;
    }

    int8 v = Mercury::g_trace_packet;
    Mercury::g_trace_packet = 0;

    Mercury::Channel* pChannel = pNetworkInterface_->findChannel(messagelogAddr_);
    if(pChannel == NULL)
    {
        if(bufferedLogPackets_.size() > 1024)
        {
            messagelogAddr_.ip = 0;
            messagelogAddr_.port = 0;

            WARNING_MSG("DebugHelper::sync: is no use the messagelog, packet size=%u.\n",
                        bufferedLogPackets_.size());
            clearBufferedLog();
        }

        Mercury::g_trace_packet = v;
        return;
    }

    if(bufferedLogPackets_.size() > 0)
    {
        if(bufferedLogPackets_.size() > 32)
        {
            WARNING_MSG("DebugHelper::sync: packet size=%u.\n", bufferedLogPackets_.size());
        }

        int i = 0;

        size_t totalLen = 0;

        std::list< Mercury::Bundle* >::iterator iter = bufferedLogPackets_.begin();
        for(; iter != bufferedLogPackets_.end();)
        {
            if(i++ >= 32 || totalLen > (PACKET_MAX_SIZE_TCP * 10))
                break;

            totalLen += (*iter)->currMsgLength();
            pChannel->send((*iter));

            Mercury::Bundle::ObjPool().reclaimObject((*iter));
            bufferedLogPackets_.erase(iter++);
        }
    }

    Mercury::g_trace_packet = v;
}
开发者ID:sdsgwangpeng,项目名称:kbengine,代码行数:63,代码来源:debug_helper.cpp

示例15: ERROR_MSG


//.........这里部分代码省略.........
		return true;
	}


	// Our reply handler for the current request.
	WatcherPacketHandler *packetHandler = NULL;

	// and call back to the program
	switch (wdm->message)
	{
		case WATCHER_MSG_GET:
		case WATCHER_MSG_GET_WITH_DESC:
		{
			// Create the packet reply handler for the current incoming request
			packetHandler = new WatcherPacketHandler( socket_, senderAddr,
					wdm->count, WatcherPacketHandler::WP_VERSION_1, false );

			char	*astr = wdm->string;
			for(int i=0;i<wdm->count;i++)
			{
				wrh_->processWatcherGetRequest( *packetHandler, astr,
					   	(wdm->message == WATCHER_MSG_GET_WITH_DESC) );
				astr += strlen(astr)+1;
			}
		}
		break;

		case WATCHER_MSG_GET2:
		{
			// Create the packet reply handler for the current incoming request
			packetHandler = new WatcherPacketHandler( socket_, senderAddr,
					wdm->count, WatcherPacketHandler::WP_VERSION_2, false );

			char	*astr = wdm->string;
			for(int i=0;i<wdm->count;i++)
			{
				unsigned int & seqNum = (unsigned int &)*astr;
				astr += sizeof(unsigned int);
				wrh_->processWatcherGet2Request( *packetHandler, astr, seqNum );
				astr += strlen(astr)+1;
			}
		}
		break;


		case WATCHER_MSG_SET:
		{
			// Create the packet reply handler for the current incoming request
			packetHandler = new WatcherPacketHandler( socket_, senderAddr,
					wdm->count, WatcherPacketHandler::WP_VERSION_1, true );

			char	*astr = wdm->string;
			for(int i=0;i<wdm->count;i++)
			{
				char	*bstr = astr + strlen(astr)+1;
				wrh_->processWatcherSetRequest( *packetHandler, astr,bstr );
				astr = bstr + strlen(bstr)+1;
			}
		}
		break;


		case WATCHER_MSG_SET2:
		{
			// Create the packet reply handler for the current incoming request
			packetHandler = new WatcherPacketHandler( socket_, senderAddr,
					wdm->count, WatcherPacketHandler::WP_VERSION_2, true );

			char	*astr = wdm->string;
			for(int i=0;i<wdm->count;i++)
			{
				wrh_->processWatcherSet2Request( *packetHandler, astr );
			}
		}
		break;

		default:
		{
			Mercury::Address srcAddr( senderAddr.sin_addr.s_addr,
									senderAddr.sin_port );
			WARNING_MSG( "WatcherNub::receiveRequest: "
						"Unknown message %d from %s\n",
					wdm->message, srcAddr.c_str() );
		}
		break;
	}

	// Start running the packet handler now, it will delete itself when
	// complete.
	if (packetHandler)
	{
		packetHandler->run();
		packetHandler = NULL;
	}

	// and we're done!
	insideReceiveRequest_ = false;

	return true;
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:101,代码来源:watcher_nub.cpp


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