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


C++ KG_COM_RELEASE函数代码示例

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


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

示例1: g_OpenIniFile

BOOL KLogClient::Init()
{
    BOOL               bResult          = false;
    BOOL               bRetCode         = false;
    IIniFile*	       piIniFile        = NULL;

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString(LOG_SERVER_SECTION_GAMESERVER, "IP", "127.0.0.1", m_szLogServerAddr, sizeof(m_szLogServerAddr));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger(LOG_SERVER_SECTION_GAMESERVER, "Port", 5004, &m_nRelayPort);
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger(LOG_SERVER_SECTION_GAMESERVER, "PingCycle", 20, &m_nPingCycle);
    KGLOG_PROCESS_ERROR(bRetCode);

    m_bRunFlag = true;

    bRetCode = m_WorkThread.Create(WorkThreadFunction, this);
    KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    if (!bResult)
    {
        KG_COM_RELEASE(m_piSocketStream);
    }

    KG_COM_RELEASE(piIniFile);
    return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:33,代码来源:KLogClient.cpp

示例2: g_OpenFile

int KGFileManager::CompareFileByDataStream(const char cszFileName_1[], const char cszFileName_2[])
{
	int nResult  = false;
	int nRetCode = false;
	IFile* pFile_1 = NULL;
	IFile* pFile_2 = NULL;
	BYTE byData_1[SIZE_READ_BUFFER] = {0};
	BYTE byData_2[SIZE_READ_BUFFER] = {0};
	char szResult[2 * MAX_PATH] = {0};

	pFile_1 = g_OpenFile(cszFileName_1);
	KGLOG_PROCESS_ERROR(pFile_1);
	pFile_2 = g_OpenFile(cszFileName_2);
	KGLOG_PROCESS_ERROR(pFile_2);

	if (pFile_1->Size() != pFile_2->Size())
	{
		nRetCode = _snprintf_s(
			szResult, 
			sizeof(szResult),
			sizeof(szResult) - 1,
			"Size Differ. File_1=%s File_2=%s",
			cszFileName_1,
			cszFileName_2
			);
		KGLOG_PROCESS_ERROR(nRetCode > 0);
		KGLogPrintf(KGLOG_ERR, szResult);
		KGLOG_PROCESS_ERROR(false);
	}

	for (ULONG i = 0; i < pFile_1->Size(); i += SIZE_READ_BUFFER)
	{
		pFile_1->Read(byData_1, SIZE_READ_BUFFER);
		pFile_2->Read(byData_2, SIZE_READ_BUFFER);
		nRetCode = memcmp(byData_1, byData_2, SIZE_READ_BUFFER);
		if (nRetCode != 0)
		{
			nRetCode = _snprintf_s(
				szResult, 
				sizeof(szResult),
				sizeof(szResult) - 1,
				"File Data Differ. File_1=%s File_2=%s",
				cszFileName_1,
				cszFileName_2
				);
			KGLOG_PROCESS_ERROR(nRetCode > 0);
			KGLogPrintf(KGLOG_ERR, szResult);
			KGLOG_PROCESS_ERROR(false);
		}
	}

	nResult = true;
Exit0:
	KG_COM_RELEASE(pFile_1);
	KG_COM_RELEASE(pFile_2);
	return nResult;
}
开发者ID:1suming,项目名称:pap2,代码行数:57,代码来源:KGFileManager.cpp

示例3: KG3DAnimationTagContainer

KG3DAnimationTagContainer* KG3DAnimationTagContainerTable::LoadTag(LPCSTR strFileName)
{
    HRESULT hrResult = E_FAIL;
    HRESULT hrRetCode = E_FAIL;
    DWORD dwID = 0;
    KG3DAnimationTagContainer* pHoldTag = NULL;
    KG3DAnimationTagContainer* pNewTag = NULL;
    TAG_MAP::iterator it;
    TAG_MAP::_Pairib Pair;

	pNewTag = new KG3DAnimationTagContainer();
	KGLOG_PROCESS_ERROR(pNewTag);

    dwID = g_FileNameHash(strFileName);

	it = m_mapTagCache.find(dwID);
	if (it == m_mapTagCache.end())
	{
		pHoldTag = new KG3DAnimationTagContainer();
		KGLOG_PROCESS_ERROR(pHoldTag);

		hrRetCode = pHoldTag->Load(strFileName);
        KGLOG_COM_PROCESS_ERROR(hrRetCode);

        Pair = m_mapTagCache.insert(make_pair(dwID, pHoldTag));
        KGLOG_PROCESS_ERROR(Pair.second);

        Pair.first->second->AddRef();
	}
	else
	{
		pHoldTag = it->second;
        pHoldTag->AddRef();
	}

    if (pHoldTag->IsLoaded())
    {
        hrRetCode = pNewTag->Clone(pHoldTag);
        KGLOG_COM_PROCESS_ERROR(hrRetCode);
    }
    else
    {
        hrRetCode = pNewTag->Load(strFileName);
        KGLOG_COM_PROCESS_ERROR(hrRetCode);
    }

    hrResult = S_OK;
Exit0:
    if (FAILED(hrResult))
        KG_COM_RELEASE(pNewTag);
    KG_COM_RELEASE(pHoldTag);
	return pNewTag;
}
开发者ID:1suming,项目名称:pap2,代码行数:53,代码来源:KG3DAnimationTagContainer.cpp

示例4: KG_PROCESS_ERROR

BOOL KLogClient::Connect()
{
    BOOL bResult    = false;
    BOOL bRetCode   = false;
    KG_SocketConnector Connector;
    struct timeval     TimeVal;
    IKG_SocketStream*	    piSocketStream = NULL;
    IKG_Buffer*             piPackage       = NULL;
    G2L_HANDSHAKE_REQUEST*  pHandshake      = NULL;

    piSocketStream = Connector.Connect(m_szLogServerAddr, m_nRelayPort);
    KG_PROCESS_ERROR(piSocketStream);

    TimeVal.tv_sec  = 0;
    TimeVal.tv_usec = 10000;

    bRetCode = piSocketStream->SetTimeout(&TimeVal);
    KGLOG_PROCESS_ERROR(bRetCode);

    m_bSocketError        = false;
    //m_nWorldIndex         = 0;

    m_nLastSendPacketTime = g_pSO3World->m_nCurrentTime;

    // 初始化的一些操作,注意多线程
    piPackage = KG_MemoryCreateBuffer((unsigned)sizeof(G2L_HANDSHAKE_REQUEST));
    KGLOG_PROCESS_ERROR(piPackage);

    pHandshake = (G2L_HANDSHAKE_REQUEST*)piPackage->GetData();
    KGLOG_PROCESS_ERROR(pHandshake);

    pHandshake->wProtocolID         = g2l_handshake_request;
    pHandshake->nServerTime         = (int)time(NULL);
    pHandshake->nServerIndexInGC    = g_pSO3World->m_nServerIndexInGC;

    bRetCode = piSocketStream->Send(piPackage);
    KGLOG_PROCESS_ERROR(bRetCode == 1);

    // 小心: 这里不能写成 "m_piSocket = piSocket; m_piSocket->AddRef(); ", 那样会导致线程安全隐患
    piSocketStream->AddRef();
    m_piSocketStream = piSocketStream;

    KGLogPrintf( KGLOG_INFO, "Connect to log server %s:%d ... ... [OK]", m_szLogServerAddr, m_nRelayPort );

    bResult = true;
Exit0:
    KG_COM_RELEASE(piPackage);
    KG_COM_RELEASE(piSocketStream);
    return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:50,代码来源:KLogClient.cpp

示例5: assert

BOOL KLogServerAgency::LoginServer(const char cszIP[], int nPort, const char cszIdentity[])
{
    BOOL                bResult      = false;
    BOOL                bRetCode     = false;
    IKG_Buffer*         piSendBuffer = NULL;
    KGCSLogServerLogin* pLogin       = NULL;
    KG_SocketConnector  Connector;
    struct timeval      TimeVal;

    assert(m_piSocket == NULL);

    m_piSocket = Connector.Connect(cszIP, nPort);
    KG_PROCESS_ERROR(m_piSocket);

    TimeVal.tv_sec  = 2;
    TimeVal.tv_usec = 0;

    bRetCode = m_piSocket->SetTimeout(&TimeVal);
    KGLOG_PROCESS_ERROR(bRetCode);

    piSendBuffer = KG_MemoryCreateBuffer((unsigned)sizeof(KGCSLogServerLogin));
    KGLOG_PROCESS_ERROR(piSendBuffer);

    pLogin = (KGCSLogServerLogin*)piSendBuffer->GetData();
    KGLOG_PROCESS_ERROR(pLogin);

    pLogin->ProtocolType = LOGC2S_LOG_LOGIN;
    pLogin->ulIdentity   = 0;

    strncpy(pLogin->szGatewayName, cszIdentity, sizeof(pLogin->szGatewayName));
    pLogin->szGatewayName[sizeof(pLogin->szGatewayName) - 1] = '\0';

    bRetCode = Send(piSendBuffer);
    KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    KGLogPrintf(
        KGLOG_INFO, "Connect to log server %s:%d ... ... [%s]",
        cszIP, nPort, bResult ? "OK" : "Failed"
    );
    if (!bResult)
    {
        KG_COM_RELEASE(m_piSocket);
    }
    KG_COM_RELEASE(piSendBuffer);
    return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:48,代码来源:KLogServerAgency.cpp

示例6: assert

BOOL KApexProxy::Connect(const char szIP[], int nPort)
{
    BOOL                bResult         = false;
    BOOL                bRetCode        = false;
    timeval             TimeoutValue    = {0, 0};
    KG_SocketConnector  Connector;

    assert(m_piSocketStream == NULL);

    m_piSocketStream = Connector.Connect(szIP, nPort);
    KG_PROCESS_ERROR(m_piSocketStream);

    bRetCode = m_piSocketStream->SetTimeout(&TimeoutValue);
    KGLOG_PROCESS_ERROR(bRetCode);

    m_bSendErrorFlag = false;

    bResult = true;
Exit0:
    if (!bResult)
    {
        KG_COM_RELEASE(m_piSocketStream);
    }

    KGLogPrintf(
        KGLOG_INFO, "[ApexProxy] Connect to %s : %d ... ... [%s]", szIP, nPort, bResult ? "Ok" : "Failed"
    );


    return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:31,代码来源:KApexProxy.cpp

示例7: CreateIDSequence

IKIDSequence* CreateIDSequence(
    const char cszDBAddr[], const char cszDBName[], const char cszUserName[], const char cszPassword[]
)
{
    IKIDSequence*   piResult    = NULL;
    KIDSequence*    pIDSequence = NULL;
    BOOL            bRetCode    = false;

    assert(cszDBAddr);
    assert(cszDBName);
    assert(cszUserName);
    assert(cszPassword);

    pIDSequence = new KIDSequence;
    KGLOG_PROCESS_ERROR(pIDSequence);

    bRetCode = pIDSequence->Create(cszDBAddr, cszDBName, cszUserName, cszPassword);
    KGLOG_PROCESS_ERROR(bRetCode);

    piResult = pIDSequence;
Exit0:
    if (!piResult)
    {
        KG_COM_RELEASE(pIDSequence);
    }
    return piResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:27,代码来源:KIDSequence.cpp

示例8: KG_GetTickCount

BOOL KLogClient::DoPingSignal()
{
    BOOL				bResult			= false;
    BOOL				bRetCode		= false;
    DWORD               dwNowTime       = 0;
    IKG_Buffer*         piSendBuffer    = NULL;
    G2L_PING_SIGNAL*    pPingSingal		= NULL;

    dwNowTime = KG_GetTickCount();

    KG_PROCESS_ERROR(dwNowTime >= m_dwNextPingTime);

    m_dwNextPingTime = dwNowTime + 1000 * m_nPingCycle;

    piSendBuffer = KG_MemoryCreateBuffer(sizeof(G2L_PING_SIGNAL));
    KGLOG_PROCESS_ERROR(piSendBuffer);

    pPingSingal = (G2L_PING_SIGNAL*)piSendBuffer->GetData();
    KGLOG_PROCESS_ERROR(pPingSingal);

    pPingSingal->wProtocolID = g2l_ping_signal;

    bRetCode = Send(piSendBuffer);
    KGLOG_PROCESS_ERROR(bRetCode);   

    bResult = true;
Exit0:
    KG_COM_RELEASE(piSendBuffer);
    return bResult;
}
开发者ID:zhengguo07q,项目名称:GameWorld,代码行数:30,代码来源:KLogClient.cpp

示例9: _countof

void KG3DFontTexture::LoadAlphaAdjustTable(LPCSTR szFontName, INT nFontSize)
{
	BOOL bAdjust = FALSE;
	char szFileName[MAX_PATH];
	LPSTR szSep = NULL;
	int nLen = _countof(szFileName) - 16;

	strncpy(szFileName, szFontName, nLen);
	szFileName[nLen - 1] = '\0';

	szSep = strrchr(szFileName, '.');
	if (szSep)
	{
		sprintf(szSep, "%d.prf", nFontSize);
		if (g_IsFileExist(szFileName))
		{
			IFile* pFile = g_OpenFile(szFileName);
			if (pFile)
			{
				unsigned int nCount = pFile->Read(m_uchAdjustBuffer, sizeof(m_uchAdjustBuffer));
				if (nCount == sizeof(m_uchAdjustBuffer))
					bAdjust = TRUE;

                KG_COM_RELEASE(pFile);
			}
		}
	}
	if (!bAdjust)
	{
		for (size_t nIndex = 0; nIndex < _countof(m_uchAdjustBuffer); ++nIndex)
		{
			m_uchAdjustBuffer[nIndex] = (UCHAR)nIndex;
		}
	}
}
开发者ID:1suming,项目名称:pap2,代码行数:35,代码来源:KG3DFontTexture.cpp

示例10: g_OpenIniFile

BOOL KLogClient::Init()
{
    BOOL               bResult          = false;
    BOOL               bRetCode         = false;
    IIniFile*	       piIniFile        = NULL;
    int                nPort            = 0;
    char               szIP[16];

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString("LogServer", "IP", "127.0.0.1", szIP, sizeof(szIP));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "Port", 5005, &nPort);
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "PingCycle", 30, &m_nPingCycle);
    KGLOG_PROCESS_ERROR(bRetCode);
    KGLOG_PROCESS_ERROR(m_nPingCycle > 0);

    bRetCode = piIniFile->GetString("LogServer", "Identity", "", m_szIdentity, sizeof(m_szIdentity));
    KGLOG_PROCESS_ERROR(bRetCode);
    m_szIdentity[sizeof(m_szIdentity) - 1] = '\0';

    // 无论连上与否,均视为成功
    LoginServer(szIP, nPort, m_szIdentity);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
开发者ID:1suming,项目名称:pap2,代码行数:33,代码来源:KLogClient.cpp

示例11: assert

int KSimulateRelay::DoFreezeCoinRequest()
{
    BOOL                            bResult  = false;
    BOOL                            bRetCode = false;
    IKG_Buffer*                     piBuffer = NULL;
    R2G_FREEZE_COIN_REQUEST*        pRequest = NULL;
    const char* pszAccountName      = "0000"; 

    DWORD   dwRoleID = 3333; 

    assert(pszAccountName);

    piBuffer = KG_MemoryCreateBuffer((unsigned)sizeof(R2G_FREEZE_COIN_REQUEST));
    KGLOG_PROCESS_ERROR(piBuffer);

    pRequest = (R2G_FREEZE_COIN_REQUEST*)piBuffer->GetData();
    KGLOG_PROCESS_ERROR(pRequest);

    pRequest->byProtocol = r2g_freeze_coin_request;

    strncpy(pRequest->szAccount, pszAccountName, sizeof(pRequest->szAccount));
    pRequest->szAccount[sizeof(pRequest->szAccount) - 1] = '\0';

    pRequest->dwRequestID = dwRoleID;

    bRetCode = m_piSocket->Send(piBuffer);
    KGLOG_PROCESS_ERROR(bRetCode);

    KGLogPrintf(KGLOG_INFO, "Relay, DoFreezeCoinRequest\n");

    bResult = true;
Exit0:
    KG_COM_RELEASE(piBuffer);
    return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:35,代码来源:KSimulateRelay.cpp

示例12: KGLOG_PROCESS_ERROR

int KSimulateRelay::DoPingRespond()
{
    int                         nResult                         = false;
    int                         nRetCode                        = false;
    IKG_Buffer*                 piSendBuffer                    = NULL;
    BYTE*                       pbySendBuffer                   = NULL;
    tagProtocolHeader*          ptagProtocolHeader              = NULL;

    KGLOG_PROCESS_ERROR(m_piSocket);

    piSendBuffer = KG_MemoryCreateBuffer((unsigned)(sizeof(R2G_PING_SIGNAL)));
    KGLOG_PROCESS_ERROR(piSendBuffer);

    pbySendBuffer = (BYTE*)piSendBuffer->GetData();
    KGLOG_PROCESS_ERROR(pbySendBuffer);

    ptagProtocolHeader = (tagProtocolHeader*)pbySendBuffer;
    ptagProtocolHeader->cProtocol = r2g_ping_signal;

    nRetCode = m_piSocket->Send(piSendBuffer);
    KGLOG_PROCESS_ERROR(nRetCode);

    nResult = true;
Exit0:
    KG_COM_RELEASE(piSendBuffer);
    return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:27,代码来源:KSimulateRelay.cpp

示例13: KG_MemoryCreateBuffer

int KSimulateRelay::OnQueryAccountState(BYTE* pbyData, size_t uDataLen)
{
    int                          nResult             = false;
    int                          nRetCode            = false;
    IKG_Buffer*                  piSendBuffer        = NULL;
    G2R_QUERY_ACCOUNT_STATE*     pQueryAccountState  = (G2R_QUERY_ACCOUNT_STATE*)pbyData;
    R2G_SYNC_ACCOUNT_STATE*      pSyncAccountState   = NULL;

    pQueryAccountState->szAccount[sizeof(pQueryAccountState->szAccount) - 1] = '\0';

    piSendBuffer = KG_MemoryCreateBuffer(sizeof(R2G_SYNC_ACCOUNT_STATE));
    KGLOG_PROCESS_ERROR(piSendBuffer);

    pSyncAccountState = (R2G_SYNC_ACCOUNT_STATE*)piSendBuffer->GetData();
    KGLOG_PROCESS_ERROR(pSyncAccountState);

    pSyncAccountState->byProtocol   = r2g_sync_account_state;
    pSyncAccountState->nPlayerIndex = pQueryAccountState->nPlayerIndex;    
    pSyncAccountState->bOnline      = m_RelayConfig.nUserOnlineResult;

    nRetCode = m_piSocket->Send(piSendBuffer);
    KGLOG_PROCESS_ERROR(nRetCode == 1);

    nResult = true;
Exit0:
    KG_COM_RELEASE(piSendBuffer);
    return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:28,代码来源:KSimulateRelay.cpp

示例14: KG_PROCESS_ERROR

int KSimulateRelay::DoSetProtocolVersion(int nLowerVersion, int nUpperVersion)
{
    int                             nResult             = false;
    int                             nRetCode            = false;
    IKG_Buffer*                     piSendBuffer        = false;
    size_t                          uSendBufferSize     = 0;
    R2G_SET_GAME_WORLD_VERSION*     pRespond            = NULL;

    KG_PROCESS_ERROR(m_piSocket);

    uSendBufferSize = sizeof(R2G_SET_GAME_WORLD_VERSION);

    piSendBuffer = KG_MemoryCreateBuffer((unsigned)uSendBufferSize);
    KGLOG_PROCESS_ERROR(piSendBuffer);

    pRespond = (R2G_SET_GAME_WORLD_VERSION*)piSendBuffer->GetData();
    KGLOG_PROCESS_ERROR(pRespond);

    pRespond->byProtocol    = r2g_set_game_world_version;
    pRespond->nLowerVersion = nLowerVersion;
    pRespond->nUpperVersion = nUpperVersion;

    nRetCode = m_piSocket->Send(piSendBuffer);
    KGLOG_PROCESS_ERROR(nRetCode == 1);

    nResult = true;
Exit0:
    KG_COM_RELEASE(piSendBuffer);
    return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:30,代码来源:KSimulateRelay.cpp

示例15: KGLOG_PROCESS_ERROR

BOOL KApexProxy::DoRoleLogout(DWORD dwRoleID)
{
    BOOL                bResult     = false;
    APEX_ROLE_LOGOUT*   pRoleLogout = NULL;
    IKG_Buffer*         piBuffer    = NULL;
    KRole*              pRole       = NULL;
    size_t              nNameLen    = 0;

    pRole = g_pSO3GameCenter->m_RoleManager.GetRole(dwRoleID);
    KGLOG_PROCESS_ERROR(pRole);

    piBuffer = KG_MemoryCreateBuffer((unsigned)sizeof(APEX_ROLE_LOGOUT));
    KGLOG_PROCESS_ERROR(piBuffer);

    pRoleLogout = (APEX_ROLE_LOGOUT*)piBuffer->GetData();
    KGLOG_PROCESS_ERROR(pRoleLogout);

    pRoleLogout->cMsgId  = 'G';
    pRoleLogout->nSendId = (int)dwRoleID;

    strncpy(pRoleLogout->szName, pRole->m_szName, sizeof(pRoleLogout->szName));
    pRoleLogout->szName[sizeof(pRoleLogout->szName) - 1] = '\0';

    Send(piBuffer);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piBuffer);
    return bResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:30,代码来源:KApexProxy.cpp


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