From: <ad...@us...> - 2003-02-21 07:55:16
|
Update of /cvsroot/bdadev/TuneReqStore In directory sc8-pr-cvs1:/tmp/cvs-serv31163 Modified Files: TuneRequestStore.cpp TuneRequestStore.h Log Message: Fixes for loading saved xml Index: TuneRequestStore.cpp =================================================================== RCS file: /cvsroot/bdadev/TuneReqStore/TuneRequestStore.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TuneRequestStore.cpp 20 Feb 2003 07:53:39 -0000 1.6 --- TuneRequestStore.cpp 21 Feb 2003 07:55:12 -0000 1.7 *************** *** 119,130 **** HRESULT hr; ! hr = m_doc->load(CComVariant(FileName), &b); if(FAILED(hr)) { m_doc.Release(); ! return hr; } if(VARIANT_FALSE == b) { --- 119,141 ---- HRESULT hr; ! hr = m_doc->load(CComVariant(FileName), &b); if(FAILED(hr)) { + // can't find the file, this is OK m_doc.Release(); ! return S_OK; } + hr = m_doc->selectSingleNode(CComBSTR("ChannelList"), &m_TopNode); + CHECK(hr); + + if(m_TopNode == NULL) + { + m_doc.Release(); + return E_FAIL; + } + + if(VARIANT_FALSE == b) { *************** *** 134,139 **** int i(0); ! while(SUCCEEDED(UnpopulateDOMDocument(NULL, &m_TuneInfos[i], MakeTagName(i)))); { ++i; } --- 145,153 ---- int i(0); ! ITuneInfo* NewTuneInfo = NULL; ! while(SUCCEEDED(UnpopulateDOMDocument(NULL, &NewTuneInfo, MakeTagName(i)))) { + m_TuneInfos.push_back(NewTuneInfo); + NewTuneInfo = NULL; ++i; } *************** *** 156,160 **** HRESULT hr; ! CHECK(m_doc->createElement(CComBSTR("ChannelList"), &m_TopNode)); for(int i(0); i < m_TuneInfos.size(); ++i) --- 170,174 ---- HRESULT hr; ! CHECK(m_doc->createElement(CComBSTR("ChannelList"), &m_TopElement)); for(int i(0); i < m_TuneInfos.size(); ++i) *************** *** 170,174 **** } ! m_doc->appendChild(m_TopNode,0); hr = m_doc->save(CComVariant(FileName)); --- 184,188 ---- } ! m_doc->appendChild(m_TopElement,0); hr = m_doc->save(CComVariant(FileName)); *************** *** 546,550 **** CHECK(PersistObject(spPersistObj)); ! CHECK(m_TopNode->appendChild(m_stackElems.top(), 0)); m_stackElems.pop(); --- 560,564 ---- CHECK(PersistObject(spPersistObj)); ! CHECK(m_TopElement->appendChild(m_stackElems.top(), 0)); m_stackElems.pop(); *************** *** 558,562 **** { CComPtr<xml::IXMLDOMNode> node; ! CHECK(m_doc->selectSingleNode(CComBSTR(L"//Object"), &node)); if(node == NULL) --- 572,576 ---- { CComPtr<xml::IXMLDOMNode> node; ! CHECK(m_TopNode->selectSingleNode(CComBSTR(ObjectName), &node)); if(node == NULL) *************** *** 705,709 **** Id = (BSTR)Variant.bstrVal; } ! else if(PropertyName != NULL && wcsicmp(PropertyName, L"Provider.Name") == 0) { CComVariant Variant; --- 719,723 ---- Id = (BSTR)Variant.bstrVal; } ! else if(PropertyName != NULL && wcsicmp(PropertyName, L"Description.Name") == 0) { CComVariant Variant; *************** *** 737,741 **** { ATLTRACE("ServiceChanged\n"); - ProgramChanged(varServiceDescriptionID); return S_OK; } --- 751,754 ---- *************** *** 808,811 **** --- 821,827 ---- // // $Log$ + // Revision 1.7 2003/02/21 07:55:12 adcockj + // Fixes for loading saved xml + // // Revision 1.6 2003/02/20 07:53:39 adcockj // Fixes to crashing problems Index: TuneRequestStore.h =================================================================== RCS file: /cvsroot/bdadev/TuneReqStore/TuneRequestStore.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TuneRequestStore.h 20 Feb 2003 07:53:39 -0000 1.5 --- TuneRequestStore.h 21 Feb 2003 07:55:12 -0000 1.6 *************** *** 91,95 **** typedef CComEnumOnSTL<IEnumTuneInfo, &IID_IEnumTuneInfo, ITuneInfo*, _Copy<ITuneInfo*>, std::vector<ITuneInfo*> > ComSTLEnum; CComPtr<xml::IXMLDOMDocument> m_doc; ! CComPtr<xml::IXMLDOMElement> m_TopNode; CComPtr<IFilterGraph> m_FilterGraph; CComPtr<IConnectionPoint> m_ConnectionPoint; --- 91,96 ---- typedef CComEnumOnSTL<IEnumTuneInfo, &IID_IEnumTuneInfo, ITuneInfo*, _Copy<ITuneInfo*>, std::vector<ITuneInfo*> > ComSTLEnum; CComPtr<xml::IXMLDOMDocument> m_doc; ! CComPtr<xml::IXMLDOMElement> m_TopElement; ! CComPtr<xml::IXMLDOMNode> m_TopNode; CComPtr<IFilterGraph> m_FilterGraph; CComPtr<IConnectionPoint> m_ConnectionPoint; |