From a72aabf4e8e795760b8508da645e9587affffec0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 29 Aug 2015 12:45:39 +0000 Subject: Quotes untied from ATL git-svn-id: http://svn.miranda-ng.org/main/trunk@15089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Quotes/src/HTMLParserMS.cpp | 50 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 36 deletions(-) (limited to 'plugins/Quotes/src/HTMLParserMS.cpp') diff --git a/plugins/Quotes/src/HTMLParserMS.cpp b/plugins/Quotes/src/HTMLParserMS.cpp index 2b6b27f67f..92c394f332 100644 --- a/plugins/Quotes/src/HTMLParserMS.cpp +++ b/plugins/Quotes/src/HTMLParserMS.cpp @@ -96,14 +96,12 @@ namespace virtual tstring GetAttribute(const tstring& rsAttrName)const { - USES_CONVERSION; - tstring sAttr; CComPtr pElement; if (SUCCEEDED(m_pElement->QueryInterface(IID_IHTMLElement, reinterpret_cast(&pElement))) && pElement) { _variant_t vAttribute; - BSTR pbstrAttrName = T2BSTR(rsAttrName.c_str()); + BSTR pbstrAttrName = ::SysAllocString(rsAttrName.c_str()); if (SUCCEEDED(pElement->getAttribute(pbstrAttrName, 1, &vAttribute)) && VT_NULL != vAttribute.vt && VT_EMPTY != vAttribute.vt) { @@ -219,48 +217,30 @@ CHTMLParserMS::CHTMLParserMS() : m_bCallUninit(false) CHTMLParserMS::~CHTMLParserMS() { - if (true == m_bCallUninit) - { + if (m_bCallUninit) ::CoUninitialize(); - } } CHTMLParserMS::THTMLNodePtr CHTMLParserMS::ParseString(const tstring& rsHTML) { - USES_CONVERSION; + mir_cslock lck(m_cs); - try + CComPtr pMC; + HRESULT hr = m_pMS->ParseString((OLECHAR*)rsHTML.c_str(), 0, &pMC, m_pMkStart, m_pMkFinish); + if (SUCCEEDED(hr) && pMC) { - mir_cslock lck(m_cs); - - OLECHAR* p = T2OLE(const_cast(rsHTML.c_str())); - CComPtr pMC; - _com_util::CheckError(m_pMS->ParseString(p, 0, &pMC, m_pMkStart, m_pMkFinish)); - - if (pMC) + CComPtr pNewDoc; + hr = pMC->QueryInterface(IID_IHTMLDocument, (LPVOID*)&pNewDoc); + if (SUCCEEDED(hr) && pNewDoc) { - CComPtr pNewDoc; - - _com_util::CheckError(pMC->QueryInterface(IID_IHTMLDocument, - (LPVOID*)&pNewDoc)); - - if (pNewDoc) - { - CComPtr pColl; - _com_util::CheckError(pNewDoc->get_all(&pColl)); + CComPtr pColl; + pNewDoc->get_all(&pColl); - CHTMLNode::TDocumentPtr pDoc; - pMC->QueryInterface(IID_IHTMLDocument3, (LPVOID*)&pDoc); - - - return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl), pDoc)); - } + CHTMLNode::TDocumentPtr pDoc; + pMC->QueryInterface(IID_IHTMLDocument3, (LPVOID*)&pDoc); + return THTMLNodePtr(new CHTMLNode(CHTMLNode::TComPtr(pColl), pDoc)); } } - catch (_com_error&/* e*/) - { - // show_com_error_msg(e); - } return THTMLNodePtr(); } @@ -290,9 +270,7 @@ bool CHTMLParserMS::IsInstalled() } if (bCallUninit) - { ::CoUninitialize(); - } return bResult; } -- cgit v1.2.3