BOOL CMQuestionUpload::AnswerQuestion(const char* sQuestionID, int nAnonymous, const char* sAnswer,const char* filename)
{
    
    if(!m_pSession)
		m_pSession = new CMSession(this);
	if(m_pSession->IsRunning())
		return FALSE;
    
	char param[640];
	snprintf(param,sizeof(param),"&questionid=%s&anonymous=%d", sQuestionID, nAnonymous);
    //构造form数据
    CMList<FormData>* list= new CMList<FormData>;
	//加入文本内容
    FormData data;

    if(filename!=NULL&&strlen(filename)!=0)
    {
        data.key=CMString("pic");
        data.value=CMString(filename);
        data.dataType=2;
        list->push_back(data);
    }

    data.key=CMString("content");
    data.value=CMString(sAnswer);
    data.dataType=1;
    list->push_back(data);

    m_pSession->CommandPost(SERVICE_ANSWERQUESTION, param,*list);
    SAFEDELETE(list);
    
    return TRUE;
}
void LayoutAttribute::setFont(CFont *font) {
  if(m_font && (m_font != m_startFont)) {
    m_font->DeleteObject();
    SAFEDELETE(m_font);
  }
  m_font = font;
}
예제 #3
0
void AnimatedImage::clearDisposeTable() {
  for(size_t i = 0; i < m_disposeTable.size(); i++) {
    PixRect *pr = m_disposeTable[i];
    SAFEDELETE(pr);
  }
  m_disposeTable.clear();
}
//=============================================================================
int XSocket::_iSendUnsentData()
{
    int iRet;
    char * pTemp;

    while (m_pUnsentDataList[m_sHead] != NULL) {

        iRet = _iSend_ForInternalUse(m_pUnsentDataList[m_sHead], m_iUnsentDataSize[m_sHead]);

        if (iRet == m_iUnsentDataSize[m_sHead]) {
            SAFEDELETE(m_pUnsentDataList[m_sHead]);
            m_iUnsentDataSize[m_sHead] = 0;
            m_sHead++;
            if (m_sHead >= m_iBlockLimit) m_sHead = 0;
        }
        else {
            if (iRet < 0)
                return iRet;

            pTemp = new char[m_iUnsentDataSize[m_sHead] - iRet];
            memcpy(pTemp, m_pUnsentDataList[m_sHead] + iRet, m_iUnsentDataSize[m_sHead] - iRet);

            delete m_pUnsentDataList[m_sHead];
            m_pUnsentDataList[m_sHead] = pTemp;

            return XSOCKEVENT_UNSENTDATASENDBLOCK;
        }
    }

    return XSOCKEVENT_UNSENTDATASENDCOMPLETE;
}
예제 #5
0
파일: histnode.cpp 프로젝트: ArildF/masters
HRESULT CHistoryInfoNode::Create(AsmBindHistoryInfo *pHistInfo, CHistoryInfoNode **pphn)
{
    HRESULT                                     hr = S_OK;
    CHistoryInfoNode                               *pHList = NULL;
   
    if (!pHistInfo || !pphn) {
        hr = E_INVALIDARG;
        goto Exit;
    }

    *pphn = NULL;

    pHList = NEW(CHistoryInfoNode);
    if (!pHList) {
        hr = E_OUTOFMEMORY;
        goto Exit;
    }

    hr = pHList->Init(pHistInfo);
    if (FAILED(hr)) {
        SAFEDELETE(pHList);
        goto Exit;
    }

    *pphn = pHList;

Exit:
    return hr;
}
BOOL CMQuestionUpload::AskQuestion(const char* sCategoryID, int nAnonymous, int nValue, const char* sQuestion,const char* filename)
{
    if(!m_pSession)
		m_pSession = new CMSession(this);
	if(m_pSession->IsRunning())
		return FALSE;
    
    char param[640];
    //构造url
	snprintf(param,sizeof(param),"&categoryid=%s&anonymous=%d&value=%d", sCategoryID, nAnonymous, nValue);
    //构造form数据
    CMList<FormData>* list= new CMList<FormData>;
    //加入文件
    FormData data;
    if(filename!=NULL&&strlen(filename)!=0)
    {
        data.key=CMString("pic");
        data.value=CMString(filename);
        data.dataType=2;
        list->push_back(data);
    }
    //加入文本内容
    data.key=CMString("content");
    data.value=sQuestion;
    data.dataType=1;
    list->push_back(data);

    m_pSession->CommandPost(SERVICE_NEWQUESTION, param,*list);
    SAFEDELETE(list);

    return TRUE;
}
예제 #7
0
EXTERN_C
DWORD
PIN_Open(
    DWORD Context, 
    DWORD Access,
    DWORD ShareMode
    )
{
    DEBUGMSG( ZONE_FUNCTION, ( _T("PIN_Open(%x, 0x%x, 0x%x)\r\n"), Context, Access, ShareMode ) );

    UNREFERENCED_PARAMETER( ShareMode );
    UNREFERENCED_PARAMETER( Access );
   
    PPININITHANDLE pPinInit = reinterpret_cast<PPININITHANDLE>( Context );

    ASSERT( NULL != pPinInit );
    PPINDEVICE pPinDevice = new PINDEVICE;

    if ( NULL == pPinDevice )
    {
        DEBUGMSG( ZONE_FUNCTION, ( _T("PIN_Open(%x): Not enough memory to create pin device\r\n"), Context ) );
    }
    else
    {
        if ( false == pPinDevice->InitializeSubDevice( pPinInit->pCamDevice ) )
        {
            SAFEDELETE( pPinDevice );
            DEBUGMSG( ZONE_INIT|ZONE_ERROR, ( _T("PIN_Init: Initialization Failed") ) );
        }

    }

    return reinterpret_cast<DWORD>( pPinDevice );
}
예제 #8
0
SunLight::~SunLight(void)
{
	//SAFEDESTROY(m_pGameModel);
	CGameModelManager::GetInstance()->ReleaseDisplayModel(m_pGameModel);
	CGameModelManager::GetInstance()->ReleaseGameModel(m_pGameModel->GetGameModelID());
	m_pGameModel = NULL;
	SAFEDELETE(m_pAnimInfo);
}
예제 #9
0
CMFileUpload::~CMFileUpload()
{
    if (m_lstItem)
    {
        m_lstItem->clear();
    }
    SAFEDELETE(m_lstItem);
}
예제 #10
0
파일: Mesh.cpp 프로젝트: q4r/QEngine
Mesh::~Mesh(){
	for (Surfaces::iterator surface = surfaces.begin(); surface != surfaces.end(); surface++){
		surface->pShader = NULL;
		surface->pTexture = NULL;
		SAFEDELETE(surface->pSurface);
	}
	surfaces.clear();
}
예제 #11
0
Control::~Control(void)
{
	while(mChilds.GetSize())
	{
		SAFEDELETE(mChilds.Back());
		mChilds.EraseBack();
	}
}
		RenderWindowOSD::~RenderWindowOSD()
		{
			DEBUG_ASSERT(Initialized == false);
			DEBUG_ASSERT(AttachedLayers.size() == 0);

			SAFEDELETE(Pipeline);
			AttachedLayers.clear();
		}
예제 #13
0
void CSystem::ShutDown()
{
	if(m_pRenderer)
	{
		m_pRenderer->Shutdown();
		SAFEDELETE(m_pRenderer);
	}

	if(m_pInput)
	{
		SAFEDELETE(m_pInput);
	}

	ShutdownWindows();

	return;
}
예제 #14
0
void GifFrame::cleanup() {
  m_disposeTo        = NULL;
  m_owner            = NULL;
  m_disposalMode     = DISPOSAL_UNSPECIFIED;
  m_delayTime        = 0;
  m_useTransparency  = false;
  m_srcRect = m_rect = CRect(0,0,0,0);
  SAFEDELETE(m_pr);
}
예제 #15
0
ArrayImpl::~ArrayImpl() {
  clear();
  SAFEDELETE(m_objectManager);
  SAFEDELETEARRAY(m_elem);

#ifdef DEBUG_ARRAYIMPL
  descounter++;
#endif
}
예제 #16
0
CSimpleFusionBindSink::~CSimpleFusionBindSink()
{
    SAFERELEASE(_pBind);
    SAFERELEASE(_pdbglog);

    if (_hEvent) {
        SAFEDELETE(_hEvent);
    }
}
예제 #17
0
/////////////////////////////////////////////////
// zhaohang  2010/7/21 
// 消息接收部分
////////////////////////////////////////////////
void ShopCityMsgMgr::Receive_AfficheResponse(CMessage* pMsg)
{
	long length = pMsg->GetLong();
	char* str = new char[length];
	pMsg->GetEx((void*)str,length);
	Affiche = str;
	SAFEDELETE(str);
	FireUIEvent(SHOPCITY_PAGE_NAME,SHOPCITY_PAGE_EVENT_AFFICHERESPONSE);
}
예제 #18
0
	WorkspaceManager::~WorkspaceManager()
	{
		DefaultDirectories.clear();
		SAFEDELETE(Operator);

		Initialized = false;

		Singleton = nullptr;
	}
예제 #19
0
CMLogger::~CMLogger(void)
{
	if (m_logfile)
	{
		m_logfile->Close();
		delete m_logfile;
	}

    SAFEDELETE(m_pMutex);
}
예제 #20
0
GameManager::~GameManager()
{
	UnloadMap();

	//erase all entities before it gets deleted, so we can unlink localactor
	if (mMap)
		mMap->FlushEntities();

	if (mPlayer)
	{
		mPlayer->mMap = NULL;
		SAFEDELETE(mPlayer);
	}

	unhookNetListeners();
	SAFEDELETE(mNet);

	game = NULL;
}
예제 #21
0
BOOL CMExerciseList::GetExerciseData(const char *eid, TExerciseListItem &item)
{
    BOOL ret = FALSE;
    CMString sPath = CMGlobal::TheOne().GetUserDir() + L"examexercise.xml";
    TiXmlDocument *pDoc = new TiXmlDocument(sPath);
    if(!pDoc)
		return ret;
	if(CMFile::FileExist(sPath))
	{
		pDoc->LoadFile(TIXML_ENCODING_UTF8);
        
		if(!pDoc->Error())
		{
			TiXmlElement *pRoot = pDoc->RootElement();
			if(pRoot)
			{
				TiXmlElement* pQuestion = pRoot->FirstChildElement("question");
				while(pQuestion)
				{
					const char* sid = pQuestion->Attribute("id");
                    
					if (strcmp(sid, eid) == 0)
					{
                        int curindex = 0;
                        pQuestion->QueryIntAttribute("index", &curindex);
                        item.nCurIndex = curindex;
                        
                        int rightcount = 0;
                        pQuestion->QueryIntAttribute("rightcount", &rightcount);
                        item.nRightCount = rightcount;
                        
                        TiXmlElement* pItem = pQuestion->FirstChildElement("item");
                        
                        int wrongcount = 0;
                        while (pItem)
                        {
                            int nWrong = 0;
                            pItem->Attribute("iswrong", &nWrong);
                            if (nWrong == 1) {
                                wrongcount++;
                            }
                            pItem = pItem->NextSiblingElement("item");
                        }
                        item.nWrongCount = wrongcount;
                    }
                    pQuestion = pQuestion->NextSiblingElement("question");
                }
            }
        }
    }
    
	SAFEDELETE(pDoc);
    
    return ret;
}
예제 #22
0
void CMSession::LogIn(int nLoginType)
{
    const CHAR* pEid = CMGlobal::TheOne().Encode(sCustomer);
    const CHAR* pName = CMGlobal::TheOne().Encode(sUsername);

    const CHAR* pPass = NULL;

//    sPassword[99]='\0';
//    memset(sPassword, 0, 100);
    //当美信跳转 =2 pwd无需加密
    if(nLoginType == 1)
    {
        char* buf = DesEncrypt::doEncrypt(sPassword, kDesSecret);
        strcpy(sPassword, buf);
        SAFEDELETE(buf);
    }

    pPass = CMGlobal::TheOne().Encode(sPassword);
    const CHAR* pUid = CMGlobal::TheOne().Encode(sUserid);

    CMSystemInfo& sysinfo = CMGlobal::TheOne().SystemInfo();
    char sUrl[1024] = {0};

    snprintf(sUrl,sizeof(sUrl),"%s?no=%d&os=%d&ver=%d&wh=%dX%d&eid=%s&logintype=%d&loginname=%s&pwd=%s&userid=%s&lang=%s&accept=%s",(const char*)SETTING.GetCenterServerUrl() ,
             SERVICE_LOGIN, CMVersion::SystemVersion().Platform, MLPAYER_VER, sysinfo.ScreenWidth, sysinfo.ScreenHeight, pEid, nLoginType, pName,
             pPass,pUid,sysinfo.CurrLang, sysinfo.AcceptType);

    SAFEDELETE(pEid);
    SAFEDELETE(pName);
    SAFEDELETE(pPass);
    SAFEDELETE(pUid);

    m_req.Clean();
    m_req.SetType(CMHTTPReqHeader::GET);
    m_req.CreateDefault();
    m_req.AddValue(HH_ATYPE, CMString(L"text/html,application/xml"));
    m_req.AddValue(HH_ACHARSET, CMString(L"utf-8"));

    m_req.SetUrl(sUrl);

    m_pHttp->Request(m_req);
}
void CSpaceTree::Release()
{
	for(unsigned int iNode=0; iNode<m_vecNodeTable.size(); ++iNode)
	{
		SPACETREENODE	*ptnode = m_vecNodeTable[iNode];

		m_pNodeRoot = NULL;

		SAFEDELETE(ptnode);
	}
}
예제 #24
0
AbstractCollection *TreeSetImpl::clone(bool cloneData) const {
  TreeSetImpl *clone = new TreeSetImpl(*m_objectManager, *m_comparator);
  if(cloneData) {
    AbstractIterator *it = ((TreeSetImpl*)this)->getIterator(); TRACE_NEW(it);
    while(it->hasNext()) {
      clone->add(it->next());
    }
    SAFEDELETE(it);
  }
  return clone;
}
예제 #25
0
LRESULT CEqualizerWnd::OnDestroy(UINT uMsg, WPARAM wParam,LPARAM lParam)
{
	//SAFEDELHDC(m_hMainoldbkBmp,m_hMainbkBmp,m_hMainbkDC);

	_eqload.Free(m_pListEQ);

	SAFEDELETE(m_pListEQ);

	SAFEDELHDC(m_hOldMemBmp,m_hMemBmp,m_hMemDC);

	return 0;
}
예제 #26
0
void
CModuleHashNode::DestroyList()
{
    CModuleHashNode *pModList = this, *pTemp;

    while ( pModList ) 
    {
        pTemp = pModList;
        pModList = pModList->_pNext;
        SAFEDELETE(pTemp);
    }

}
void CMPlayerUtility::OpenFile(CMString sFileName, const UINT32 nMode/* = EMode_3mv*/)
{
    if(m_nState == EReady)
    {
        m_bDataCompleted = FALSE;
        SAFEDELETE(m_pMediaData);

        m_pMediaData = new CMLocalDataSource;
        BOOL ret = FALSE;
        m_bOnlyAudio = nMode != EMode_3mv;
        if(m_pMediaData && m_pMediaData->Init(this, m_pStreamBuffer))
            ret = m_pMediaData->Open(sFileName, nMode);
        if(ret)
        {
            m_PlayerObserver.StateChange(m_UserData, EOpening, m_nState);
            m_nState = EOpening;
            m_pMediaData->Start();
        }
        else
            SAFEDELETE(m_pMediaData);
    }
}
예제 #28
0
EXTERN_C
BOOL
PIN_Deinit(
    DWORD dwContext
    )
{
    DEBUGMSG( ZONE_INIT, ( _T("PIN_Deinit\r\n") ) );

    PPININITHANDLE pPinInitDev = reinterpret_cast<PPININITHANDLE>( dwContext );
    SAFEDELETE( pPinInitDev ) ;

    return TRUE;
}
예제 #29
0
void RSManager::releaseResources() {
	SDLOG(0, "RenderstateManager release: going into neutral state\n");
	for(int i = 0; i < 16; ++i) d3ddev->SetTexture(i, NULL);
	IDirect3DSurface9 *bb = NULL;
	d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &bb);
	d3ddev->SetRenderTarget(0, bb);
	SAFERELEASE(bb);
	SDLOG(0, "RenderstateManager releasing resources\n");
	SAFEDELETE(plugin);
	SAFEDELETE(scaler);
	SAFEDELETE(perfMonitor);
	SAFERELEASE(depthStencilSurf);
	extraBuffer.reset(NULL);
	imgWriter.reset(NULL);
	SAFERELEASE(prevStateBlock);
	SAFERELEASE(initStateBlock);
	SAFERELEASE(prevVDecl);
	SAFERELEASE(prevDepthStencilSurf);
	SAFERELEASE(prevRenderTarget);
	backBuffers.clear();
	console.cleanup();
	SDLOG(0, "RenderstateManager resource release completed\n");
}
예제 #30
0
void Widget::RemoveAll()
{
	for (int i = 0; i < mChildren.size(); ++i)
	{
		if (mChildren.at(i))
		{
			mChildren.at(i)->mParent = NULL;
			SAFEDELETE(mChildren.at(i));
		}
	}
	
	mChildren.clear();
	FlagRender();
}